GNU bug report logs - #74912
Guix Home leaves user shepherd on logout, starts new instance on login

Previous Next

Package: guix;

Reported by: Jake <jforst.mailman <at> gmail.com>

Date: Mon, 16 Dec 2024 14:24:01 UTC

Severity: important

Merged with 67863, 76998

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

Bug is archived. No further changes may be made.

Full log


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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Danny Milosavljevic <dannym <at> friendly-machines.com>
Cc: Jake <jforst.mailman <at> gmail.com>, 74912 <at> debbugs.gnu.org,
 Tomas Volf <~@wolfsden.cz>
Subject: Re: bug#74912: Shepherd: Growing number of user shepherds when
 relogging
Date: Tue, 01 Apr 2025 12:13:43 +0200
Hi Danny,

Danny Milosavljevic <dannym <at> friendly-machines.com> skribis:

> I would suggest the following:
>
> (1) For Guix native, patch elogind[i] to also kill -TERM shepherd
> (See user_stop_service--which is for that).
> How does it find the shepherd process, specifically?

I think ‘user_stop_service’ could run:

  herd stop root -s /run/user/$UID/shepherd/socket

> So elogind probably could also start
>
>   /run/current-system/profile/bin/shepherd
>   (with which config?)
>
> on first user session login (and remember its pid)
> (See user_start_service--which is for that, anyway).

Oh yes, that too.

> (2) When a foreign distro uses systemd (there's a very high chance it
> does), then we can just install shepherd as a systemd user unit
> (from guix-install.sh).  systemd will do the right thing, the end.

I wouldn’t do it from ‘guix-install.sh’ because it only makes sense if
you’re going to use Guix Home; and if you use Guix Home, it has its own
way of starting shepherd.

> (3) Maybe use .bash_logout and have it invoke "w" (or "loginctl") to see
> whether we are the last session of that user (that would have a race...).
> If we are, then kill shepherd.

Yes.

Question is how to keep Home portable between Guix and foreign distros.
Neither the elogind nor the systemd approach are portable; the
‘.bash_logout’ thing may be portable, but it’s probably more fragile.

Maybe we shouldn’t try to be portable, and first start by fixing the
problem on Guix System?

> What about shepherd's child processes (for example services)?
> Will shepherd clean those up on shepherd termination?

Yes: if you ‘herd stop root’ or send SIGTERM to shepherd, it will shut
down all the services properly.

Thanks,
Ludo’.




This bug report was last modified 3 days ago.

Previous Next


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