GNU bug report logs - #73903
[shepherd]: Guix Home's shepherd masks shutdown/reboot on foreign distribution

Previous Next

Package: guix;

Reported by: Dariqq <dariqq <at> posteo.net>

Date: Sun, 20 Oct 2024 10:13:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73903 in the body.
You can then email your comments to 73903 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Sun, 20 Oct 2024 10:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dariqq <dariqq <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 20 Oct 2024 10:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: bug-guix <at> gnu.org
Subject: [shepherd]: Guix Home's shepherd masks shutdown/reboot on foreign
 distribution
Date: Sun, 20 Oct 2024 10:12:08 +0000
When using guix home to manage shepherd services on a foreign 
distribution the shepherd package is also added to the home-profile.

This then makes the home profile provide 'halt', 'shutdown' and 'reboot' 
(and their manpages) masking the system ones.

Trying to run one of these then results in an error:
reboot: error: /var/run/shepherd/socket: No such file or directory

instead of e.g. rebooting the system.





Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Wed, 06 Nov 2024 13:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Jakob Honal <jakob.honal <at> gmx.de>
To: 73903 <at> debbugs.gnu.org
Date: Wed, 6 Nov 2024 14:52:19 +0100
[Message part 1 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Sun, 10 Nov 2024 11:52:02 GMT) Full text and rfc822 format available.

Message #11 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks
 shutdown/reboot on foreign distribution
Date: Sun, 10 Nov 2024 12:51:04 +0100
Hi,

Dariqq <dariqq <at> posteo.net> skribis:

> When using guix home to manage shepherd services on a foreign
> distribution the shepherd package is also added to the home-profile.
>
> This then makes the home profile provide 'halt', 'shutdown' and
> 'reboot' (and their manpages) masking the system ones.

Oh, indeed.  I’m not sure how to address that though.  Ideas?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Sun, 10 Nov 2024 15:59:01 GMT) Full text and rfc822 format available.

Message #14 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks shutdown/reboot
 on foreign distribution
Date: Sun, 10 Nov 2024 15:57:54 +0000
Hi Ludo,

On 10.11.24 12:51, Ludovic Courtès wrote:
> Hi,
> 
> Dariqq <dariqq <at> posteo.net> skribis:
> 
>> When using guix home to manage shepherd services on a foreign
>> distribution the shepherd package is also added to the home-profile.
>>
>> This then makes the home profile provide 'halt', 'shutdown' and
>> 'reboot' (and their manpages) masking the system ones.
> 
> Oh, indeed.  I’m not sure how to address that though.  Ideas?
> 
Not sure if this is something that should be addressed by shepherd or 
the default shepherd package used for guix home.

Initially I had the idea to add a configure flag to shepherd to disable 
"building" and installing these 5 files (which is why I reported against 
shepherd). I threw something together that works but I am not really 
happy with it because imo such an option should disable *all*
 things that are not required when only using it for user level 
services and not just the entrypoints. That would be a lot more work though.

Another (simpler solution) would be to just solve the problem in guix by 
using a shepherd variant that deletes sbin and share/man/man8.


Wdyt?
> Ludo’.





Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Wed, 20 Nov 2024 10:47:01 GMT) Full text and rfc822 format available.

Message #17 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks
 shutdown/reboot on foreign distribution
Date: Wed, 20 Nov 2024 11:46:30 +0100
Hi,

Dariqq <dariqq <at> posteo.net> skribis:

> On 10.11.24 12:51, Ludovic Courtès wrote:
>> Hi,
>> Dariqq <dariqq <at> posteo.net> skribis:
>> 
>>> When using guix home to manage shepherd services on a foreign
>>> distribution the shepherd package is also added to the home-profile.
>>>
>>> This then makes the home profile provide 'halt', 'shutdown' and
>>> 'reboot' (and their manpages) masking the system ones.
>> Oh, indeed.  I’m not sure how to address that though.  Ideas?
>> 
> Not sure if this is something that should be addressed by shepherd or
> the default shepherd package used for guix home.

[...]

> Another (simpler solution) would be to just solve the problem in guix
> by using a shepherd variant that deletes sbin and share/man/man8.

