Re: Where does systemd-logind.service store its stats (e.g. loginctl things)?

Chris Green <[email protected]> Sat, 4 Jul 2026 16:26:11 +0100
Newsgroups gmane.linux.debian.user
Organization linux.* mail to news gateway
Message-ID <[email protected]>
Todd Zullinger <[email protected]> wrote:
> [-- text/plain, size 1.2K, charset us-ascii, 37 lines, encoding quoted-printable --]
> 
> Chris Green wrote:
> > This is more out of interest than necessity but I'd like to know where
> > systemd-logind.service stores its persistent data. E.g. in particular
> > when I run 'loginctl enaable-linger chris' where is the required flag
> > set?
> > 
> > It must be a persistent location as 'enable-linger' obviously survives
> > a reboot, but I just can't find where it is.
> > 
> > There is a sort of reason for wanting to know this, I want to backup
> > the information so that if/when I rebuild a system it doesn't get
> > lost. At present I just have a note to myself in my configuration
> > repository that 'loginctl enable-linger chris' needs to be run on a
> > couple of systems but it would be nicer if I could automate it.
> 
> AFAIK it simply touches /var/lib/systemd/linger/$USER:
> 
>     [test@trixie ~]$ loginctl show-user "$USER" --property=Linger
>     Linger=no
>     [test@trixie ~]$ ls /var/lib/systemd/linger/
>     [test@trixie ~]$
> 
>     [test@trixie ~]$ loginctl enable-linger
>     [test@trixie ~]$ loginctl show-user "$USER" --property=Linger
>     Linger=yes
>     [test@trixie ~]$ ls /var/lib/systemd/linger/
>     test
> 
>     [test@trixie ~]$ loginctl disable-linger
>     [test@trixie ~]$ loginctl show-user "$USER" --property=Linger
>     Linger=no
>     [test@trixie ~]$ ls /var/lib/systemd/linger/
>     [test@trixie ~]$
> 
Yes! Thank you.

I'd dug around in /var/lib/systemd/ but I hadn't spotted the 'linger'
directory, it's an obvious way to do it though.