unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: guix-devel@gnu.org
Subject: Shepherd should not reboot on exit when running as root
Date: Wed, 26 Jan 2022 19:23:42 +0530	[thread overview]
Message-ID: <87tudq8uxl.fsf@systemreboot.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]


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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 524 bytes --]

             reply	other threads:[~2022-01-26 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 13:53 Arun Isaac [this message]
2022-02-05 13:51 ` Shepherd should not reboot on exit when running as root Ludovic Courtès
2022-02-07  5:00   ` Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tudq8uxl.fsf@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).