Yes, this sounds like a reasonable solution to me.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Thu, 21 Nov 2024 16:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks shutdown/reboot
 on foreign distribution
Date: Thu, 21 Nov 2024 16:21:55 +0000
Hi,

On 20.11.24 11:46, Ludovic Courtès wrote:

> 
>> Another (simpler solution) would be to just solve the problem in guix
>> by using a shepherd variant that deletes sbin and share/man/man8.
> 
> Yes, this sounds like a reasonable solution to me.
> 
> Ludo’.

How should this work? should this be a (public?) procedure? Should it 
rebuild shepherd or just copy the output with trivial-build-system?


I just thought of a more elegant solution, but this would be a lot 
harder to implement properly:

- Move the sbin stuff into a seperate output
- Home shepherd service only adds the main output to the profile and 
shepherd-root-service both
- Will need adjustments some packages that currently reference 
shutdown/reboot ( -> lots of rebuilds because logind) and the same 
change for the shepherd packages in the shepherd module.




Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Tue, 26 Nov 2024 15:56:01 GMT) Full text and rfc822 format available.

Message #23 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks
 shutdown/reboot on foreign distribution
Date: Tue, 26 Nov 2024 16:55:02 +0100
Hi,

Dariqq <dariqq <at> posteo.net> skribis:

> On 20.11.24 11:46, Ludovic Courtès wrote:
>
>> 
>>> Another (simpler solution) would be to just solve the problem in guix
>>> by using a shepherd variant that deletes sbin and share/man/man8.
>> Yes, this sounds like a reasonable solution to me.
>> Ludo’.
>
> How should this work? should this be a (public?) procedure? Should it
> rebuild shepherd or just copy the output with trivial-build-system?

My understanding of this proposal is that there would be a
“shepherd-foreign” package, which is like “shepherd” but without
‘reboot’ and ‘halt’.

That package could be implemented with ‘trivial-build-system’ or
‘copy-build-system’ indeed, and it would symlink all of ‘shepherd’,
except its ‘sbin’ directory.

> I just thought of a more elegant solution, but this would be a lot
> harder to implement properly:
>
> - Move the sbin stuff into a seperate output
> - Home shepherd service only adds the main output to the profile and
>   shepherd-root-service both
> - Will need adjustments some packages that currently reference
>   shutdown/reboot ( -> lots of rebuilds because logind) and the same
>   change for the shepherd packages in the shepherd module.

The advantage is that no extra step would be needed when using a foreign
distro.  But yeah, it’s relatively intrusive, and not my favorite
solution, FWIW.  Dunno.

WDYT?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Tue, 26 Nov 2024 18:50:02 GMT) Full text and rfc822 format available.

Message #26 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks shutdown/reboot
 on foreign distribution
Date: Tue, 26 Nov 2024 18:49:01 +0000
Hi,

On 26.11.24 16:55, Ludovic Courtès wrote:
> Hi,
> 
> Dariqq <dariqq <at> posteo.net> skribis:
> 
>>
>> How should this work? should this be a (public?) procedure? Should it
>> rebuild shepherd or just copy the output with trivial-build-system?
> 
> My understanding of this proposal is that there would be a
> “shepherd-foreign” package, which is like “shepherd” but without
> ‘reboot’ and ‘halt’.
> 
> That package could be implemented with ‘trivial-build-system’ or
> ‘copy-build-system’ indeed, and it would symlink all of ‘shepherd’,
> except its ‘sbin’ directory.
> 

Imo it would make sense to have the sbinless shepherd be the default 
shepherd for home-shepherd s.t. the home environment never provides 
shutdown/halt by default. Those are commands are for the system to take 
care of (whether that is the shepherd coming from root-shepherd or the 
init from the foreign system).

On my foreign distro setup i am currently using this (apologies if the 
formatting turns out weird):

