* [question] How to start systemd services installed by packages in Ubuntu?
@ 2024-02-22 2:17 Rodrigo Morales
2024-02-22 10:54 ` Nils Landt
0 siblings, 1 reply; 4+ messages in thread
From: Rodrigo Morales @ 2024-02-22 2:17 UTC (permalink / raw)
To: help-guix
I'm using =guix= on Ubuntu and I have installed the packages =thunar=
and =thumbler=. As some of you might know, =thunar= is a file manager
and =tumbler= is the daemon which makes it possible for =thunar= to
show thumbnails for some files.
#+BEGIN_SRC sh
guix package -l | sed -n '/(current)/,$p'
#+END_SRC
#+RESULTS:
#+begin_example
Generation 10 Feb 21 2024 20:45:25 (current)
+ tumbler 4.18.1 out /gnu/store/xk9kwfzpps58i6xvrxda3yqx39c5my34-tumbler-4.18.1
+ thunar 4.18.7 out /gnu/store/6x5wax4vd6gj78bigmb1hwi8sx8q7m0q-thunar-4.18.7
#+end_example
The package =tumbler= comes with a systemd service for starting the
daemon. I assumed that this was how it is intended to be started in
Ubuntu.
#+BEGIN_SRC sh
find ~/.guix-profile/lib/systemd/user
#+END_SRC
#+RESULTS:
#+begin_example
/home/rodrigo/.guix-profile/lib/systemd/user/
/home/rodrigo/.guix-profile/lib/systemd/user/tumblerd.service
/home/rodrigo/.guix-profile/lib/systemd/user/thunar.service
#+end_example
Upon installation, I executed the following command but the service
was not found.
#+HEADER: :prologue "exec 2>&1"
#+HEADER: :epilogue ":"
#+BEGIN_SRC sh
systemctl --user start tumblerd.service
#+END_SRC
#+RESULTS:
#+begin_example
Failed to start tumblerd.service: Unit tumblerd.service not found.
#+end_example
I created a symbolic link in
=/home/rodrigo/.config/systemd/user/tumblerd.service= that points to
=/home/rodrigo/.guix-profile/lib/systemd/user/tumblerd.service= and I
was able to start the service and see thumbnails within =thunar=.
#+BEGIN_SRC sh
ln -sf /home/rodrigo/.guix-profile/lib/systemd/user/tumblerd.service /home/rodrigo/.config/systemd/user/tumblerd.service
systemctl --user start tumblerd.service
echo Exit code: $?
#+END_SRC
#+RESULTS:
#+begin_example
Exit code: 0
#+end_example
As explained before, I needed to create a symbolic link from the
directory =~/.guix-profile/lib/systemd/user= to
=~/.config/systemd/user=, which is the directory that is looked up by
=systemd= when searching for user services. This is a manual task that
I would rather avoid doing whenever I install a package.
I have two questions:
1. Is using systemd user services for packages, that are installed
through =guix package -i=, the way how daemons are intended to be
started in Ubuntu?
2. Is it possible to make systemd in Ubuntu aware that there might be
user services in =~/.guix-profile/lib/systemd/user=? I want to do
this in order to avoid the manual task of creating a symbolic link
to the directory that is actually ser. Ideally, I want to install a
package and just execute =systemctl --user start <<service>>=.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] How to start systemd services installed by packages in Ubuntu?
2024-02-22 2:17 [question] How to start systemd services installed by packages in Ubuntu? Rodrigo Morales
@ 2024-02-22 10:54 ` Nils Landt
2024-02-22 17:56 ` Rodrigo Morales
0 siblings, 1 reply; 4+ messages in thread
From: Nils Landt @ 2024-02-22 10:54 UTC (permalink / raw)
To: Rodrigo Morales, help-guix
> Rodrigo Morales <me@rodrigomorales.site> hat am 22.02.2024 03:17 CET geschrieben:
>
> 1. Is using systemd user services for packages, that are installed
> through =guix package -i=, the way how daemons are intended to be
> started in Ubuntu?
I'm guessing the expected usage is to write a shepherd service.
Looks to me like almost everyone using Guix uses shepherd / mcron, not systemd. I hacked something together for systemd, but haven't published it.
Also, it looks like you're not using Guix home, which I think is the best way to use Guix on a foreign distro.
So I suggest looking into that: https://guix.gnu.org/manual/en/html_node/Home-Configuration.html
> 2. Is it possible to make systemd in Ubuntu aware that there might be
> user services in =~/.guix-profile/lib/systemd/user=? I want to do
> this in order to avoid the manual task of creating a symbolic link
> to the directory that is actually ser.
Yes. In ~/.config/systemd/user.conf (file probably doesn't exist yet):
[Manager]
ManagerEnvironment="XDG_DATA_DIRS=%h/.guix-profile/lib"
In case the %h doesn't work for you (depends on systemd version), write /home/rodrigo (or whatever) instead.
After restarting the user session, it should pick up the unit files.
You can check the paths that are checked for user unit files with:
systemctl --user show -p UnitPath --value
and of course, the following:
systemctl --user list-unit-files "thunar*"
> Ideally, I want to install a
> package and just execute =systemctl --user start <<service>>=.
Just making sure, but are you sure you want to start, and not enable, or enable --now?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] How to start systemd services installed by packages in Ubuntu?
2024-02-22 10:54 ` Nils Landt
@ 2024-02-22 17:56 ` Rodrigo Morales
2024-02-23 17:35 ` Nils Landt
0 siblings, 1 reply; 4+ messages in thread
From: Rodrigo Morales @ 2024-02-22 17:56 UTC (permalink / raw)
To: Nils Landt, help-guix
(I'm sending this message again because it seems I replied to you but
not to the mailing list so that this message gets to the mailing list
archive, pardon for sending it twice)
Nils Landt <nils@landt.email> writes:
> Yes. In ~/.config/systemd/user.conf (file probably doesn't exist yet):
>
> [Manager]
> ManagerEnvironment="XDG_DATA_DIRS=%h/.guix-profile/lib"
>
> In case the %h doesn't work for you (depends on systemd version), write /home/rodrigo (or whatever) instead.
> After restarting the user session, it should pick up the unit files.
I did what you suggested, and the services were found, but some errors
were shown when launching applications and the startup time
significantly increased.
Initially, the file =~/.config/systemd/user.conf= was
empty. Therefore, the services =thunar.service= and =tumblerd.service=
which were located in =~/.guix-profile/lib/systemd/user/= couldn't be
found.
#+BEGIN_SRC sh
systemctl --user list-unit-files '*.service' | grep -e 'thunar.service' -e 'tumblerd.service' | wc -l
#+END_SRC
#+RESULTS:
#+begin_example
0
#+end_example
* Attempt no. 1 (your suggestion)
:PROPERTIES:
:CREATED: [2024-02-22 11:21:37 -05]
:END:
I edited the file =~/.config/systemd/user.conf= as you suggested. I
logged out and logged in.
#+BEGIN_SRC sh
cat ~/.config/systemd/user.conf
#+END_SRC
#+RESULTS:
#+begin_example
[Manager]
ManagerEnvironment="XDG_DATA_DIRS=/home/rodrigo/.guix-profile/lib"
#+end_example
I noticed that =/home/rodrigo/.guix-profile/lib= was included to the
variable =XDG_DATA_DIRS= (see result of the command below).
#+BEGIN_SRC sh
echo $XDG_DATA_DIRS | tr ':' '\n' | sort
#+END_SRC
#+RESULTS:
#+begin_example
/gnu/store/16kl9gx8k8ygkcj7dw1xrpw2p1h1bhjh-emacs-29.1/share
/gnu/store/23rprfqw8jy1xr0bcfvq644s2jmycdkr-gtk+-3.24.37/share
/gnu/store/gc4q34l7yc63qv2qcqq7avmf34hdpbwp-shared-mime-info-1.15/share
/gnu/store/m26kdkgr4c09wc0djn2pgcz9jl7j2rw1-glib-2.72.3/share
/home/rodrigo/.guix-home/profile/share
/home/rodrigo/.guix-profile/lib
/home/rodrigo/.guix-profile/share
/home/rodrigo/.guix-profile/share
/home/rodrigo/.local/share/flatpak/exports/share
/usr/share/gnome
/usr/share/i3
/var/lib/flatpak/exports/share
/var/lib/snapd/desktop
#+end_example
I also noticed that =/home/rodrigo/.guix-profile/lib/systemd/user= was
included in the property =UnitPath= (see result of the command below).
#+BEGIN_SRC sh
systemctl --user show --property=UnitPath --value | tr ' ' '\n' | sort
#+END_SRC
#+RESULTS:
#+begin_example
/etc/systemd/user
/etc/xdg/systemd/user
/home/rodrigo/.config/systemd/user
/home/rodrigo/.config/systemd/user.control
/home/rodrigo/.guix-profile/lib/systemd/user
/home/rodrigo/.local/share/systemd/user
/run/systemd/user
/run/user/1000/systemd/generator
/run/user/1000/systemd/generator.early
/run/user/1000/systemd/generator.late
/run/user/1000/systemd/transient
/run/user/1000/systemd/user
/run/user/1000/systemd/user.control
/usr/lib/systemd/user
/usr/local/lib/systemd/user
/usr/local/share/systemd/user
/usr/share/systemd/user
#+end_example
Therefore, the services could be found.
#+BEGIN_SRC sh
systemctl --user list-unit-files '*.service' | grep -e 'thunar.service' -e 'tumblerd.service'
#+END_SRC
#+RESULTS:
#+begin_example
thunar.service static -
tumblerd.service static -
#+end_example
The problem I noticed was that applications that were installed
through =guix package -i= took more than usual to start.
Inkscape took 25 seconds to print the version.
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/inkscape --version
(inkscape:42859): dbind-WARNING **: 11:58:15.650: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Inkscape 1.2.1 (9c6d41e410, 2022-07-14)
/home/rodrigo/.guix-profile/bin/inkscape --version 0.02s user 0.03s system 0% cpu 25.072 total
$ echo $?
0
#+END_SRC
Thunar started immediately when printing the version (first code block
below), but not when the graphical interface was shown (second code
block below).
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/thunar --version
thunar 4.18.7 (Xfce 4.18)
Copyright (c) 2004-2022
The Thunar development team. All rights reserved.
Written by Benedikt Meurer <benny@xfce.org>.
Please report bugs to <https://gitlab.xfce.org/xfce/thunar>.
/home/rodrigo/.guix-profile/bin/thunar --version 0.01s user 0.01s system 94% cpu 0.016 total
$ echo $?
0
#+END_SRC
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/thunar /tmp
(thunar:42772): dbind-WARNING **: 11:57:56.620: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
ThunarThumbnailer: Failed to retrieve supported types: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.thumbnails.Thumbnailer1 was not provided by any .service files
/home/rodrigo/.guix-profile/bin/thunar /tmp 0.36s user 0.05s system 0% cpu 52.116 total
$ echo $?
0
#+END_SRC
* Attempt no. 2 (add path for systemd services in guix home)
:PROPERTIES:
:CREATED: [2024-02-22 11:21:40 -05]
:END:
I edited the file =~/.config/systemd/user.conf=, but this time I
included the path were =guix home= install systemd services. I logged
out and logged in.
#+BEGIN_SRC sh
cat ~/.config/systemd/user.conf
#+END_SRC
#+RESULTS:
#+begin_example
[Manager]
ManagerEnvironment="XDG_DATA_DIRS=/home/rodrigo/.guix-home/profile/lib"
#+end_example
As happened in attempt no. 1, the specified value in
=~/.config/systemd/user.conf= (=/home/rodrigo/.guix-home/profile/lib=
was added to =XDG_DATA_DIRS=.
#+BEGIN_SRC sh
echo $XDG_DATA_DIRS | tr ':' '\n' | sort
#+END_SRC
#+RESULTS:
#+begin_example
/gnu/store/16kl9gx8k8ygkcj7dw1xrpw2p1h1bhjh-emacs-29.1/share
/gnu/store/23rprfqw8jy1xr0bcfvq644s2jmycdkr-gtk+-3.24.37/share
/gnu/store/gc4q34l7yc63qv2qcqq7avmf34hdpbwp-shared-mime-info-1.15/share
/gnu/store/m26kdkgr4c09wc0djn2pgcz9jl7j2rw1-glib-2.72.3/share
/home/rodrigo/.guix-home/profile/lib
/home/rodrigo/.guix-home/profile/share
/home/rodrigo/.guix-profile/share
/home/rodrigo/.local/share/flatpak/exports/share
/usr/share/gnome
/usr/share/i3
/var/lib/flatpak/exports/share
/var/lib/snapd/desktop
#+end_example
As happened in attempt no. 1, the specified value in
=~/.config/systemd/user.conf=
(i.e. =/home/rodrigo/.guix-home/profile/lib/systemd/user=) was added
to the property =UnitPath=.
#+BEGIN_SRC sh
systemctl --user show --property=UnitPath --value | tr ' ' '\n' | sort
#+END_SRC
#+RESULTS:
#+begin_example
/etc/systemd/user
/etc/xdg/systemd/user
/home/rodrigo/.config/systemd/user
/home/rodrigo/.config/systemd/user.control
/home/rodrigo/.guix-home/profile/lib/systemd/user
/home/rodrigo/.local/share/systemd/user
/run/systemd/user
/run/user/1000/systemd/generator
/run/user/1000/systemd/generator.early
/run/user/1000/systemd/generator.late
/run/user/1000/systemd/transient
/run/user/1000/systemd/user
/run/user/1000/systemd/user.control
/usr/lib/systemd/user
/usr/local/lib/systemd/user
/usr/local/share/systemd/user
/usr/share/systemd/user
#+end_example
As happened in attempt no. 1, the services were found.
#+BEGIN_SRC sh
systemctl --user list-unit-files '*.service' | grep -e 'thunar.service' -e 'tumblerd.service'
#+END_SRC
#+RESULTS:
#+begin_example
thunar.service static -
tumblerd.service static -
#+end_example
The same issue of attempt no. 1 occured, some applications that were
installed through =guix packaege -i= took more than usual to start.
Inkscape took 10 seconds to print the version.
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/inkscape --version
(inkscape:37335): dbind-WARNING **: 11:29:48.365: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.a11y.Bus': timed out (service_start_timeout=120000ms)
Inkscape 1.2.1 (9c6d41e410, 2022-07-14)
/home/rodrigo/.guix-profile/bin/inkscape --version 0.03s user 0.02s system 0% cpu 10.016 total
$ echo $?
0
#+END_SRC
Thunar started immediately when printing the version (first code block
below), but not when the graphical interface was shown (second code
block below).
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/thunar --version
thunar 4.18.7 (Xfce 4.18)
Copyright (c) 2004-2022
The Thunar development team. All rights reserved.
Written by Benedikt Meurer <benny@xfce.org>.
Please report bugs to <https://gitlab.xfce.org/xfce/thunar>.
/home/rodrigo/.guix-profile/bin/thunar --version 0.01s user 0.01s system 82% cpu 0.016 total
$ echo $?
0
#+END_SRC
#+BEGIN_SRC text
$ time /home/rodrigo/.guix-profile/bin/thunar /tmp
(thunar:38326): dbind-WARNING **: 11:35:15.484: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
ThunarThumbnailer: Failed to retrieve supported types: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.thumbnails.Thumbnailer1 was not provided by any .service files
/home/rodrigo/.guix-profile/bin/thunar /tmp 0.33s user 0.05s system 0% cpu 51.356 total
$ echo $?
0
#+END_SRC
* Conclusion
:PROPERTIES:
:CREATED: [2024-02-22 12:01:46 -05]
:END:
As was shown above, adding any of =~/.guix-home/profile/lib/= or
=~/.guix-profile/lib/= to =~/.config/systemd/user.conf= under
=ManagerEnvironment= significantly increased the startup time of
applications and some errors were shown.
The question now is: How to make =systemd= aware of user services in
=~/.guix-home/profile/lib/= or =~/.guix-bprofile/lib/= but without
disrupting the startup of some applications.
For the time being, to avoid having to wait too much time whenever an
application is launched, I will have =~/.config/systemd/user.conf=
empty and I will manually create symbolic links from
=~/.config/systemd/user= to point to the services located in
=~/.guix-home/profile/lib/systemd/user= and
=~/.guix-profile/lib/systemd/user=.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] How to start systemd services installed by packages in Ubuntu?
2024-02-22 17:56 ` Rodrigo Morales
@ 2024-02-23 17:35 ` Nils Landt
0 siblings, 0 replies; 4+ messages in thread
From: Nils Landt @ 2024-02-23 17:35 UTC (permalink / raw)
To: Rodrigo Morales, help-guix
> Rodrigo Morales <me@rodrigomorales.site> hat am 22.02.2024 18:56 CET geschrieben:
> I noticed that =/home/rodrigo/.guix-profile/lib= was included to the
> variable =XDG_DATA_DIRS= (see result of the command below).
>
> #+BEGIN_SRC sh
> echo $XDG_DATA_DIRS | tr ':' '\n' | sort
> #+END_SRC
>
> #+RESULTS:
> #+begin_example
> /gnu/store/16kl9gx8k8ygkcj7dw1xrpw2p1h1bhjh-emacs-29.1/share
> /gnu/store/23rprfqw8jy1xr0bcfvq644s2jmycdkr-gtk+-3.24.37/share
> /gnu/store/gc4q34l7yc63qv2qcqq7avmf34hdpbwp-shared-mime-info-1.15/share
> /gnu/store/m26kdkgr4c09wc0djn2pgcz9jl7j2rw1-glib-2.72.3/share
> /home/rodrigo/.guix-home/profile/share
> /home/rodrigo/.guix-profile/lib
> /home/rodrigo/.guix-profile/share
> /home/rodrigo/.guix-profile/share
> /home/rodrigo/.local/share/flatpak/exports/share
> /usr/share/gnome
> /usr/share/i3
> /var/lib/flatpak/exports/share
> /var/lib/snapd/desktop
> #+end_example
This shouldn't be due to the changes you made - ManagerEnvironment only sets it for the systemd user management process, not for any spawned processes and especially not your shell.
You mentioned below that you removed ~/.config/systemd/user.conf, is /home/rodrigo/.guix-profile/lib still in XDG_DATA_DIRS after that?
> The problem I noticed was that applications that were installed
> through =guix package -i= took more than usual to start.
>
> Inkscape took 25 seconds to print the version.
>
> #+BEGIN_SRC text
> $ time /home/rodrigo/.guix-profile/bin/inkscape --version
>
> (inkscape:42859): dbind-WARNING **: 11:58:15.650: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
> Inkscape 1.2.1 (9c6d41e410, 2022-07-14)
> /home/rodrigo/.guix-profile/bin/inkscape --version 0.02s user 0.03s system 0% cpu 25.072 total
> $ echo $?
> 0
> #+END_SRC
I'm almost afraid to hear the answer, but how many files are in /home/rodrigo/.guix-profile/lib (including all subdirectories)?
My best guess here is that inkscape / thunar enumerate all files in XDG_DATA_DIRS on startup, and so they become slow if there's a lot of files. But, as mentioned above, setting ManagerEnvironment should not affect XDG_DATA_DIRS for them!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-23 17:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22 2:17 [question] How to start systemd services installed by packages in Ubuntu? Rodrigo Morales
2024-02-22 10:54 ` Nils Landt
2024-02-22 17:56 ` Rodrigo Morales
2024-02-23 17:35 ` Nils Landt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).