* Shepherd should not reboot on exit when running as root
@ 2022-01-26 13:53 Arun Isaac
2022-02-05 13:51 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Arun Isaac @ 2022-01-26 13:53 UTC (permalink / raw)
To: guix-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Shepherd should not reboot on exit when running as root
2022-01-26 13:53 Shepherd should not reboot on exit when running as root Arun Isaac
@ 2022-02-05 13:51 ` Ludovic Courtès
2022-02-07 5:00 ` Arun Isaac
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2022-02-05 13:51 UTC (permalink / raw)
To: Arun Isaac; +Cc: guix-devel
Hello!
Arun Isaac <arunisaac@systemreboot.net> skribis:
> 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
Oops, fixed in 7c380590164ea8ee40de46059d07e08a48963577, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Shepherd should not reboot on exit when running as root
2022-02-05 13:51 ` Ludovic Courtès
@ 2022-02-07 5:00 ` Arun Isaac
0 siblings, 0 replies; 3+ messages in thread
From: Arun Isaac @ 2022-02-07 5:00 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 107 bytes --]
> Oops, fixed in 7c380590164ea8ee40de46059d07e08a48963577, thanks!
That's a neat solution. Thanks, Ludo!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 524 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-07 5:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 13:53 Shepherd should not reboot on exit when running as root Arun Isaac
2022-02-05 13:51 ` Ludovic Courtès
2022-02-07 5:00 ` Arun Isaac
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).