Number of (ghost) sessions grow and never cleared

Asked by Amos on 2020-02-12

I setup a new VPS with ubuntu 18.04.4, including virtualmin/usermin. In auth.log I see a lot of

    su[12936]: Successful su for domain by root
    su[12936]: + ??? root:domain
    systemd-logind[148]: New session c315 of user domain .
    su[12936]: pam_unix(su:session): session opened for user domain by (uid=0)
    su[12936]: pam_unix(su:session): session closed for user domain

in syslog, I see a lot of

    systemd[1]: Started Session c314 of user domain.
    systemd[1]: Started Session c315 of user domain.

domain is the user of my virtual server defined in the VPS. c314/c315 increased by 1 each time, every 5 minutes (see explanation below). When running `loginctl list-sessions` those sessions number grow as "active=yes" and "state=closing" and never disappear from the list.

a random session as an example:

    loginctl session-status c315
    c315 - domain (1000)
               Since: Sat 2020-02-08 20:27:08 UTC; 23h ago
              Leader: 12936
                 TTY: ???
              Remote: user root
             Service: su; type tty; class user
               State: closing
                Unit: session-c315.scope

I did a simple test: logged in with ssh, logged out (exit) and re-logged in. I saw 2 sessions in loginctl list-sessions and the previous one, which I obviously closed, never disappeared from the list.

as a "bonus": Virtualmin apparently open/close a session for the virtual server user to do its stuff causing the number of ghost sessions to grow forever...

I posted this question in server fault, askubuntu, ubuntuforums and virtualmin - no one knew what to tell me. I have no idea what/where to look for... Please advice :) Thanks in advance.

FWIW: Someone from virtualmin forum told me that he had a similar problem with debian 9 and it was fixed in debian 10.

After a boot I see this, maybe related?

Feb 13 06:39:48 domain systemd[1]: Starting User Manager for UID 1000...
Feb 13 06:39:48 domain systemd[636]: Failed to create /user.slice/user-1000.slice/user@1000.service/init.scope control group: Permission denied
Feb 13 06:39:48 domain systemd[636]: Failed to allocate manager object: Permission denied
Feb 13 06:39:48 domain systemd[1]: user@1000.service: Failed with result 'protocol'.
Feb 13 06:39:48 domain systemd[1]: Failed to start User Manager for UID 1000

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2020-02-13
Last reply:
2020-02-14

What is the output of:

lsb_release -a; uname -a; grep 1000 /etc/passwd

Thanks

Amos (amosss) said : #2

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Linux domain.com 4.15.0 #1 SMP Mon Dec 9 19:36:21 MSK 2019 x86_64 x86_64 x86_64 GNU/Linux
domain:x:1000:1000::/home/domain:/bin/bash

Do you log in as the "domain" user?

Amos (amosss) said : #4

I ssh using domain user (yes) and exit using "exit" - session remains when I ssh again... meaning I see both sessions.

Also, virtualmin opens/close connections for user domain to do its thing (not sure how it does that exactly).
https://www.cloudmin.com/node/54674
The above means that every 5 minute I have a new ghost session.

Because I added this later, so it won't be missed, after reboot I saw this
Feb 13 06:39:48 domain systemd[1]: Starting User Manager for UID 1000...
Feb 13 06:39:48 domain systemd[636]: Failed to create /user.slice/user-1000.slice/user@1000.service/init.scope control group: Permission denied
Feb 13 06:39:48 domain systemd[636]: Failed to allocate manager object: Permission denied
Feb 13 06:39:48 domain systemd[1]: user@1000.service: Failed with result 'protocol'.
Feb 13 06:39:48 domain systemd[1]: Failed to start User Manager for UID 1000

Amos (amosss) said : #5

Does this sound like a bug?
Like bad settings?
Like something else?
Can I switch this question to a bug?
Thanks

Sounds like a bug to me. Please report it

Can you help with this problem?

Provide an answer of your own, or ask Amos for more information if necessary.

To post a message you must log in.