systemd quirks

shutdown on Ctrl-Alt-Del

ln -s /lib/systemd/system/poweroff.target /etc/systemd/system/ctrl-alt-del.target


do not kill user processes on logout

Set in /etc/systemd/logind.conf :
KillUserProcesses=no


no hanging jobs on shutdown

mkdir -p /etc/systemd/system.conf.d
echo DefaultTimeoutStopSec=10s > /etc/systemd/system.conf.d/timeout.conf


do not lock screen when closing laptop lid

Set in /etc/systemd/logind.conf :
HandleLidSwitch=ignore


continue booting on failing mount

If there is a filesystem which fails to mount on boot, systemd enters rescue mode.
To prevent this, add the mount options nobootwait,nofail to /etc/fstab


auto root-login on VT13 (Shift-Alt-F1)

Useful for VMs where you are sure no one else has access to the console.
perl -p -i -e 's/#NAutoVTs.*/NAutoVTs=13/' /etc/systemd/logind.conf

cat >/etc/systemd/system/getty.target.wants/getty@tty13.service <<EOD
[Unit]
Description=root bash on %I
Conflicts=rescue.service
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service
Before=getty.target
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0

[Service]
ExecStart=-/sbin/agetty --noclear -a root %I $TERM
ExecStopPost=-/sbin/vhangup /dev/%I
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

[Install]
WantedBy=getty.target
EOD


Author: Ulli Horlacher