[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: D-Bus service files on foreign distributions
From: |
Nils Landt |
Subject: |
Re: D-Bus service files on foreign distributions |
Date: |
Thu, 12 Sep 2024 13:13:17 +0200 (CEST) |
> Roman Riabenko via <help-guix@gnu.org> hat am 11.09.2024 20:57 CEST
> geschrieben:
>
>
> У пн, 2024-08-26 у 10:27 +0200, Nils Landt пише:
> > > Roman Riabenko via <help-guix@gnu.org> hat am 25.08.2024 13:08 CEST
> > > geschrieben:
> > >
> > > How to expose service files to D-Bus on a foreign distribution?
> >
> > I'm 100% guessing here, but I think systemd just doesn't see your
> > service files because they are not in the search path.
> > If this is the case, you can set XDG_DATA_DIRS in
> > ~/.config/systemd/user.conf (under the Manager header), i.e.:
> > [Manager]
> > ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
>
> Thank you for the suggestion. The lines are already present. I assume
> that the guix installation script added them.
>From what I can tell, the installation script does not do this. Maybe you did
>it in the past already? Anyway, shouldn't matter.
> $ cat ~/.config/systemd/user.conf
> [Manager]
> ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
>
> It may be working because the systemd environment for the user session
> gets the value.
>
> $ systemctl --user show-environment | grep XDG_DATA_DIRS
> XDG_DATA_DIRS=/home/purism/.guix-profile/share:/home/purism/.guix-
> profile/share:/usr/share/librem5:/home/purism/.guix-
> profile/share:/home/purism/.guix-
> profile/share:/usr/share/librem5:/home/purism/.local/share/flatpak/expo
> rts/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
>
> But systemd does not pass the value to the user DBus environment.
>
> $ systemctl --user status dbus | grep PID
> Main PID: 1261 (dbus-daemon)
> $ sudo strings /proc/1261/environ | grep XDG_DATA_DIRS
> XDG_DATA_DIRS=/home/purism/.local/share/flatpak/exports/share:/var/lib/
> flatpak/exports/share:/usr/local/share/:/usr/share/
>
> So, DBus does not see the service files in the guix profile.
>
> $ LC_ALL=C gdbus call --session --method
> org.freedesktop.DBus.Introspectable.Introspect --dest
> org.gnome.TextEditor --object-path=/org/gnome/TextEditor
> Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
> org.gnome.TextEditor was not provided by any .service files
>
> The manual page for systemd-system.conf says that to set manager
> environment variables passed to all executed process, one can set
> DefaultEnvironment option. I set it as suggested in
> https://unix.stackexchange.com/a/698459/423679
>
> $ cat ~/.config/systemd/user.conf
> [Manager]
> ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
> DefaultEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
>
> This change was ignored. So, I tried adding it to the file specified in
> the manual page.
DefaultEnvironment does nothing here. Processes spawned by the user manager
inherit the environment variables from the user manager.
> $ cat /etc/systemd/user.conf | grep DefaultEnvironment
> DefaultEnvironment="XDG_DATA_DIRS=%h/.guix-profile/share"
Looking at the purism docs
(https://software.pureos.net/package/src/pureos/byzantium/systemd), systemd is
version 247. But %h expansion in user config is only available since systemd
256.1 (https://github.com/systemd/systemd/pull/26675).
So maybe you can try explicitly specifying the path here.
I don't think it will help, but it's something :)
BUT! While I was writing this, I noticed that ManagerEnvironment itself was
added in version 248! So if you're really on 247, it can't work.
In this case, I suggest you try a drop-in file for the dbus, e.g.:
systemctl --user edit dbus
(add the following two lines as only uncommented ones):
[Service]
Environment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"