This bug is missing log files that will aid in diagnosing the problem.
While running an Ubuntu kernel (not a mainline or third-party kernel)
please enter the following command in a terminal window:
apport-collect 1807140
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable
to run this command, please add a comment stating that fact and change
the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the
Ubuntu Kernel Team.
** Changed in: linux (Ubuntu)
Status: New => Incomplete
** Tags added: bionic
--
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1807140
Title:
The last console= argument is not used by the kernel
Status in linux package in Ubuntu:
Incomplete
Bug description:
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 be used for
/dev/console
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."
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
BOOT_IMAGE=/vmlinuz-4.15.0-42-generic
root=UUID=580a3c58-1040-4c7d-b94f-93230874caf5 ro console=tty0
console=ttyS0,115200 console=ttyS1,115200
journalctl -k | grep ttyS
Dec 03 21:42:41 ubuntu kernel: Command line:
BOOT_IMAGE=/vmlinuz-4.15.0-42-generic
root=UUID=580a3c58-1040-4c7d-b94f-93230874caf5 ro console=tty0
console=ttyS0,115200 console=ttyS1,115200
Dec 03 21:42:41 ubuntu kernel: Kernel command line:
BOOT_IMAGE=/vmlinuz-4.15.0-42-generic
root=UUID=580a3c58-1040-4c7d-b94f-93230874caf5 ro console=tty0
console=ttyS0,115200 console=ttyS1,115200
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/bV2pDc4Hdw/
$ 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
$ 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
/etc/default/grub: https://paste.ubuntu.com/p/sdWQrY7JwN/
# 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:~$ cat /sys/class/tty/console/active
ttyS0
ubuntu@maas-vhost5:~$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-42-generic
root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS0,115200
console=ttyS2,115200 console=ttyS1,115200
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
# 1 tty passed only
ubuntu@maas-vhost5:~$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-42-generic
root=UUID=a60217c2-6752-4c69-afb9-55f86a2b6c1d ro console=ttyS1,115200
# now it's shown as active
ubuntu@maas-vhost5:~$ cat /sys/class/tty/console/active
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:
https://elixir.bootlin.com/linux/v4.15.18/source/kernel/printk/printk.c#L2379
https://elixir.bootlin.com/linux/v4.15.18/source/kernel/printk/printk.c#L1916
https://elixir.bootlin.com/linux/v4.15.18/source/kernel/printk/printk.c#L1961
https://elixir.bootlin.com/linux/v4.15.18/source/kernel/printk/printk.c#L1886
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1807140/+subscriptions
--
Mailing list: https://launchpad.net/~kernel-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp