I need to create a USB live ubuntu to run an application. I want to open my application after the boot as fullscreen without any other option to the end user.
I read that I should use Gtk+ or Qt5 if I want to run an app without a desktop environment or display manager so I created my app using Gtk+.
To be able to open the app without a desktop environment I added to .bashrc the following:
export DISPLAY=:0
while true; do ./myapp; done
I put it inside a while because sometimes I got the following error:
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(myapp:4918): Gtk-WARNING **: cannot open display:
I suppose I was trying to run the application before the display manager is running.
Enable auto-login for the default user makes .bashrc on tty1 to be executed and my application is launched.
mkdir /etc/systemd/system/[email protected]
nano /etc/systemd/system/[email protected]/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ubuntu %I $TERM
Type=idle
To make it work I also needed to edit /usr/share/xsessions/ubuntu.desktop
so it doesn't launch the desktop environment.
I'm using Ubuntu 16.04.
It is working however there are some points that I don't understand.
1 - Most of the answers to this problem say to edit ubuntu.desktop and change exec to my application however I wasn't able to make it work. It doesn't run Ubuntu desktop indeed but I wasn't able to make it run my app. I didn't find how I could debug why it was failing.
2 - I read that Gtk+ and Qt5 can use Wayland so I didn't a desktop environment neither a display manager, how could I do that?
3 - Which alternatives do you recommend to obtain the same result? The way I did it in .bashrc sounds a little bit hackish.
Thank you