Package: grml2usb Version: 0.18.3 Severity: normal Tags: patch grml2usb autopkgtest frequently fail in Ubuntu's CI. For example: https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-hirsute/hirsute/amd64/g/grml2usb/20201116_194744_cbe0f@/log.gz
An excerpt showing the error: 2020-11-17 14:14:49,362 Installing default MBR 2020-11-17 14:14:49,363 executing: dd if='/dev/loop0' of='/tmp/tmpa2umy9df' bs=5 12 count=1 2020-11-17 14:14:49,381 executing: dd if=/usr/share/grml2usb/mbr/mbrldr of=/tmp/ tmpa2umy9df bs=439 count=1 conv=notrunc 2020-11-17 14:14:49,385 executing: dd if='/tmp/tmpa2umy9df' of='/dev/loop0' bs=5 12 count=1 conv=notrunc 2020-11-17 14:14:49,401 executing: sync 2020-11-17 14:14:49,433 Probing device via 'blockdev --rereadpt /dev/loop0' blockdev: ioctl error on BLKRRPART: Device or resource busy 2020-11-17 14:14:49,452 Execution failed: ("Couldn't execute blockdev on '%s' (i nstall util-linux?)", '/dev/loop0') I am able to reproduce this on an OpenStack instance with a failure rate of 33% (36 failures, 110 passes). My theory is that the sync is not sufficient, and that we really need to do a targeted fsync of the file. With the attached patch, I've yet to see a failure in 42 iterations. -- System Information: Debian Release: bullseye/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.9.0-1-amd64 (SMP w/4 CPU threads) Kernel taint flags: TAINT_FIRMWARE_WORKAROUND Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages grml2usb depends on: ii grub2-common 2.04-10 ii kmod 27+20200310-2 ii mtools 4.0.25-1 ii python3 3.8.6-1 ii python3-parted 3.11.6-0.1+b1 ii rsync 3.2.3-2 ii syslinux 3:6.04~git20190206.bf6db5b4+dfsg1-3 Versions of packages grml2usb recommends: ii genisoimage 9:1.1.11-3.1 ii isolinux 3:6.04~git20190206.bf6db5b4+dfsg1-3 ii syslinux 3:6.04~git20190206.bf6db5b4+dfsg1-3 ii syslinux-utils 3:6.04~git20190206.bf6db5b4+dfsg1-3 ii xorriso 1.5.2-1 grml2usb suggests no packages. -- no debconf information
diff -urp grml2usb-0.18.3.orig/grml2usb grml2usb-0.18.3/grml2usb --- grml2usb-0.18.3.orig/grml2usb 2020-06-23 10:48:42.000000000 +0000 +++ grml2usb-0.18.3/grml2usb 2020-11-17 18:49:10.884080710 +0000 @@ -856,7 +852,9 @@ def install_mbr(mbrtemplate, device, par set_rw(device) logging.debug( - "executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc", tmpf.name, device + "executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc,fsync", + tmpf.name, + device, ) proc = subprocess.Popen( [ @@ -865,7 +863,7 @@ def install_mbr(mbrtemplate, device, par "of=%s" % device, "bs=512", "count=1", - "conv=notrunc", + "conv=notrunc,fsync", ], stderr=open(os.devnull, "r+"), ) @@ -874,11 +872,6 @@ def install_mbr(mbrtemplate, device, par raise Exception("error executing dd (third run)") del tmpf - # make sure we sync filesystems before returning - logging.debug("executing: sync") - proc = subprocess.Popen(["sync"]) - proc.wait() - logging.debug("Probing device via 'blockdev --rereadpt %s'", device) proc = subprocess.Popen(["blockdev", "--rereadpt", device]) proc.wait()