dracut: mount only subdirectory of /lib/modules
This makes is possible to modify /lib/modules content - especially install other kernel packages, without unmounting the whole /lib/modules. Since dom0-provided modules will no longer conflict with VM kernel packages (assuming kernel versions are different), there is no need for qubes-kernel-vm-placeholder anymore. Having only one subdirectory of /lib/modules mounted is somehow tricky, because: 1. Directory name isn't always the same - it depends on kernel version. This means that mountpoint must be created dynamically (so $NEWROOT must be mounted in R/W for a moment). 2. There is one-command way to mount only a subdirectory of some filesystem. So use a trick: mount it in some temporary directory, get interesting subdir with `mount --bind`, then unmount temporary directory. QubesOS/qubes-issues#1354
This commit is contained in:
parent
42469fdbe4
commit
789e9c2549
@ -4,11 +4,22 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
if ! [ -d $NEWROOT/lib/modules/`uname -r` ]; then
|
kver="`uname -r`"
|
||||||
|
if ! [ -d "$NEWROOT/lib/modules/$kver/kernel" ]; then
|
||||||
echo "Waiting for /dev/xvdd device..."
|
echo "Waiting for /dev/xvdd device..."
|
||||||
while ! [ -e /dev/xvdd ]; do sleep 0.1; done
|
while ! [ -e /dev/xvdd ]; do sleep 0.1; done
|
||||||
|
|
||||||
mount -n -t ext3 /dev/xvdd $NEWROOT/lib/modules
|
# Mount only `uname -r` subdirectory, to leave the rest of /lib/modules writable
|
||||||
|
mkdir -p /tmp/modules
|
||||||
|
mount -n -t ext3 /dev/xvdd /tmp/modules
|
||||||
|
if ! [ -d "$NEWROOT/lib/modules/$kver" ]; then
|
||||||
|
mount "$NEWROOT" -o remount,rw
|
||||||
|
mkdir -p "$NEWROOT/lib/modules/$kver"
|
||||||
|
mount "$NEWROOT" -o remount,ro
|
||||||
|
fi
|
||||||
|
mount --bind "/tmp/modules/$kver" "$NEWROOT/lib/modules/$kver"
|
||||||
|
umount /tmp/modules
|
||||||
|
rmdir /tmp/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
killall udevd systemd-udevd
|
killall udevd systemd-udevd
|
||||||
|
@ -54,11 +54,22 @@ mkdir -p /sysroot
|
|||||||
mount /dev/mapper/dmroot /sysroot -o ro
|
mount /dev/mapper/dmroot /sysroot -o ro
|
||||||
NEWROOT=/sysroot
|
NEWROOT=/sysroot
|
||||||
|
|
||||||
if ! [ -d $NEWROOT/lib/modules/`uname -r` ]; then
|
kver="`uname -r`"
|
||||||
|
if ! [ -d "$NEWROOT/lib/modules/$kver/kernel" ]; then
|
||||||
echo "Waiting for /dev/xvdd device..."
|
echo "Waiting for /dev/xvdd device..."
|
||||||
while ! [ -e /dev/xvdd ]; do sleep 0.1; done
|
while ! [ -e /dev/xvdd ]; do sleep 0.1; done
|
||||||
|
|
||||||
mount -n -t ext3 /dev/xvdd $NEWROOT/lib/modules
|
# Mount only `uname -r` subdirectory, to leave the rest of /lib/modules writable
|
||||||
|
mkdir -p /tmp/modules
|
||||||
|
mount -n -t ext3 /dev/xvdd /tmp/modules
|
||||||
|
if ! [ -d "$NEWROOT/lib/modules/$kver" ]; then
|
||||||
|
mount "$NEWROOT" -o remount,rw
|
||||||
|
mkdir -p "$NEWROOT/lib/modules/$kver"
|
||||||
|
mount "$NEWROOT" -o remount,ro
|
||||||
|
fi
|
||||||
|
mount --bind "/tmp/modules/$kver" "$NEWROOT/lib/modules/$kver"
|
||||||
|
umount /tmp/modules
|
||||||
|
rmdir /tmp/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user