Change default boot option with "configure" for Grub

Currently the default boot option is configured by how the user is logged on onto the system that is installing a image. This is a valid way if the administrator is always logged on through an console.

If the user is logged on through ssh, the default option will always be ‘KVM Console’.

As my systems console is also managed through a serial connection, I like to have the system started with ‘Serial console’. For multiple purposes:

  • Not having to many select the correct option at boot;
  • Always see messages, and not only kernel messages when connecting the serial connection.

Line that verifies logged on user: https://github.com/vyos/vyatta-cfg-system/blob/d72aabf2fe33b9a158f93eea04ff619b694ed213/scripts/vyatta-grub-setup#L96C11-L96C20

Line that set based on previous outcome the default boot option: https://github.com/vyos/vyatta-cfg-system/blob/d72aabf2fe33b9a158f93eea04ff619b694ed213/scripts/vyatta-grub-setup#L103

(Not sure if $SUDO_USER ever get set?)

Should be nice to configure this inside vyos configuration:

set system grub console serial|kvm

The problem is how to recover from such misconfiguration other than completely wipe the box (or try to find a usb-drive to boot from)?

I would prefer if this could get resolved so all three outputs (and inputs) could be used at once?

  1. This setting could then be removed (well replaced).

  2. It doesnt matter if you connect to /dev/ttyS0, /dev/ttyUSB0 or the local keyboard+video output - all three options works without rebooting or changing configuration.