| 1 |
# A root shell on %I, for diagnosing a live medium that will not finish. |
| 2 |
# |
| 3 |
# Gated on `alloy.debug` the same way alloy-installer.service is gated on |
| 4 |
# `alloy.installer`: the live system and the installed system are the same |
| 5 |
# image, so a unit that could start on an installed machine would be a root |
| 6 |
# shell with no password on every Alloy in the world. Only the verbose GRUB |
| 7 |
# entries in build/make-iso.sh set the flag, and an installed system's kernel |
| 8 |
# arguments come from the image, not from those entries. |
| 9 |
# |
| 10 |
# It exists because the live medium is otherwise unreachable. There is no |
| 11 |
# account on it (the installer creates one on the target, not here), root is |
| 12 |
# locked, so a failure inside the live system can only be read off whatever |
| 13 |
# the installer happened to print. Diagnosing the read-only mount that |
| 14 |
# blocked the configure step meant a full ISO rebuild per question. |
| 15 |
# |
| 16 |
# Instantiated for tty9 and ttyS0 by the preset: tty9 for a laptop with a |
| 17 |
# keyboard in front of it (Ctrl-Alt-F9), ttyS0 for a VM, where the serial |
| 18 |
# console is a text log that can be read and searched instead of |
| 19 |
# photographed. |
| 20 |
# |
| 21 |
# tty9 rather than a low-numbered VT because logind auto-spawns a getty on |
| 22 |
# the first six VTs as soon as one is switched to, which takes the terminal |
| 23 |
# straight back off this unit and offers a login prompt for an account that |
| 24 |
# does not exist on a live medium. Observed on tty2; systemd's own |
| 25 |
# debug-shell.service picks tty9 for the same reason. |
| 26 |
[Unit] |
| 27 |
Description=Alloy debug shell on %I |
| 28 |
Documentation=https://git.sr.ht/~maxmj/alloy |
| 29 |
ConditionKernelCommandLine=alloy.debug |
| 30 |
After=systemd-user-sessions.service |
| 31 |
Before=getty.target |
| 32 |
# Whichever getty owns this terminal has to lose it, and which one that is |
| 33 |
# depends on the terminal: serial consoles get serial-getty@, VTs get getty@. |
| 34 |
# Naming both is how one template serves both without knowing which it is. |
| 35 |
Conflicts=getty@%i.service serial-getty@%i.service |
| 36 |
|
| 37 |
[Service] |
| 38 |
# Type=idle for the same reason the installer uses it: let the boot's own |
| 39 |
# output finish before taking the terminal. |
| 40 |
Type=idle |
| 41 |
ExecStart=/usr/bin/bash --login |
| 42 |
TTYPath=/dev/%I |
| 43 |
StandardInput=tty |
| 44 |
StandardOutput=tty |
| 45 |
StandardError=journal |
| 46 |
TTYReset=yes |
| 47 |
TTYVHangup=yes |
| 48 |
# A debug shell that does not come back when you exit it is a debug shell |
| 49 |
# you get to use once per boot. |
| 50 |
Restart=always |
| 51 |
RestartSec=1 |
| 52 |
|
| 53 |
[Install] |
| 54 |
WantedBy=multi-user.target |
| 55 |
|