Bind-mount /run/udev in target system as workaround for lvm2 issue #918590
authorMichael Prokop <mika@grml.org>
Fri, 18 Jan 2019 12:54:47 +0000 (13:54 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 18 Jan 2019 13:14:47 +0000 (14:14 +0100)
Installation takes ages with lvm 2.03.02-1 if /run/udev isn't
available in the target system, causing messages like:

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

Especially when grub package gets installed (which invokes
vgs and related tools) this takes forever and looks like a
failing installation.

This /run/udev bind-mount is a workaround required for Debian/buster's
lvm2, at least until #918590 is resolved.

grml-debootstrap

index accef96..945b859 100755 (executable)
@@ -266,7 +266,7 @@ cleanup() {
 
       # ugly, but make sure we really don't leave anything (/proc /proc and
       # /dev /dev are intended, trying to work around timing issues, see #657023)
 
       # ugly, but make sure we really don't leave anything (/proc /proc and
       # /dev /dev are intended, trying to work around timing issues, see #657023)
-      for ARG in /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do
+      for ARG in /run/udev /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do
         [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1
         umount "$MNTPOINT"/$ARG >/dev/null 2>&1
       done
         [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1
         umount "$MNTPOINT"/$ARG >/dev/null 2>&1
       done
@@ -1742,6 +1742,13 @@ iface eth0 inet dhcp
      cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples"
   fi
 
      cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples"
   fi
 
+  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
+
   eend 0
 }
 # }}}
   eend 0
 }
 # }}}
@@ -1866,6 +1873,12 @@ umount_chroot() {
   fi
 
   if grep -q "$MNTPOINT" /proc/mounts ; then
   fi
 
   if grep -q "$MNTPOINT" /proc/mounts ; then
+    if mountpoint "${MNTPOINT}"/run/udev &>/dev/null ; then
+      einfo "Unmounting bind-mount /run/udev"
+      umount "${MNTPOINT}"/run/udev
+      eend $?
+    fi
+
      if [ -n "$PARTITION" ] ; then
         einfo "Unmount $MNTPOINT"
         umount "$MNTPOINT"
      if [ -n "$PARTITION" ] ; then
         einfo "Unmount $MNTPOINT"
         umount "$MNTPOINT"