Siduction Forum

Siduction Forum => Siduction News => Topic started by: devil on 2014/05/10, 23:00:41

Title: when the system does not boot...
Post by: devil on 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:
Code: [Select]
systemctl enable debug-shell.serviceThe system will set a symbolic link:
Code: [Select]
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
Code: [Select]
debug-shell.service to the kernel boot line.


greetz
devil
Title: Re: when the system does not boot...
Post by: ReinerS on 2014/05/10, 23:11:20
Great, I will surely give it a try.

Regards

Reiner
Title: Re: when the system does not boot...
Post by: GoinEasy9 on 2014/05/11, 00:11:42
Wow, this is interesting, nice feature.
Title: Re: when the system does not boot...
Post by: musca on 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:
Code: [Select]
mount -o remount,rw /
systemctl enable debug-shell.service
sync
mount -o remount,ro /
reboot


greetings
musca
Title: Re: when the system does not boot...
Post by: dibl on 2014/05/21, 20:03:58
This is interesting -- I just enabled it.



Title: Re: when the system does not boot...
Post by: mylo on 2014/05/21, 22:10:08
yes, good to know and beter to have in case.
Title: Re: when the system does not boot...
Post by: der_bud on 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.

Quote from: 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.