Re: [systemd-devel] mate desktop user service file

2014-12-09 Thread arnaud gaboury
On Thu, Dec 4, 2014 at 7:06 PM, arnaud gaboury  wrote:
> On Thu, Dec 4, 2014 at 4:20 PM, arnaud gaboury  
> wrote:
>>>
>>> You seem to be using some mechanism for starting 'systemd --user' that
>>> gives it a DBUS_SESSION_BUS_ADDRESS that assumes dbus-daemon is being
>>> started via a specific third-party implementation of a dbus.service for
>>> the user bus, possibly from "user-session-units". If you use the part of
>>> user-session-units that assumes a dbus-daemon will be launched, but not
>>> the part that actually launches the dbus-daemon, then I'm afraid you get
>>> to keep both pieces.
>>>
>>> Neither dbus nor systemd currently ships that dbus.service. When I
>>> suggested adding one to dbus, Lennart asked me to use a different path
>>> for the socket, then said he had no plans to support a non-kdbus user
>>> bus at all ... so that feature request is on hold.
>>> (https://bugs.freedesktop.org/show_bug.cgi?id=61301 if you're interested.)
>>>
>>> Find what is setting DBUS_SESSION_BUS_ADDRESS, and make it not do that.
> --
> └─session-c2.scope
>   ├─2908 login -- gabx
>   ├─2911 -zsh
>   ├─2929 /bin/sh /usr/bin/startx
>   ├─2951 xinit /home/gabx/.xinitrc -- /etc/X11/xinit/xserverrc :0
> vt1 -auth /tmp/serverauth.7yJtuNYzPM
>   ├─2952 /usr/bin/Xorg.bin -nolisten tcp :0 vt1 -auth
> /tmp/serverauth.7yJtuNYzPM vt1
>   ├─2956 i3
>   ├─2979 firefox-aurora
>   ├─2980 i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-socket.2956
>   ├─2982 urxvt
>   ├─2985 caja --no-desktop
>   ├─2987 urxvt
>   ├─2996 i3status --config=~/.config/i3/i3status.conf
>   ├─3011 dbus-launch --autolaunch=77f348a2b3fb429b85a5de751ea9175a
> --binary-syntax --close-stderr
>
> ---
>

It took me numerous tests and lots of reading the dbus literature, but
I finally managed what I wanted.

First, I parsed
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/dbus/user_bus_socket
in my X environment (adding in ~/.xprofile). This way X11 services
have a given dbus adress.
Then I started my dbus user session this way :
ExecStart=/usr/bin/dbus-daemon --config-file=/etc/dbus-1/session.conf
(removed the --nofork --nopidfile --systemd-activation options).

This leaves me with only one dbus session:
157:gabx   961   913  0 11:41 ?00:00:00
/usr/bin/dbus-daemon --config-file=/etc/dbus-1/session.conf

and this output from systemd-cgls:

-
└─user.slice
  └─user-1000.slice
├─user@1000.service
│ ├─913 /usr/lib/systemd/systemd --user
│ ├─927 (sd-pam)
│ ├─dbus.service
│ │ ├─ 961 /usr/bin/dbus-daemon --config-file=/etc/dbus-1/session.conf
│ │ ├─1419 /usr/lib/gvfs/gvfsd
│ │ ├─1427 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
│ │ ├─1453 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
│ │ ├─1477 /usr/lib/at-spi2-core/at-spi-bus-launcher
│ │ ├─1486 /usr/lib/gvfs/gvfs-afc-volume-monitor
│ │ ├─1491 /usr/lib/gvfs/gvfsd-trash --spawner :1.1
/org/gtk/gvfs/exec_spaw/0
│ │ ├─1529 /usr/lib/GConf/gconfd-2
│ │ └─1534 /usr/lib/dconf/dconf-service
│ ├─xinit.service
│ │ ├─1346 /usr/bin/xinit
│ │ ├─1347 /usr/bin/Xorg.bin -nolisten tcp vt1
│ │ ├─1354 i3
│ │ ├─1393 firefox-aurora
│ │ ├─1394 i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-socket.1354
│ │ ├─1396 caja --no-desktop
│ │ ├─1398 urxvt
│ │ ├─1400 urxvt
│ │ ├─1403 i3status --config=~/.config/i3/i3status.conf
│ │ ├─1405 zsh
│ │ ├─1406 zsh
│ │ ├─1546 adb -P 5037 fork-server server
│ │ ├─1734 systemd-cgls
│ │ └─1735 less
│ ├─tmux.service
│ │ ├─963 /usr/bin/tmux new-session -d -n irc irssi && hangups
│ │ ├─964 zsh -c irssi && hangups
│ │ └─968 irssi
│ ├─urxvtd.service
│ │ └─1276 /usr/bin/urxvtd -o -q -f
│ ├─gpg-agent.service
│ │ └─966 /usr/bin/gpg-agent --daemon --homedir=/home/gabx/.config/gnupg
│ ├─ssh-agent.service
│ │ └─958 /usr/bin/ssh-agent -d -a /run/user/1000/ssh_auth_sock
│ └─mate-settings-daemon.service
│   ├─1605 /usr/lib/mate-settings-daemon/mate-settings-daemon
│   └─1613 /usr/bin/pulseaudio --start --log-target=syslog
└─session-c1.scope
  ├─1296 login -- gabx
  └─1326 -zsh
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread arnaud gaboury
On Thu, Dec 4, 2014 at 4:20 PM, arnaud gaboury  wrote:
>>
>> You seem to be using some mechanism for starting 'systemd --user' that
>> gives it a DBUS_SESSION_BUS_ADDRESS that assumes dbus-daemon is being
>> started via a specific third-party implementation of a dbus.service for
>> the user bus, possibly from "user-session-units". If you use the part of
>> user-session-units that assumes a dbus-daemon will be launched, but not
>> the part that actually launches the dbus-daemon, then I'm afraid you get
>> to keep both pieces.
>>
>> Neither dbus nor systemd currently ships that dbus.service. When I
>> suggested adding one to dbus, Lennart asked me to use a different path
>> for the socket, then said he had no plans to support a non-kdbus user
>> bus at all ... so that feature request is on hold.
>> (https://bugs.freedesktop.org/show_bug.cgi?id=61301 if you're interested.)
>>
>> Find what is setting DBUS_SESSION_BUS_ADDRESS, and make it not do that.
--
└─session-c2.scope
  ├─2908 login -- gabx
  ├─2911 -zsh
  ├─2929 /bin/sh /usr/bin/startx
  ├─2951 xinit /home/gabx/.xinitrc -- /etc/X11/xinit/xserverrc :0
vt1 -auth /tmp/serverauth.7yJtuNYzPM
  ├─2952 /usr/bin/Xorg.bin -nolisten tcp :0 vt1 -auth
/tmp/serverauth.7yJtuNYzPM vt1
  ├─2956 i3
  ├─2979 firefox-aurora
  ├─2980 i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-socket.2956
  ├─2982 urxvt
  ├─2985 caja --no-desktop
  ├─2987 urxvt
  ├─2996 i3status --config=~/.config/i3/i3status.conf
  ├─3011 dbus-launch --autolaunch=77f348a2b3fb429b85a5de751ea9175a
--binary-syntax --close-stderr

---

Culprit is localized : i3

Thank you again for all your explanations.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread arnaud gaboury
>
> You seem to be using some mechanism for starting 'systemd --user' that
> gives it a DBUS_SESSION_BUS_ADDRESS that assumes dbus-daemon is being
> started via a specific third-party implementation of a dbus.service for
> the user bus, possibly from "user-session-units". If you use the part of
> user-session-units that assumes a dbus-daemon will be launched, but not
> the part that actually launches the dbus-daemon, then I'm afraid you get
> to keep both pieces.
>
> Neither dbus nor systemd currently ships that dbus.service. When I
> suggested adding one to dbus, Lennart asked me to use a different path
> for the socket, then said he had no plans to support a non-kdbus user
> bus at all ... so that feature request is on hold.
> (https://bugs.freedesktop.org/show_bug.cgi?id=61301 if you're interested.)
>
> Find what is setting DBUS_SESSION_BUS_ADDRESS, and make it not do that.
>
> autolaunch is a mechanism to start a dbus-daemon per (machine, X11
> display) pair when no dbus-daemon is running and an application tries to
> connect to D-Bus. It mostly works via X11 properties; the files in
> ~/.dbus are a fallback.

After carefully reading dbus-launch(1), I understand now the fall back
mechanism.

Fom man :


I have this drop-in config as recommanded by my distro (Archlinux) wiki[0]:

/etc/systemd/system/user@.service.d/dbus.conf
-
[Service]
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket
---

I start systemd --user as described in wiki.

[0]https://wiki.archlinux.org/index.php/Systemd/User
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread Simon McVittie
On 04/12/14 08:56, arnaud gaboury wrote:
> -$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.
...
> $systemctl --user show-environment returns
> DBUS_SESSION_BUS_ADDRESS=/run/user/1000/dbus/user_bus_socket

You can ignore those reasons as much as you like, but ignoring them is
not going to make them go away.

You seem to be using some mechanism for starting 'systemd --user' that
gives it a DBUS_SESSION_BUS_ADDRESS that assumes dbus-daemon is being
started via a specific third-party implementation of a dbus.service for
the user bus, possibly from "user-session-units". If you use the part of
user-session-units that assumes a dbus-daemon will be launched, but not
the part that actually launches the dbus-daemon, then I'm afraid you get
to keep both pieces.

Neither dbus nor systemd currently ships that dbus.service. When I
suggested adding one to dbus, Lennart asked me to use a different path
for the socket, then said he had no plans to support a non-kdbus user
bus at all ... so that feature request is on hold.
(https://bugs.freedesktop.org/show_bug.cgi?id=61301 if you're interested.)

Find what is setting DBUS_SESSION_BUS_ADDRESS, and make it not do that.

> So adding 
> EnvironmentFile=%h/.dbus/session-bus/77f348a2b3fb429b85a5de751ea9175a-0
> solved the issue.

FYI, 77f... is your D-Bus machine ID, found in /var/lib/dbus/machine-id
or /etc/machine-id.

> 154:gabx  1424 1  0 Nov29 ?00:00:00 dbus-launch
> --autolaunch=77f348a2b3fb429b85a5de751ea9175a --binary-syntax
> --close-stderr
> 
> Why this autolaunch ?

autolaunch is a mechanism to start a dbus-daemon per (machine, X11
display) pair when no dbus-daemon is running and an application tries to
connect to D-Bus. It mostly works via X11 properties; the files in
~/.dbus are a fallback.

If mate-settings-daemon can connect to X11 (a correct DISPLAY and
XAUTHORITY) and *does not* have DBUS_SESSION_BUS_ADDRESS in its
environment, it will use the autolaunch mechanism to get a bus.

Normally, Linux distributions and desktop environments also ensure that
a dbus-daemon is running for each X11 session. Since you seem to have
constructed your own desktop environment out of pieces, it's up to you
to decide how you launch your dbus-daemon and communicate its address to
the right places; autolaunch is the fallback mechanism for if you don't.

S

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


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread arnaud gaboury
> 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
> 
> 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...
>

I am NOT using mate, so the autostart is not starting. I use i3 wm and
Caja file manger. I only want to use mate-settings-daemon, nothing
else.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread Qu Wenruo


在 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

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


Re: [systemd-devel] mate desktop user service file

2014-12-04 Thread 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




> 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


Re: [systemd-devel] mate desktop user service file

2014-12-01 Thread David Herrmann
Hi

On Sat, Nov 29, 2014 at 10:48 AM, arnaud gaboury
 wrote:
> I only use some settings from mate desktop (clipboard, appearance...)
> thus looking for a service file to start mate-settings-daemon.
>
>
> /home/gabx/.config/systemd/user/mate-settings-daemon.service
> -
> [Unit]
> Description=Mate settings daemon
>
> [Service]
> Type=daemon
> ExecStart=/usr/lib/mate-settings-daemon/mate-settings-daemon
>
> [Install]
> WantedBy=wm.target
> 
>
> The above service leave me with an error:
>
> --
> 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: failed (Result: exit-code) since Sat 2014-11-29 10:29:09
> CET; 14min ago
>   Process: 26343
> ExecStart=/usr/lib/mate-settings-daemon/mate-settings-daemon
> (code=exited, status=1/FAILURE)
>  Main PID: 26343 (code=exited, status=1/FAILURE)
>
> Nov 29 10:29:09 hortensia systemd[914]: Started Mate settings daemon.
> Nov 29 10:29:09 hortensia mate-settings-daemon[26343]: No protocol specified
> Nov 29 10:29:09 hortensia mate-settings-daemon[26343]: **
> (mate-settings-daemon:26343): WARNING **: Unable to initialize GTK+

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.

Anyway, you really should talk to the mate developers to ask them
what's needed to run it from systemd. Just putting stuff into services
usually does not work. Many of the X11 legacy expects to be run from
within the X11 environment, not from a clean service.

Thanks
David

> --
>
> I have tried unsuccessfully to change parts of the service file.
> Running manually the command < $
> /usr/lib/mate-settings-daemon/mate-settings-daemon > works.
>
> N.B: display is in my environment.
> ---
> gabx@hortensia ➤➤ ~ % systemctl --user show-environment
> DBUS_SESSION_BUS_ADDRESS=/run/user/1000/dbus/user_bus_socket
> DISPLAY=:0
> --
>
>
> I have no idea what I do wrong. Thank you for advices.
>
>
> --
>
> google.com/+arnaudgabourygabx
> ___
> 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