From: Rodrigo Morales <me@rodrigomorales.site>
To: Nils Landt <nils@landt.email>, <help-guix@gnu.org>
Subject: Re: [question] How to start systemd services installed by packages in Ubuntu?
Date: Thu, 22 Feb 2024 12:56:09 -0500 [thread overview]
Message-ID: <87v86gqt6u.fsf@rodrigomorales.site> (raw)
In-Reply-To: <704162954.134516.1708599269182@office.mailbox.org>
(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=.
next prev parent reply other threads:[~2024-02-22 17:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-02-23 17:35 ` Nils Landt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v86gqt6u.fsf@rodrigomorales.site \
--to=me@rodrigomorales.site \
--cc=help-guix@gnu.org \
--cc=nils@landt.email \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).