--8<---------------cut here---------------start------------->8---
(define shepherd-for-home
  (package
   (inherit shepherd)
   (name "shepherd-for-home")
   (source #f)
   (build-system trivial-build-system)
   (arguments
    (list
     #:modules '((guix build union)
                 (guix build utils))
     #:builder
     #~(begin
         (use-modules (guix build union)
                      (guix build utils))
         (union-build #$output
                      (list #$(this-package-input "shepherd"))
                      #:create-all-directories? #t)
         (delete-file-recursively (string-append #$output "/sbin"))
         (delete-file-recursively (string-append #$output 
"/share/man/man8")))))
   (native-inputs '())
   (inputs (list shepherd))))
--8<---------------cut here---------------end--------------->8---


If we don't want to care about the manpages then the 
(#:create-all-directories? #t) can be omitted in union-build.

>> I just thought of a more elegant solution, but this would be a lot
>> harder to implement properly:
>>
>> - Move the sbin stuff into a seperate output
>> - Home shepherd service only adds the main output to the profile and
>>    shepherd-root-service both
>> - Will need adjustments some packages that currently reference
>>    shutdown/reboot ( -> lots of rebuilds because logind) and the same
>>    change for the shepherd packages in the shepherd module.
> 
> The advantage is that no extra step would be needed when using a foreign
> distro.  But yeah, it’s relatively intrusive, and not my favorite
> solution, FWIW.  Dunno.
> 


If this would be possible without rebuilding I'd really like it because 
it makes clear what part of the shepherd something depends on (service 
manager stuff vs generic init stuff) and avoids an extra package that is 
just shepherd minus sbindir. But the 3300 dependants of logind makes 
this really unattractive.

> WDYT?
> 
> Ludo’.

Dariqq





Information forwarded to bug-guix <at> gnu.org:
bug#73903; Package guix. (Thu, 12 Dec 2024 10:52:02 GMT) Full text and rfc822 format available.

Message #29 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73903 <at> debbugs.gnu.org
Subject: Re: bug#73903: [shepherd]: Guix Home's shepherd masks
 shutdown/reboot on foreign distribution
Date: Thu, 12 Dec 2024 11:50:45 +0100
Hi Dariqq,

Dariqq <dariqq <at> posteo.net> skribis:

> Imo it would make sense to have the sbinless shepherd be the default 
> shepherd for home-shepherd s.t. the home environment never provides 
> shutdown/halt by default. Those are commands are for the system to take 
> care of (whether that is the shepherd coming from root-shepherd or the 
> init from the foreign system).

I agree.

> On my foreign distro setup i am currently using this (apologies if the 
> formatting turns out weird):
>
> (define shepherd-for-home
>    (package
>     (inherit shepherd)
>     (name "shepherd-for-home")
>     (source #f)
>     (build-system trivial-build-system)
>     (arguments
>      (list
>       #:modules '((guix build union)
>                   (guix build utils))
>       #:builder
>       #~(begin
>           (use-modules (guix build union)
>                        (guix build utils))
>           (union-build #$output
>                        (list #$(this-package-input "shepherd"))
>                        #:create-all-directories? #t)
>           (delete-file-recursively (string-append #$output "/sbin"))
>           (delete-file-recursively (string-append #$output 
> "/share/man/man8")))))
>     (native-inputs '())
>     (inputs (list shepherd))))

Perfect!

Would you like to submit a patch adding this package (probably with the
‘hidden?’ property), followed by a patch making it the default for Home?

Thanks,
Ludo’.




Information forwarded to , bug-guix <at> gnu.org:
bug#73903; Package guix. (Mon, 16 Dec 2024 21:34:02 GMT) Full text and rfc822 format available.

Message #32 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73903 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 0/2] Add shepherd-for-home and make it default
Date: Mon, 16 Dec 2024 21:33:11 +0000
Hello,

This adds a variant of shepherd without sbin and makes it the default for home services. The reason is that when using guix home with shepherd services on a foreign distribution the default shepherd package masks commands like halt, shutdown and reboot which are usually provided by the initsystem. 

Per the discussion in https://issues.guix.gnu.org/73903 the package is hidden and just symlinks all the relevant files from the base shepberd to the new output.

I successfully reconfigured my home environment and confirmed that halt/reboot are now provided by my system profile.


Dariqq (2):
  gnu: Add shepherd-for-home.
  gnu: home: Use shepherd-for-home as the default shepherd.

 gnu/home/services/shepherd.scm |  2 +-
 gnu/packages/admin.scm         | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)


base-commit: c3290cee6add60b7e56f5f919d9498d78542790a
-- 
2.46.0





Information forwarded to sharlatanus <at> gmail.com, bug-guix <at> gnu.org:
bug#73903; Package guix. (Mon, 16 Dec 2024 21:34:02 GMT) Full text and rfc822 format available.

Message #35 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73903 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 1/2] gnu: Add shepherd-for-home.
Date: Mon, 16 Dec 2024 21:33:12 +0000
* gnu/packages/admin.scm (shepherd-for-home): New variable.

Change-Id: If66c7e7b688de239ca862326b51592b43ba22c25
---
 gnu/packages/admin.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 77d02baa4e..08ac3d582a 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -428,6 +428,33 @@ (define-public shepherd-1.0
 
 (define-public shepherd shepherd-0.10)
 
+;; A variant of shepherd without sbin to not mask
+;; halt and reboot on foreign distributions
+(define-public shepherd-for-home
+  (let ((base shepherd-1.0))
+    (hidden-package
+     (package/inherit base
+       (name "shepherd-for-home")
+       (source #f)
+       (build-system trivial-build-system)
+       (arguments
+        (list
+         #:modules '((guix build union)
+                     (guix build utils))
+         #:builder
+         #~(begin
+             (use-modules (guix build union)
+                          (guix build utils))
+             (union-build #$output
+                          (list #$(this-package-input "shepherd"))
+                          #:create-all-directories? #t)
+             (delete-file-recursively
+              (string-append #$output "/sbin"))
+             (delete-file-recursively
+              (string-append #$output "/share/man/man8")))))
+       (native-inputs '())
+       (inputs (list base))))))
+
 (define-public guile2.2-shepherd
   (package
     (inherit shepherd-0.10)
-- 
2.46.0





Information forwarded to , bug-guix <at> gnu.org:
bug#73903; Package guix. (Mon, 16 Dec 2024 21:34:03 GMT) Full text and rfc822 format available.

Message #38 received at 73903 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73903 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 2/2] gnu: home: Use shepherd-for-home as the default shepherd.
Date: Mon, 16 Dec 2024 21:33:13 +0000
* gnu/home/services/shepherd.scm (home-shepherd-configuration): Change default
value of shepherd field to shepherd-for-home

Change-Id: I3773403bb1fcdcbe2acb1bbcbfaa009f4d31ace4
---
 gnu/home/services/shepherd.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm
index 37ad1489d6..c9bf819803 100644
--- a/gnu/home/services/shepherd.scm
+++ b/gnu/home/services/shepherd.scm
@@ -55,7 +55,7 @@ (define-record-type* <home-shepherd-configuration>
   home-shepherd-configuration make-home-shepherd-configuration
   home-shepherd-configuration?
   (shepherd home-shepherd-configuration-shepherd
-            (default shepherd-1.0))               ;package
+            (default shepherd-for-home))               ;package
   (auto-start? home-shepherd-configuration-auto-start?
                (default #t))
   (daemonize? home-shepherd-configuration-daemonize?
-- 
2.46.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 14 May 2025 17:05:06 GMT) Full text and rfc822 format available.

Notification sent to Dariqq <dariqq <at> posteo.net>:
bug acknowledged by developer. (Wed, 14 May 2025 17:05:06 GMT) Full text and rfc822 format available.

Message #43 received at 73903-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73903-done <at> debbugs.gnu.org, Janneke Nieuwenhuizen <janneke <at> gnu.org>,
 Tanguy Le Carrour <tanguy <at> bioneland.org>, Andrew Tropin <andrew <at> trop.in>
Subject: Re: bug#73903: [PATCH 0/2] Add shepherd-for-home and make it default
Date: Wed, 14 May 2025 18:23:19 +0200
Hi,

Dariqq <dariqq <at> posteo.net> writes:

>   gnu: Add shepherd-for-home.
>   gnu: home: Use shepherd-for-home as the default shepherd.

For some reasons I had overlooked these patches.  Finally applied, with
cosmetic modifications to the first one.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Jun 2025 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.