SystemD

From MK Wiki EN
Revision as of 17:19, 28 June 2018 by MkWikiEnSysOp (talk | contribs) (4 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Booting, Shutting down and the like

Problems shutting down

In case there are problems:

RFE: when "systemctl poweroff" or "systemctl poweroff -f" fails, because PID 1 is hosed, recommend retrying with "systemctl poweroff -ff"

SystemD and tty

Don't clear tty1 before login screen appears

Debian 8: "edit" command of systemctl is not available.

systemctl edit getty@tty1
[Service]
TTYVTDisallocate=no

Credits

Set another number of ttys than 6

In /etc/systemd/logind.conf, locate NAutoVTs and change its value.

Credits

journald on tty

Let's have journald output on tty12 for example: Create file /etc/systemd/journald.conf.d/fw-tty12.conf (perform mkdir /etc/systemd/journald.conf.d/ if necessary) and put

[Journal]
ForwardToConsole=yes
TTYPath=/dev/tty12
MaxLevelConsole=info

inside this file, then do a

systemctl restart systemd-journald

Credits

Arbitrary program on specific tty

This SystemD service starts "htop" on tty11 (as user "nobody" for security reasons):

[Unit]
Description=htop on tty11

[Service]
Type=simple
ExecStart=/usr/bin/sudo -u nobody /usr/bin/htop
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty11

[Install]
WantedBy=multi-user.target

It can be saved in /etc/systemd/system as htop.service and later be started by systemctl start htop. If it should be started at boot, systemctl enable htop can be used.

Credits - I have enhanced it by "sudo -u nobody", otherwise anybody with physical access to the system would be able to manipulate it, i.e. killing processes by pressing F9.