From Fedora Project Wiki

(debug-shell.service)
 
(tips)
Line 1: Line 1:
= Setting up an early debug shell =
In case of boot-time problems with systemd, it is useful to have a root shell available for debugging.
In case of boot-time problems with systemd, it is useful to have a root shell available for debugging.


Line 30: Line 32:


* Enable it using <code>systemctl enable debug-shell.service</code>
* Enable it using <code>systemctl enable debug-shell.service</code>
{{admon/tip|Manual enabling|If you find yourself in a situation where you cannot use systemctl (e.g. when setting this up from a different booted system), you can enable the service manually:
<pre>cd $PATH_TO_FEDORA_ROOT/etc/systemd/system
mkdir sysinit.target.wants
ln -s ../debug-shell.service sysinit.target.wants/</pre>}}
* Next time when booting, you will be able to switch to tty9 using CTRL+ALT+F9 and have a root shell there available from an early point in the booting process.
* Next time when booting, you will be able to switch to tty9 using CTRL+ALT+F9 and have a root shell there available from an early point in the booting process.
{{admon/warning|Use it only for 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.}}

Revision as of 08:28, 11 May 2012

Setting up an early debug shell

In case of boot-time problems with systemd, it is useful to have a root shell available for debugging.

  • Save the following unit as /etc/systemd/system/debug-shell.service
[Unit]
Description=early root shell on tty9 for debugging
DefaultDependencies=no
IgnoreOnIsolate=yes

[Service]
Environment=TERM=linux
ExecStart=/usr/bin/openvt -f -c 9 -e /usr/bin/bash
Restart=always
RestartSec=0
TTYPath=/dev/tty9
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
# bash ignores SIGTERM
KillSignal=SIGHUP

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
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=sysinit.target
  • Enable it using systemctl enable debug-shell.service
Idea.png
Manual enabling
If you find yourself in a situation where you cannot use systemctl (e.g. when setting this up from a different booted system), you can enable the service manually:
cd $PATH_TO_FEDORA_ROOT/etc/systemd/system
mkdir sysinit.target.wants
ln -s ../debug-shell.service sysinit.target.wants/
  • Next time when booting, you will be able to switch to tty9 using CTRL+ALT+F9 and have a root shell there available from an early point in the booting process.
Warning.png
Use it only for 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.