Provide workaround for Debian bug #918590 with lvm + udev in VM installations
authorMichael Prokop <mika@grml.org>
Fri, 13 Dec 2019 11:13:49 +0000 (12:13 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 13 Dec 2019 11:15:41 +0000 (12:15 +0100)
We need the /run/udev bind-mount to be present also when doing VM
installations for buster and newer, otherwise the installation
takes loooong due to the:

| WARNING: Device /dev/... not initialized in udev database even after waiting 10000000 microseconds

bug. As the /run/udev bind-mount is already gone we need
to resurrect before invoking update-grub in the VM installation.

grml-debootstrap

index 103946c..6f9743c 100755 (executable)
@@ -1515,6 +1515,15 @@ if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v |
   rm -f "${MNTPOINT}/tmp/core.img"
 fi
 
+  # workaround for Debian bug #918590 with lvm + udev:
+  # WARNING: Device /dev/... not initialized in udev database even after waiting 10000000 microseconds
+  if [ -d /run/udev ] ; then
+    einfo "Setting up bind-mount /run/udev"
+    mkdir -p "${MNTPOINT}"/run/udev
+    mount --bind /run/udev "${MNTPOINT}"/run/udev
+    eend $?
+  fi
+
   einfo "Updating grub configuration file."
   chroot "${MNTPOINT}" update-grub
 
@@ -1534,6 +1543,14 @@ fi
     sed -i "s;root=[^ ]\\+;root=UUID=$TARGET_UUID;" "${MNTPOINT}"/boot/grub/grub.cfg
   fi
 
+  # workaround for Debian bug #918590 with lvm + udev:
+  # WARNING: Device /dev/... not initialized in udev database even after waiting 10000000 microseconds
+  if mountpoint "${MNTPOINT}"/run/udev &>/dev/null ; then
+    einfo "Unmounting bind-mount /run/udev"
+    umount "${MNTPOINT}"/run/udev
+    eend $?
+  fi
+
   umount "${MNTPOINT}"/proc
   umount "${MNTPOINT}"/sys
   umount "${MNTPOINT}"/dev/pts