Re: [systemd-devel] Many user slices created and user managers spawned on boot

2019-01-28 Thread Simon McVittie
On Sat, 26 Jan 2019 at 10:26:23 -0600, Steve Bergman wrote:
> possibly since before the upgrade from Debian 7 with sysvinit to
> Debian 9 with systemd

I hope you upgraded from Debian 7 (usually booted with sysvinit) to Debian 8
(usually booted with systemd), then rebooted, cleaned up any obsolete packages,
and upgraded from Debian 8 to Debian 9 as a separate step. Debian does not
support upgrades that skip a release: our releases are about 2 years apart, and
applying 4 or more years of development to a running system is too much change
to do reliably in one go. If this system is working, it's probably fine now,
but please upgrade in 1-release steps if you upgrade any similar systems.

The major "Debianism" to be aware of with systemd is that in upstream
systemd, logind's [Login] KillUserProcesses option defaults to "yes",
whereas in Debian it defaults to "no".

The benefit of that change is that on Debian systems, tools like screen(1) and
tmux(1) work as intended without needing special steps to exclude them from the
session scope; the cost is that processes that continue to run after a user's
session has ended are not cleaned up (because systemd can't know that they
weren't meant to behave like screen or tmux).

smcv
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Many user slices created and user managers spawned on boot

2019-01-26 Thread Steve Bergman

On 1/26/19 10:58 AM, Mantas Mikulėnas wrote:


Take a look at /var/lib/systemd/linger. Something, quite possibly
X2go

,
is configuring systemd to start a user@.service for every
user on boot.


Forgot to finish that thought. It looks like X2go uses this feature 
because it also avoids systemd's usual cleanup on logout, as there's 
no easy opt-out for that. (Although I believe it's now usually 
disabled distro-wide via /etc/systemd/logind.conf anyway?)




Thank you very much.  I'd kind of guessed that it might have something 
to do with X2Go, and that it might have something to do with 'linger'.  
x2gostartagent does, indeed, enable linger behavior.  FYI, Debian 9's  
/etc/systemd/logind.conf looks like:


[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Many user slices created and user managers spawned on boot

2019-01-26 Thread Mantas Mikulėnas
On Sat, Jan 26, 2019 at 6:55 PM Mantas Mikulėnas  wrote:

> On Sat, Jan 26, 2019 at 6:36 PM Steve Bergman  wrote:
>
>> Hi,
>>
>> I have a Debian 9 server, fully updated (systemd 240-4) which acts as an
>> X2Go desktop server hosting remote X sessions for about 150 users.  I've
>> made no special customizations to the systemd configuration.  On boot,
>> immediately after systemd-user-sessions.service starts, systemd
>> immediately creates slices for most of my users, starts a user manager
>> for each, and mounts a run directory for each.  Users which have not
>> logged in for a very long time (possibly since before the upgrade from
>> Debian 7 with sysvinit to Debian 9 with systemd) are not included.  But
>> if I log in as one of these users then, starting with the next reboot,
>> those accounts are included, as well.
>>
>> Is this normal?  This server is certainly acting quite differently than
>> any of my others, where the slices and management processes get created
>> on login and destroyed on logout.
>>
>
> Take a look at /var/lib/systemd/linger. Something, quite possibly X2go
> ,
> is configuring systemd to start a user@.service for every user on
> boot.
>
> This is normally off by default and done by the admin via `loginctl
> enable-linger ` or `loginctl disable-linger `. (The feature is
> there to let certain users start stuff on boot without having to rely on
> e.g. cron's @reboot jobs.)
>

Forgot to finish that thought. It looks like X2go uses this feature because
it also avoids systemd's usual cleanup on logout, as there's no easy
opt-out for that. (Although I believe it's now usually disabled distro-wide
via /etc/systemd/logind.conf anyway?)

-- 
Mantas Mikulėnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Many user slices created and user managers spawned on boot

2019-01-26 Thread Mantas Mikulėnas
On Sat, Jan 26, 2019 at 6:36 PM Steve Bergman  wrote:

> Hi,
>
> I have a Debian 9 server, fully updated (systemd 240-4) which acts as an
> X2Go desktop server hosting remote X sessions for about 150 users.  I've
> made no special customizations to the systemd configuration.  On boot,
> immediately after systemd-user-sessions.service starts, systemd
> immediately creates slices for most of my users, starts a user manager
> for each, and mounts a run directory for each.  Users which have not
> logged in for a very long time (possibly since before the upgrade from
> Debian 7 with sysvinit to Debian 9 with systemd) are not included.  But
> if I log in as one of these users then, starting with the next reboot,
> those accounts are included, as well.
>
> Is this normal?  This server is certainly acting quite differently than
> any of my others, where the slices and management processes get created
> on login and destroyed on logout.
>

Take a look at /var/lib/systemd/linger. Something, quite possibly X2go
,
is configuring systemd to start a user@.service for every user on boot.

This is normally off by default and done by the admin via `loginctl
enable-linger ` or `loginctl disable-linger `. (The feature is
there to let certain users start stuff on boot without having to rely on
e.g. cron's @reboot jobs.)

-- 
Mantas Mikulėnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Many user slices created and user managers spawned on boot

2019-01-26 Thread Steve Bergman

On 1/26/19 10:26 AM, Steve Bergman wrote:

I have a Debian 9 server, fully updated (systemd 240-4) which...


Oops.  My original post contained a significant error.  The version of 
systemd involved is "232-25+deb9u8".



-Steve Bergman
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Many user slices created and user managers spawned on boot

2019-01-26 Thread Steve Bergman

Hi,

I have a Debian 9 server, fully updated (systemd 240-4) which acts as an 
X2Go desktop server hosting remote X sessions for about 150 users.  I've 
made no special customizations to the systemd configuration.  On boot, 
immediately after systemd-user-sessions.service starts, systemd 
immediately creates slices for most of my users, starts a user manager 
for each, and mounts a run directory for each.  Users which have not 
logged in for a very long time (possibly since before the upgrade from 
Debian 7 with sysvinit to Debian 9 with systemd) are not included.  But 
if I log in as one of these users then, starting with the next reboot, 
those accounts are included, as well.


Is this normal?  This server is certainly acting quite differently than 
any of my others, where the slices and management processes get created 
on login and destroyed on logout.


I've googled and googled, and I can't seem to find any reports of anyone 
else mentioning this.


Here is a sample of the syslog output during boot:

Jan 26 08:22:44 hagar systemd[1]: Started Permit User Sessions.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of ap3.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of billing9.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dallas10.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dallas12.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of hagar5.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dalparts1.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of mark.
Jan 26 08:22:44 hagar systemd[1]: Starting User Manager for UID 1068...
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of okcship3.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dallas14.
Jan 26 08:22:44 hagar systemd[1]: Starting User Manager for UID 648...
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of epparts2.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dalparts6.
Jan 26 08:22:44 hagar systemd[1]: Starting User Manager for UID 1058...
Jan 26 08:22:44 hagar systemd[1]: Starting User Manager for UID 1077...
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dalsvc11.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of kathy.
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of operator1.
Jan 26 08:22:44 hagar systemd[1]: Starting User Manager for UID 612...
Jan 26 08:22:44 hagar systemd[1]: Created slice User Slice of dalparts11.
...

Thanks for any feedback,
Steve Bergman

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel