Start my jetson-inference application at startup

Hi.

I have developed my application and all works great, it’s an application based on the source of jetson-inference. I now need my application to boot on startup, I have created a init.d script and the application can be run as a service with the service commands.

But when I do that I can’t get the OpenGL window to show, I see the process a alive and running but the camera window does not show.

Anybody have any suggestions what could be the issue here or another way to make this works?

Thanks

/Marcus

HI MarcusNilsson,

Is your application able to recognize the display?

export DISPLAY=:0

Hi thanks for the reply.

I added the export DISPLAY=:0 before launching the jetson-inference program but it didnt work.

I have added some more logging. I get the following error in the log

[OpenGL] failed to open X11 server connection.[OpenGL] failed to create X11 Window.

I have a main service running as a systemd service and then spawn a new process, and then I get this error.

All work great if I just run the application from a shell.

You need to have an X instance running, your program must have that environment. If you don’t want to log in a user and then get this up, try running “startx /where/ever/your/program/is/the_program”. If there is a monitor capable of running X with OpenGL, then this should work.

I added startx, but the the problem was that it went fullscreen and I could not get out of it.

I then could login again on the ubuntu user, it seems owner of the .xauthority had been changed to root.

I changed it back and every thing went back to normal, I decided to go with the route to not create a window at all since its not needed.

X runs a single GUI application, and always is full screen. It is the window manager which can run applications in resizeable windows. startx with a window manager is a single application so far as X is concerned, but the window manager can itself contain and run more applications…X has no knowledge of those applications, it talks to the window manager, and the window manager passes events through to individual applications. If you have a GUI automatically starting in the ALT-F1 (or in GUI CTRL-ALT-F1) screen, then this is still there and you can switch back and forth with CTRL-ALT-F1 ($DISPLAY=":0") or CTRL-ALT-F2 ($DISPLAY=":1"). A custom startx does not remove the original X environment, it adds a second GUI (unless of course you never started a first GUI).

startx could be told to start a window manager, but this is the default…you can’t expect to start a GUI application with a window manager unless the window manager starts first. Are you really looking to automatically log in a particular user with the application running on a standard desktop? If so, then you don’t want rc.local, you want that user’s desktop to start the application on login, and perhaps autologin.