Skip to content

Commit 0a67a77

Browse files
committed
Merge remote-tracking branch 'origin/pr/636'
* origin/pr/636: minimal-vms: mask gvfs-daemon to prevent dbus timeout Pull request description: Some programs try to start gvfs-daemon, which refusing to start when minimal-vm is enabled, using a dbus method call and resulting in timeouts. Trying to start a masked service is detected by Dbus and doesn't trigger any timeout. The service is masked at runtime thanks to a new service executed when running a qube with minimal-netvm or minimal-usbvm. Fixes QubesOS/qubes-issues#10165 (comment)
2 parents 8214ce1 + a811d95 commit 0a67a77

8 files changed

Lines changed: 61 additions & 22 deletions

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ endif
146146

147147
# Systemd service files
148148
SYSTEMD_ALL_SERVICES := $(wildcard vm-systemd/qubes-*.service) vm-systemd/dev-xvdc1-swap.service
149-
SYSTEMD_NETWORK_SERVICES := vm-systemd/qubes-firewall.service vm-systemd/qubes-iptables.service vm-systemd/qubes-updates-proxy.service vm-systemd/qubes-antispoof.service vm-systemd/qubes-sysctl-minimal-sys-net.service
149+
SYSTEMD_NETWORK_SERVICES := vm-systemd/qubes-firewall.service vm-systemd/qubes-iptables.service vm-systemd/qubes-updates-proxy.service vm-systemd/qubes-antispoof.service
150150
SYSTEMD_SELINUX_SERVICES := vm-systemd/qubes-relabel-root.service vm-systemd/qubes-relabel-rw.service
151151
SYSTEMD_CORE_SERVICES := $(filter-out $(SYSTEMD_NETWORK_SERVICES) $(SYSTEMD_SELINUX_SERVICES), $(SYSTEMD_ALL_SERVICES))
152152

@@ -169,6 +169,7 @@ install-systemd: install-init
169169
install -m 0644 vm-systemd/home.mount $(DESTDIR)$(SYSLIBDIR)/systemd/system/
170170
install -m 0755 vm-systemd/user-environment-generators/30-qubes.sh $(DESTDIR)$(SYSLIBDIR)/systemd/user-environment-generators/30-qubes.sh
171171
install -m 0644 vm-systemd/usr-local.mount $(DESTDIR)$(SYSLIBDIR)/systemd/system/
172+
install -m 0755 vm-systemd/setup-minimal-vm $(DESTDIR)$(LIBDIR)/qubes/setup-minimal-vm
172173

173174
.PHONY: install-sysvinit
174175
install-sysvinit: install-init

debian/qubes-core-agent-networking.install

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ lib/systemd/system/qubes-antispoof.service
1818
lib/systemd/system/qubes-network.service
1919
lib/systemd/system/qubes-network-uplink.service
2020
lib/systemd/system/qubes-network-uplink@.service
21-
lib/systemd/system/qubes-sysctl-minimal-sys-net.service
2221
lib/systemd/system/qubes-updates-proxy.service
2322
lib/systemd/network/80-qubes-vif.link
2423
usr/lib/qubes/init/network-proxy-setup.sh

debian/qubes-core-agent.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ lib/systemd/system/qubes-early-vm-config.service
9999
lib/systemd/system/qubes-misc-post.service
100100
lib/systemd/system/qubes-mount-dirs.service
101101
lib/systemd/system/qubes-rootfs-resize.service
102+
lib/systemd/system/qubes-setup-minimal-vm.service
102103
lib/systemd/system/qubes-sysinit.service
103104
lib/systemd/system/qubes-update-check.service
104105
lib/systemd/system/qubes-update-check.timer
@@ -189,6 +190,7 @@ usr/lib/qubes/qvm-move-to-vm.gnome
189190
usr/lib/qubes/qvm-move-to-vm.kde
190191
usr/lib/qubes/qvm-service-wrapper
191192
usr/lib/qubes/resize-rootfs
193+
usr/lib/qubes/setup-minimal-vm
192194
usr/lib/qubes/tar2qfile
193195
usr/lib/qubes/update-proxy-configs
194196
usr/lib/qubes/upgrades-installed-check

