diff --git a/images/almalinux.yaml b/images/almalinux.yaml index 97efcab0d..46837a456 100644 --- a/images/almalinux.yaml +++ b/images/almalinux.yaml @@ -412,7 +412,7 @@ actions: target="$(readlink -f /etc/grub2-efi.cfg)" grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: @@ -427,11 +427,11 @@ actions: # Create grub.cfg file grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" # Update files in /boot/loader/entries/. `grubby` needs to be run after # `grub2-mkconfig` as the latter overwrites files in /boot/loader/entries/. - grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=/dev/sda2 ro" + grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=${LXD_IMAGEBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f diff --git a/images/alpine.yaml b/images/alpine.yaml index 182ffd750..cba910b52 100644 --- a/images/alpine.yaml +++ b/images/alpine.yaml @@ -391,7 +391,7 @@ actions: target=/boot/grub/grub.cfg grub-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" TARGET="x86_64" [ "$(uname -m)" = "aarch64" ] && TARGET="arm64" diff --git a/images/archlinux.yaml b/images/archlinux.yaml index 64a501959..b03497798 100644 --- a/images/archlinux.yaml +++ b/images/archlinux.yaml @@ -809,7 +809,7 @@ actions: grub-install --target="${TARGET}-efi" --efi-directory=/boot/efi --no-nvram --removable grub-install --target="${TARGET}-efi" --efi-directory=/boot/efi --no-nvram grub-mkconfig -o /boot/grub/grub.cfg - sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg # Rebuild initrd sed -i 's#^MODULES=.*#MODULES=(virtio_pci virtio_scsi virtio_console)#' /etc/mkinitcpio.conf diff --git a/images/centos.yaml b/images/centos.yaml index 71978c5b7..201cd6c39 100644 --- a/images/centos.yaml +++ b/images/centos.yaml @@ -413,11 +413,11 @@ actions: # Create grub.cfg file grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" # Update files in /boot/loader/entries/. `grubby` needs to be run after # `grub2-mkconfig` as the latter overwrites files in /boot/loader/entries/. - grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=/dev/sda2 ro" + grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=${LXD_IMAGEBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f diff --git a/images/debian.yaml b/images/debian.yaml index 2cb37d0d9..bfbe01686 100644 --- a/images/debian.yaml +++ b/images/debian.yaml @@ -1386,7 +1386,7 @@ actions: grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram update-grub - sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm diff --git a/images/fedora.yaml b/images/fedora.yaml index 8d343623f..a79e5e1f2 100644 --- a/images/fedora.yaml +++ b/images/fedora.yaml @@ -342,7 +342,7 @@ actions: target=/boot/efi/EFI/fedora/grub.cfg grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" sed -Eri "s#^(linux|initrd) .+/overlay/#\1 /#g" /boot/loader/entries/* sed -ri 's#^options .+#options $kernelopts#g' /boot/loader/entries/* diff --git a/images/gentoo.yaml b/images/gentoo.yaml index 6575d800b..9e2c00226 100644 --- a/images/gentoo.yaml +++ b/images/gentoo.yaml @@ -583,7 +583,7 @@ actions: systemd-machine-id-setup bootctl install --no-variables --esp-path=/boot/efi/ - echo "root=/dev/sda2" >> /etc/kernel/cmdline + echo "root=${LXD_IMAGEBUILDER_ROOT_UUID}" >> /etc/kernel/cmdline echo "sys-apps/systemd kernel-install" >> /etc/portage/package.use/systemd echo "sys-kernel/installkernel dracut systemd systemd-boot" >> /etc/portage/package.use/installkernel @@ -673,7 +673,7 @@ actions: grub-install --target=${TARGET}-efi --no-nvram --removable grub-install --target=${TARGET}-efi --no-nvram grub-mkconfig -o /boot/grub/grub.cfg - sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm variants: diff --git a/images/openeuler.yaml b/images/openeuler.yaml index 1fd5fce50..16422c243 100644 --- a/images/openeuler.yaml +++ b/images/openeuler.yaml @@ -342,7 +342,7 @@ actions: umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" # Workaround for broken systemd in centos7 systemctl enable lxd-agent-workaround.service diff --git a/images/opensuse.yaml b/images/opensuse.yaml index a89b55a77..708be29ec 100644 --- a/images/opensuse.yaml +++ b/images/opensuse.yaml @@ -407,7 +407,7 @@ actions: grub2-mkconfig -o /boot/grub2/grub.cfg umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub2/grub.cfg + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" /boot/grub2/grub.cfg types: - vm diff --git a/images/rockylinux.yaml b/images/rockylinux.yaml index 076222f42..af432cd76 100644 --- a/images/rockylinux.yaml +++ b/images/rockylinux.yaml @@ -343,7 +343,7 @@ actions: dracut --kver "${kver}" -f target="$(readlink -f /etc/grub2-efi.cfg)" grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: @@ -357,10 +357,10 @@ actions: target=/boot/efi/EFI/rocky/grub.cfg # Create grub.cfg file grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" # Update files in /boot/loader/entries/. `grubby` needs to be run after # `grub2-mkconfig` as the latter overwrites files in /boot/loader/entries/. - grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=/dev/sda2 ro" + grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=${LXD_IMAGEBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f types: diff --git a/images/springdalelinux.yaml b/images/springdalelinux.yaml index c688c8f45..05f55dc83 100644 --- a/images/springdalelinux.yaml +++ b/images/springdalelinux.yaml @@ -438,7 +438,7 @@ actions: umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" # Workaround for broken systemd in centos7 systemctl enable lxd-agent-workaround.service @@ -459,7 +459,7 @@ actions: target="$(readlink -f /etc/grub2-efi.cfg)" grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: diff --git a/images/ubuntu.yaml b/images/ubuntu.yaml index fa4baab69..b4e468b96 100644 --- a/images/ubuntu.yaml +++ b/images/ubuntu.yaml @@ -643,7 +643,7 @@ actions: grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram update-grub - sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg + sed -i "s#root=[^ ]*#root=${LXD_IMAGEBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm