Skip to content

Enabling persistent user instance systemd #3702

@CMCDragonkai

Description

@CMCDragonkai

Apparently user specific systemd instances only exist while there is a session for a specific user. If the last session exits, then the user specific systemd instance exits as well.

There's a way to make a user specific systemd instance persistent, so that users can run unattended long running services: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_start-up_of_systemd_user_instances

Basically you need to activate this option: http://www.freedesktop.org/software/systemd/man/loginctl.html#enable-linger%20USER...

loginctl enable-linger username

However this option is not available in NixOS or NixPkgs, I searched the repo. Also the logind extraConfig doesn't cover it.

I think there might need to be a new option as part of the user management that makes the user instance systemd persistent, and run the above command on bootup and the opposite if the setting changes?

It should of course only run once if it has already ran, even though it is idempotent. I wonder how you can do this?

Right now I'm simply running it during when I pack the image.

Metadata

Metadata

Labels

0.kind: enhancementAdd something new or improve an existing system.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions