From ebf117ab90a749421cc784a25781766e8645f0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 6 Jan 2026 15:11:59 +0100 Subject: [PATCH] Set user session stop timeout in all templates Not only in Fedora. The issue happens on Debian recently, and the default timeout of 90s is longer than default VM shutdown timeout of 60s - which means: 1. slow user session stop may prevent other services stopping properly before shutdown timeout expires 2. logs do not include stop timeout message that normally tells which processes remained running - such information would help debugging the issue The timeout applied in Fedora is really short (500ms), make it longer (5s) but apply everywhere. --- archlinux/PKGBUILD.in | 2 +- boot/Makefile | 3 +++ boot/redhat/Makefile | 2 -- boot/redhat/session-stop-timeout.conf | 2 -- boot/session-stop-timeout.conf | 2 ++ debian/qubes-core-agent.install | 1 + rpm_spec/core-agent.spec.in | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 boot/redhat/session-stop-timeout.conf create mode 100644 boot/session-stop-timeout.conf diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD.in index 2e0a4d3c..655c0d0b 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD.in @@ -101,7 +101,7 @@ package_qubes-vm-core() { cd "${_pkgnvr}" # shellcheck disable=SC2154 - make -C boot DESTDIR="$pkgdir" install + make -C boot DESTDIR="$pkgdir" SYSTEM_DROPIN_DIR=/usr/lib/systemd/system install make install-corevm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux make -C app-menu install DESTDIR="$pkgdir" install LIBDIR=/usr/lib SYSLIBDIR=/usr/lib make -C misc install DESTDIR="$pkgdir" install LIBDIR=/usr/lib SYSLIBDIR=/usr/lib diff --git a/boot/Makefile b/boot/Makefile index c9b4123f..63ad200c 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -1,4 +1,5 @@ LIBDIR ?= /usr/lib +SYSTEM_DROPIN_DIR ?= /lib/systemd/system SYSCONFDIR ?= /etc GRUBCONFDIR ?= $(SYSCONFDIR)/default DRACUTCONFDIR ?= $(LIBDIR)/dracut/dracut.conf.d @@ -7,5 +8,7 @@ GRUBCFGNAME ?= grub.qubes .PHONY: install install: + install -D -m 0644 session-stop-timeout.conf \ + $(DESTDIR)$(SYSTEM_DROPIN_DIR)/user@.service.d/90-session-stop-timeout.conf install -D -m 0644 grub.qubes $(DESTDIR)$(GRUBCONFDIR)/$(GRUBCFGNAME) install -D -m 0644 dracut-qubes.conf $(DESTDIR)$(DRACUTCONFDIR)/30-qubes.conf diff --git a/boot/redhat/Makefile b/boot/redhat/Makefile index 030ca9c6..8972e355 100644 --- a/boot/redhat/Makefile +++ b/boot/redhat/Makefile @@ -7,7 +7,5 @@ QUBESDATADIR = $(DATADIR)/qubes .PHONY: install install: - install -D -m 0644 session-stop-timeout.conf \ - $(DESTDIR)$(LIBDIR)/systemd/system/user@.service.d/90-session-stop-timeout.conf install -D -m 0644 serial.conf $(DESTDIR)$(QUBESDATADIR)/serial.conf install -D qubes-serial-login $(DESTDIR)$(BINDIR)/qubes-serial-login diff --git a/boot/redhat/session-stop-timeout.conf b/boot/redhat/session-stop-timeout.conf deleted file mode 100644 index fb8e422f..00000000 --- a/boot/redhat/session-stop-timeout.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Service] -TimeoutStopSec=500000us diff --git a/boot/session-stop-timeout.conf b/boot/session-stop-timeout.conf new file mode 100644 index 00000000..449242ce --- /dev/null +++ b/boot/session-stop-timeout.conf @@ -0,0 +1,2 @@ +[Service] +TimeoutStopSec=5s diff --git a/debian/qubes-core-agent.install b/debian/qubes-core-agent.install index 6312641a..5c1c92c8 100644 --- a/debian/qubes-core-agent.install +++ b/debian/qubes-core-agent.install @@ -118,6 +118,7 @@ lib/systemd/system/systemd-timesyncd.service.d/30_qubes.conf lib/systemd/system/systemd-logind.service.d/30_qubes.conf lib/systemd/system/systemd-nsresourced.service.d/30_qubes.conf lib/systemd/system/systemd-nsresourced.socket.d/30_qubes.conf +lib/systemd/system/user@.service.d/90-session-stop-timeout.conf lib/systemd/resolved.conf.d/30_resolved-no-mdns-or-llmnr.conf lib/systemd/system/home.mount lib/systemd/system/usr-local.mount diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index e2fb2fdf..e6d79b96 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -489,7 +489,7 @@ export ETCSECURITYDIR=/usr/etc/security make install-vm PYTHON=%{__python3} "DESTDIR=$RPM_BUILD_ROOT" SYSTEM_DROPIN_DIR=%{_unitdir} SYSLIBDIR=/usr/lib ENABLE_SELINUX=%with_selinux make -C app-menu DESTDIR=$RPM_BUILD_ROOT install -make -C boot DESTDIR=$RPM_BUILD_ROOT install +make -C boot DESTDIR=$RPM_BUILD_ROOT SYSTEM_DROPIN_DIR=%{_unitdir} install make -C boot/redhat DESTDIR=$RPM_BUILD_ROOT install make -C config-overrides DESTDIR=$RPM_BUILD_ROOT install make -C filesystem DESTDIR=$RPM_BUILD_ROOT install