Howto serial console on fedora coreos

I need help to setup serial console on my fedora coreOS 41 server to remove monitor and keyboard.
This is current kernel grub entry:

root@mostro:~# cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt3)/boot/ostree/fedora-coreos-717f957fb4680546cce36bc1c5e633abdbf5e4ecb6e99e5665df3c00a56088fa/vmlinuz-6.11.6-300.fc41.x86_64 rw mitigations=auto,nosmt ostree=/ostree/boot.1/fedora-coreos/717f957fb4680546cce36bc1c5e633abdbf5e4ecb6e99e5665df3c00a56088fa/0 ignition.platform.id=metal root=UUID=e4b61129-1606-4208-b509-9e717fa77f8d rw rootflags=prjquota boot=UUID=43f98951-15bc-4466-9909-d9982fab214c

See Emergency console access :: Fedora Docs

1 Like

Emergency console works great thanks!

But I am missing the grub menu on the serial console. I understand I have to add the following in the grub config:

serial --unit=0 --speed=115200
terminal --timeout=5 serial console

Problem is that I dont have a /etc/default/grub file; probably due to this:

So how can I do that?

Fedora CoreOS 41.20241109.3.0
Kernel 6.11.6-300.fc41.x86_64 on an x86_64 (ttyS0)

I’m not sure I fully understand what you’re asking. Would you please try to describe it in more detail? In the meantime, you can take a look at /etc/default/grub is missing on Silverblue 41 fresh install.

I read the article ^^ but what is mentioned there to create a new file: /boot/grub2/user.cfg canot work for me:
root@mostro:/boot/grub2# touch user.cfg
touch: cannot touch ‘user.cfg’: Read-only file system

So back to square 0:

  • my whish is to enable grub menu on the serial console
  • this is achieved by configuring this grub parameters:
serial --unit=0 --speed=115200
terminal --timeout=5 serial console
  • in which file should I enter them?

Have you tried Configuring the console after installation?

Instructions from the docs – link from the previous line:

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.

1 Like

Yes that works perfectly, but doesnt cover GRUB as the document also says.
GRUB needs this two lines of config ^^ which I dont know in which file should go

Maybe try re-provisioning with the appropriate install/ignition config?

by re-provisioning means scrap the server and fresh reinstall?
If that the case I would really keep it as very last option

If your data is stored under a persistent /var, it will not be affected by system upgrades or re-provisioning unless you have explicitly configured it.

FWIW, there are people who run Fedora CoreOS entirely from RAM, so with each update (release), which is every two weeks, they effectively re-provision their systems.

You can remount /boot read write to make changes: mount -o remount,rw /boot

2 Likes

Ok, I did change /boot filesystem to rw and created the file; but now it fails the grub2-mkconfig:

root@mostro:~# grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of `composefs'.
root@mostro:~# cat /boot/grub2/user.cfg 
serial --unit=0 --speed=115200
terminal --timeout=10 serial console

Any idea how to make new config effective?

As far as I know, the GRUB config is now a static config in Fedora CoreOS, so you probably don’t need the grub2-mkconfig step. Since you have already created/modified /boot/grub2/user.cfg just reboot to check if it will work.

tried different combination of user.cfg and also adding the same directly in grub.cfg but no avail. Out of options now.
Shall I open a bugzilla?
What is the procedure to open a bug for fedora coreOs

root@mostro:/boot/grub2# cat user.cfg 
set timeout=10
insmod serial
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal serial

Not sure if this is Fedora CoreOS related, as setting set timeout=10 works. Unfortunately I don’t have the necessary equipment to test the serial console settings.

As I mentioned in my previous post, unfortunately I don’t have the necessary equipment to test the serial console settings on a bare metal machine. However, it seems to work on a virtual machine.

These are the steps I followed to test it:

hricky@silverblue >_ ssh core@fcos-22.local
Fedora CoreOS 41.20241215.1.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/tag/coreos

Last login: Sun Dec 22 17:26:27 2024

core@fcos-22:~$ sudo systemctl enable --now serial-getty@ttyS0.service

