Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed hardcoded root partition device name sda2 #822

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions images/almalinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/alpine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion images/archlinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions images/centos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion images/fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
4 changes: 2 additions & 2 deletions images/gentoo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion images/openeuler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/opensuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions images/rockylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions images/springdalelinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading