Sync filesystems before returning from MBR installation
authorMichael Prokop <mika@grml.org>
Wed, 25 Feb 2015 11:28:57 +0000 (12:28 +0100)
committerMichael Prokop <mika@grml.org>
Wed, 25 Feb 2015 11:32:51 +0000 (12:32 +0100)
We need to make sure the device/filesystem is synced, otherwise
syslinux installation might fail with:

| [...]
| Installing default MBR
| Installing syslinux as bootloader
| syslinux: /dev/sdb1: No such file or directory
| Fatal: Error executing syslinux (either try --fat16 or use grub?)

fsync-ing via dd isn't enough, so we need to make it
a full sync.

Closes: #779193

grml2usb

index 9d5c2ef..e324954 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -645,6 +645,10 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True):
         raise Exception("error executing dd (third run)")
     del tmpf
 
+    # make sure we sync filesystems before returning
+    proc = subprocess.Popen(["sync"])
+    proc.wait()
+
 
 def is_writeable(device):
     """Check if the device is writeable for the current user