Hi, I have an Ubuntu 21.10 on which I run mopidy as a systemd system service (sudo systemctl restart mopidy
). I use output = pulsesink client-name=mopidy server=127.0.0.1
and everything is fine.
My question is why this works? I mean, as far as I know Ubuntu is using pipewire instead of pulseaudio so I should hear nothing.
I’m not using as a desktop the computer running the mopidy service.
I’m connecting to it only with ssh, using a not root user (other than mopidy).
I don’t have pipewire-pulse package installed.
Here’s my setup:
$id mopidy
uid=136(mopidy) gid=29(audio) groups=29(audio)
$grep module-native-protocol-unix /etc/pulse/system.pa
load-module module-native-protocol-unix auth-anonymous=1
$systemctl cat mopidy
# /lib/systemd/system/mopidy.service
[Unit]
Description=Mopidy music server
After=avahi-daemon.service
After=dbus.service
After=network-online.target
Wants=network-online.target
After=nss-lookup.target
After=pulseaudio.service
After=remote-fs.target
After=sound.target
[Service]
User=mopidy
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/cache/mopidy
ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy
ExecStart=/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf
[Install]
WantedBy=multi-user.target
# /etc/mopidy/mopidy.conf
# [audio]
# output = pulsesink client-name=mopidy server=127.0.0.1
$grep -B2 -A2 snd-hda-intel /etc/modprobe.d/alsa-base.conf
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2
# without this, mopidy won't play after not using it for few hours (e.g. over night)!
options snd-hda-intel model=auto
$ps -ef | grep /[p]ulse
lightdm 1730 1668 0 Oct30 ? 00:05:04 /usr/bin/pulseaudio --daemonize=no --log-target=journal
lightdm 1864 1730 0 Oct30 ? 00:00:00 /usr/libexec/pulse/gsettings-helper
$sudo -u lightdm pactl get-default-sink
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
$sudo -u mopidy pactl get-default-sink
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
$pactl get-default-sink
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xcb_connection_has_error() returned true
auto_null
$sudo -u mopidy pactl info
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
$sudo -u lightdm pactl info
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
$pactl info
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xcb_connection_has_error() returned true
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: gigi
Host Name: adrhc.go.ro
Server Name: pulseaudio
Server Version: 15.0
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: auto_null
Default Source: auto_null.monitor
Cookie: bce4:b262
$pactl list sinks
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xcb_connection_has_error() returned true
Sink #0
State: IDLE
Name: auto_null
Description: Dummy Output
Driver: module-null-sink.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 2
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: auto_null.monitor
Latency: 1997360 usec, configured 2000000 usec
Flags: DECIBEL_VOLUME LATENCY SET_FORMATS
Properties:
device.description = "Dummy Output"
device.class = "abstract"
device.icon_name = "audio-card"
Formats:
pcm
$systemctl --user --no-pager status pulseaudio
○ pulseaudio.service - Sound Service
Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2021-10-31 23:05:54 EET; 31min ago
TriggeredBy: ● pulseaudio.socket
Process: 3492864 ExecStart=/usr/bin/pulseaudio --daemonize=no --log-target=journal (code=exited, status=0/SUCCESS)
Main PID: 3492864 (code=exited, status=0/SUCCESS)
CPU: 63ms
Oct 31 23:05:34 adrhc.go.ro systemd[1510]: Starting Sound Service...
Oct 31 23:05:34 adrhc.go.ro systemd[1510]: Started Sound Service.
Oct 31 23:05:54 adrhc.go.ro systemd[1510]: pulseaudio.service: Deactivated successfully.
$systemctl --no-pager status pulseaudio
Unit pulseaudio.service could not be found.
$systemctl --user --no-pager status pipewire
● pipewire.service - Multimedia Service
Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-10-30 23:39:22 EEST; 24h ago
TriggeredBy: ● pipewire.socket
Main PID: 1767 (pipewire)
Tasks: 2 (limit: 37152)
Memory: 1.6M
CPU: 174ms
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
└─1767 /usr/bin/pipewire
Oct 30 23:39:22 adrhc.go.ro systemd[1510]: Started Multimedia Service.
Oct 30 23:39:22 adrhc.go.ro pipewire[1767]: RTKit error: org.freedesktop.DBus.Error.AccessDenied
Oct 30 23:39:22 adrhc.go.ro pipewire[1767]: could not set nice-level to -11: Permission denied
Oct 30 23:39:23 adrhc.go.ro pipewire[1767]: RTKit error: org.freedesktop.DBus.Error.AccessDenied
Oct 30 23:39:23 adrhc.go.ro pipewire[1767]: could not make thread realtime: Permission denied
$systemctl --no-pager status pipewire
Unit pipewire.service could not be found.
# all these commands produce the expected sound:
$sudo -u mopidy gst-launch-1.0 audiotestsrc ! audioresample ! autoaudiosink`
$sudo -u mopidy aplay '/home/gigi/Music/MUZICA/Diverse11/Oasis - Go Let Me Out.wav'
$sudo -u mopidy mplayer -prefer-ipv4 -volume 80 http://live.smartradio.ro:9128/live