Bug 61129 - spawn user@`id -u`.service on login
Summary: spawn user@`id -u`.service on login
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-19 17:31 UTC by Simon McVittie
Modified: 2014-06-21 02:56 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
logind: start a systemd for each logged-in user (2.65 KB, patch)
2013-02-22 17:28 UTC, Simon McVittie
Details | Splinter Review
sd_uid_get_display: add (5.60 KB, patch)
2013-02-22 17:28 UTC, Simon McVittie
Details | Splinter Review
core: if running as user, pick up the X11 display from logind (4.46 KB, patch)
2013-02-22 17:29 UTC, Simon McVittie
Details | Splinter Review
temporary: add loginctl direct-sd-uid-get-display (1.36 KB, patch)
2013-02-22 17:30 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2013-02-19 17:31:14 UTC
TODO says:

>  - logind: spawn user@..service on login

I'm currently trying to implement this.
Comment 1 Simon McVittie 2013-02-22 17:28:05 UTC
Created attachment 75335 [details] [review]
logind: start a systemd for each logged-in user

---

This is not very useful until/unless we can copy around $DISPLAY, as discussed in the thread starting at <http://lists.freedesktop.org/archives/systemd-devel/2013-February/009119.html>.
Comment 2 Simon McVittie 2013-02-22 17:28:33 UTC
Created attachment 75336 [details] [review]
sd_uid_get_display: add

This can be used to get a best-effort X11 display, suitable for passing
to user-bus-activated services.
Comment 3 Simon McVittie 2013-02-22 17:29:20 UTC
Created attachment 75337 [details] [review]
core: if running as user, pick up the X11 display from logind

Otherwise, user-bus-activated services that are GUIs, like
gnome-terminal, will not be able to access the appropriate display.
Comment 4 Simon McVittie 2013-02-22 17:30:03 UTC
Created attachment 75338 [details] [review]
temporary: add loginctl direct-sd-uid-get-display

---

I doubt you'll want to merge this, but it's what I used to test sd_uid_get_display.
Comment 5 Simon McVittie 2013-02-22 19:13:22 UTC
With a couple of changes to the transition between gdm and gnome-session, and an adjustment to dbus, I've been able to get this working fairly well:

<https://bugzilla.gnome.org/show_bug.cgi?id=694472> is a gnome-session patch to make it try XDG_RUNTIME_DIR/dbus/user_bus_socket before running dbus-launch.

The patch "Don't wrap dbus-launch around gnome-session, only around  gdm-simple-chooser" on <https://bugzilla.gnome.org/show_bug.cgi?id=693668> stops gdm from interfering.

The patches on this bug get the 'systemd --user' started.

The patches on <https://bugs.freedesktop.org/show_bug.cgi?id=61301> let dbus-daemon use sd_uid_get_display(), so D-Bus services that are not also systemd user services can have a (more or less arbitrary) $DISPLAY.
Comment 6 Simon McVittie 2013-04-08 11:16:30 UTC
I'm no longer actively working on this.
Comment 7 Transperp 2013-05-11 13:54:48 UTC
Simon.. I signed up just to say, I really appreicate to see the work you put in on this and being so helpful and prompt. 

I wish to create a custom session in or around gnome but I just do not like unity/gnome 3 but I used gnome since 99/00 so. Anyway, this seems to be very useful to tinker with. I use arch linux so obviously we move forward fast (so gnome 3.8 it is) but also systemd. 

Now, to figure out these patches.. I found a link with patches 2-5/5 but no #1 :p

Also not sure which and how they all fit together (if some are redundant/duplicates).

Either way, a big thank you for your input too. It showed a side of the dev around gnome sessions which is more aligned with how gnome used? to be.
Comment 8 Simon McVittie 2013-06-05 15:01:11 UTC
(In reply to comment #7)
> Now, to figure out these patches.. I found a link with patches 2-5/5 but no
> #1 :p

It might have been a bugfix that was already committed for a different bug.

> Also not sure which and how they all fit together (if some are
> redundant/duplicates).

This is the sort of system-integration work that shouldn't be applied by distributions until there is consensus on how everything is meant to work. I suggest either waiting, or trying to restart discussion on the mailing list.
Comment 9 Zbigniew Jedrzejewski-Szmek 2013-07-14 02:39:44 UTC
http://cgit.freedesktop.org/systemd/systemd/commit/?id=fb6becb makes user@$UID.service be started at first login (in principle, I think it
doesn't actually work all that well.)
Comment 10 Zbigniew Jedrzejewski-Szmek 2013-09-11 20:41:32 UTC
http://cgit.freedesktop.org/systemd/systemd/commit/?id=5c390a4 adds another piece of the puzzle.
Comment 11 Zbigniew Jedrzejewski-Szmek 2014-06-21 02:56:13 UTC
OK, user session mostly work nowadays. Various things still require work, but it'll probably be better to open new discrete bugs for that.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.