[systemd-devel] How to properly start user session from DM?

Peter Lemenkov lemenkov at gmail.com
Wed Mar 6 02:17:15 PST 2013

Hello All!
I'm trying to properly start a user's session from systemd. Actually I
already did that and I just want to improve my experience further.
Here is my story.

I'm using XDM which is cool and simple DM. When someone submits proper
login and password it loads "/etc/X11/xdm/xdm-config" file, searches
for "DisplayManager*session" key and runs whatever is written here
("/etc/X11/xdm/Xsession" by default, "/usr/bin/systemd --user" in my
case). So far everything works perfectly.  Important note - it runs
this as a user which has just logged in.

I'm trying to replace "/usr/bin/systemd --user"  with something which
looks more proper - with "/usr/bin/systemctl --user start user@`id -n
-u`.service" but it logs out almost immediately. I tried it with and
w/o "--user" switch but nothing really changed - I see some login
attempts in journalctl logs and xdm is just restarted (looks like
someone pressed ctrl+alt+bksp). I suspect it's due to the act that
"/usr/bin/systemctl --user" stays forever while systemctl returns
almost immediately.

So I've got a two questions:

* What did I do wrong and how to fix that?
* Could someone please explain what's the purpose of this
/usr/lib/systemd/system/user at .service file and how to use it?

With best regards, Peter Lemenkov.

More information about the systemd-devel mailing list