After upgrading a serial-console 1.4.x installation to rolling with add system image, the system boots on serial once.
Then the GRUB console order flips and boot output goes to the KVM/VGA console instead of the serial port. The 31-to-32 migration does not add system console device ttyS0 kernel, although the system booted on ttyS0.
Steps to reproduce
- Have 1.4.5 installed alongside a legacy 1.3.x image, booting on serial (console=tty0 console=ttyS0,115200), with system console device ttyS0 speed 115200
- Run: add system image <rolling ISO>
- Reboot (boot 1): still on serial, but the migrated config lacks system console device ttyS0 kernel
- Reboot (boot 2): cmdline is now console=ttyS0,115200 console=tty0, so there is no boot output on serial.
Root cause
The installed legacy 1.3.x image keeps GRUB in compat mode (VYOS_CFG_VER=0), so vyos-grub-update.service rewrites the GRUB vars on every boot, before migration runs. 31-to-32 reads console_type from those vars instead of the console the system booted on, and skips.
Without kernel in the config, the console conf-mode script then writes console_type=tty to the GRUB vars, which flips the console order on the next boot.
Proposed Fix
Only on legacy compat GRUB installs (VYOS_CFG_VER=0), where the GRUB vars are rewritten before migration, 31-to-32 uses the kernel's boot console. It takes the last console= on /proc/cmdline and sets kernel if that is the flavor's serial device and the device is configured. Installs using the new GRUB layout keep the existing GRUB vars logic.