[H-GEN] Systemd killing processes after logout

Russell Stuart russell-humbug at stuart.id.au
Sun Jun 5 20:24:46 EDT 2016


At the last Humbug we discussed in new feature in systemd - it now
kills all background processes on logout, including those run by nohup,
screen, tmux, mosh and so on.  This new behaviour arrived in Debian
unstable on May 23.

At the meeting there was furious agreement this was insane, (except
from Clinton, who defended it - but then he defended binary logs when
they first came out so this wasn't unexpected).  The question most
interesting to me was WTF? - with the W standing for "why".  'nix has
had a mechanism for do this for as long as I can remember - all
descendent processes of the login process is sent a HUP signal when it
exits.  It was simple, robust mechanism and had worked well back when
we had 100's students learning to use computers for the first time on a
single timesharing machine.  So why this new one?

I knew [0] it was because on Desktop's now it's the fashion to have
background services are started by via RPC (remote procedure call) sent
to a background daemon, and the background daemon was evidently not
started by the login shell.  I assumed it was a global background
process, but Clinton insisted a separate background RPC daemon was
started for each login session.

Turns out we are both 1/2 right.  Clinton is right - a separate RPC
background daemon is started for each login session, but for some
reason is *not* a descendent of the login process (lightdm in my case).
 So on my laptop I have two trees of processes for my login:

    systemd,1                    systemd,1
    `-systemd,2356               `-lightdm,1246
      |-(sd-pam),2362             `-lightdm,2347
      |-dbus-daemon,2383            `-lxsession,2375
      |-dconf-service,2880            |-lxpanel,2440
      |-evolution-addre,2914          |-lxpolkit,2439
      | |-evolution-addre,2952        |-openbox,2436
      |-evolution-calen,2889          | |-evolution,2858
      | |-evolution-calen,2896        | `-iceweasel,2749
      | |-evolution-calen,2905        |-pcmanfm,2442
      | |-evolution-calen,2920        |-pidgin,2443
      |-evolution-sourc,2863          |-ssh-agent,2409
      |-gconfd-2,2610           
      |-gnome-terminal-,2691    
      | |-bash,2697             
      | |   `-pstree,3639       
      |-goa-daemon,2550         
      |-goa-identity-se,2561    
      |-gvfs-afc-volume,2532    
      |-gvfs-goa-volume,2546    
      |-gvfs-gphoto2-vo,2541    
      |-gvfs-mtp-volume,2537    
      |-gvfs-udisks2-vo,2515    
      |-gvfsd,2420              
      |-gvfsd-fuse,2425         
      |-gvfsd-metadata,2868     
      `-gvfsd-trash,2498        

I have no idea why they designed it that way - in fact it seems utterly
inexplicable.  But it meant when the user logged out the cleanup
process wasn't simple. With complexity comes bugs, and so often
background daemons were left running when a GUI user logged out.  The
systemd guys decided the solution wasn't to fix the design, it was to
use a bigger hammer that impacted not just the GUI users who had the
original problem - but all of the headless systems maintained by
sysadmins who, if they have a process running on logout are almost
certainly wanted it to remain running.

It's mostly developers who run GUI's on Debian (the unwashed masses
tend to use something like Ubuntu), and it was Debian developers who
thought this change was a good idea.  But when it's all said and done
Debian's main users are the thousands if not millions of headless
servers maintained by those sysadmin's.  The howls of protest from them
started 3 days after the change hit unstable, and ramped up rapidly.  
So it's not surprising the Debian systemd packagers have now uploaded a
new version reverting this particular "improvement".

But this does mean the original problem it was put in to fix remains a
problem in Debian.  In fact it has hit me - I've seen it those
duplicate copies of Gnome services running on my laptop from time to
time.  I had wondered who they got started.


[0] https://github.com/systemd/systemd/issues/2900


More information about the General mailing list