This tutorial ensures there's no stdin/stdout/stderr (File Descriptors) as a potential performance optimization vector, furthermore no Login Manager is required nor a VT/Virtual Terminal (Getty/agetty). You can still execute a custom script (e.g. start.sh) but by default it skips login and spawns a Wayland compositor in TTYPath=/dev/tty1
-
Open your desktop environment in a different TTY (e.g.
CTRL+ALT+F2). -
Copy over all files to your editor.
-
CTRL+Fand searh for following hardcoded values and replace them with what fits your system:Value Description tty1desired TTY number chvt 1TTY number gameyour username /home/user/gamePATH to your $HOMEjaydesired command -
Prepare the environment:
#sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf sudo nano /etc/systemd/system/ttylauncher.service # Paste content of the systemd unit from below sudo systemctl enable ttylauncher # Auto start on boot sudo systemctl mask autovt@tty1.service # Prevent VT1 template unit from being triggered sudo systemctl disable --now getty@tty1.service # Disable login prompt sudo systemctl daemon-reload; sudo systemctl restart ttylauncher # Run each time you make modifications
-
Verify:
$ sudo ls -l /proc/$(pgrep -x jay)/fd/{0,1,2} lr-x------ 1 game game 64 Aug 3 18:00 /proc/367459/fd/0 -> /dev/null l-wx------ 1 game game 64 Aug 3 18:00 /proc/367459/fd/1 -> /dev/null l-wx------ 1 game game 64 Aug 3 18:00 /proc/367459/fd/2 -> /dev/null
-
Script
To run a
script.shinstead of a command, tweakttylauncher.serviceto use:ExecStart=/home/user/game/start.sh -
Troubleshooting
To collect logs with
$ journalctl -fStandardOutput=journal -
File Descriptors
/usr/bin/file </dev/null 1>/dev/null 2>/dev/nullis equivelent to:StandardInput=null StandardOutput=null StandardError=null
/usr/bin/file <&- 1>&- 2>&-can be replicated with:StandardInput=closed StandardOutput=closed StandardError=closed
Unit file (systemd)
- https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html
- https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Command%20lines
- https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers
Examples