My Jetson focused Linux tips and tricks

I’m listing here a few things that I tend to tweak or do on my dev boards. Most of them are generic Linux configs, some are more Jetson specific.

First step

Flash the latest L4T release with “-S 14GiB” option to get a decent sized root partition.

First Boot

This only valid in releases before 21.1.

Make a copy of the libglx.so as that gets overridden in upgrades:

sudo cp /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so-19r3

Everytime you run “apt-get upgrade”, do copy the original version back.

Speed up the remote login

It takes a quite a while to login with ssh as Ubuntu checks for updates. To disable that, edit

/etc/update-motd.d/90-updates-available
/etc/update-motd.d/91-release-upgrade

And add the “exit 0” on the second line, right after the “#!/bin/sh

If you don’t want to provide your password every time you log in to Jetson with ssh, you can copy your public key to Jetson. If you haven’t yet created the keys on your desktop Linux, you can create them with “ssh-keygen”. After that you should have either “$HOME/.ssh/id_dsa.pub” or “$HOME/.ssh/id_rsa.pub”. Copy the public key to Jetson:

ssh-copy-id ubuntu@<jetson's IP or hostname>

If you get “ERROR: No identities found”, add “-i $HOME/.ssh/id_rsa.pub” option.

Now you should be able to login without ssh asking the password:

ssh ubuntu@<jetson's IP or hostname>

Extra repositories

You may want to add the Ubuntu’s Universe and Multiverse repositories as they contain packages that many instructions assume. Universe contains community maintained software and Multiverse contains non-free software (licensing restrictions etc.)

sudo apt-add-repository universe
sudo apt-add-repository multiverse
sudo apt-get update

Some of the packages mentioned below comes from Universe or Multiverse.

Autologin

If you want to login automatically to the graphical environment instead of manually logging in after every boot, do the following:

sudo mkdir -p /etc/lightdm/lightdm.conf.d
sudo vi /etc/lightdm/lightdm.conf.d/autologin.conf

And add the following lines:

[SeatDefaults]
autologin-user=ubuntu

Reboot the Jetson to make LightDM to read the configuration again.

XFCE

If you want to use something else than Unity as the desktop environment, I recommend XFCE. It is quite lightweight and has a lot of options to tweak it.

Install XFCE:

sudo apt-get install xfce4 xfce4-goodies gnome-icon-theme-full

(I’m not sure if the gnome-icon-theme-full package provides anything meaningful…)

You can have multiple desktop environments installed at the same time and when logging in using the graphical login manager, you can choose which one to start.

Or if you want to change the default (works also with the autologin):

sudo mkdir -p /etc/lightdm/lightdm.conf.d
sudo vi /etc/lightdm/lightdm.conf.d/xfce.conf

And add the following lines:

[SeatDefaults]
user-session=xfce

Reboot the Jetson to make LightDM to read the configuration again.

You can check all the available sessions from /usr/share/xsessions/.

I recommend changing the screensaver to “Blank screen only” in SettingsScreensaver.

It seems that from some reason the colors in the XFCE’s default terminal are black on black so I recommend to edit the default profile in the Terminal application and select green on black color mode.

If you are interested to know how much CPU etc. are being used, click right mouse button on the panel and add all the CPU/network/monitor/temperature/etc. plugins to the panel. CPU temperature is not shown on the panel by default but you need to enable it from the plugin’s properties.

CPU performance

rel-21.1 changed governor to interactive by default which seems to work better for many cases than the ondemand that 19.3 defaulted to. For Kodi (XBMC) use, I still recommend setting the performance mode.

On the idle desktop the performance governor seems to increase the power consumption by 0.4W, which I’m fine with. On heavy use cases the difference might be significantly larger though.

Install CPU frequency tools:

sudo apt-get install cpufrequtils

Configure it by editing the default setting (create the file if needed):

sudo vi /etc/default/cpufrequtils

And add the following lines:

ENABLE="true"
GOVERNOR="performance"
MAX_SPEED=0
MIN_SPEED=0

Reboot or restart the service to get the new settings applied:

sudo /etc/init.d/cpufrequtils restart

VNC

I’m rarely using VNC but others might find it a convenient way to do some occasional work on a remote system. VNC allows you to run the whole graphical environment remotely but it doesn’t use any display related accelerated rendering so any OpenGL/CUDA applications you should run locally. These instructions will open a new session, so you can open it even if you already have the graphical desktop environment running there.

Install VNC server:

sudo apt-get install tightvncserver

Configure the login manager to start VNC:

sudo mkdir -p /etc/lightdm/lightdm.conf.d
sudo vi /etc/lightdm/lightdm.conf.d/vnc.conf

And add the following lines:

[VNCServer]
enabled=true
port=5900
width=1280
height=720
depth=24

Reboot the Jetson to make LightDM to read the configuration again.

