You are not logged in.

#1 2012-09-06 03:32:31

dgbaley27
Member
Registered: 2011-07-22
Posts: 47

systemd --user as session manager: my setup and questions

I wanted to see if anyone else is using systemd --user as their user session. I have a few questions, but first I'll just describe what I've done.

/usr/share/xsessions/systemd.desktop

[Desktop Entry]
Name=systemd
Exec=systemd --user
Type=XSession

Then, in $HOME/.config/systemd/usr/default.target.wants, I placed a bunch of services for my desktop session. Right now, these are:

bluetooth-applet.service
dock.service
gnome-settings-daemon.service
nm-applet.service
openbox.service
xcompmgr.service

I plan on making up a whole bunch of these, and possibly hosting them on github/aur if there is interest.

Question one, how can I have a user service depend on a system service?

bluetooth-applet.service:

[Unit]
Description=Bluetooth Manager Applet
Requisite=bluetooth.service

[Service]
ExecStart=/usr/bin/bluetooth-applet

I'm probably doing something wrong, because the applet is starting anyway, but bluetooth.service is definitely not running on my system.

Question two, what are my options for ending my session? Right now, I'm just doing pkill systemd Is there a way for systemd --user to exist if a specific unit exists? (openbox.service for example)

Offline

#2 2012-09-06 14:22:05

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: systemd --user as session manager: my setup and questions

1. As far as I know, you can't directly. However, you can use many of the system-wide targets (network.target, bluetooth.target, etc).

2. Why not just just exit with `systemctl --user exit`? This will bring down any running units (your window manager included). If you want a system that allows simultaneous logins, you can try something like: http://www.mail-archive.com/systemd-dev … 06065.html


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#3 2012-09-06 19:35:29

dgbaley27
Member
Registered: 2011-07-22
Posts: 47

Re: systemd --user as session manager: my setup and questions

Stebalien wrote:

1. As far as I know, you can't directly. However, you can use many of the system-wide targets (network.target, bluetooth.target, etc).

I'm not following. I don't want to start a system/bluetooth.service. I want user/bluetooth-applet.service to only start if system/bluetooth.service is running.

Stebalien wrote:

2. Why not just just exit with `systemctl --user exit`? This will bring down any running units (your window manager included). If you want a system that allows simultaneous logins, you can try something like: http://www.mail-archive.com/systemd-dev … 06065.html

That's the same as using pkill. I'm looking for a way to stop a particular service and have the trigger systemd --user exit. I wonder if it will be overkill to write a DBus daemon that listens for the standard freedesktop.org/gnome logout() api.

Offline

#4 2012-09-06 21:03:52

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: systemd --user as session manager: my setup and questions

dgbaley27 wrote:
Stebalien wrote:

1. As far as I know, you can't directly. However, you can use many of the system-wide targets (network.target, bluetooth.target, etc).

I'm not following. I don't want to start a system/bluetooth.service. I want user/bluetooth-applet.service to only start if system/bluetooth.service is running.

I've been reading through the systemd mailing lists recently, and as far as I recall, that is not yet properly implemented. Your system-wide instance of systemd would have to be able to "talk" to the user instance  over dbus, and vice versa. There are a few things left to be ironed out for that, especially with regards to seat management.

I'll post a few mails I've collected since I've been meaning to get systemd --user to work as well.

This is Auke Kok's first mail on the subject, in which he explains how he managed to get systemd --user to work in Tizen (it seemed to be a simple environment, with a single, automatically logged-on user). This is basically Tizen's systemd --user implementation adapted for PCs (the package mentioned in this mail is in the AUR).

The most insightful mails with regard to your problem are probably this one and this one. Here Auke describes some of the problems with dbus which seemed relevant enough to me, and here another user describes the problems with using systemd --user over SSH (which might be related to seat management as well).

Last edited by Runiq (2012-09-06 21:06:15)

Offline

#5 2012-09-07 13:48:38

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: systemd --user as session manager: my setup and questions

Here is a bug report (w/ patch) about getting dbus --session and systemd --user to work together: https://bugs.freedesktop.org/show_bug.cgi?id=50962


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#6 2012-09-21 18:36:18

sunite
Member
From: Freiburg i. Br., DE
Registered: 2012-05-14
Posts: 29
Website

Re: systemd --user as session manager: my setup and questions

ignore, sry

Last edited by sunite (2012-09-21 18:36:36)

Offline

#7 2012-09-21 21:28:12

dgbaley27
Member
Registered: 2011-07-22
Posts: 47

Re: systemd --user as session manager: my setup and questions

So the stuff that Auke Kok is doing the work of the display manager. What I was originally getting as was the next step in the desktop process.

What I've done is created .service files for all of the stuff I want to be started when I log in. That includes openbox, cairo-dock, and some other applets and daemons. When I log in (using LXDM), I have a very short .Xsession script that launches dbus, and then execs as gnome-session. My gnome-session does nothing but start systemd --user, and my default.target.wants has all of my service files.

The next step is to be able to start gnome-session from systemd. To do this I'd need a way of getting the SESSION_MANAGER environmental variable that gnome-session gives to all of its children.

A similar step is needed for DBUS, but this is easier because dbus-daemon allows you to set the bus address. Anyone know how to do this for gnome-session?

Offline

#8 2012-09-24 01:30:45

dgbaley27
Member
Registered: 2011-07-22
Posts: 47

Re: systemd --user as session manager: my setup and questions

One of my original questions was how to have a user unit dependant on a system unit. By default, there is a bluetooth.target in user that's a symlink to system. For bluetooth-applet Requisite=bluetooth.target, the behavior is exactly what I want.

This doesn't work for nm-applet though. I have a symlink to the system NetworkManager.service, but the user session doesn't see it as active.

Also, I've managed to start dbus-daemon --session from within systemd --user, but it requires a patch to dbus.

Offline

Board footer

Powered by FluxBB