I know how to enable/disable lingering with loginctl.

But up to now I found no way to query the status of a user.

I want to know: Is lingering enable for user foo?

How can I access this information?

3 Answers 3


You can show a list of lingering users with

ls /var/lib/systemd/linger


loginctl enable-linger $USER
loginctl disable-linger $USER

do the equivalent of

touch /var/lib/systemd/linger/$USER
rm /var/lib/systemd/linger/$USER
  • 2
    Note: folder /var/lib/systemd/linger does not exist until you « linger » your first user May 18, 2020 at 14:48
  • @Jocelyndelalande On Debian unstable I got that linger directory, even though it is empty, I never had a lingering user (95% sure), nor is it part of a package. Jan 25 at 22:15

loginctl user-status foo shows linger status.

  • 3
    I am unsure if this really works. Some minutes ago this printed a tree for a test-user which has not lingering enabled. Now, some minutes later, the output is "Failed to get user: No user '1003' known or logged in". I will use the solution from Markus Kuhn (check if file /var/lib/systemd/linger/$USER exists)
    – guettli
    Aug 15, 2017 at 9:05

The best I found for check it in scripts (programmatically):

loginctl show-user "$USER" --property=Linger | grep -q 'yes'
  • Why not use this: "check the existance of /var/lib/systemd/linger"?
    – guettli
    Jan 4, 2019 at 9:30
  • 6
    Because it's more subject to changes without notice.
    – Xorax
    Jan 8, 2019 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.