Skip to content

Commit

Permalink
Disable pipewire by default
Browse files Browse the repository at this point in the history
We don't have pipewire plugin yet, and it conflicts with pulseaudio when
accessing physical audio cards (sys-audio case).

Fixes QubesOS/qubes-issues#7485
Related to QubesOS/qubes-issues#6358
  • Loading branch information
marmarek committed May 3, 2022
1 parent 0b6cab1 commit b717d1e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ install-systemd: install-init
install -m 0644 $(SYSTEMD_CORE_SERVICES) $(DESTDIR)$(SYSLIBDIR)/systemd/system/
install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)$(SYSLIBDIR)/systemd/system/
install -m 0644 vm-systemd/75-qubes-vm.preset $(DESTDIR)$(SYSLIBDIR)/systemd/system-preset/
install -D -m 0644 vm-systemd/75-qubes-vm.user-preset \
$(DESTDIR)$(USER_DROPIN_DIR)-preset/75-qubes-vm.preset
install -m 0644 vm-systemd/qubes-core.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
install -m 0644 vm-systemd/xendriverdomain.service $(DESTDIR)/etc/systemd/system/
install -m 0644 vm-systemd/80-qubes-vif.link $(DESTDIR)$(SYSLIBDIR)/systemd/network/
Expand Down
17 changes: 13 additions & 4 deletions archlinux/PKGBUILD.install
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ EOF
############################
## Service Management Functions ##
############################
# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
is_static() {
[ -f "/usr/lib/systemd/system/$1" ] && ! grep -q '^[[].nstall]' "/usr/lib/systemd/system/$1"
}
Expand Down Expand Up @@ -166,6 +167,8 @@ unmask() {

preset_units() {
local represet=
# shellcheck disable=SC2206
local extra_opts=( $3 )
while read -r action unit_name
do
if [ "$action" = "#" ] && [ "$unit_name" = "Units below this line will be re-preset on package upgrade" ]
Expand All @@ -191,15 +194,17 @@ preset_units() {
# We masked this static unit before, now we unmask it.
unmask "$unit_name"
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
else
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
fi
fi
done < "$1"
}

restore_units() {
# shellcheck disable=SC2206
local extra_opts=( $2 )
grep '^[[:space:]]*[^#;]' "$1" | while read -r action unit_name
do
if is_static "$unit_name" && is_masked "$unit_name"
Expand All @@ -208,17 +213,19 @@ restore_units() {
# Otherwise systemctl preset will fail badly.
unmask "$unit_name"
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
done
}

configure_systemd() {
if [ "$1" -eq 1 ]
then
preset_units /usr/lib/systemd/system-preset/$qubes_preset_file initial
preset_units /usr/lib/systemd/user-preset/$qubes_preset_file initial --global
changed=true
else
preset_units /usr/lib/systemd/system-preset/$qubes_preset_file upgrade
preset_units /usr/lib/systemd/user-preset/$qubes_preset_file upgrade --global
changed=true
# Upgrade path - now qubes-iptables is used instead
for svc in iptables ip6tables
Expand Down Expand Up @@ -399,7 +406,8 @@ pre_remove() {
# once the Qubes OS preset file is removed.
mkdir -p /run/qubes-uninstall
cp -f /usr/lib/systemd/system-preset/$qubes_preset_file /run/qubes-uninstall/
cp -f /usr/lib/systemd/system-preset/$qubes_preset_file /run/qubes-uninstall/
cp -f /usr/lib/systemd/user-preset/$qubes_preset_file \
/run/qubes-uninstall/user-$qubes_preset_file
fi
}

Expand All @@ -412,6 +420,7 @@ post_remove() {
# We have a saved preset file (or more).
# Re-preset the units mentioned there.
restore_units /run/qubes-uninstall/$qubes_preset_file
restore_units /run/qubes-uninstall/user-$qubes_preset_file --global
rm -rf /run/qubes-uninstall
changed=true
fi
Expand Down
1 change: 1 addition & 0 deletions debian/qubes-core-agent.install
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ usr/lib/qubes/xdg-icon
usr/lib/qubes/tinyproxy-wrapper
usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf
usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf
usr/lib/systemd/user-preset/75-qubes-vm.preset
usr/share/glib-2.0/schemas/*
usr/share/kde4/services/*.desktop
usr/share/kservices5/ServiceMenus/*.desktop
Expand Down
9 changes: 7 additions & 2 deletions debian/qubes-core-agent.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ debug() {
fi
}

# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
is_static() {
[ -f "/lib/systemd/system/$1" ] && ! grep -q '^[[].nstall]' "/lib/systemd/system/$1"
}
Expand Down Expand Up @@ -57,6 +58,8 @@ unmask() {

preset_units() {
local represet=
# shellcheck disable=SC2206
local extra_opts=( $3 )
while read -r action unit_name
do
if [ "$action" = "#" ] && [ "$unit_name" = "Units below this line will be re-preset on package upgrade" ]
Expand Down Expand Up @@ -84,9 +87,9 @@ preset_units() {
# We masked this static unit before, now we unmask it.
deb-systemd-helper unmask "${unit_name}" > /dev/null 2>&1 || true
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
else
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
fi
fi
done < "$1"
Expand Down Expand Up @@ -137,11 +140,13 @@ case "${1}" in

# Systemd preload-all
preset_units /lib/systemd/system-preset/75-qubes-vm.preset initial
preset_units /usr/lib/systemd/user-preset/75-qubes-vm.preset initial --global

# Maybe install overridden serial.conf init script
installSerialConf
else
preset_units /lib/systemd/system-preset/75-qubes-vm.preset upgrade
preset_units /usr/lib/systemd/user-preset/75-qubes-vm.preset upgrade --global
fi
systemctl reenable haveged

Expand Down
15 changes: 12 additions & 3 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
%define plateform_python3_sitelib %(/usr/libexec/platform-python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
%endif

# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
%define scriptletfuns is_static() { \
[ -f "%{_unitdir}/$1" ] && ! grep -q '^[[].nstall]' "%{_unitdir}/$1" \
} \
Expand Down Expand Up @@ -65,6 +66,7 @@ unmask() { \
\
preset_units() { \
local represet= \
local extra_opts="$3" \
cat "$1" | while read action unit_name \
do \
if [ "$action" = "#" -a "$unit_name" = "Units below this line will be re-preset on package upgrade" ] \
Expand All @@ -90,15 +92,16 @@ preset_units() { \
# We masked this static unit before, now we unmask it. \
unmask "$unit_name" \
fi \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
else \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
fi \
fi \
done \
} \
\
restore_units() { \
local extra_opts="$2" \
grep '^[[:space:]]*[^#;]' "$1" | while read action unit_name \
do \
if is_static "$unit_name" && is_masked "$unit_name" \
Expand All @@ -107,7 +110,7 @@ restore_units() { \
# Otherwise systemctl preset will fail badly. \
unmask "$unit_name" \
fi \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
done \
} \

Expand Down Expand Up @@ -957,6 +960,7 @@ The Qubes core startup configuration for SystemD init.
/usr/lib/systemd/system/[email protected]
/usr/lib/systemd/system/qubes-updates-proxy-forwarder.socket
/usr/lib/systemd/system-preset/%qubes_preset_file
/usr/lib/systemd/user-preset/%qubes_preset_file
/usr/lib/modules-load.d/qubes-core.conf
/usr/lib/systemd/system/boot.automount.d/30_qubes.conf
/usr/lib/systemd/system/chronyd.service.d/30_qubes.conf
Expand Down Expand Up @@ -993,9 +997,11 @@ changed=
if [ $1 -eq 1 ]
then
preset_units %{_presetdir}/%qubes_preset_file initial
preset_units %{%_userpresetdir}/%qubes_preset_file initial --global
changed=true
else
preset_units %{_presetdir}/%qubes_preset_file upgrade
preset_units %{_userpresetdir}/%qubes_preset_file upgrade --global
changed=true
# Upgrade path - now qubes-iptables is used instead
for svc in iptables ip6tables
Expand Down Expand Up @@ -1045,6 +1051,8 @@ if [ $1 -eq 0 ] ; then
# once the Qubes OS preset file is removed.
mkdir -p %{_rundir}/qubes-uninstall
cp -f %{_presetdir}/%qubes_preset_file %{_rundir}/qubes-uninstall/
cp -f %{_userpresetdir}/%qubes_preset_file \
%{_rundir}/qubes-uninstall/user-%qubes_preset_file
fi

%postun systemd
Expand All @@ -1058,6 +1066,7 @@ then
# We have a saved preset file (or more).
# Re-preset the units mentioned there.
restore_units %{_rundir}/qubes-uninstall/%qubes_preset_file
restore_units %{_rundir}/qubes-uninstall/user-%qubes_preset_file --global
rm -rf %{_rundir}/qubes-uninstall
changed=true
fi
Expand Down
7 changes: 7 additions & 0 deletions vm-systemd/75-qubes-vm.user-preset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# Units below this line will be re-preset on package upgrade

# conflicts with pulseaudio
disable pipewire.socket
disable pipewire.service
disable wireplumber.service

0 comments on commit b717d1e

Please sign in to comment.