How to config start-up service

Type command ‘systemctl list-unit-files | grep enabled’
I can see many system service is started up.

root@tegra-ubuntu:~# systemctl list-unit-files | grep enabled
cups.path                                  enabled 
accounts-daemon.service                    enabled 
anacron-resume.service                     enabled 
anacron.service                            enabled 
argus-daemon.service                       enabled 
autovt@.service                            enabled 
avahi-daemon.service                       enabled 
bluetooth.service                          enabled 
brltty.service                             enabled 
cron.service                               enabled 
cups-browsed.service                       enabled 
cups.service                               enabled 
dbus-org.bluez.service                     enabled 
dbus-org.freedesktop.Avahi.service         enabled 
dbus-org.freedesktop.ModemManager1.service enabled 
dbus-org.freedesktop.nm-dispatcher.service enabled 
display-manager.service                    enabled 
dns-clean.service                          enabled 
dnsmasq.service                            enabled 
docker.service                             enabled 
getty@.service                             enabled 
gpsd.service                               enabled 
lightdm.service                            enabled 
lvm2-monitor.service                       enabled 
ModemManager.service                       enabled 
network-manager.service                    enabled 
networking.service                         enabled 
NetworkManager-dispatcher.service          enabled 
NetworkManager.service                     enabled 
nv-l4t-usb-device-mode.service             enabled 
nv.service                                 enabled 
nv_update_verifier.service                 enabled 
nvcamera-daemon.service                    enabled 
nvfb.service                               enabled 
nvpmodel.service                           enabled 
ofono.service                              enabled 
pppd-dns.service                           enabled 
rsyslog.service                            enabled 
serial-getty@.service                      enabled 
ssh.service                                enabled 
sshd.service                               enabled 
syslog.service                             enabled 
ubuntu-fan.service                         enabled 
unattended-upgrades.service                enabled 
whoopsie.service                           enabled 
apport-forward.socket                      enabled 
avahi-daemon.socket                        enabled 
cups.socket                                enabled 
dm-event.socket                            enabled 
docker.socket                              enabled 
gpsd.socket                                enabled 
lvm2-lvmetad.socket                        enabled 
lvm2-lvmpolld.socket                       enabled 
rpcbind.socket                             enabled 
snapd.socket                               enabled 
default.target                             enabled 
multi-user.target                          enabled 
remote-fs.target                           enabled 
runlevel2.target                           enabled 
runlevel3.target                           enabled 
runlevel4.target                           enabled 
apt-daily.timer                            enabled

Are there some scripts in the rootfs to config the started up service?

Also,How to config TX2 start-up to terminal mode(currently is windows Desktop)? Or how to Config the runlevel?

