Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 480748 - media-sound/pulseaudio[system-wide] - Support systemd as an alternative dependency to openrc.
Summary: media-sound/pulseaudio[system-wide] - Support systemd as an alternative depen...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2013-08-12 15:30 UTC by Tom Wijsman (TomWij) (RETIRED)
Modified: 2014-02-17 21:20 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
unit file for pulseaudio system wide (pulseaudio.service,287 bytes, text/plain)
2013-12-24 08:46 UTC, Martin Gysel (bearsh)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-12 15:30:32 UTC
With the USE flag system-wide enabled there is a forced dependency

media-sound/pulseaudio-4.0 (system-wide ? sys-apps/openrc)

which disallows removing sys-apps/openrc when the system runs sys-apps/systemd; I would appreciate it if this were investigated, thank you very much in advance.
Comment 1 Pacho Ramos gentoo-dev 2013-12-23 16:18:45 UTC
I am unsure if pulseaudio is supposed to be run in system-wide mode with systemd :/
Comment 2 Martin Gysel (bearsh) 2013-12-23 21:14:05 UTC
Why not? Do you have a better alternative for a headless 'soundclient' (e.g.  on little arm board)?
ps: it works for me together with the logitech media server and squeezelite
Comment 3 Pacho Ramos gentoo-dev 2013-12-23 22:20:19 UTC
Well, looks like upstream doesn't like the system-wide mode:
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/

But will try to add a service unit file for corner cases :/
Comment 4 Martin Gysel (bearsh) 2013-12-24 08:46:17 UTC
Created attachment 366060 [details]
unit file for pulseaudio system wide

there's also an arch pkg:
https://aur.archlinux.org/packages/pulseaudio-systemd/

(I took that as a base for my unit)
Comment 5 Martin Gysel (bearsh) 2013-12-24 08:52:09 UTC
as some systemd integration for pulseaudio has been done recently it may also be possible to change the service type from fork to something else in the feature (maybe already now, haven't tried it)
Comment 6 Alexander Tsoy 2013-12-24 09:17:03 UTC
(In reply to Martin Gysel (bearsh) from comment #4)
> Created attachment 366060 [details]
> unit file for pulseaudio system wide
> 
> there's also an arch pkg:
> https://aur.archlinux.org/packages/pulseaudio-systemd/
> 
> (I took that as a base for my unit)

1. "Requires=avahi-daemon.service" is bad for gentoo. pulseaudio can be configured without avahi support. If user don't have avahi installed, then pulseaudio.service will not be activated. We can put this dependency commented out in /etc/systemd/system/pulseaudio.service.d/

2. "Type=forking" should be avoided if possible. I think something like this should work, but I didn't test it yet ("Type=simple" is by default, "PIDFile" is not needed and --daemonize=0):

[Service]
ExecStart=/usr/bin/pulseaudio --system --disallow-module-loading=1 \
	--disallow-exit=1 --disable-shm=1 --fail=1 --daemonize=0
Comment 7 Alexander Tsoy 2013-12-24 09:26:39 UTC
(In reply to Alexander Tsoy from comment #6)
> 1. "Requires=avahi-daemon.service" is bad for gentoo. pulseaudio can be
> configured without avahi support. If user don't have avahi installed, then
> pulseaudio.service will not be activated. We can put this dependency
> commented out in /etc/systemd/system/pulseaudio.service.d/

Ah.. Unit can be modified at install time using unifdef. pulseaudio ebuild is already using unifdef.
Comment 9 Martin Gysel (bearsh) 2013-12-30 09:45:43 UTC
(In reply to Alexander Tsoy from comment #6)
> 2. "Type=forking" should be avoided if possible. I think something like this
> should work, but I didn't test it yet ("Type=simple" is by default,
> "PIDFile" is not needed and --daemonize=0):
> 
> [Service]
> ExecStart=/usr/bin/pulseaudio --system --disallow-module-loading=1 \
> 	--disallow-exit=1 --disable-shm=1 --fail=1 --daemonize=0

if I do that, I get:
Dez 30 09:38:49 beaglebone systemd[1]: Started PulseAudio Sound Server.
Dez 30 09:38:51 beaglebone pulseaudio[15978]: N: [pulseaudio] main.c: System mode refused for non-root user. Only starting the D-Bus server lookup service.
Dez 30 09:38:51 beaglebone pulseaudio[15978]: W: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Using X11 for dbus-daemon autolaunch was disabled at c...DDRESS instead

so it seems current pulseaudio it not ready to be run in system-mode without being started as user root
Comment 10 Pacho Ramos gentoo-dev 2014-02-16 21:24:05 UTC
fixed in 4.99.4
Comment 11 Martin Gysel (bearsh) 2014-02-17 11:05:17 UTC
(In reply to Pacho Ramos from comment #10)
> fixed in 4.99.4

system-wide? (
	sys-apps/openrc
	alsa? ( media-sound/alsa-utils )
	bluetooth? ( >=net-wireless/bluez-5 )
)

is there a reason openrc as a hard RDEPEND? as you added a systemd service unit, shouldn't it be like
openrc || systemd
Comment 12 Pacho Ramos gentoo-dev 2014-02-17 21:20:39 UTC
+  17 Feb 2014; Pacho Ramos <pacho@gentoo.org> pulseaudio-4.99.4.ebuild:
+  Adjust dep for openrc/systemd (#480748)
+

Strictly, I dropped the dep as I don't think we need to RDEPEND on none of them simply because we are supplying an init.d/unit file (as we do in all the other packages), you can even start pulseaudio manualy with the same command if you want