guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shepherd should not reboot on exit when running as root


From: Arun Isaac
Subject: Shepherd should not reboot on exit when running as root
Date: Wed, 26 Jan 2022 19:23:42 +0530

Hi,

If shepherd is run as root, it assumes it is the init system and reboots
the system. Since shepherd is not just an init system, but can also be
used as a non-init process to manage other daemons, this is probably not
good default behaviour. At the very least, it would be nice to have a
command-line option to disable this behaviour.

Just yesterday, I was tinkering with shepherd on a production server
running Debian as the host system, and ended up accidentally rebooting
it. Needless to say, I went through much pain and suffering! :-) I
suppose I should count myself very lucky that it didn't halt the system!
:-P

Here is the relevant piece of code in modules/shepherd.scm of the
shepherd source code.
--8<---------------cut here---------------start------------->8---
(define* (quit-exception-handler key #:optional value)
  "Handle the 'quit' exception, rebooting if we're running as root."
  (if (zero? (getuid))
      (begin
        (local-output (l10n "Rebooting..."))
        (reboot))
      (quit)))
--8<---------------cut here---------------end--------------->8---

Thanks!
Arun

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]