在 12/04/2014 04:56 PM, arnaud gaboury 写道:
mate-settings-daemon might expect to be run from within an X-session.
These errors look like DISPLAY= isn't set, which is reasonable because
systemd starts programs from a clean environment.
As mentioned in my post, $DISPLAY is correctly set and is in systemctl
environment. The command is run inside the X session

After more tests, I realized two variables were missing:
-$XAUTHORITY
In an effort to group runtime variables in one place, I set
XAUTHORITY=/run/user/1000/Xauthority.
So adding Environment=XAUTHORITY=/run/user/1000/Xauthority solved this issue.

-$DBUS_SESSION_BUS_ADDRESS
For reasons I ignore (far from being a dbus expert), the
$DBUS_SESSION_BUS_ADDRESS as returned by the
$systemctl --user show-environment did not work for mate-settings-daemon.
Instead, mate is looking for this file to connect to dbus :
~/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0
(machine.id-display). This file has the following content:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-jszhQsZmjR,guid=be0e590886758c696ffc70175458d736
DBUS_SESSION_BUS_PID=8268
DBUS_SESSION_BUS_WINDOWID=16777217
So adding 
EnvironmentFile=%h/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0
solved the issue.

I am now with this service file:

~/.config/systemd/user/mate-settings-daemon.service

---------------------------------
[Unit]
Description=Mate settings daemon

[Service]
Type=daemon
Environment=XAUTHORITY=/run/user/1000/Xauthority
EnvironmentFile=%h/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0
ExecStart=/usr/lib/mate-settings-daemon/mate-settings-daemon

[Install]
WantedBy=wm.target
------------------------------------

it works and does what I am expecting (mate-settings are started
without any mate session being started).

-------------------------------------
gabx@hortensia ➤➤ ~ % systemctl --user status mate-settings-daemon
● mate-settings-daemon.service - Mate settings daemon
    Loaded: loaded
(/home/gabx/.config/systemd/user/mate-settings-daemon.service;
disabled)
    Active: active (running) since Thu 2014-12-04 09:34:39 CET; 9min ago
  Main PID: 5664 (mate-settings-d)
    CGroup: 
/user.slice/user-1000.slice/user@1000.service/mate-settings-daemon.service
            └─5664 /usr/lib/mate-settings-daemon/mate-settings-daemon
------------------------------------

Just to mention, the default 1.8.1 mate, will autostart mate-setting-daemon according to
its file in /etc/xdg/autostart/mate-settings-daemon.desktop:
------
[Desktop Entry]
Type=Application
Name=MATE Settings Daemon
<A lot of i18n names>
Exec=/usr/lib/mate-settings-daemon/mate-settings-daemon
OnlyShowIn=MATE;
X-MATE-Autostart-Phase=Initialization
X-MATE-Autostart-Notify=true
X-MATE-AutoRestart=true
------

So the problem does not involve systemd at all...

Thanks,
Qu

Anyway, you really should talk to the mate developers to ask them
It is done, but still waiting for any hint...

Now my new questions:

It seems to me my setting is a dirty hack. I can't understand the
content of ~/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0.

-----------------------------
$ myps dbus
.....
154:gabx      1424     1  0 Nov29 ?        00:00:00 dbus-launch
--autolaunch=77f348a2b3fb429b85a5de751ea9175a --binary-syntax
--close-stderr
.........
-------------------------------

Why this autolaunch ?
Why is the DBUS_SESSION_BUS_ADDRESS in this file set to
/tmp/dbus-jszhQsZmjR,guid=be0e590886758c696ffc70175458d736 when
$systemctl --user show-environment returns
DBUS_SESSION_BUS_ADDRESS=/run/user/1000/dbus/user_bus_socket ?
I am left with two adresses, which sounds to me confusing and weird.

Why is mate-settings-daemon listening to the adress in
~/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0 and not to the
one provided by systemctl ?


Even if my setup works, I would like to understand this story of two
dbus seesion adresses. Thank you for any explanation to light my
lantern.


Regards.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to