rpm_spec/core-agent.spec.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ rm -f %{name}-%{version}
11451145
%_unitdir/qubes-network.service
11461146
%_unitdir/qubes-network-uplink.service
11471147
%_unitdir/qubes-network-uplink@.service
1148-
%_unitdir/qubes-sysctl-minimal-sys-net.service
11491148
%_unitdir/qubes-updates-proxy.service
11501149
/usr/lib/systemd/network/80-qubes-vif.link
11511150
/usr/lib/qubes/init/network-proxy-setup.sh
@@ -1251,6 +1250,7 @@ The Qubes core startup configuration for SystemD init.
12511250
%_unitdir/systemd-nsresourced.service.d/30_qubes.conf
12521251
%dir %_unitdir/systemd-nsresourced.socket.d
12531252
%_unitdir/systemd-nsresourced.socket.d/30_qubes.conf
1253+
%_unitdir/qubes-setup-minimal-vm.service
12541254
%dir %_userunitdir/*.service.d
12551255
%_userunitdir/tracker-extract-3.service.d/30_qubes.conf
12561256
%_userunitdir/tracker-miner-fs-3.service.d/30_qubes.conf
@@ -1267,6 +1267,7 @@ The Qubes core startup configuration for SystemD init.
12671267
%_userunitdir/pipewire.service.d/40_minimal.conf
12681268
%_userunitdir/wireplumber.service.d/30_qubes.conf
12691269
/usr/lib/systemd/user-environment-generators/30-qubes.sh
1270+
/usr/lib/qubes/setup-minimal-vm
12701271

12711272
%post systemd
12721273

vm-systemd/75-qubes-vm.preset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ enable qubes-psu-client@.service default sys-usb
118118
enable dev-xvdc1-swap.service
119119
enable NetworkManager.service
120120
enable NetworkManager-dispatcher.service
121-
enable qubes-sysctl-minimal-sys-net.service
121+
enable qubes-setup-minimal-vm.service
122122

123123
# Disable useless Xen services in Qubes VM
124124
disable xenstored.service
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Apply minimal vm runtime configuration
3+
DefaultDependencies=no
4+
Conflicts=shutdown.target
5+
After=systemd-modules-load.service qubes-sysinit.service
6+
Before=sysinit.target shutdown.target
7+
ConditionPathExists=|/var/run/qubes-service/minimal-netvm
8+
ConditionPathExists=|/var/run/qubes-service/minimal-usbvm
9+
10+
[Service]
11+
Type=oneshot
12+
ExecStart=/usr/lib/qubes/setup-minimal-vm
13+
14+
[Install]
15+
WantedBy=sysinit.target

vm-systemd/qubes-sysctl-minimal-sys-net.service

Lines changed: 0 additions & 18 deletions
This file was deleted.

vm-systemd/setup-minimal-vm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
# License: GPL-2+
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License
7+
# as published by the Free Software Foundation; either version 2
8+
# of the License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
19+
20+
is_minimal_netvm() {
21+
test -f /run/qubes-service/minimal-netvm
22+
}
23+
24+
is_minimal_usbvm() {
25+
test -f /run/qubes-service/minimal-usbvm
26+
}
27+
28+
29+
setup_minimal_netvm() {
30+
if [ "$(id -u)" = "0" ]; then
31+
systemd-sysctl /etc/sysctl.d/82-qubes-minimal-sys-net.conf.optional
32+
systemctl --global --runtime mask gvfs-daemon.service
33+
fi
34+
}
35+
36+
if is_minimal_netvm; then
37+
setup_minimal_netvm
38+
fi
39+

0 commit comments

Comments
 (0)