Have check those configure files at /etc/systemd/system/*

A note about “/etc/systemd/system/*”: Many of these are symbolic links into the “standard” version which Ubuntu provides when there is more than one possible choice. Entries in the “/etc” take precedence over other system preferences. If you were to link a current systemd service in the “/etc” location to itself, then this is the same as doing nothing; if there are several possibilities, and you change which one the symbolic link points at, then you’ve picked a new version without harming the filesystem. If you were to copy a file from somewhere else and put it in the “/etc” location, and then edit, then you’d have your customization; to revert you’d just remove that file (or typically for temporary purposes I bzip2 the file).

I want to have tx2 system not login ubuntu desktop System(just have tx2 run our customer app).
Try run the following command:

systemctl disable lightdm.service

the output log message:
Synchronizing state of lightdm.service with SysV init with /lib/systemd/systemd-sysv-install…
Executing /lib/systemd/systemd-sysv-install disable lightdm
insserv: warning: current start runlevel(s) (empty) of script lightdm' overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script lightdm’ overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script lightdm' overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script lightdm’ overrides LSB defaults (0 1 6).

But after reboot, it still start-up desktop UI System.

Boot to console as default by below command
sudo systemctl set-default multi-user.target
Boot to Desktop by below command.
sudo systemctl set-default graphical.target

Hi ShaneCCC,

Unfortunately,I try the command
sudo systemctl set-default multi-user.target, then reboot the system, TX2 still boot to Desktop.
By the way,Currently, TX2 is installing Jetpack3.3.
Can you please check it again?

THanks,

Hi ShaneCCC,

Have you any update?

Thanks,

I am try it on J4.2 it’s ubuntu 18.04, does the J3.3 is 16.04?
For 16.04 could you have a try below link

https://askubuntu.com/questions/859630/how-to-start-ubuntu-in-console-mode

Hello ShaneCCC,

Try to the above link.
edit /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=“text”
GRUB_TERMINAL=console
But I don’t see the file /etc/default/grub on TX2 Ubuntun16.04
I just create file /etc/default/grub then add the following line
GRUB_CMDLINE_LINUX_DEFAULT=“text”
GRUB_TERMINAL=console
when run command ‘sudo update-grub’,it show "bash:update-grub:command not found
Can you please confirm if the way is OK on TX2 Ubuntu16.04?

Thanks,
Martin

Just run below command no need to update the grub.

sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target

sudo systemctl enable graphical.target --force
sudo systemctl set-default graphical.target

Hello ShaneCCC,

Thanks for your update.
I just try the command, but have no effect.

nvidia@tegra-ubuntu:~$ sudo systemctl enable multi-user.target --force
nvidia@tegra-ubuntu:~$ sudo systemctl set-default multi-user.target
Created symlink from /etc/systemd/system/default.target to /lib/systemd/system/multi-user.target.
nvidia@tegra-ubuntu:~$
nvidia@tegra-ubuntu:~$ sudo -s
root@tegra-ubuntu:~# reboot

Unfortunately, it still boot to ubuntu graphical mode on Ubuntu16.04.

Also, I tried it on sdk4.2 with ubuntu18.04 it is working fine.

Thanks,
Martin

There’s no problem on my side. After that I boot to full console mode.

nvidia@nvidia-desktop:~$ sudo systemctl enable multi-user.target --force
[sudo] password for nvidia:
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:

  1. A unit may be statically enabled by being symlinked from another unit’s
    .wants/ or .requires/ directory.
  2. A unit’s purpose may be to act as a helper for some other unit which has
    a requirement dependency on it.
  3. A unit may be started when needed via activation (socket, path, timer,
    D-Bus, udev, scripted systemctl call, …).
  4. In case of template units, the unit is meant to be enabled with some
    instance name specified.
    nvidia@nvidia-desktop:~ sudo systemctl set-default multi-user.target Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target. nvidia@nvidia-desktop:~ sudo reboot

Hello ShaneCCC,

It is a little strange!

Are you testing on Jetpack3.3(ubuntu16.04LTS)? 

Thanks,
Martin

OOPS I try on J4.2 ubuntu 18.0
Could you try below command for J3.3 ubuntu 16.04

sudo systemctl disable lightdm.service

Unfortunately,try ‘sudo systemctl disable lightdm.service’, it is not working.

This might help, but is originally for Xavier (just the first step, “Disable display manager after booting”):
https://devtalk.nvidia.com/default/topic/1068437/jetson-agx-xavier/why-is-egl-required-for-nv-gstreamer-pluigins-when-running-headless-/post/5411886/#5411886

Hi,

It is not working on TX2 Jetpack3.3 Ubuntu16.04.
The following is the log:
sudo systemctl stop gdm
Failed to stop gdm.service: Unit gdm.service not loaded.
It seem that is not correcly way,
Our project urgently need to get this issue resolved.
Can you please provide correctly way to fix the issues on TX2 Jetpack3.3 Ubuntu16.04 ?

@27653276
Did you have check linuxdev’s comment?

Yes, I have checked linuxdev’s comment, That’s not working.
when run the command “sudo systemctl stop gdm”
it show “Failed to stop gdm.service: Unit gdm.service not loaded.”

@27653276
Could you try to uninstall the ubuntu-desktop by below command

sudo apt purge ubuntu-desktop -y