From 7e608a8bb4497397e0217d54a236b30dd2213982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 29 May 2017 11:56:42 +0200 Subject: [PATCH] Remove DisposableVM savefile related files In Qubes 4.0 we no longer use two-stage DisposableVM startup. --- Makefile | 3 -- archlinux/PKGBUILD.install | 2 +- debian/qubes-core-agent.install | 4 --- debian/qubes-core-agent.postinst | 2 -- debian/qubes-core-agent.postrm | 2 +- init/setup-dvm-home.sh | 22 -------------- misc/dispvm-prerun.sh | 37 ----------------------- rpm_spec/core-agent.spec | 11 +------ vm-init.d/qubes-dvm | 43 --------------------------- vm-systemd/75-qubes-vm.preset | 1 - vm-systemd/misc-post-stop.sh | 6 ---- vm-systemd/mount-dirs.sh | 18 ++++------- vm-systemd/prepare-dvm.sh | 30 ------------------- vm-systemd/qubes-dvm.service | 14 --------- vm-systemd/qubes-misc-post.service | 2 +- vm-systemd/qubes-qrexec-agent.service | 2 +- 16 files changed, 11 insertions(+), 188 deletions(-) delete mode 100755 init/setup-dvm-home.sh delete mode 100755 misc/dispvm-prerun.sh delete mode 100755 vm-init.d/qubes-dvm delete mode 100755 vm-systemd/prepare-dvm.sh delete mode 100644 vm-systemd/qubes-dvm.service diff --git a/Makefile b/Makefile index 1707af6..0f8a3ca 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,6 @@ install-sysvinit: install-init install vm-init.d/qubes-firewall $(DESTDIR)/etc/init.d/ install vm-init.d/qubes-qrexec-agent $(DESTDIR)/etc/init.d/ install vm-init.d/qubes-updates-proxy $(DESTDIR)/etc/init.d/ - install vm-init.d/qubes-dvm $(DESTDIR)/etc/init.d/ install vm-init.d/qubes-updates-proxy-forwarder $(DESTDIR)/etc/init.d/ install -D vm-init.d/qubes-core.modules $(DESTDIR)/etc/sysconfig/modules/qubes-core.modules install -D vm-init.d/qubes-misc.modules $(DESTDIR)/etc/sysconfig/modules/qubes-misc.modules @@ -205,7 +204,6 @@ install-common: install -g user -m 2775 -d $(DESTDIR)/var/lib/qubes/dom0-updates install -D -m 0644 misc/qubes-master-key.asc $(DESTDIR)/usr/share/qubes/qubes-master-key.asc - install misc/dispvm-prerun.sh $(DESTDIR)$(LIBDIR)/qubes/dispvm-prerun.sh install misc/close-window $(DESTDIR)$(LIBDIR)/qubes/close-window install misc/upgrades-installed-check $(DESTDIR)$(LIBDIR)/qubes/upgrades-installed-check @@ -303,7 +301,6 @@ endif install -d $(DESTDIR)/var/run/qubes - install -d $(DESTDIR)/home_volatile/user install -d $(DESTDIR)/rw install-deb: install-common install-systemd install-systemd-dropins diff --git a/archlinux/PKGBUILD.install b/archlinux/PKGBUILD.install index e0f200c..51823a7 100644 --- a/archlinux/PKGBUILD.install +++ b/archlinux/PKGBUILD.install @@ -475,7 +475,7 @@ post_remove() { rm -rf /var/lib/qubes/xdg - for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-mount-dirs qubes-network qubes-qrexec-agent; do + for srv in qubes-sysinit qubes-misc-post qubes-mount-dirs qubes-network qubes-qrexec-agent; do systemctl disable $srv.service done diff --git a/debian/qubes-core-agent.install b/debian/qubes-core-agent.install index d72c3c9..26d83cf 100644 --- a/debian/qubes-core-agent.install +++ b/debian/qubes-core-agent.install @@ -63,7 +63,6 @@ lib/systemd/system/netfilter-persistent.service.d/30_qubes.conf lib/systemd/system/org.cups.cupsd.path.d/30_qubes.conf lib/systemd/system/org.cups.cupsd.service.d/30_qubes.conf lib/systemd/system/org.cups.cupsd.socket.d/30_qubes.conf -lib/systemd/system/qubes-dvm.service lib/systemd/system/qubes-early-vm-config.service lib/systemd/system/qubes-misc-post.service lib/systemd/system/qubes-mount-dirs.service @@ -95,18 +94,15 @@ usr/lib/python2.7/dist-packages/qubesagent-*.egg-info/* usr/lib/python2.7/dist-packages/qubesagent/* usr/lib/qubes-bind-dirs.d/30_cron.conf usr/lib/qubes/close-window -usr/lib/qubes/dispvm-prerun.sh usr/lib/qubes/init/bind-dirs.sh usr/lib/qubes/init/control-printer-icon.sh usr/lib/qubes/init/functions usr/lib/qubes/init/misc-post-stop.sh usr/lib/qubes/init/misc-post.sh usr/lib/qubes/init/mount-dirs.sh -usr/lib/qubes/init/prepare-dvm.sh usr/lib/qubes/init/qubes-early-vm-config.sh usr/lib/qubes/init/qubes-random-seed.sh usr/lib/qubes/init/qubes-sysinit.sh -usr/lib/qubes/init/setup-dvm-home.sh usr/lib/qubes/init/setup-rw.sh usr/lib/qubes/init/setup-rwdev.sh usr/lib/qubes/prepare-suspend diff --git a/debian/qubes-core-agent.postinst b/debian/qubes-core-agent.postinst index bfd60c6..d5bfd62 100755 --- a/debian/qubes-core-agent.postinst +++ b/debian/qubes-core-agent.postinst @@ -91,8 +91,6 @@ case "${1}" in sed -i "/^127\.0\.0\.1\s/,+0s/\(\s`hostname`\)\+\(\s\|$\)/\2/g" /etc/hosts || true fi - chown user:user /home_volatile/user - # Set default "runlevel" rm -f /etc/systemd/system/default.target ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target diff --git a/debian/qubes-core-agent.postrm b/debian/qubes-core-agent.postrm index c18702d..c691a52 100755 --- a/debian/qubes-core-agent.postrm +++ b/debian/qubes-core-agent.postrm @@ -43,7 +43,7 @@ if [ "${1}" = "remove" ] ; then rm /lib/firmware/updates fi - for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-network qubes-qrexec-agent; do + for srv in qubes-sysinit qubes-misc-post qubes-network qubes-qrexec-agent; do systemctl disable ${srv}.service done fi diff --git a/init/setup-dvm-home.sh b/init/setup-dvm-home.sh deleted file mode 100755 index 6b45d32..0000000 --- a/init/setup-dvm-home.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Source Qubes library. -. /usr/lib/qubes/init/functions - -echo "Setting up DVM home" >&2 - -touch /etc/this-is-dvm - -# If the user has customized DispVM settings, use its home instead of default skel -[ -e /home_volatile/user/.qubes-dispvm-customized ] && already_customized=yes || already_customized=no -[ -e /rw/home/user/.qubes-dispvm-customized ] && wants_customization=yes || wants_customization=no -if [ "$wants_customization" = "yes" ] ; then - if [ "$already_customized" = "no" ] ; then - echo "Customizing /home from /rw/home/user" >&2 - rm -rf /home_volatile/user - cp -af /rw/home/user /home_volatile/user - chown -R user.user /home_volatile/user - fi -else - initialize_home "/home_volatile" unconditionally -fi diff --git a/misc/dispvm-prerun.sh b/misc/dispvm-prerun.sh deleted file mode 100755 index 9273ece..0000000 --- a/misc/dispvm-prerun.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# This script must be run as the `user` user. -# It is customarily launched from prepare-dvm.sh. - -# At this point, the DispVM home directory customizations -# undertaken by mount-dirs.sh have taken place. -# We know this because dispvm-prerun.sh executes after -# local-fs.target, and mount-dirs.sh runs before it. - -me=$( basename "$0" ) -apps="/usr/libexec/evinced" - -echo "$me started." >&2 - -for app in $apps ; do - echo "Launching $app" >&2 - $app & -done - -echo "Waiting for I/O to quiesce" >&2 -PREV_IO=0 -while true; do - IO=`vmstat -D | awk '/read|write/ {IOs+=$1} END {print IOs}'` - if [ $IO -lt $(( $PREV_IO + 50 )) ]; then - break; - fi - PREV_IO=$IO - sleep 2 -done - -echo "Closing windows" >&2 -/usr/lib/qubes/close-window `xwininfo -root -children|tail -n +7 |awk '{print $1}'` -sleep 1 -fuser -vkm /rw - -echo "$me finished." >&2 diff --git a/rpm_spec/core-agent.spec b/rpm_spec/core-agent.spec index 96490f6..2e7f9f6 100644 --- a/rpm_spec/core-agent.spec +++ b/rpm_spec/core-agent.spec @@ -20,7 +20,7 @@ # # -%define qubes_services qubes-core qubes-core-netvm qubes-core-early qubes-firewall qubes-iptables qubes-updates-proxy qubes-qrexec-agent qubes-dvm qubes-updates-proxy-forwarder +%define qubes_services qubes-core qubes-core-netvm qubes-core-early qubes-firewall qubes-iptables qubes-updates-proxy qubes-qrexec-agent qubes-updates-proxy-forwarder %define qubes_preset_file 75-qubes-vm.preset %{!?version: %define version %(cat version)} @@ -126,8 +126,6 @@ Requires: qubes-utils >= 3.1.3 Requires: initscripts Requires: gawk Requires: sed -# for dispvm-prerun.sh -Requires: procps-ng Requires: util-linux # for qubes-desktop-run Requires: pygobject3-base @@ -513,7 +511,6 @@ rm -f %{name}-%{version} /usr/bin/qubes-session-autostart %dir /usr/lib/qubes /usr/lib/qubes/vusb-ctl.py* -/usr/lib/qubes/dispvm-prerun.sh /usr/lib/qubes/sync-ntp-clock /usr/lib/qubes/prepare-suspend /usr/lib/qubes/qrexec-agent @@ -543,11 +540,9 @@ rm -f %{name}-%{version} /usr/lib/qubes/init/misc-post-stop.sh /usr/lib/qubes/init/misc-post.sh /usr/lib/qubes/init/mount-dirs.sh -/usr/lib/qubes/init/prepare-dvm.sh /usr/lib/qubes/init/qubes-early-vm-config.sh /usr/lib/qubes/init/qubes-random-seed.sh /usr/lib/qubes/init/qubes-sysinit.sh -/usr/lib/qubes/init/setup-dvm-home.sh /usr/lib/qubes/init/setup-rw.sh /usr/lib/qubes/init/setup-rwdev.sh /usr/lib/qubes/init/functions @@ -569,8 +564,6 @@ rm -f %{name}-%{version} /usr/share/qubes/mime-override/globs /usr/share/qubes/qubes-master-key.asc -%dir /home_volatile -%attr(700,user,user) /home_volatile/user %dir /mnt/removable %dir /rw @@ -641,7 +634,6 @@ The Qubes core startup configuration for SysV init (or upstart). /etc/init.d/qubes-sysinit /etc/init.d/qubes-core-early /etc/init.d/qubes-core -/etc/init.d/qubes-dvm /etc/init.d/qubes-core-netvm /etc/init.d/qubes-firewall /etc/init.d/qubes-iptables @@ -712,7 +704,6 @@ The Qubes core startup configuration for SystemD init. %files systemd %defattr(-,root,root,-) -/lib/systemd/system/qubes-dvm.service /lib/systemd/system/qubes-misc-post.service /lib/systemd/system/qubes-mount-dirs.service /lib/systemd/system/qubes-sysinit.service diff --git a/vm-init.d/qubes-dvm b/vm-init.d/qubes-dvm deleted file mode 100755 index f93635c..0000000 --- a/vm-init.d/qubes-dvm +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# chkconfig: 345 91 91 -# description: Executes Qubes core scripts at AppVM boot -# -# This must run after GUI agent has started. Hence 91. -# -# Source function library. -. /etc/rc.d/init.d/functions - -# Source Qubes library. -. /usr/lib/qubes/init/functions - -start() -{ - have_qubesdb || return - - if qsvc qubes-dvm; then - echo -n $"Preparing Qubes DVM:" - /usr/lib/qubes/init/prepare-dvm.sh && success || failure - echo - fi -} - -stop() -{ - return 0 -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - *) - echo $"Usage: $0 {start|stop}" - exit 3 - ;; -esac - -exit $RETVAL diff --git a/vm-systemd/75-qubes-vm.preset b/vm-systemd/75-qubes-vm.preset index b6850bd..6f32bc7 100644 --- a/vm-systemd/75-qubes-vm.preset +++ b/vm-systemd/75-qubes-vm.preset @@ -83,7 +83,6 @@ enable qubes-gui-agent.service enable qubes-update-check.timer enable qubes-misc-post.service enable qubes-updates-proxy.service -enable qubes-dvm.service enable qubes-network.service enable qubes-qrexec-agent.service enable qubes-mount-dirs.service diff --git a/vm-systemd/misc-post-stop.sh b/vm-systemd/misc-post-stop.sh index 399a41f..3d62be5 100755 --- a/vm-systemd/misc-post-stop.sh +++ b/vm-systemd/misc-post-stop.sh @@ -2,10 +2,4 @@ # Save default applications for DispVM -su -c 'mkdir -p /home_volatile/user/.local/share/applications' user -su -c 'cp -a /usr/share/applications/defaults.list /home_volatile/user/.local/share/applications/' user -if [ -r '/home/user/.local/share/applications/defaults.list' ]; then - su -c 'cat /home/user/.local/share/applications/defaults.list >> /home_volatile/user/.local/share/applications/defaults.list' user -fi - exit 0 diff --git a/vm-systemd/mount-dirs.sh b/vm-systemd/mount-dirs.sh index 9aad2c9..70bf705 100755 --- a/vm-systemd/mount-dirs.sh +++ b/vm-systemd/mount-dirs.sh @@ -9,15 +9,9 @@ set -e if [ -e /dev/xvdb ] ; then mount /rw ; fi /usr/lib/qubes/init/setup-rw.sh -if qsvc qubes-dvm; then - /usr/lib/qubes/init/setup-dvm-home.sh - echo "Mounting /home_volatile onto /home" >&2 - mount --bind /home_volatile /home -else - initialize_home "/rw/home" ifneeded - echo "Mounting /rw/home onto /home" >&2 - mount /home - # https://github.com/QubesOS/qubes-issues/issues/1328#issuecomment-169483029 - # Do none of the following in a DispVM. - /usr/lib/qubes/init/bind-dirs.sh -fi +initialize_home "/rw/home" ifneeded +echo "Mounting /rw/home onto /home" >&2 +mount /home +# https://github.com/QubesOS/qubes-issues/issues/1328#issuecomment-169483029 +# Do none of the following in a DispVM. +/usr/lib/qubes/init/bind-dirs.sh diff --git a/vm-systemd/prepare-dvm.sh b/vm-systemd/prepare-dvm.sh deleted file mode 100755 index 48f25f9..0000000 --- a/vm-systemd/prepare-dvm.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Source Qubes library. -. /usr/lib/qubes/init/functions - -set -e - -echo "Waiting for user session to quiesce." >&2 -echo user | /bin/sh /etc/qubes-rpc/qubes.WaitForSession || : - -echo "Possibly running save script." >&2 -possibly_run_save_script - -echo "Unmounting /rw filesystem." >&2 -umount_retry /rw || echo "Giving up and proceeding. Warning: this may not work." >&2 - -dmesg -C -qubesdb-watch /qubes-restore-complete & -watch_pid=$! -free | grep Mem: | - (read label total used free shared buffers cached; qubesdb-write /qubes-used-mem $(( $used + $cached )) ) - -# we're still running in DispVM template -echo "Waiting for restore signal." >&2 -qubesdb-read /qubes-restore-complete >/dev/null || wait $watch_pid -echo "Restore complete." >&2 - -# Reload random seed -echo "Reloading random seed." >&2 -reload_random_seed diff --git a/vm-systemd/qubes-dvm.service b/vm-systemd/qubes-dvm.service deleted file mode 100644 index f791341..0000000 --- a/vm-systemd/qubes-dvm.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Prepare Qubes DispVM Template -ConditionPathExists=/var/run/qubes-service/qubes-dvm -After=systemd-readahead-replay.service qubes-gui-agent.service -Wants=qubes-gui-agent.service -Before=xendriverdomain.service - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/lib/qubes/init/prepare-dvm.sh - -[Install] -WantedBy=multi-user.target diff --git a/vm-systemd/qubes-misc-post.service b/vm-systemd/qubes-misc-post.service index ccc98e6..09a2f84 100644 --- a/vm-systemd/qubes-misc-post.service +++ b/vm-systemd/qubes-misc-post.service @@ -1,6 +1,6 @@ [Unit] Description=Qubes misc post-boot actions -After=network-pre.target qubes-dvm.service qubes-mount-dirs.service qubes-network.service qubes-firewall.service qubes-netwatcher.service +After=network-pre.target qubes-mount-dirs.service qubes-network.service qubes-firewall.service qubes-netwatcher.service [Service] Type=oneshot diff --git a/vm-systemd/qubes-qrexec-agent.service b/vm-systemd/qubes-qrexec-agent.service index ed0f338..3c49b86 100644 --- a/vm-systemd/qubes-qrexec-agent.service +++ b/vm-systemd/qubes-qrexec-agent.service @@ -1,6 +1,6 @@ [Unit] Description=Qubes remote exec agent -After=qubes-dvm.service xendriverdomain.service +After=xendriverdomain.service [Service] ExecStartPre=/bin/sh -c '[ -e /dev/xen/evtchn ] || modprobe xen_evtchn'