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

Todd Zullinger <[email protected]> Sat, 4 Jul 2026 10:33:24 -0400
Newsgroups gmane.linux.debian.user
Message-ID <[email protected]>
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 ~]$

-- 
Todd
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQSvlwC4tRNlCF6x+moHOcdGE+n45gUCakkZqgAKCRAHOcdGE+n4
5lVkAQDLtbm0+ih7mne0Nu3m5smBQkM8h8R/ybrdlVpFoZoKTAEAhtvtigxaAEdl
Z1HL1dGbwVQKshmh5VnxA5yM/um3UQA=
=xsze
-----END PGP SIGNATURE-----