Now you can connect to Jetson from your desktop computer. The command is for Linux but I think there are applications for Windows as well:

vncviewer <jetson's IP or hostname>

The connection is slowish even in fast local network but I think it’s still usable for many things. It can be even used over slower networks with heavy compression:

vncviewer -compresslevel 9 <jetson's IP or hostname>

Sharing monitor, keyboard and mouse

I don’t have extra monitor to dedicate to Jetson and having extra set of keyboard and mouse is also inconvenient. Yet another way to running graphical applications remotely is to use X forwarding over ssh:

ssh -X ubuntu@<jetson's IP or hostname>

That allows you to run some apps easily without any other setup. Again, that doesn’t support display related accelerated rendering so it’s a bit limited.

Another solution is to run everything locally on Jetson and just forward your mouse and keyboard to that direction. My monitor has DVI and HDMI inputs. My Linux desktop is connected to the DVI and Jetson to the HDMI, so I can switch easily between them by using the source-button in my monitor.

To forward your mouse and keyboard you need to allow X forward on Jetson:

sudo mkdir -p /etc/lightdm/lightdm.conf.d
sudo vi /etc/lightdm/lightdm.conf.d/allow-tcp.conf

And add the following lines:

[SeatDefaults]
xserver-allow-tcp=true

Reboot the Jetson to make LightDM to read the configuration again.

Allow external X connections from any host to Jetson:

ssh ubuntu@<jetson's IP or hostname>
export DISPLAY=:0
xhost +

Now, install x2x on your Linux desktop and run it (assuming Jetson is on your table left from your Linux desktop’s monitor):

sudo apt-get install x2x
x2x -to jetson:0 -west

The x2x command above means that when you move your mouse on your Linux desktop over the left (west) edge, it will be on the Jetson’s display. So switch your monitor’s input to Jetson and you can pretend you are locally on your Jetson board.

Running scripts on boot

The easiest way to run scripts as root on every boot, is to run your script from /etc/rc.local.

Nice list! Question for you…have you noticed if using XFCE reduces the occurrence of the random logout issue? ([url]https://devtalk.nvidia.com/default/topic/784780/embedded-systems/-problem-jetson-tk1-auto-logout-randrom/[/url]), which seems to be triggered when interacting with Unity elements

Nice tips, thank you ++

I haven’t seen it ever. But most of the time I’m using my Jetson remotely through ssh.

I slightly updated the info related to rel-21.1’s interactive CPU governor.

Just FYI…

Your First Boot instructions can be reduced to just executing the following command any other apt-get commands:

sudo apt-mark hold xserver-xorg-core

That will prevent the livglx.so from being clobbered on future updates.

I edited the section to mention that it’s valid only for releases before 21.1 as that is supposed to have it fixed.

Hi,
I have a problem with CPU Frequency. When I try to restart the service it says [FAIL].
If I run “cpufreq-info” I get information only about the CPU0

I think the “cpufreq-info” only reports info about the cores that are online. They are automatically taken online when there’s enough work for them.

If you want to force them always online, see: Jetson/Performance - eLinux.org

That offline cores shouldn’t cause the restart to fail though…

Thank you kulve… I tried it, but I get I/O errors performing those commands.

The strange thing is that after trying them I can use correctly restart cpufrequtils service without failing :-|

You get I/O errors when trying to put a core online that is already online, so it’s more like a warning than an error.

Hey I did the

[SeatDefaults]
user-session=xfce

and it still boots to unity, help?

Also, is it safe to install LXDE on the jetson?

Do you have xfce under “/usr/share/xsessions/”?

Should be. You can have multiple environments installed and choose one on login.

xfce is working now, but i’m getting very random logouts now as well… what did you do to fix this?

Are you running the latest L4T release?

Yes I am.

There were random logouts reported earlier but I don’t remember seeing them in a while now.

Does “dmesg” print any suspicious errors? What about /var/log/Xorg.0.log (or /var/log/Xorg.0.log.old if X already restarted).

What does this show:

head -n 1 /etc/nv_tegra_release
# ...also, does this show any error:
sha1sum -c /etc/nv_tegra_release

head-n 1 /etc/nv_tegra_release

R21 (release), REVISION: 2.0, GCID: 4814984, BOARD: ardbeg, EABI: hard, DATE: Mon Dec 1 22:48:21 UTC 2014

sha1sum is all ok

The version which was known for some logout issues was R19.2, but this shows a correct R21.2.

I’d be interested in knowing the answer to what kulve asked. From a non-GUI console, or from serial console, you might monitor anything “interesting” in “/var/log/*” via “tail -f” after you’ve logged in. This should see what logs say as your login gets cut short…check if any new log lines came out after login dies. “Interesting” should include “/var/log/Xorg.0.log”, but might also include any logs xfce might produce (I know lightdm has logs, not sure what xfce has).