I ran into a problem with the console argument handling on a physical system with a BMC (Dell R610) and also reproduced the same behavior on a QEMU/KVM VM with multiple serial ports.
The kernel documentation notes that the last entry will https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-tty
"What: /sys/class/tty/console/active
Shows the list of currently configured console devices, like 'tty1 ttyS0'. The last entry in the file is the active device connected to /dev/console.
The file supports poll() to detect virtual console switches."
The actual behavior is different and the console specified in the last console argument does not become an active one. As a result, SOL functionality is not possible to use unless only one ttyS<n> argument is specified in the kernel command line arguments. Setting the arguments to only contain the right one results in a proper behavior and I can see rx counters increasing in /proc/tty/driver/serial for the relevant port after I type something via the BMC.
# the ones that override /etc/default/grub
$ cat /etc/default/grub.d/50-curtin-settings.cfg
cat: cat: No such file or directory
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200 console=ttyS1,115200"
# disable grub os prober that might find other OS installs.
GRUB_DISABLE_OS_PROBER=true
GRUB_TERMINAL=console
# grub.cfg: http://paste.ubuntu.com/p/zKGTqDh6sR/
# two entries, both with the proper arg and properly sent to the kernel cmdline based on /proc/cmdline
grep ttyS grub.cfg
linux /vmlinuz-4.15.0-42-generic root=UUID=580a3c58-1040-4c7d-b94f-93230874caf5 ro console=tty0 console=ttyS0,115200 console=ttyS1,115200
linux /vmlinuz-4.15.0-42-generic root=UUID=580a3c58-1040-4c7d-b94f-93230874caf5 ro console=tty0 console=ttyS0,115200 console=ttyS1,115200
~~~
I managed to reproduce the exact same behavior on a VM with multiple 8250 serial ports.
ubuntu@maas-vhost5:~$ grep -RP ttyS /boot/grub/grub.cfg
linux /boot/vmlinuz-4.15.0-42-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS0,115200 console=ttyS2,115200 console=ttyS1,115200
linux /boot/vmlinuz-4.15.0-42-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS0,115200 console=ttyS2,115200 console=ttyS1,115200
linux /boot/vmlinuz-4.15.0-39-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS0,115200 console=ttyS2,115200 console=ttyS1,115200
# changed to the following config with only ttyS1 present:
ubuntu@maas-vhost5:~$ grep -RP ttyS /boot/grub/grub.cfg
linux /boot/vmlinuz-4.15.0-42-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS1,115200
linux /boot/vmlinuz-4.15.0-42-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS1,115200
linux /boot/vmlinuz-4.15.0-39-generic root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS1,115200
I ran into a problem with the console argument handling on a physical system with a BMC (Dell R610) and also reproduced the same behavior on a QEMU/KVM VM with multiple serial ports.
The kernel documentation notes that the last entry will /www.kernel. org/doc/ Documentation/ ABI/testing/ sysfs-tty tty/console/ active
https:/
"What: /sys/class/
Shows the list of currently configured console devices, like 'tty1 ttyS0'. The last entry in the file is the active device connected to /dev/console.
The file supports poll() to detect virtual console switches."
https:/ /elixir. bootlin. com/linux/ v4.15.18/ source/ kernel/ printk/ printk. c#L1960
"The last preferred console added will be used for kernel messages and stdin/out/err for init."
The actual behavior is different and the console specified in the last console argument does not become an active one. As a result, SOL functionality is not possible to use unless only one ttyS<n> argument is specified in the kernel command line arguments. Setting the arguments to only contain the right one results in a proper behavior and I can see rx counters increasing in /proc/tty/ driver/ serial for the relevant port after I type something via the BMC.
$ cat /proc/cmdline /vmlinuz- 4.15.0- 42-generic root=UUID= 580a3c58- 1040-4c7d- b94f-93230874ca f5 ro console=tty0 console= ttyS0,115200 console= ttyS1,115200
BOOT_IMAGE=
journalctl -k | grep ttyS /vmlinuz- 4.15.0- 42-generic root=UUID= 580a3c58- 1040-4c7d- b94f-93230874ca f5 ro console=tty0 console= ttyS0,115200 console= ttyS1,115200 /vmlinuz- 4.15.0- 42-generic root=UUID= 580a3c58- 1040-4c7d- b94f-93230874ca f5 ro console=tty0 console= ttyS0,115200 console= ttyS1,115200
Dec 03 21:42:41 ubuntu kernel: Command line: BOOT_IMAGE=
Dec 03 21:42:41 ubuntu kernel: Kernel command line: BOOT_IMAGE=
Dec 03 21:42:41 ubuntu kernel: console [ttyS0] enabled
Dec 03 21:42:41 ubuntu kernel: 00:02: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
Dec 03 21:42:41 ubuntu kernel: 00:03: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
Dec 03 21:42:41 ubuntu kernel: tty ttyS3: hash matches
Full dmesg: http:// paste.ubuntu. com/p/bV2pDc4Hd w/
$ cat /sys/class/ tty/console/ active
ttyS0 tty0
$ sudo cat /proc/tty/ driver/ serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:78 rx:0 RTS|DTR
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
# ...
~~~
GRUB setttings:
# the ones that override /etc/default/grub grub.d/ 50-curtin- settings. cfg LINUX_DEFAULT= "console= tty0 console= ttyS0,115200 console= ttyS1,115200" OS_PROBER= true console
$ cat /etc/default/
cat: cat: No such file or directory
GRUB_CMDLINE_
# disable grub os prober that might find other OS installs.
GRUB_DISABLE_
GRUB_TERMINAL=
/etc/default/grub: https:/ /paste. ubuntu. com/p/sdWQrY7Jw N/
# grub.cfg: http:// paste.ubuntu. com/p/zKGTqDh6s R/ 4.15.0- 42-generic root=UUID= 580a3c58- 1040-4c7d- b94f-93230874ca f5 ro console=tty0 console= ttyS0,115200 console= ttyS1,115200 4.15.0- 42-generic root=UUID= 580a3c58- 1040-4c7d- b94f-93230874ca f5 ro console=tty0 console= ttyS0,115200 console= ttyS1,115200
# two entries, both with the proper arg and properly sent to the kernel cmdline based on /proc/cmdline
grep ttyS grub.cfg
linux /vmlinuz-
linux /vmlinuz-
~~~
I managed to reproduce the exact same behavior on a VM with multiple 8250 serial ports.
ubuntu@ maas-vhost5: ~$ cat /sys/class/ tty/console/ active
ttyS0
ubuntu@ maas-vhost5: ~$ cat /proc/cmdline /boot/vmlinuz- 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS0,115200 console= ttyS2,115200 console= ttyS1,115200
BOOT_IMAGE=
ubuntu@ maas-vhost5: ~$ grep -RP ttyS /boot/grub/grub.cfg 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS0,115200 console= ttyS2,115200 console= ttyS1,115200 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS0,115200 console= ttyS2,115200 console= ttyS1,115200 4.15.0- 39-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS0,115200 console= ttyS2,115200 console= ttyS1,115200
linux /boot/vmlinuz-
linux /boot/vmlinuz-
linux /boot/vmlinuz-
# changed to the following config with only ttyS1 present: maas-vhost5: ~$ grep -RP ttyS /boot/grub/grub.cfg 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS1,115200 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS1,115200 4.15.0- 39-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS1,115200
ubuntu@
linux /boot/vmlinuz-
linux /boot/vmlinuz-
linux /boot/vmlinuz-
# 1 tty passed only maas-vhost5: ~$ cat /proc/cmdline /boot/vmlinuz- 4.15.0- 42-generic root=UUID= a60217c2- 6752-4c69- afb9-55f86a2b6c 1d ro console= ttyS1,115200
ubuntu@
BOOT_IMAGE=
# now it's shown as active maas-vhost5: ~$ cat /sys/class/ tty/console/ active
ubuntu@
ttyS1
ubuntu@ maas-vhost5: ~$ sudo cat /proc/tty/ driver/ serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0 CTS|DSR|CD
1: uart:16550A port:000002F8 irq:3 tx:14763 rx:0 RTS|CTS|DTR|DSR|CD
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 CTS|DSR|CD
~~~~
Relevant code: /elixir. bootlin. com/linux/ v4.15.18/ source/ kernel/ printk/ printk. c#L2379 /elixir. bootlin. com/linux/ v4.15.18/ source/ kernel/ printk/ printk. c#L1916 /elixir. bootlin. com/linux/ v4.15.18/ source/ kernel/ printk/ printk. c#L1961 /elixir. bootlin. com/linux/ v4.15.18/ source/ kernel/ printk/ printk. c#L1886
https:/
https:/
https:/
https:/