You are not logged in.

#1 2013-08-24 02:58:15

Sanjeev K Sharma
Member
Registered: 2013-08-14
Posts: 72

getting multiple instances of sytemd --user

no matter wher I put the systemd start In my experiments so far

/usr/lib/systemd/systemd --user &

in a shell profile for virtual console login, in startx, in the list of programs to start with a session - users can trigger multiple copies. or instances  regardless of where I start it from.

Is there  a flag or option or some built in way that guarantees one instance of systemd per user?

Maybe I have a blind spot and missed reading how to start the user instances from the pid=1 or as Lennart calls it, the "pid eins" process?

would it cause problems to run multiple copies - multiple copies of services starting up, timer jobs getting triggered multiple times or race conditions where services don't start?

Just playing around with starting jobs and looking at the logs it seems even if multiple copies are running per user one is active - or at least only one is writing to the journal and/or responding to the command

systemctl --user status unit_name

Last edited by Sanjeev K Sharma (2013-08-24 15:10:11)

Offline

#2 2013-08-25 18:39:37

Sanjeev K Sharma
Member
Registered: 2013-08-14
Posts: 72

Re: getting multiple instances of sytemd --user

update: If I put the cleanup/exit code in the exit for whatever the users do (dot-logout file or at the end of the xinit)  it somehow still survives sometimes.

Anyway, this looks like it's working - create an alias in the login shell init (mostly dot-bash_profie) and invoke the user systemd only using the alias. 

 alias sdUSER='/usr/bin/systemctl --user exit; \
/usr/bin/systemctl --user exit; \
/usr/lib/systemd/systemd --user  '

(the backslashes added just to make it readable on the forum)

almost guarantees they won't get multiple instances - exit twice for each invocation.

and leave some of these in the logout scripts:

/usr/bin/systemctl --user exit

It's a hack.  Also just for safety add a couple of actual exits (not just in defining the alias) in the login script.

Last edited by Sanjeev K Sharma (2013-08-25 18:42:02)

Offline

Board footer

Powered by FluxBB