• Recent
    • Docs
    • Github
    • 百度网盘
    • Onedrive
    • Official
    • Shop
    • Register
    • Login

    Coolpi 4b Ubuntu22.04 原生系统

    Scheduled Pinned Locked Moved Ubuntu
    24 Posts 8 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Twsuts
      last edited by

      我在系统中使用想开机自启动一个QT程序,我沿用了树莓派的方法,在~/.profile文件中添加了我的启动路径,但是程序并没有像树莓派一样启动,传统的自启动程序会进入桌面再启动程序,效果会差很多时间也长很多,还有就是开机的动画能不能有个教程,如果太忙了就算了,希望能回答我第一个问题

      大法师大 1 Reply Last reply Reply Quote 0
      • 大法师大
        大法师 @Twsuts
        last edited by

        @Twsuts
        提供个demo与配置,我们测试下

        jack@cool-pi.com

        T 1 Reply Last reply Reply Quote 0
        • T
          Twsuts @大法师
          last edited by

          @大法师 配置就是在~/profile文件末尾加上 echo “coolpi” | sudo -S /home/coolpi/qt5/demo ,这是启动程序的命令,树莓派跟我以前用的ROCKPI正常是能启动程序的,在界面出来以前,你看到的效果就是黑屏然后直接进入了我们的程序,demo可以随便写一个QT demo,然后开机重启的时候看能不能在进入界面之前启动

          大法师大 1 Reply Last reply Reply Quote 0
          • 大法师大
            大法师 @Twsuts
            last edited by 大法师

            @Twsuts
            这是阻塞系统运行?还是后台运行作为开机动画?

            我试了分别在/etc/profile、/home/coolpi/.profile文件尾增加qt demo是可以的

            sudo apt install qtbase5-examples
            
            coolpi@coolpi:~$ cat /etc/profile
            # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
            # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
            
            if [ "${PS1-}" ]; then
              if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
                # The file bash.bashrc already sets the default PS1.
                # PS1='\h:\w\$ '
                if [ -f /etc/bash.bashrc ]; then
                  . /etc/bash.bashrc
                fi
              else
                if [ "`id -u`" -eq 0 ]; then
                  PS1='# '
                else
                  PS1='$ '
                fi
              fi
            fi
            
            if [ -d /etc/profile.d ]; then
              for i in /etc/profile.d/*.sh; do
                if [ -r $i ]; then
                  . $i
                fi
              done
              unset i
            fi
            
            #echo "coolpi" | sudo -S /usr/lib/aarch64-linux-gnu/qt5/examples/gui/analogclock/analogclock
            coolpi@coolpi:~$
            
            coolpi@coolpi:~$ cat ~/.profile 
            # ~/.profile: executed by the command interpreter for login shells.
            # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
            # exists.
            # see /usr/share/doc/bash/examples/startup-files for examples.
            # the files are located in the bash-doc package.
            
            # the default umask is set in /etc/profile; for setting the umask
            # for ssh logins, install and configure the libpam-umask package.
            #umask 022
            
            # if running bash
            if [ -n "$BASH_VERSION" ]; then
                # include .bashrc if it exists
                if [ -f "$HOME/.bashrc" ]; then
                    . "$HOME/.bashrc"
                fi
            fi
            
            # set PATH so it includes user's private bin if it exists
            if [ -d "$HOME/bin" ] ; then
                PATH="$HOME/bin:$PATH"
            fi
            
            # set PATH so it includes user's private bin if it exists
            if [ -d "$HOME/.local/bin" ] ; then
                PATH="$HOME/.local/bin:$PATH"
            fi
            
            echo "coolpi" | sudo -S /usr/lib/aarch64-linux-gnu/qt5/examples/gui/analogclock/analogclock
            coolpi@coolpi:~$
            

            因为不是后台运行,重启后会阻塞桌面系统显示窗口。此时可以通过键盘ctrl+alt+f6切换到终端命令行进行恢复修改操作。

            也可以后台运行测试

            vim ~/.profile
            ...
            echo "coolpi" | sudo -S /usr/lib/aarch64-linux-gnu/qt5/examples/gui/analogclock/analogclock &
            

            jack@cool-pi.com

            T 1 Reply Last reply Reply Quote 0
            • T
              Twsuts @大法师
              last edited by

              @大法师 感谢您的回答,您的操作看起来很正常,这样看来确实很奇怪,但我这边不论是ubuntu22还是ubuntu20我在.profile文件下启动我的qt程序都没反应,它会直接进入桌面,而在/etc/xdg/autostart/下可以自动启动我的应用程序,但是后者显示屏会出现几秒钟的ubuntu图形界面,这看起来很糟糕!

              大法师大 1 Reply Last reply Reply Quote 0
              • 大法师大
                大法师 @Twsuts
                last edited by

                @Twsuts
                百度网盘或onedrive有最新镜像,是否镜像不一致?

                jack@cool-pi.com

                T 1 Reply Last reply Reply Quote 0
                • T
                  Twsuts @大法师
                  last edited by

                  @大法师 前天刚刷的最新镜像,甚至于我在使用ssh登陆时都能启动程序,终端登陆就会启动程序,但是显示屏上就是直接进入了桌面。

                  大法师大 顾 2 Replies Last reply Reply Quote 0
                  • 大法师大
                    大法师 @Twsuts
                    last edited by

                    @Twsuts
                    是不是自动登陆设置打开了?

                    jack@cool-pi.com

                    T 2 Replies Last reply Reply Quote 0
                    • T
                      Twsuts @大法师
                      last edited by

                      @大法师 还真是的

                      1 Reply Last reply Reply Quote 0
                      • T
                        Twsuts @大法师
                        last edited by

                        @大法师 关了也没用,换了一个最简单的demo也没用,我只能通过我原来的方法启动程序,然后把整个桌面服务关了试试看了,不过这样启动会慢很多

                        顾 1 Reply Last reply Reply Quote 0
                        • 顾
                          顾真牛 @Twsuts
                          last edited by

                          @Twsuts 看看登录服务用的是什么gdm还是LightDM,改那个的配置文件。不启动桌面启动你的QT程序

                          1 Reply Last reply Reply Quote 0
                          • 顾
                            顾真牛 @Twsuts
                            last edited by

                            @Twsuts SSH能启动 开机不启动,你看看是不是用户不一致

                            T 2 Replies Last reply Reply Quote 0
                            • T
                              Twsuts @顾真牛
                              last edited by

                              @顾真牛 用户都是一样的coolpi,我现在解决了这个问题,在那之前加入export DISPLAY=:0 这样就可以启动了

                              1 Reply Last reply Reply Quote 0
                              • T
                                Twsuts @顾真牛
                                last edited by

                                @顾真牛 @大法师 感谢你们的帮助🤓

                                1 Reply Last reply Reply Quote 0
                                • 大法师大 大法师 moved this topic from Pi 4B on
                                • 1
                                • 2
                                • 1 / 2
                                • First post
                                  Last post