TX1 L23.2 run Qt qml gui app on startup

I want to execute Qt qml application on TX1 startup without showing any boot message or Ubuntu Home.
I disabled boot message.

But i not able to run qt app on startup.
I have tried putting my script on crontab, rc.local, lightdm.conf but still not getting any success.

Can anyone have any idea?

Here is some information which may be useful in getting started, but I have not set this up for automatic run before…this is just to demo some of what needs to be done.

The script “/usr/bin/startx” can be used as a utility to start X on the command line (including shell scripts). Everything after the double dash “–” option is passed directly to the X program…or Xorg in this case. The pre-existing X which runs on a normal Ubuntu system starts with the ctrl-alt-F7 as its terminal, so this is virtual terminal 7 (VT7). This initial display is assigned the DISPLAY environment “:0”. To add an additional X session, using automatic selection of VT and DISPLAY, just run this (if “:0” is running on VT7 prior to this, then that is incremented and you will now also have “:1” on “VT8”):

startx --

With X already running as DISPLAY “:0” on VT7, this alternate command line creates a new session running as DISPLAY “:1” on VT5 instead of VT8, and gives verbose output as to what it is using for configuration:

startx -- vt5 -verbose

Note that some scripts check the kernel command line for the option “text” (which is why X startup scripts show kernel command line), and if this is found, X should not be run via scripts which check this. There are exceptions, and X itself does not check kernel command line for “text”. If you add this to the APPEND in extlinux.conf as a kernel option, then you’d boot only to text mode when using that boot entry (via serial console) and truly have no X run at all…useful for experimenting if you have serial console set up (this gets init involved in avoiding graphics…this goes beyond what having “text” in command line does):

APPEND ...stuff already there... systemd.unit=multi-user.target

If you boot with that, then there will be no graphical mode until you boot without “systemd.unit=multi-user.target”, or after manually running command “systemctl isolate graphical.target”. You could force the system back to text only via command “systemctl isolate multi-user.target”. The append option is just for boot time, interactive use of systemctl allows going back and forth between text and graphical run levels while experimenting. If you go to text mode via either booting with the systemd.unit=multi-user.target, or by manually running “systemctl isolate multi-user.target”, you can be sure that the only X you see is the one you manually start.

To forcibly start your session specifically as DISPLAY “:1” on VT5, even when “:0” does not exist:

startx -- :1 vt5

If you have qmlviewer installed, then from a text console or script, you can display it in that session via:

export DISPLAY=:1
qmlviewer &

So step one is to run X on the terminal you are interested in using a manually set/predictable DISPLAY environment variable. Then from anywhere else you can set DISPLAY to this and run an X application. X applications usually have options for “geometry”, and since there is no desktop window manager, you won’t be able to drag or resize applications with the mouse…you have to set this on command line. Conveniently, arguments passed to X after the “–” of startx include the ability to start X with particular resolution, e.g., 1920x1080…after which you can start your application with that geometry to do the equivalent of full screen. When you get that how you want, then add it to rc.local. If you need this to run as non-root, then you can use "sudo --user=someone " for both the startx and the GUI app to run on that DISPLAY.

For a list of options you can pass to X, see “X -help 2>&1 | less”. If you run a normal X session without any intervention, see “ps a | grep Xorg” to see what the automatic session used for arguments. Note that startx is a convenience, Xorg can be called directly. I see this for a default automatic X startup:

728 tty7 ... /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

If you are in text mode, and run this sudo, you will get a completely unconfigured desktop responding as DISPLAY “:1” on VT5 (and you probably want unconfigured…startx still does some configuration even when not told to use a display manager, e.g., background color…this version has no background):

/usr/lib/xorg/Xorg -core :1 -seat seat0 -nolisten tcp vt5 -novtswitch

You’ll probably like this latter method of startup if you don’t mind running as root…I’m not sure what the setup requirement is to run without startx and still run as user ubuntu (or anyone other than root). Somewhere a simple sudo will do the trick, I just don’t know where that is without researching it.

Note that the “-nolisten tcp” is a security option to prevent remote networked interaction with your display. The “novtswitch” is explained in “X -help”, and may or may not be what you want.

Thanks for your details description.
But i am little confused about your suggestion.

Actually i have created .desktop entry of my QT application running script. And put it in /etc/xdg/autostart
And also i have disabled boot message and enable auto login and disable password prompt.

So Now my Qt App will start on restart. But the problem is that Ubuntu Unity desktop is still running in background so if i pressed Alt+tab or Alt+Ctlr+Del or any other desktop key combination my qt app goes in background and shows Ubuntu Desktop.

So i need to somehow disable Ubuntu desktop to be started.
I think your suggestion is doing the same right?

I tried your command on TX1.
On running ubuntu i executed below command on terminal.


As a result TX1 restarts and run my Qt app as i have added on startup entry. And ubuntu desktop is not running. So this seems solved my problem.

But Now i want to come back to Ubuntu Desktop. So i start new terminal by Alt+Ctrl+F5 and executreed below command.

startx -- vt5 -verbose

As a result, TX1 restarts and stops at ubuntu login screen. But strange thing is that i unable to login to my account. entering right password will restart TX1 and still stops at same login screen. And also same happens with guest login.

So how to get back to my ubuntu desktop?

And also can you send some code snippet for switching between Ubuntu Desktop mode and Only my Qt App mode?

I don’t know the exact reason what happened but i got successful login in ubuntu by following command.

chown username:username .Xauthority

where username is my login name: ubuntu

So now can you suggest some code snippet for switching between Ubuntu Desktop mode and Only my Qt App mode?

My first answer was about running just your app without a window system. Would it be correct to say you really just wanted to autorun something in a normal desktop upon login with the user retaining full control? My previous reply gives instructions on having a single graphical application run on its own terminal without any kind of desktop environment (and removing user interaction other than for the one app).

If you wanted to customize login behavior for anyone using the system there is a mention of “/usr/sbin/lightdm-session” here which might be of interest (lightdm is the window manager):