Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt app work on boot ubuntu
Forum Updated to NodeBB v4.3 + New Features

Qt app work on boot ubuntu

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 4 Posters 2.7k Views 1 Watching
  • 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.
  • A asisisyah

    Merhaba

    Which version of Qt are you using ?

    Qt 5 on nvidia jetson nano aarch64

    With which backend ?

    backend i dont know it what does mean .

    Are you ensuring that you start your application only when the graphics server is fully started ?

    i think yes . my service file is include
    After=display-manager.service multi-user.target

    sudo systemctl daemon-reload
    sudo systemctl enable myApp.service
    sudo systemctl start myApp.service
    sudo systemctl status myApp.service says that:
    Loaded: loaded (/etc/systemd/system/myApp.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: core-dump) since Sun 2024-01-07 21:15:19 UTC; 1s ago
    Process: 3370 ExecStart=/usr/local/bin/myApp/myApp
    (code=dumped, signal=ABRT)
    Main PID: 3370 (code=dumped, signal=ABRT)
    nvidia@nvidia-desktop:~$
    if i run with in terminal sudo its work. but
    sudo systemctl start myApp.service says that:

    Do you have anything else that is starting ?

    yes i made little another app. like this myApp2 its working perfect.

    Do you have any logs that might shed some light about what is happening ?

    yes i wrote systemctl status.. myApp using https://github.com/Rubberazer/JETGPIO library.
    myApp Qt gui. and little sqllite. camera and my program write txt log file in workingdirectory.
    but myApp is working in Terminal with sudo ./myApp

    A Offline
    A Offline
    asisisyah
    wrote on last edited by
    #5

    hi,
    i dont need sudo, i want that run mayApp on boot ;)
    but how is it..
    this is error journal
    myApp.service - myApp
    Loaded: loaded (/etc/systemd/system/myApp.service; enabled; vendor preset: enabled)
    Active: failed (Result: core-dump) since Sun 2024-01-07 21:12:33 UTC; 3s ago
    Process: 3662 ExecStartPre=/bin/bash -c while [ ! -e /dev/mem ]; do sleep 1; done (code=exited, status=0/SUCCESS)
    Process: 3663 ExecStart=/home/nvidia/Desktop/hardworks/myApp (code=dumped, signal=ABRT)
    Main PID: 3663 (code=dumped, signal=ABRT)

    Jan 07 21:12:33 nvidia-desktop systemd[1]: Starting LS...
    Jan 07 21:12:33 nvidia-desktop systemd[1]: Started LS.
    Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.xcb: could not connect to display
    Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    Jan 07 21:12:33 nvidia-desktop myApp[3663]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    Jan 07 21:12:33 nvidia-desktop myApp[3663]: Available platform plugins are: dxcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-eg>
    Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Main process exited, code=dumped, status=6/ABRT
    Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Failed with result 'core-dump'.
    lines 1-15/15 (END)

    JonBJ A 2 Replies Last reply
    0
    • A asisisyah

      hi,
      i dont need sudo, i want that run mayApp on boot ;)
      but how is it..
      this is error journal
      myApp.service - myApp
      Loaded: loaded (/etc/systemd/system/myApp.service; enabled; vendor preset: enabled)
      Active: failed (Result: core-dump) since Sun 2024-01-07 21:12:33 UTC; 3s ago
      Process: 3662 ExecStartPre=/bin/bash -c while [ ! -e /dev/mem ]; do sleep 1; done (code=exited, status=0/SUCCESS)
      Process: 3663 ExecStart=/home/nvidia/Desktop/hardworks/myApp (code=dumped, signal=ABRT)
      Main PID: 3663 (code=dumped, signal=ABRT)

      Jan 07 21:12:33 nvidia-desktop systemd[1]: Starting LS...
      Jan 07 21:12:33 nvidia-desktop systemd[1]: Started LS.
      Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.xcb: could not connect to display
      Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
      Jan 07 21:12:33 nvidia-desktop myApp[3663]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
      Jan 07 21:12:33 nvidia-desktop myApp[3663]: Available platform plugins are: dxcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-eg>
      Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Main process exited, code=dumped, status=6/ABRT
      Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Failed with result 'core-dump'.
      lines 1-15/15 (END)

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #6

      @asisisyah said in Qt app work on boot ubuntu:

      qt.qpa.xcb: could not connect to display

      And sure enough that is the reason, as we suggested. I don't know how you expect a UI program to find and connect to a display when it is run from boot rather than from the user's desktop.

      Strat by setting environment variable QT_DEBUG_PLUGINS to value 1. Then you will get possibly more helpful diagnostic output. How you set that variable when running from boot the way you do I do not know. It may be enough to just set the environment variable in the very first line of your code, before you create the QApplication. I cannot recall if that is early enough or whether it has to be set before the executable is even launched, but worth a try.

      1 Reply Last reply
      1
      • A asisisyah

        hi,
        i dont need sudo, i want that run mayApp on boot ;)
        but how is it..
        this is error journal
        myApp.service - myApp
        Loaded: loaded (/etc/systemd/system/myApp.service; enabled; vendor preset: enabled)
        Active: failed (Result: core-dump) since Sun 2024-01-07 21:12:33 UTC; 3s ago
        Process: 3662 ExecStartPre=/bin/bash -c while [ ! -e /dev/mem ]; do sleep 1; done (code=exited, status=0/SUCCESS)
        Process: 3663 ExecStart=/home/nvidia/Desktop/hardworks/myApp (code=dumped, signal=ABRT)
        Main PID: 3663 (code=dumped, signal=ABRT)

        Jan 07 21:12:33 nvidia-desktop systemd[1]: Starting LS...
        Jan 07 21:12:33 nvidia-desktop systemd[1]: Started LS.
        Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.xcb: could not connect to display
        Jan 07 21:12:33 nvidia-desktop myApp[3663]: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
        Jan 07 21:12:33 nvidia-desktop myApp[3663]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
        Jan 07 21:12:33 nvidia-desktop myApp[3663]: Available platform plugins are: dxcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-eg>
        Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Main process exited, code=dumped, status=6/ABRT
        Jan 07 21:12:33 nvidia-desktop systemd[1]: myApp.service: Failed with result 'core-dump'.
        lines 1-15/15 (END)

        A Offline
        A Offline
        asisisyah
        wrote on last edited by
        #7

        @asisisyah
        yes i set it , but problem is that i used /dev/mem file for gpio , this is permitted and i dont know any solition. when my program start on boot or after the desktop , doesent mater for me, its not running because /dev/mem is permitted.. so i use sudo ..

        SGaistS A C 3 Replies Last reply
        0
        • A asisisyah

          @asisisyah
          yes i set it , but problem is that i used /dev/mem file for gpio , this is permitted and i dont know any solition. when my program start on boot or after the desktop , doesent mater for me, its not running because /dev/mem is permitted.. so i use sudo ..

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @asisisyah the usual way is to add the proper rights for the user to access the device. It's usually done through adding the user to a specific group.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A asisisyah

            @asisisyah
            yes i set it , but problem is that i used /dev/mem file for gpio , this is permitted and i dont know any solition. when my program start on boot or after the desktop , doesent mater for me, its not running because /dev/mem is permitted.. so i use sudo ..

            A Offline
            A Offline
            asisisyah
            wrote on last edited by
            #9

            @asisisyah
            i tried but i dont make it.
            maybe i must change gpiolib. can you suggest a library or easyes way for control. i use Qt and jetson orin nano and c++, because i use rubberazer jetgipio library . if i dont use jetgpio myApp did starting perfectly s on boot.

            Thank you all

            SGaistS A 2 Replies Last reply
            0
            • A asisisyah

              @asisisyah
              i tried but i dont make it.
              maybe i must change gpiolib. can you suggest a library or easyes way for control. i use Qt and jetson orin nano and c++, because i use rubberazer jetgipio library . if i dont use jetgpio myApp did starting perfectly s on boot.

              Thank you all

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #10

              @asisisyah what did you try exactly ?

              Did you add the user that will start the application to the kmem group ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A asisisyah

                @asisisyah
                i tried but i dont make it.
                maybe i must change gpiolib. can you suggest a library or easyes way for control. i use Qt and jetson orin nano and c++, because i use rubberazer jetgipio library . if i dont use jetgpio myApp did starting perfectly s on boot.

                Thank you all

                A Offline
                A Offline
                asisisyah
                wrote on last edited by
                #11

                @asisisyah
                my user name is nvidia its add in group called nvidia.
                i want say again
                i have a program , its working in terminal with command sudo ./myApp.. i want start automaticly when system is open. thats all . its not to be that very hard. but i dont make it.
                thank you all.

                SGaistS A 2 Replies Last reply
                0
                • A asisisyah

                  @asisisyah
                  my user name is nvidia its add in group called nvidia.
                  i want say again
                  i have a program , its working in terminal with command sudo ./myApp.. i want start automaticly when system is open. thats all . its not to be that very hard. but i dont make it.
                  thank you all.

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @asisisyah you know that a user can be part of several groups ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • A asisisyah

                    @asisisyah
                    my user name is nvidia its add in group called nvidia.
                    i want say again
                    i have a program , its working in terminal with command sudo ./myApp.. i want start automaticly when system is open. thats all . its not to be that very hard. but i dont make it.
                    thank you all.

                    A Offline
                    A Offline
                    asisisyah
                    wrote on last edited by
                    #13

                    @asisisyah
                    i am sorry but no. i am newbe for linux.
                    please explain.
                    i must make it my project is end . everything is okey but its not start on automaticly. please explain step by step or i am goingto crazy.
                    regards.

                    SGaistS A 2 Replies Last reply
                    0
                    • A asisisyah

                      @asisisyah
                      i am sorry but no. i am newbe for linux.
                      please explain.
                      i must make it my project is end . everything is okey but its not start on automaticly. please explain step by step or i am goingto crazy.
                      regards.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @asisisyah a quick search of "Linux add group to user" would have been quicker. See for example here.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • A asisisyah

                        @asisisyah
                        i am sorry but no. i am newbe for linux.
                        please explain.
                        i must make it my project is end . everything is okey but its not start on automaticly. please explain step by step or i am goingto crazy.
                        regards.

                        A Offline
                        A Offline
                        asisisyah
                        wrote on last edited by
                        #15

                        @asisisyah
                        i did add many group my username (nvidia)

                        nvidia@nvidia-desktop:~/Desktop$ groups
                        nvidia adm sudo audio video render gdm docker weston-launch gpio jtop
                        nvidia@nvidia-desktop:~/Desktop$ id
                        uid=1001(nvidia) gid=1001(nvidia) groups=1001(nvidia),4(adm),27(sudo),29(audio),44(video),103(render),130(gdm),132(docker),996(weston-launch),999(gpio),1002(jtop)
                        nvidia@nvidia-desktop:~/Desktop$ groups nvidia
                        nvidia : nvidia adm sudo audio video render gdm gpio weston-launch docker jtop
                        nvidia@nvidia-desktop:~/Desktop$ getent group
                        root:x:0:
                        daemon:x:1:
                        bin:x:2:
                        sys:x:3:
                        adm:x:4:syslog,{USERNAME},nvidia
                        tty:x:5:syslog
                        disk:x:6:
                        lp:x:7:
                        mail:x:8:
                        news:x:9:
                        uucp:x:10:
                        man:x:12:
                        proxy:x:13:
                        kmem:x:15:
                        dialout:x:20:
                        fax:x:21:
                        voice:x:22:
                        cdrom:x:24:
                        floppy:x:25:
                        tape:x:26:
                        sudo:x:27:{USERNAME},nvidia
                        audio:x:29:pulse,{USERNAME},nvidia
                        dip:x:30:
                        www-data:x:33:
                        backup:x:34:
                        operator:x:37:
                        list:x:38:
                        irc:x:39:
                        src:x:40:
                        gnats:x:41:
                        shadow:x:42:
                        utmp:x:43:
                        video:x:44:{USERNAME},gdm,nvidia
                        sasl:x:45:
                        plugdev:x:46:
                        staff:x:50:
                        games:x:60:
                        users:x:100:
                        nogroup:x:65534:
                        input:x:101:
                        kvm:x:102:
                        render:x:103:{USERNAME},nvidia
                        ssh:x:104:
                        dhcpd:x:105:
                        netdev:x:106:
                        systemd-timesync:x:107:
                        systemd-journal:x:108:
                        systemd-network:x:109:
                        systemd-resolve:x:110:
                        messagebus:x:111:
                        rdma:x:112:
                        i2c:x:113:
                        tss:x:114:
                        crontab:x:115:
                        lpadmin:x:116:
                        bluetooth:x:117:
                        ssl-cert:x:118:
                        whoopsie:x:119:
                        geoclue:x:120:
                        scanner:x:121:saned
                        pulse:x:122:
                        pulse-access:x:123:
                        avahi-autoipd:x:124:
                        saned:x:125:
                        rtkit:x:126:
                        colord:x:127:
                        avahi:x:128:
                        nm-openvpn:x:129:
                        gdm:x:130:{USERNAME},nvidia
                        syslog:x:131:
                        gpio:x:999:nvidia
                        trusty:x:998:
                        crypto:x:997:
                        weston-launch:x:996:{USERNAME},nvidia
                        {USERNAME}:x:1000:
                        nvidia:x:1001:
                        systemd-coredump:x:995:
                        debug:x:994:
                        docker:x:132:nvidia
                        fwupd-refresh:x:133:
                        jtop:x:1002:nvidia
                        nvidia@nvidia-desktop:~/Desktop$

                        1 Reply Last reply
                        0
                        • A asisisyah

                          @asisisyah
                          yes i set it , but problem is that i used /dev/mem file for gpio , this is permitted and i dont know any solition. when my program start on boot or after the desktop , doesent mater for me, its not running because /dev/mem is permitted.. so i use sudo ..

                          C Offline
                          C Offline
                          ChrisW67
                          wrote on last edited by
                          #16

                          @asisisyah said in Qt app work on boot ubuntu:

                          yes i set it , but problem is that i used /dev/mem file for gpio ,

                          This is my Ubuntu:

                          $ ls -l /dev/mem
                          crw-r----- 1 root kmem 1, 1 Jan 14 06:53 /dev/mem
                          

                          So, your process can read and write (rw-) /dev/mem if it is run as root (i.e. via sudo) , and read-only (r--) if your process is run by a user in the kmem group, and no access at all (---) for anyone else. This restriction is for a good reason.

                          I will guess that your nvidia user is not in the kmem group; no standard Ubuntu user is.

                          $ id -a chrisw
                          uid=1000(chrisw) gid=1000(chrisw) groups=1000(chrisw),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),133(lxd),134(sambashare),136(docker),137(wireshark)
                          

                          and service accounts are generally far more restricted:

                          $ id -a dnsmasq
                          uid=111(dnsmasq) gid=65534(nogroup) groups=65534(nogroup)
                          
                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            asisisyah
                            wrote on last edited by
                            #17

                            my /dev/mem ls -l
                            $ ls -l /dev/mem
                            crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/mem

                            and please what i must do. if you explain i think i do it.
                            step by step.

                            thank you all

                            SGaistS A 2 Replies Last reply
                            0
                            • A asisisyah

                              my /dev/mem ls -l
                              $ ls -l /dev/mem
                              crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/mem

                              and please what i must do. if you explain i think i do it.
                              step by step.

                              thank you all

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #18

                              @asisisyah said in Qt app work on boot ubuntu:

                              my /dev/mem ls -l
                              $ ls -l /dev/mem
                              crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/mem

                              and please what i must do. if you explain i think i do it.
                              step by step.

                              thank you all

                              Were these the original rights of the device ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • A asisisyah

                                my /dev/mem ls -l
                                $ ls -l /dev/mem
                                crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/mem

                                and please what i must do. if you explain i think i do it.
                                step by step.

                                thank you all

                                A Offline
                                A Offline
                                asisisyah
                                wrote on last edited by
                                #19

                                @asisisyah
                                No , its not. Originally that root:root
                                My user name : nvidia

                                SGaistS A 2 Replies Last reply
                                0
                                • A asisisyah

                                  @asisisyah
                                  No , its not. Originally that root:root
                                  My user name : nvidia

                                  SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #20

                                  @asisisyah what distribution are you running on your device ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • A asisisyah

                                    @asisisyah
                                    No , its not. Originally that root:root
                                    My user name : nvidia

                                    A Offline
                                    A Offline
                                    asisisyah
                                    wrote on last edited by
                                    #21

                                    @asisisyah
                                    first of all thank you so much everyone.
                                    i made a "starter.sh" file... than echo nvidia | sudo -S ./myApp ...
                                    than start it with startUp Application .

                                    its worked. no problem just now

                                    thank you so much everyone

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved