How to disable TX1's desktop?

Hi,ererybody:
I need to disable the automatic boot of TX1 desktop(not uninstall),I try this command"sudo systemctl disable lightdm.service" bui it didn’t work.And the L4T version of TX1 is R24.2.1,the kernel version is 3.10.96.
Could you kindly tell me how to disabled tx1’s gui?

My method is harsh :
I did this : in the file “/etc/X11/default-display-manager”, delete the line “/usr/sbin/lightdm”

(Don’t comment this line. For some reason that I cannot explain, it still work when I comment it…)

Cill,thank you very much,it works!

You might be interested in this:
https://devtalk.nvidia.com/default/topic/762072/jetson-tk1/optional-x-desktop-disable-x/post/4805812/#4805812

Or:

sudo systemctl disable lightdm.service
sudo chmod -x /usr/sbin/lightdm

The lightdm.override was working on TK1 with Ubuntu 14.04, but no longer on TX1 with Ubuntu 16.04.
I think that on 16.04 there is also a different command from the systemctl disable lightdm.service that someone has posted a few months ago but I can’t find it now. [EDIT: This may be @sperok’s suggestion from https://devtalk.nvidia.com/default/topic/1001007/jetson-tx2/is-there-a-way-to-boot-ubuntu-16-04-into-command-line-only-do-not-start-gui-/post/5118728/#5118728]
Anyway be aware that this may result in X server to be not started (check with ps awwux | grep X), and in some own experience it was working but with poor performance for CUDA execution. This was indeed saving some memory, but for most cases I ended up letting lightdm running with no display nor input.

There was also this, I have not tested:

sudo -s
echo "manual" > /etc/init/failsafe-x.override
echo "manual" > /etc/init/lightdm.override
exit

I tried those commands on Ubuntu 16 (Jetpack 2.3.1) : It doesn’t work.
Maybe on the last version of JetPack (3.0) ?

I will not be in Ubuntu anymore but I’m sure there is an another way to disable TX1’s desktop. Maybe we must replace “gnome” (gnome desktop or gdm ) by something else ? I don’t have more time to try this.

EDIT : Sorry, the command “gdm” doesn’t exist in my platform Ubuntu 16.

This works only with Ubuntu14.04, not with Ubuntu16.04, as said in post #5.

I tried an experiment. Normally you might replace lightdm with something else in “/etc/lightdm/lightdm.conf”. Previous to my experiment there was no “/etc/lightdm/lightdm.conf”, so I added this and the content which disabled X was:

greeter-setup-script=/bin/false

…this is probably the wrong way to do it, but it seems to work. Removing the conf file restores lightdm.

The TX1 module 24.2.1 uses kernel version as 3.10.96. In this Kernel systemd is the main init system. And to disable the X desktop (GUI), need to disable the display manager service.

There are different kinds of display managers available (gdm, kdm & lightdm) and TX1 uses lightdm as the display manager. By using systemd we can disable the GUI.

sudo systemctl disable lightdm

The above command stops the lightdm service and same can be started by using systemd

sudo systemctl enable lightdm

Note: restart is required to effect the changes.

If you still see the Xserver is running, then remove the below line from the nvfb.sh file

service lightdm restart

Thanks

Hi, for systemd I believe the ‘correct’ way to enable/disable desktop is to isolate the correct target level, so to enable desktop:

systemctl isolate graphical.target
systemctl set-default graphical.target

and to disable desktop:

systemctl isolate multi-user.target
systemctl set-default multi-user.target

These are somewhat analogous to runlevels 3 and 5 in svr4 init. However, this seems to be broken on T4L, as the desktop is still running after isolating multi-user target.

1 Like

Yes, systemd via systemctl isolate does not work correctly on Jetsons. Don’t know why, I haven’t looked any deeper since systemd is complicated and other methods of disabling the desktop still exist.

Note that R28.2.0 driver package release notes http://developer2.download.nvidia.com/embedded/L4T/r28_Release_v2.0/Docs/Tegra_Linux_Driver_Package_Release_Notes_R28.2_rc.pdf says:

<b>To disable the Ubuntu desktop</b>
1.Execute the command:
$ sudo systemctl stop lightdm.service 

2.If there are two display outputs, unblank the second inactive display, as follows:
$ sudo sh -c 'echo 0 > /sys/class/graphics/fb1/blank'

I have not yet tried it, but we can expect a simple way to do this from now.

“systemctl disable” doesn’t work because on the Jetson “lightdm.service” is configured as a “static unit”, It can’t be “disabled” nor “enabled”
https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT…

It is always run by default because it has no dependencies nor is required by other service units (“systemctl list-dependencies” and “systemctl list-dependencies --reverse”).

Also, you’ll see “lightdm.service” is not part of “multi-user.target” nor “graphical.target”. That’s why changing the target doesn’t change whether or not it stops and starts. This is unlike stock Ubuntu 16.04.

The systemd way to turn off a static service unit across a reboot is “systemctl mask”
https://www.freedesktop.org/software/systemd/man/systemctl.html#mask%20UNIT…

$ sudo systemctl stop lightdm.service
$ sudo systemctl mask lightdm.service

very readable overview of systemd unit management at https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units#unit-management