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