Nominate our 2022 Qt Champions!

Ubuntu Run Qml Application on startup

  • I am using nvidia TX1 with ubuntu 14.04.
    I want to run QT gui application on startup without showing linux boot messages or ubuntu home.
    I have successfully disabled boot messages. But not able to run qt app directly 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?

  • Lifetime Qt Champion

    Did you make a deployment folder for you app?

    You should be able to just open shell, and start the program with

    To verify it can find all its SO files.

    you can check with ldd also.

  • Moderators

    @RiteshPanchal If you are trying to load the application before X loads then you will have to find some other solution for eg. using framebuffer.

  • @mrjj ya i have made deployment folder for my app.
    I can able to run my app from shell.

    I need to add PATH for qt-gstreamer library which is used my app.

    export LD_LIBRARY_PATH=/usr/local/lib/arm-linux-gnueabihf/

    @p3c0 Ya i need to load X11 for before running qt app.
    is there any way to bypass ubuntu after loading lightdm and execute my qt app. and always stays on the app?

  • Moderators

    @RiteshPanchal lightdm will start X so there shouldn't be any issue. Btw. what do you meany by "bypass ubuntu" ?
    Also if you are using plugins then I think you will also need to set plugins path using QT_PLUGIN_PATH.

  • @p3c0 "bypass ubuntu" means my app should start without showing any ubuntu home UI. And my app is fullscreen.
    I already done autologin and disabled root password prompt.

    So can you tell me where to put command for executing my script for running app?

  • Moderators

    @RiteshPanchal Are you able to manually start the Qt application once system fully booted ?

  • Yes. I can start the app by following from terminal
    export LD_LIBRARY_PATH=/usr/local/lib/arm-linux-gnueabihf/

  • Lifetime Qt Champion

    @RiteshPanchal said in Ubuntu Run Qml Application on startup:

    export LD_LIBRARY_PATH=/usr/local/lib/arm-linux-gnueabihf/

    and you put those 2 lines in a .sh file and call it during boot
    and not the app directly?
    Just checking as calling the ".exe" directly wont work.

  • Moderators

    @RiteshPanchal Ok. So the best way would be use autostart. On Ubuntu you can create a .desktop file and put it inside /etc/xdg/autostart or user's local autostart.
    The contents of this file follows this specification.
    For eg.

    [Desktop Entry]
    Name=My Application
    Comment=My Desktop Application
    Exec=/usr/local/app/  #this script contains `export` and then launches app

  • @mrjj Ya i have put these 2 lines in .sh file and try to call this script on boot.
    But my question is where to put command from executing my .sh script so that it would load X11 and successfully run the app.?

  • @p3c0 Ya. this method works.
    Thanks for your help.

    But if i pressed Alt+Tab or Windows button or any other windows key combination it will again show ubuntu.
    So is there any way to stop loading ubuntu unity home.? so my app user unable to accidentally minimized my app and can't access ubuntu?

  • Moderators


    But if i pressed Alt+Tab or Windows button or any other windows key combination it will again show ubuntu.

    Window manager handles that part and in your case ubuntu unity. So look for a way to disable alt-tab from unity. I too dont know. A quick google search points out some.

    Actually instead of using a full Ubuntu you should use a Minimal Ubuntu and install only those packages which are required. Then start X server on boot and a lightweight window manager. There are many of those available and also highly customizable.

  • @p3c0 Actually I am using nVidia Jetson TX1 board. And they are not giving flexibility to install minimal linux.
    I need to search something else.
    But thanks for your reply.

  • Moderators

    @You're Welcome :)

    Actually I am using nVidia Jetson TX1 board. And they are not giving flexibility to install minimal linux.

    Just curiosity. Why ?

  • @p3c0 There may be some advanced method for doing this.
    But They have given sample-root-file-system and kernel source. This file system contains full ubuntu 14.04. And provided documents to compile kernel and flashing this file system to TX1 eMMC.

    I think mostly TX1 user use this board in Robotics, Machine learning and embedded visual computing applications. So they required full ubuntu.

    As for now i don't know any method to do that nor any post related on their forum. I will post a question on there forum. And hope for their reply soon.