diff --git a/images/almalinux.yaml b/images/almalinux.yaml index e83f78b7..7e9dd0ea 100644 --- a/images/almalinux.yaml +++ b/images/almalinux.yaml @@ -409,7 +409,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=${DISTROBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: @@ -424,11 +424,11 @@ actions: # Create grub.cfg file grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${DISTROBUILDER_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=${DISTROBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f diff --git a/images/alpine.yaml b/images/alpine.yaml index 9a3539a5..8ee77cd3 100644 --- a/images/alpine.yaml +++ b/images/alpine.yaml @@ -386,7 +386,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=${DISTROBUILDER_ROOT_UUID}#g" "${target}" TARGET="x86_64" [ "$(uname -m)" = "aarch64" ] && TARGET="arm64" diff --git a/images/archlinux.yaml b/images/archlinux.yaml index 04249a11..4695c0da 100644 --- a/images/archlinux.yaml +++ b/images/archlinux.yaml @@ -796,7 +796,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=${DISTROBUILDER_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 4f3d0e83..63ca4711 100644 --- a/images/centos.yaml +++ b/images/centos.yaml @@ -831,7 +831,7 @@ actions: umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${DISTROBUILDER_ROOT_UUID}#g" "${target}" # Workaround for broken systemd in centos7 systemctl enable incus-agent-workaround.service @@ -852,7 +852,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=${DISTROBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: @@ -867,11 +867,11 @@ actions: # Create grub.cfg file grub2-mkconfig -o "${target}" - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${DISTROBUILDER_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=${DISTROBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f diff --git a/images/debian.yaml b/images/debian.yaml index 7c096a01..09caab77 100644 --- a/images/debian.yaml +++ b/images/debian.yaml @@ -1478,7 +1478,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=${DISTROBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm releases: diff --git a/images/fedora.yaml b/images/fedora.yaml index c046e71d..2c7131b6 100644 --- a/images/fedora.yaml +++ b/images/fedora.yaml @@ -353,7 +353,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=${DISTROBUILDER_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 22371a48..4b3381e2 100644 --- a/images/gentoo.yaml +++ b/images/gentoo.yaml @@ -578,7 +578,7 @@ actions: systemd-machine-id-setup bootctl install --no-variables --esp-path=/boot/efi/ - echo "root=/dev/sda2" >> /etc/kernel/cmdline + echo "root=${DISTROBUILDER_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 @@ -668,7 +668,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=${DISTROBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm variants: diff --git a/images/openeuler.yaml b/images/openeuler.yaml index eb0d4089..8d4304ba 100644 --- a/images/openeuler.yaml +++ b/images/openeuler.yaml @@ -357,7 +357,7 @@ actions: umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${DISTROBUILDER_ROOT_UUID}#g" "${target}" # Workaround for broken systemd in centos7 systemctl enable incus-agent-workaround.service diff --git a/images/opensuse.yaml b/images/opensuse.yaml index 65048339..1dfffb09 100644 --- a/images/opensuse.yaml +++ b/images/opensuse.yaml @@ -409,7 +409,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=${DISTROBUILDER_ROOT_UUID}#g" /boot/grub2/grub.cfg types: - vm diff --git a/images/rockylinux.yaml b/images/rockylinux.yaml index 3edb1303..e8b71ae6 100644 --- a/images/rockylinux.yaml +++ b/images/rockylinux.yaml @@ -360,7 +360,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=${DISTROBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: @@ -374,10 +374,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=${DISTROBUILDER_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=${DISTROBUILDER_ROOT_UUID} ro" # Regenerate initramfs dracut --kver "${kver}" -f types: diff --git a/images/springdalelinux.yaml b/images/springdalelinux.yaml index 4c5636a4..571cf1ea 100644 --- a/images/springdalelinux.yaml +++ b/images/springdalelinux.yaml @@ -431,7 +431,7 @@ actions: umount /sys/firmware - sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}" + sed -i "s#root=[^ ]*#root=${DISTROBUILDER_ROOT_UUID}#g" "${target}" # Workaround for broken systemd in centos7 systemctl enable incus-agent-workaround.service @@ -452,7 +452,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=${DISTROBUILDER_ROOT_UUID}#g" "${target}" types: - vm releases: diff --git a/images/ubuntu.yaml b/images/ubuntu.yaml index 0f6101a6..cb424ef1 100644 --- a/images/ubuntu.yaml +++ b/images/ubuntu.yaml @@ -713,7 +713,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=${DISTROBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg types: - vm