Write final static netplan during install

This commit is contained in:
Jino Jose 2026-06-25 06:15:04 +05:30
parent 01793ede4e
commit b9aa72f038

View File

@ -7,40 +7,23 @@ autoinstall:
keyboard:
layout: us
# ── Network: apply known-good static defaults ─
# We no longer pause on the installer network screen because Subiquity was
# accepting the IP but dropping the default gateway on console installs.
# Bring the VM up directly on the standard Cezen static network instead.
# ── Network: keep installer boot simple; write final netplan ourselves ─
# Subiquity was repeatedly bringing the target system up without the default
# route, even when the static gateway was supplied. Use DHCP only for the
# installer environment, then write the final static netplan file directly
# into the installed system in late-commands.
network:
network:
version: 2
ethernets:
any-en:
dhcp4: false
dhcp4: true
match:
name: "en*"
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
any-eth:
dhcp4: false
dhcp4: true
match:
name: "eth*"
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
# ── Storage: LVM using ALL disk space ─────────
storage:
@ -80,6 +63,27 @@ autoinstall:
- echo "cezen ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/cezen
- chmod 440 /target/etc/sudoers.d/cezen
# Replace the installer-generated network config with the final static
# Cezen network so the installed system always has the expected route.
- rm -f /target/etc/netplan/50-cloud-init.yaml /target/etc/netplan/00-installer-config.yaml || true
- |
cat > /target/etc/netplan/99-cezen-static.yaml << 'EOF'
network:
version: 2
ethernets:
ens18:
dhcp4: false
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
EOF
# Disable the installer media APT source so post-install apt uses network
# mirrors instead of the custom ISO content.
- sed -i 's/^deb cdrom:/# deb cdrom:/' /target/etc/apt/sources.list || true