m (Fixed typo) |
m (→Setting up an early debug shell: It is poor style to advise a behaviour without explicitly stating a good reason) |
||
Line 1: | Line 1: | ||
= Setting up an early debug shell = | = Setting up an early debug shell = | ||
In case of boot-time problems with systemd, it is useful to have a | In case of e.g. boot-time problems with '''systemd''', it is useful to have as root a debug-shell available. | ||
'''CTRL+ALT+F9''' will immediately switch to the debug-shell ("bash") without prompting for the password, saving precious time. | |||
{{admon/warning|This debug shell requires no authentication and provides root privileges to anyone who has physical access to the machine. | {{admon/warning|This debug-shell requires no authentication and provides root privileges to anyone who has '''physical access''' to the machine hitting '''CTRL+ALT+F9''' keys. Hence, turn in it on only as needed and disable it afterwards.}} | ||
* Enable using <code>systemctl enable debug-shell</code> | * Enable using <code>systemctl enable debug-shell</code> | ||
{{admon/tip|Manual enabling|If you find yourself in a situation where you | {{admon/tip|Manual enabling|If you find yourself in a situation where you can neither edit e.g. in grub2 the kernel parameters nor use '''systemctl''' (e.g. when setting this up remotely from a different system), you could enable the service manually: | ||
<pre>cd $PATH_TO_FEDORA_ROOT/etc/systemd/system | <pre>cd $PATH_TO_FEDORA_ROOT/etc/systemd/system | ||
mkdir sysinit.target.wants | mkdir sysinit.target.wants | ||
ln -s /usr/lib/systemd/system/debug-shell.service sysinit.target.wants/</pre>}} | ln -s /usr/lib/systemd/system/debug-shell.service sysinit.target.wants/</pre>}} | ||
* Next time | * Next time after booting, you will be able to switch to '''tty9''' by pressing the 3 key combo '''CTRL+ALT+F9''' and have a '''bash''' debug-shell available from an early stage in the booting process. | ||
Use the debug-shell e.g. for checking the status of services, reading logs, looking for stuck jobs with <code>systemctl list-jobs</code>, '''htop''' , '''killall''' etc.. | |||
* When done, disable with <code>systemctl disable debug-shell</code>. | * When done, disable with <code>systemctl disable debug-shell</code> to keep others from obtaining passwordless root access. | ||
* You may also want to consider alternative troubleshooting techniques available as kernel parameters. Edit e.g. GRUB2 vmlinuz line, adding | |||
'''debug rescue emergency 1 ''' | |||
or a combination of those for example. Those will limit the processes being launched by '''systemd'''. | |||
{{admon/warning|Use this shell only | {{admon/warning|Use this shell only while actually debugging!|Do not forget to disable debug-shell.service after you've finished debugging your boot problems. Leaving the root shell always available would be a security risk since anybody in presence could just press '''Ctrl+Alt+F9''' to obtain root privilege.}} |
Revision as of 08:02, 4 June 2021
Setting up an early debug shell
In case of e.g. boot-time problems with systemd, it is useful to have as root a debug-shell available. CTRL+ALT+F9 will immediately switch to the debug-shell ("bash") without prompting for the password, saving precious time.
- Enable using
systemctl enable debug-shell
- Next time after booting, you will be able to switch to tty9 by pressing the 3 key combo CTRL+ALT+F9 and have a bash debug-shell available from an early stage in the booting process.
Use the debug-shell e.g. for checking the status of services, reading logs, looking for stuck jobs with systemctl list-jobs
, htop , killall etc..
- When done, disable with
systemctl disable debug-shell
to keep others from obtaining passwordless root access. - You may also want to consider alternative troubleshooting techniques available as kernel parameters. Edit e.g. GRUB2 vmlinuz line, adding
debug rescue emergency 1
or a combination of those for example. Those will limit the processes being launched by systemd.