Page MenuHomePhabricator

Image install should put correct serial console device in created grub menuentry
Open, NormalPublicFEATURE REQUEST

Description

On Netgate RCC-VE devices, the console device is on the second UART, ttyS1. This means that the Serial console Grub menuentry needs to look something like this:

menuentry "VyOS 999.201609230235-current (Serial console)" {
        linux /boot/999.201609230235-current/vmlinuz boot=live quiet systemd.show_status=1 vyos-union=/boot/999.201609230235-current console=tty0 console=ttyS1,115200n8
        initrd /boot/999.201609230235-current/initrd.img
}

Every time I do 'add system image' to install a new version, I need to remember to go and hand-edit the added console=ttyS0 parameters to console=ttyS1,115200n8. Otherwise, I don't se anything on the serial console after Grub starts up.

Ideally, the installer would figure out the correct incantations to add to the Grub menuentry by looking at the current running system. The new Jessie-based system's systemd seems able to figure out which device has the serial console, and it starts a getty on it correctly. So, at least the device name is available. For instance, the following two files:

/sys/dev/char/5:1/active and
/sys/devices/virtual/tty/console/active

contain the value tty0 ttyS1 on my system. That does match the two console parameters passed in via Grub. Unfortunately, it doesn't contain the (also necessary) serial port speed. I guess it's a start.

While I'm here, why does each added menuentry contain two console parameters? The KVM versions list console=ttyS0,9600 console=tty0 (or whatever the correct serial console it), while the Serial console versions list console=tty0 console=ttyS1,115200n8. So, it seems like the second one overrides the first. But why include two? (I notice that /opt/vyatta/bin/vyatta-boot-image.pl assumes this two-console-parameter configuration.) So, why not include a single console parameter in each menuentry?

Details

Difficulty level
Normal (likely a few hours)
Version
-

Event Timeline

syncer triaged this task as Normal priority.Aug 1 2017, 5:14 AM
syncer changed the edit policy from "Task Author" to "Custom Policy".
syncer set Version to -.
syncer edited projects, added VyOS 1.2 Crux; removed VyOS 1.1.x (1.1.8).
syncer added a subscriber: dmbaturin.

I think we need address this in installer
@dmbaturin your feedback will be very useful

syncer reassigned this task from syncer to UnicronNL.Nov 3 2017, 12:35 PM
syncer added a subscriber: syncer.

think we need modify installer and ask on install ?

Upon add system image vyos-xxxx.iso, serial speed arguments in Kernel boot parameters are set statically to 9600 baud, no matter what /config/config.boot states.
The culprit seems to be in file /opt/vyatta/sbin/install-image-existing lines 262 to 280, where templates from /opt/vyatta/etc/grub/default-union-grub-entry is used to set up the new grub.cfg. Within the latter file, serial speed is statically set to 9600 baud.

How would package vyatta-cfg-system be altered the best way to support taking config.boot serial console config values into account?

c-po added a subscriber: c-po.Dec 30 2017, 4:27 PM

IMHO the whole serial part should be re-written.

Upon ISO boot the OS should determine the correct serial port (ttyS0 ... ttyS2) and set this into the VyOS running config (which is the one beeing installed during install image). All the scripts changing serial parameters should the query the running config and set the appropriate ports/speed for the OS and also GRUB.

Serial is, sadly, a hard problem, especially on machines that need it most, i.e. those without any graphical console. Since it's impossible to automatically find out the correct port and speed/parity settings, it will always need some manual configuration I suppose.

The best thing to do with those machines right now is to edit the configs before flashing the image to their drive.

syncer changed the subtype of this task from "Task" to "Feature Request".Oct 19 2018, 9:14 AM
pasik added a subscriber: pasik.Mar 12 2019, 6:12 PM
jjakob added a subscriber: jjakob.Aug 31 2019, 6:38 PM

+1 to this. I have VyOS running on several serial-console-only devices (they do have a graphics card on the chipset but it has no connector and is disabled in BIOS).
The console works in GRUB and once fully booted (login screen) but the boot console messages (kernel) still go to the video console. I have console device ttyS0 set in config, but every "install system image" resets the GRUB default entry to KVM console.