From 1477211c74d8be63342fb97c0fdb4d7bbe414348 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 17 Aug 2018 19:05:15 -0300 Subject: Provision: fix GRUB install issues --- share/hydractl/provision | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/share/hydractl/provision b/share/hydractl/provision index ffbcce8..192ae69 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -336,9 +336,11 @@ hydra_sudo_run LC_ALL=C DEBIAN_FRONTEND=noninteractive debootstrap --force-check # Initial configuration. echo "Applying initial configuration..." -hydra_sudo_run mount none -t proc $WORK/proc -hydra_sudo_run mount none -t sysfs $WORK/sys -hydra_sudo_run mount -o bind /dev/ $WORK/dev +hydra_sudo_run mount none -t proc $WORK/proc +hydra_sudo_run mount none -t sysfs $WORK/sys +hydra_sudo_run mount -o bind /run/ $WORK/run +hydra_sudo_run mount -o bind /dev/ $WORK/dev +hydra_sudo_run mount -o bind /dev/pts $WORK/dev/pts echo LANG=C | $SUDO tee $WORK/etc/default/locale > /dev/null # Resolver configuration. @@ -467,6 +469,14 @@ else kernel_arch="$arch" fi +# Boot device must be available before installing kernel and initramfs. +if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then + echo "Boot device setup..." + hydra_sudo_run mkfs.ext4 $boot_device + hydra_sudo_run mount $boot_device $WORK/boot + echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null +fi + # Kernel. $APT_INSTALL linux-image-$kernel_arch -y @@ -480,14 +490,6 @@ hydra_sudo_run chroot $WORK update-initramfs -u # Grub. if [ "$grub" == "y" ]; then - echo "Boot device setup..." - - if [ "$encrypt" != "y" ]; then - hydra_sudo_run mkfs.ext4 $boot_device - hydra_sudo_run mount $boot_device $WORK/boot - echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null - fi - echo "Setting up GRUB..." $APT_INSTALL grub-pc -y @@ -545,7 +547,7 @@ if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then hydra_sudo_run umount $WORK/boot fi -hydra_sudo_run umount $WORK/sys $WORK/proc $WORK/dev $WORK +hydra_sudo_run umount $WORK/sys $WORK/proc $WORK/dev/pts $WORK/dev $WORK/run $WORK if [ "$swap_size" != "0" ]; then hydra_sudo_run cryptsetup luksClose provision-swap -- cgit v1.2.3