Auto login jetson nano 2gb

I want to auto-login jetson nano 2gb ( Actually, I want to run a script automatically when the board is powered ).

I have followed the instructions suggested in this thread but it’s not working.

Does your script require a GUI? In some cases you don’t necessarily need an actual logged in account. You might want to provide more information on the script, especially if it requires a GUI, is interactive, so on, and if it is to run as a regular user.

I have a python script that first checks if jetson nano (2 GB) is connected to any network, if yes then it runs 2 other python scripts

os.system(“gnome-terminal – /bin/sh -c ‘cd /home/jetson2/rpi-rf/scripts;python3 rpi-rf_send 1; exec bash’”)

os.system(“gnome-terminal – /bin/sh -c ‘cd /opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-app;./deepstream-app -c /opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_Yolo/deepstream_app_config_yoloV3.txt; exec bash’”)

and then it closes itself


so rpi-rf does not require GUI but I guess deepstream does.

I don’t want to watch the inference stream, but I don’t know how to shut it down and it’s good while debugging.

Also, I have tried creating a cron job but it doesn’t work the desired way, even when the jetson is connected to a network it shows disconnected, the same script works fine when I run it from the terminal.

I can message you the script if you want

thank you for your reply.


deepstream have sink options that could be customized in the configuration file in a way there will be no glsink output

If you didn’t need a GUI things would be much simpler. If you can get what @_av mentions to work (a sink to replace a GUI), then your life would be much simpler. I’d probably add a systemd service which runs upon reaching with networking running. I am not a “deepstream guy”, do you think you could use a sink instead of an actual GUI? Hopefully someone can suggest sink options, but I worry with what @Andry1984 said about no glsink maybe being a deal breaker.

If you need an actual GUI you’re going to have to install a virtual desktop server and only run the application when boot reaches the and the virtual desktop is running.

Thank you for all the replies,
I have changed the deepstream sink option as suggested by @_av, so now there is no window showing the inference from yolo.
I created a systemd service for the script to run it at time of boot,
as suggested over here ( Jetson nano auto run python code when power up - #3 by xuanthinh010110 )

the script runs but for some reason it do not start gnome terminal.

If I run the service as a user service then it do opens the gnome terminal and works fine but then it do not starts at boot time automatically.

systemctl --user enable mytest.service

A gnome terminal implies you have to run this in a GUI. If the GUI is not started, or if the GUI is started but the user is different between gnome terminal user and GUI user, then this will fail. If the correct user is logged in to the GUI, and the service starts as that user, but “DISPLAY” is not set, then this will also fail.

Is a GUI required (probably since gnome terminal is involved)? Does your service recognize the individual user’s login to the GUI as a prerequisite? I suspect there is a valid attempt to run the program automatically, but the manual login will have met dependencies your systemd service does not take into consideration.

Actually the reason why I am using gnome terminal is that when I run the first script it initially checks if the device is connected to internet,

if yes then it starts yolo program in new gnome terminal and terimate it self

if no then it waits for a QR code with the network cerdentials (SSID and password) and tries to connects to those credential

the reason why I got to start the yolo - deepstream program in new gnome terminal and terminate the first program is because when deepstream tries to access the camera while it gets camera busy,

I tried doing

cam.release ()

but the camera light still stays on and is shown busy till the time I do not terminate the programme.

I have attached the python script

Thank you for your time and generous response. (4.4 KB)

probably the QR code is read by the same camera the deepstream accesses? but by a separate app - the python code?
there would be a colission if they both access the camera concurrently
However, gnome terminal is init 5 level, while console terminal is init3 level, as it seems to me.
Does your implementation necessarily require init 5 level?
Init 5 autologin also could be done via default settings in Ubuntu menu for a given user

yeah I have one camera connected to my device, the program first use it for QR code reading and then it is used for deepstream implementation,
the reason why I initiated the yolo - deepstream in another gnome terminal is simply because when I was calling deepstram from the same (QR code) script deepstream was giving a camera busy error.

No my implementation does not necessarily require init 5 level.

Also jetson nano 2gb has LXDE and I fail to find any auto login option in this.

Thnak you

Hey @linuxdev . I want to achieve the same what is mentioned here…

My program (object detection) doesn’t need a GUI nor there is any sort of interactive output. I just want my python program to run as soon as I plug in the power…What do u suggest? What is the correct method to achieve this?

Even if your program does not require a GUI, then you can expect gnome terminal to cause the dependency. Checking for internet should not require a gnome terminal, and so you could remove that dependency.

I don’t know enough about deepstream to say how you might remove that having a GUI dependency. What @_av mentions as runlevel 5 is the GUI requirement. If you could switch everything to needing runlevel 3 (text mode multi-user login), then your life would be simplified.

hey sorry for the late reply,
As you told me to do I modified my code and no gnome terminal were required after that because of which I was able to create the service and it worked great
Thank you

Try creating a service as suggested over here

It worked for me.

Hello @swapnilgtm1998 , I also found a method…It was pretty easy and it did the job…thanks anyways