Siduction Forum

Siduction Forum => Siduction News => Thema gestartet von: devil in 2014/05/10, 23:00:41

Titel: when the system does not boot...
Beitrag von: devil in 2014/05/10, 23:00:41
Siduction/Debian has a rescue tool that is not very well known. It comes with systemd and is called debug-shell.service. It allows you to open a rescue shell on tty 9 if you have problems with booting your system. The service file is preinstalled, but not activated. So to be able to use it in case you need it, you should activate it now:
systemctl enable debug-shell.service
The system will set a symbolic link:
ln -s '/lib/systemd/system/debug-shell.service' '/etc/systemd/system/sysinit.target.wants/debug-shell.service'

Now you can at any time open a shell with CTL ALT 9 and try to debug what is wrong by checking the status of services, reading logs, looking for stuck jobs with systemctl list-jobs etc. As long as GRUB starts, you can also add debug-shell.service to the kernel boot line.


greetz
devil
Titel: Re: when the system does not boot...
Beitrag von: ReinerS in 2014/05/10, 23:11:20
Great, I will surely give it a try.

Regards

Reiner
Titel: Re: when the system does not boot...
Beitrag von: GoinEasy9 in 2014/05/11, 00:11:42
Wow, this is interesting, nice feature.
Titel: Re: when the system does not boot...
Beitrag von: musca in 2014/05/21, 15:43:42
Hello devil, GoinEasy9
yes, interesting, but the 'debug-shell.service' parameter set in grub's kernel cmdline doesn't give me the shell.

I learned from der_bud that  'systemd.unit=emergency.target'  enters maintenance mode.
While on it you can also add 'systemd.show_status=true' for traditional [ok] or [failed] messages.

So one can enable the debug-shell in maintenance mode:
mount -o remount,rw /
systemctl enable debug-shell.service
sync
mount -o remount,ro /
reboot



greetings
musca
Titel: Re: when the system does not boot...
Beitrag von: dibl in 2014/05/21, 20:03:58
This is interesting -- I just enabled it.



Titel: Re: when the system does not boot...
Beitrag von: mylo in 2014/05/21, 22:10:08
yes, good to know and beter to have in case.
Titel: Re: when the system does not boot...
Beitrag von: der_bud in 2014/05/22, 07:35:34
Please let me add a warning to all of this. It really is a nice feature to add this debug-shell when you have plans to investigate something on your system, then do as devil described. In case of emergency or boot problems, you can activate it like musca posted. But please consider to disable that shell again when you are done with testing it, otherwise your system has on tty9 an always enabled root shell without password, which might be considered as a vulnerability.

Zitat von: http://freedesktop.org/wiki/Software/systemd/Debugging/ :
"Warning: Use this shell only for debugging! Do not forget to disable systemd-debug-shell.service after you've finished debugging your boot problems. Leaving the root shell always available would be a security risk."

On that site http://freedesktop.org/wiki/Software/systemd/Debugging/ (http://freedesktop.org/wiki/Software/systemd/Debugging/) is a lot more interesting stuff to read about bootproblems, debugging systemd, emergency.target and rescue.target and such.