[pve-devel] [PATCH] Fix postinst script when qga is installed

Stoiko Ivanov s.ivanov at proxmox.com
Mon May 27 18:21:40 CEST 2019


While testing a few upgrades on virtualized machines I noted that pve-qemu-kvm
always broke while running the postinst script:
```
Setting up pve-qemu-kvm (3.0.1-61) ...
rmdir: failed to remove '/etc/qemu': Directory not empty
dpkg: error processing package pve-qemu-kvm (--configure):
 installed pve-qemu-kvm package post-installation script subprocess
  returned error exit status 1
```

A quick check showed that qemu-guest-agent in buster ships the following files:
```
/etc/qemu
/etc/qemu/fsfreeze-hook
/etc/qemu/fsfreeze-hook.d
```

One packages postinst script should not remove directories which are also used
by other packages.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Tested shortly by building the patched version on buster and installing on top
of a broken version - it worked.

We could consider completely dropping the script since most other invocations
don't do too much, but emitting a warning and exiting cleanly.
>From the git blame output it seems that the script was already present for
pve-4 and we should now be save to drop it entirely?


debian/postinst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/postinst b/debian/postinst
index ddf9452..494a994 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -9,7 +9,7 @@ case "$1" in
     # remove stale /etc/qemu (files are in /etc/kvm)
     # file is now in /usr/share/kvm/cpus-x86_64.conf
     rm -f /etc/qemu/target-x86_64.conf
-    if test -d /etc/qemu; then rmdir /etc/qemu; fi
+    if test -d /etc/qemu; then rmdir --ignore-fail-on-non-empty /etc/qemu; fi
     rm -f /etc/kvm/target-x86_64.conf
 
     # There are three sub-cases:
-- 
2.11.0





More information about the pve-devel mailing list