Qt app work on boot ubuntu
-
i make an Application through Qt, than i run it with myApp.service (/etc/systemd/system , i tried all systemctl command)file but its not work on boot , window is open it and close. if in terminal sudo ./myApp its work properly. i tried Startup command in ubuntu but its same error. my App is Qt Gui application and control gpio. i made basic Qt application than tried it and its worked. but myApp is not work.
-
Hi,
Which version of Qt are you using ?
With which backend ?
Are you ensuring that you start your application only when the graphics server is fully started ?
Do you have anything else that is starting ?
Do you have any logs that might shed some light about what is happening ? -
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.targetsudo 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 -
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.targetsudo 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@asisisyah said in Qt app work on boot ubuntu:
if i run with in terminal sudo its work. but
Why does it need to be run via sudo ?? I would start by figuring that out, and then eliminating that.
-
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.targetsudo 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 ./myApphi,
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) -
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)@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 value1
. 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 theQApplication
. 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. -
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)@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 .. -
@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 ..@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.
-
@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 ..@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
-
@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
@asisisyah what did you try exactly ?
Did you add the user that will start the application to the kmem group ?
-
@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
@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. -
@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.@asisisyah you know that a user can be part of several groups ?
-
@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.@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. -
@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.@asisisyah a quick search of "Linux add group to user" would have been quicker. See for example here.
-
@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.@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$ -
@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 ..@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. viasudo
) , and read-only (r--) if your process is run by a user in thekmem
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 thekmem
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)
-
my /dev/mem ls -l
$ ls -l /dev/mem
crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/memand please what i must do. if you explain i think i do it.
step by step.thank you all
@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/memand 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 ?
-
my /dev/mem ls -l
$ ls -l /dev/mem
crw-rw----- 1 root nvidia 1, 1 Jan 13 21:13 /dev/memand please what i must do. if you explain i think i do it.
step by step.thank you all
@asisisyah
No , its not. Originally that root:root
My user name : nvidia -
@asisisyah
No , its not. Originally that root:root
My user name : nvidia@asisisyah what distribution are you running on your device ?