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

Previous Next

Package: guix;

Reported by: dannym <at> friendly-machines.com

Date: Thu, 13 Mar 2025 19:11:02 UTC

Severity: important

Merged with 67863, 74912

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: dannym <at> friendly-machines.com
Subject: bug#76998: closed (Re: bug#76998: Guix Home leaves user shepherd
 on logout, starts new instance on login)
Date: Sat, 14 Jun 2025 21:28:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#76998: Guix Home leaves user shepherd on logout, starts new instance on login

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 76998 <at> debbugs.gnu.org.

-- 
76998: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76998
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Danny Milosavljevic <dannym <at> friendly-machines.com>
Cc: 74912 <at> debbugs.gnu.org, 76998 <at> debbugs.gnu.org, Tomas Volf <~@wolfsden.cz>,
 76998-done <at> debbugs.gnu.org, Jake <jforst.mailman <at> gmail.com>,
 Daniel Littlewood <dan <at> danielittlewood.xyz>
Subject: Re: bug#76998: Guix Home leaves user shepherd on logout, starts new
 instance on login
Date: Sat, 14 Jun 2025 23:26:53 +0200
Hi Danny,

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

> It's good that the "is a shepherd already running" check is back in
> shepherd.  It was in shepherd years ago, then got removed without
> explanation, then now it's back again (now in a very convoluted but
> safer way).  This shouldn't have been removed in the first place.
> It's EXTREMELY dangerous to have multiple parallel shepherds for the
> same user (automated backup service destroying backups etc).  Please,
> let's not remove it ever again.

If you’re referring to 649a98a6697d358a53eccc45b387e5130278b5ec (8 years
ago), I believe it wasn’t doing just that due to lingering.

(Aside: I think the tone of this paragraph is uncalled for.)

> In any case, what shepherd 1.0.4 does is stop the bleeding, but not fix the problem:
> It prevents two (or 100) user shepherds for the same user from running in parallel.
> It does not stop shepherd when a user closed all their sessions.

Yes.  It just occurred to me that we probably just got it wrong from the
start: ‘XDG_RUNTIME_DIR’ (/run/user/$UID) is specified as having limited
lifetime.  Quoth
<https://specifications.freedesktop.org/basedir-spec/latest/>:

  The lifetime of the directory MUST be bound to the user being logged
  in.  It MUST be created when the user first logs in and if the user
  fully logs out the directory MUST be removed.

So it was probably a bad idea in the first place for shepherd to store
its socket in /run/user/$UID (even more so that this directory doesn’t
exist on systems without elogind/systemd).  GnuPG avoids
$XDG_RUNTIME_DIR for exactly this reason (there’s a comment in
‘homedir.c’).

So, what can we do?

In the Shepherd 1.1, we could default to $XDG_STATE_HOME instead; we
probably shouldn’t change that in 1.0.x.

Any other idea?

Thanks,
Ludo’.

[Message part 3 (message/rfc822, inline)]
From: dannym <at> friendly-machines.com
To: Bug Guix <bug-guix <at> gnu.org>
Subject: user shepherd stays around with some zombies
Date: Thu, 13 Mar 2025 20:10:36 +0100
Steps to reproduce:

1. Log into the console using your regular user
2. Log into GUI using your regular user
3. Log out of GUI
4. Switch to logged-in console
5. Run "px --tree" there
6. Observe the following:

shepherd(1)
  accounts-daemon(1110)
  avahi-daemon:(2443)
    avahi-daemon:(2446)
  bluetoothd(1026)
  colord(25587)
  cupsd(2440)
  dbus-daemon(769)
  dnsmasq(1845)
    dnsmasq(1846)
  earlyoom(744)
  elogind(1024)
  gdm(1038)
  guix-daemon(740)
  libvirtd(1023)
  login(26536)
    -bash(6739)
  mcron(747)
  mingetty... (5×)
  ModemManager(1276)
  NetworkManager(1256)
  nginx:(797)
    nginx:(798)
  nscd(2177)
  polkitd(1231)
  postgres(852)
    postgres:... (6×)
  rasdaemon(796)
  rpc.idmapd(2447)
  rpc.mountd(2501)
  rpc.statd(2444)
  rpcbind(2441)
  shepherd(6395) <--- also dannym
    [dbus-daemon](6397)
    [ssh-agent](6444)
    [xdg-permission-](6411)
    wireplumber(6399)
  shepherd(26114) <--- dannym
    dbus-daemon(6881)
    pipewire(6882)
    pipewire-pulse(6883)
    ssh-agent(6880)
    wireplumber(6888)
    xdg-permission-store(7259)
  udevd(330)
  upowerd(1025)
  virtlogd(742)
  wpa_supplicant(1045)

Those "[...]" with brackets mean that these processes were not reaped 
(so is defunct).

What the hell?

$ guix describe
Generation 194	Mar 13 2025 19:11:33	(current)
  guix 678b3dd
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 678b3dddfe442e643fe5cff7730d4f9690c3e2c2



This bug report was last modified today.

Previous Next


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