[Bug 1807140] Re: The last console= argument is not used by the kernel

2019-07-24 Thread Brad Figg
** Tags added: cscc

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1807140

Title:
  The last console= argument is not used by the kernel

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1807140/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1807140] Re: The last console= argument is not used by the kernel

2018-12-06 Thread Dmitrii Shcherbakov
The information above is from a VM with a reproducer.

** Changed in: linux (Ubuntu)
   Status: Incomplete => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1807140

Title:
  The last console= argument is not used by the kernel

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1807140/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1807140] Re: The last console= argument is not used by the kernel

2018-12-06 Thread Dmitrii Shcherbakov
apport information

** Tags added: apport-collected uec-images

** Description changed:

  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 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:03F8 irq:4 tx:78 rx:0 RTS|DTR
  1: uart:16550A port:02F8 irq:3 tx:0 rx:0 CTS|DSR|CD
  2: uart:unknown port:03E8 irq:4
  3: uart:unknown port:02E8 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-55f86a2

[Bug 1807140] Re: The last console= argument is not used by the kernel

2018-12-06 Thread Dmitrii Shcherbakov
** Description changed:

  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 
+ 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."
+  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 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 
+ $ 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:03F8 irq:4 tx:78 rx:0 RTS|DTR
  1: uart:16550A port:02F8 irq:3 tx:0 rx:0 CTS|DSR|CD
  2: uart:unknown port:03E8 irq:4
  3: uart:unknown port:02E8 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
- 
+ 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.
+ 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 
+ 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-4c6