Accesso alla console di emergenzavvvv

A volte potresti voler accedere alla console del nodo per eseguire operazioni di risoluzione dei problemi o manutenzione d’emergenza. Ad esempio, potresti voler accedere alla shell di emergenza sulla console per eseguire il debug di problemi di provisioning al primo avvio.

Configurazione predefinita della console

Tutte le immagini di Fedora CoreOS (FCOS) vengono fornite con una configurazione predefinita per la console, pensata per adattarsi alla maggior parte delle configurazioni virtualizzate e bare-metal. Le versioni precedenti di FCOS abilitavano per default sia le console seriali che grafiche. Le versioni più recenti utilizzano impostazioni predefinite diverse per ciascuna piattaforma cloud e di virtualizzazione e usano le impostazioni predefinite del kernel (tipicamente una console grafica) su bare metal. Le nuove installazioni di Fedora CoreOS adotteranno questi nuovi default a partire dalle release in queste date:

  • next stream: 3 ottobre 2022

  • testing stream: November 28, 2022

  • stable stream: December 12, 2022

The default consoles may not always match your specific hardware configuration. In that case, you can tweak the console setup. Fedora CoreOS has special support for doing this during bare-metal installation, and in other cases you can adjust kernel parameters. Both approaches use kernel argument syntax for specifying the desired consoles. You can specify multiple consoles; kernel messages will appear on all of them, but only the last-specified device will be used as the foreground interactive console (i.e. /dev/console) for the machine.

Configuring the console during bare-metal installation

If you are installing FCOS via coreos-installer, you can configure the console at install time.

Example: Enabling primary serial and secondary graphical console
sudo podman run --pull=always --privileged --rm \
    -v /dev:/dev -v /run/udev:/run/udev -v .:/data -w /data \
    quay.io/coreos/coreos-installer:release \
    install /dev/vdb -i config.ign \
    --console tty0 --console ttyS0,115200n8

This will configure both the GRUB bootloader and the kernel to use the specified consoles.

Configuring the console with Ignition

If you are launching FCOS from an image (in a cloud or a virtual machine), you can use Ignition to configure the console at provisioning time.

Example: Enabling primary serial and secondary graphical console
variant: fcos
version: 1.6.0
kernel_arguments:
  should_exist:
    # Order is significant, so group both arguments into the same list entry.
    - console=tty0 console=ttyS0,115200n8
  should_not_exist:
    # Remove any existing defaults. Adjust as needed.
    - console=hvc0
    - console=tty0
    - console=ttyAMA0,115200n8
    - console=ttyS0,115200n8
    - console=ttyS1,115200n8

This will configure the kernel to use the specified consoles. The GRUB bootloader will continue to use its previous default. Ignition will configure the console, then reboot into the new configuration and continue provisioning the node.

Configuring the console after installation

You can adjust the console configuration of an existing FCOS node via rpm-ostree.

Example: Enabling primary serial and secondary graphical console
sudo rpm-ostree kargs --append=console=tty0 --append=console=ttyS0,115200n8 --reboot

rpm-ostree will create a new deployment with the specified kernel arguments added and reboot into the new configuration. The GRUB bootloader will continue to use its previous default.