Ubuntu 26.04: boot with net.ifnames=0 so cloud-init static IPs apply on first boot

This commit is contained in:
steffen committed 2026-11-04 21:49:14 +01:00
1 parent b61de5de22
commit 9da0327faa
1 file changed
+6 -1
+6 -1
View File
@@ -269,8 +269,13 @@ build_template() {
local image="$WORKDIR/build-$id.img" local image="$WORKDIR/build-$id.img"
# The cloud image's root filesystem is only ~2 GB, too small for Docker. # The cloud image's root filesystem is only ~2 GB, too small for Docker.
# Grow the image by 4 GB and the root partition with it before installing. # Grow the image by 4 GB and the root partition with it before installing.
# Classic eth0/eth1 NIC names: Proxmox cloud-init configures eth0..ethN, and
# Ubuntu 26.04 brings NICs up in the initramfs, so cloud-init can't rename them
# later and static IPs never apply on first boot.
local -a customize=(--run-command 'growpart /dev/sda 1 && resize2fs /dev/sda1' local -a customize=(--run-command 'growpart /dev/sda 1 && resize2fs /dev/sda1'
--install qemu-guest-agent) --install qemu-guest-agent
--write '/etc/default/grub.d/99-net-ifnames.cfg:GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT net.ifnames=0 biosdevname=0"'
--run-command 'update-grub')
info "[$id] Preparing image for $name" info "[$id] Preparing image for $name"
cp "$BASE_IMAGE" "$image" cp "$BASE_IMAGE" "$image"