core@fcos-22:~$ sudo systemctl status serial-getty@ttyS0.service
● serial-getty@ttyS0.service - Serial Getty on ttyS0
     Loaded: loaded (/usr/lib/systemd/system/serial-getty@.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf, 50-keep-warm.conf
             /etc/systemd/system/serial-getty@ttyS0.service.d
             └─autologin-core.conf
     Active: active (running) since Sun 2024-12-22 17:28:27 UTC; 19min ago
 Invocation: 9be31e06612448498bdcecbe5ca4a7cd
       Docs: man:agetty(8)
             man:systemd-getty-generator(8)
             https://0pointer.de/blog/projects/serial-console.html
   Main PID: 1872 (login)
      Tasks: 0 (limit: 2233)
     Memory: 3M (peak: 6M)
        CPU: 15ms
     CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttyS0.service
             ‣ 1872 "login -- core"

Dec 22 17:28:27 fcos-22.local systemd[1]: Started serial-getty@ttyS0.service - Serial Getty on ttyS0.

core@fcos-22:~$ sudo cat /boot/grub2/user.cfg
set timeout=3
serial --unit=0 --speed=115200
terminal --timeout=5 serial console
core@fcos-22:~$ cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt3)/ostree/fedora-coreos-95a91f4f5971d467d3caaf85afac74cdd30139f4b6c2ef90367d8b6d04f7a803/vmlinuz-6.11.11-300.fc41.x86_64 mitigations=auto,nosmt ignition.platform.id=qemu console=tty0 console=ttyS0,115200n8 ostree=/ostree/boot.1/fedora-coreos/95a91f4f5971d467d3caaf85afac74cdd30139f4b6c2ef90367d8b6d04f7a803/0 root=UUID=8b1a17fe-b66e-41da-990a-5ff9e1b259fb rw boot=UUID=b83eb0d3-0838-4f7a-b153-58a97e2ea04a
core@fcos-22:~$ who --all
           system boot  2024-12-22 17:28
           run-level 3  2024-12-22 17:28
core     + ttyS0        2024-12-22 17:28 00:29        1872
LOGIN      tty1         2024-12-22 17:28              1871 id=tty1
core     + pts/0        2024-12-22 17:29   .          2002 (192.168.122.1)
           pts/1        2024-12-22 17:59              2238 id=ts/1  term=0 exit=0
hricky@silverblue >_ sudo virsh console --domain fcos-vm-ansible-22
Connected to domain 'fcos-vm-ansible-22'
Escape character is ^] (Ctrl + ])

[core@fcos-22 ~]$ who --all
           system boot  2024-12-22 18:03
           run-level 3  2024-12-22 18:03
LOGIN      tty1         2024-12-22 18:03              1872 id=tty1
core     + ttyS0        2024-12-22 18:03   .          1873
core     + pts/0        2024-12-22 18:04 00:05        2007 (192.168.122.1)
[core@fcos-22 ~]$ 

Hristo, tty access works for me as well.
What doesn’t work for me is getting the GRUB menu on the serial console.
Would you mind checking if you can get the GRUB menu via serial in your setup


can you tell me what sudo bootupctl status shows on your system? I wonder if this might be a case where the grub.cfg on your system is older and won’t pick up changes to user.cfg.

Another way to tell is, are you able to reproduce the issue on a freshly installed system?

Yes, I can.

In fact, if I completely screw up one of my VM deployments, I can always get into the GRUB menu (without making any configuration modifications) with the following commands:

sudo virsh destroy --graceful --remove-logs --domain fcos-vm-ansible-22
sudo virsh start --console --domain fcos-vm-ansible-22

Here is mine for reference.

core@fcos-22:~$ sudo bootupctl -vvvvv status
[TRACE bootupd] executing cli
Running as unit: bootupd.service
[TRACE bootupd] executing cli
[TRACE bootupd::bootupd] Gathering status for installed component: EFI
[DEBUG bootupd::efi] Unmounting
[TRACE bootupd::bootupd] Remaining known components: 1
[TRACE bootupd::component] Adoptable: ContentMetadata { timestamp: 2024-02-07T15:05:14.458Z, version: "39.20240128.1.1" }
Component EFI
  Installed: grub2-efi-x64-1:2.06-110.fc39.x86_64,shim-x64-15.6-2.x86_64
  Update: Available: grub2-efi-x64-1:2.12-15.fc41.x86_64,shim-x64-15.8-3.x86_64
Detected: BIOS: 39.20240128.1.1
CoreOS aleph version: 39.20240128.1.1
Boot method: BIOS