From: mirai <mirai@makinata.eu>
To: 59866 <59866@debbugs.gnu.org>
Cc: Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: [bug#59866] Pulseaudio woes
Date: Tue, 3 Jan 2023 14:43:23 +0000 [thread overview]
Message-ID: <b381d59b-2278-1a6b-5f93-7b008504d544@makinata.eu> (raw)
In-Reply-To: <cover.1670368385.git.mirai@makinata.eu>
I've found out that this service (even before this patch-set)
is biased towards being used as a home service rather than a system service.
The reason is that it sets the XDG_RUNTIME_DIR environment variable through shepherd
to:
--8<---------------cut here---------------start------------->8---
(list (string-append
"XDG_RUNTIME_DIR=/run/user/"
(number->string (passwd:uid (getpwnam #$user)))))
--8<---------------cut here---------------end--------------->8---
This directory does not exist if this is launched as a system-wide service.
I presume that this went unnoticed because most of the times you'd want to
use this service system-wide you also configure this either as a MPD
'satellite instance' or the audio-outputs are always network-streaming ones.
This falls apart if you configure a system-wide mpd-service with a pulseaudio
output as it will try to access XDG_RUNTIME_DIR which is not created for the
system? #t 'mpd' user.
Now, pulseaudio is usually launched as a 'per-user' daemon although it can
be used in a system-pulse configuration though this is strongly discouraged.
Under most conditions (pulseaudio config mostly unchanged),
a system-wide mpd-service-type is also able to launch its own pulse instance
but due to the inherent assumptions present in the original service we have that:
- The XDG_RUNTIME_DIR env var is set when it should only be set for 'system? #f' users.
- PULSE_CLIENTCONFIG and PULSE_CONFIG are not set by shepherd.
These usually correspond to:
PULSE_CONFIG =/etc/pulse/client.conf
PULSE_CONFIG=/etc/pulse/daemon.conf
But if you use mpd-service-type as a home service, you could also have
these set to a user-specific pulse config, which will be overridden by shepherd
if these are set in mpd-service-type.
But again, if you don't set these env vars and use it as a systemwide service
with a pulseaudio output and you workaround the XDG_RUNTIME_DIR by unsetting it,
your pulse daemon won't read its config and there will be no output.
This is not just a theoretical issue, consider this snippet:
--8<---------------cut here---------------start------------->8---
;; Set a systemwide mpd service that streams with pulseaudio RTP output.
(service pulseaudio-service-type (pulseaudio-configuration
(extra-script-files
(list
(plain-file
"rtp.pa"
(string-join (list "load-module module-null-sink sink_name=rtp"
"load-module module-rtp-send source=rtp.monitor"
"set-default-sink rtp") "\n" 'suffix))))))
(service mpd-service-type
(mpd-configuration
(outputs (list (mpd-output (name "Pulseaudio over RTP")
(type "pulse")
(extra-options '((sink . "rtp")))))))
--8<---------------cut here---------------end--------------->8---
The problem here is how to conditionally select which environment variables should be set based
on whether this is being launched as a system-wide or home-instance service. I'm all ears for
suggestions.
Regarding the current patch-set, I'm thinking that some of the non-public procedures could
be defined with 'define-deprecated' instead which should (?) be cleaner than the current
comments that are demarcating deprecated code.
Regards,
Bruno
next prev parent reply other threads:[~2023-01-03 14:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 23:22 [bug#59866] [PATCH 0/2] services: mpd: Refactor MPD service mirai
2022-12-06 23:25 ` [bug#59866] [PATCH 1/2] services: mpd: use 'define-configuration' mirai
2022-12-06 23:25 ` [bug#59866] [PATCH 2/2] services: mpd: Refactor MPD service mirai
2022-12-07 8:59 ` [bug#59866] [PATCH 0/2] " ( via Guix-patches via
2022-12-07 13:42 ` mirai
2022-12-07 13:43 ` ( via Guix-patches via
2022-12-07 18:27 ` Liliana Marie Prikler
2022-12-08 13:11 ` mirai
2022-12-08 13:35 ` [bug#54986] " Liliana Marie Prikler
2022-12-09 13:44 ` [bug#59866] " mirai
2022-12-09 19:22 ` Liliana Marie Prikler
2022-12-11 12:05 ` mirai
2022-12-08 0:59 ` [bug#59866] [PATCH v2] " mirai
2022-12-16 14:15 ` [bug#59866] [PATCH v3] " mirai
2022-12-21 14:15 ` [bug#59866] [PATCH v4 1/2] services: mpd: use 'define-configuration' mirai
2022-12-21 14:15 ` [bug#59866] [PATCH v4 2/2] services: mpd: Refactor MPD service mirai
2022-12-24 13:51 ` [bug#59866] [PATCH v5 1/2] services: mpd: rewrite using 'define-configuration' mirai
2022-12-24 13:51 ` [bug#59866] [PATCH v5 2/2] services: mpd: Refactor MPD service mirai
2022-12-24 14:11 ` [bug#59866] [PATCH v5.1] " mirai
2022-12-24 17:20 ` Liliana Marie Prikler
2022-12-24 19:17 ` mirai
2022-12-24 18:53 ` [bug#59866] [PATCH v5.2] " mirai
2023-01-03 14:43 ` mirai [this message]
2023-01-03 19:38 ` [bug#59866] Pulseaudio woes Liliana Marie Prikler
2023-02-02 20:07 ` [bug#59866] [PATCH v6 1/3] services: mpd: Rewrite using 'define-configuration' Bruno Victal
2023-02-02 20:07 ` [bug#59866] [PATCH v6 2/3] services: mpd: Refactor MPD service Bruno Victal
2023-02-02 21:08 ` Liliana Marie Prikler
2023-02-05 6:11 ` bug#59866: " Liliana Marie Prikler
2023-02-02 20:07 ` [bug#59866] [PATCH v6 3/3] services: mpd: Do not hardcode environment variables Bruno Victal
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=b381d59b-2278-1a6b-5f93-7b008504d544@makinata.eu \
--to=mirai@makinata.eu \
--cc=59866@debbugs.gnu.org \
--cc=liliana.prikler@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).