Summary: | sys-kernel/genkernel-3.4.47 does not output to serial console | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Matthew Thode ( prometheanfire ) <prometheanfire> |
Component: | genkernel | Assignee: | Gentoo Genkernel Maintainers <genkernel> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Matthew Thode ( prometheanfire )
![]() ![]() ![]() ![]() To properly fix this, we need to make every thing in the linuxrc/initramfs scope write to ALL consoles and take input from all consoles. Dracut and other systems can do this I think, so it's just a matter of figuring out HOW they do it, and replicating it in genkernel. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f49a899ce13f9e41bdf592187e0d157b071bf82d commit f49a899ce13f9e41bdf592187e0d157b071bf82d Author: Thomas Deutschmann <whissi@gentoo.org> AuthorDate: 2019-08-06 15:43:40 +0000 Commit: Thomas Deutschmann <whissi@gentoo.org> CommitDate: 2019-08-06 20:40:32 +0000 linuxrc: Fix console support - Make sure we set console after processing CMDLINE so that we will use last set console which matches kernel documentation. - Strip any set option from console= value. - Regain control after spawning a shell. Bug: https://bugs.gentoo.org/473128 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> defaults/initrd.scripts | 15 ++++++++++++--- defaults/linuxrc | 25 +++++++++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) Serial console should now work in >=sys-kernel/genkernel-4.0.0_beta11. Please file a new bug if you still experience problems. Let me add some additional information to this bug in case this will ever come up again: (In reply to Robin Johnson from comment #1) > To properly fix this, we need to make every thing in the linuxrc/initramfs > scope write to ALL consoles and take input from all consoles. > > Dracut and other systems can do this I think, so it's just a matter of > figuring out HOW they do it, and replicating it in genkernel. No! This is not possible -- at least by default: Kernel code which calls printk() will write to a buffer. Any console which will get added to /dev/console will receive this buffer. This is handled by the kernel. User space will only write to the so called "preferred console" aka CONSDEV (console which show up with "C" in /proc/consoles for example). By default, the last set console becomes the preferred console. Going back to Matthew's example (console=tty0 console=ttyS0,115200 console=ttyS2,115200) that means that he will get kernel output on tty0, ttyS0 and ttyS2 BUT ttyS2 will become the CONSDEV (preferred console). So cryptsetup will prompt to enter LUKS passphrase on ttyS2. If he wants to use tty0, he will have to change order of console kernel command-line arguments (=putting console=tty0 last). Same is true for genkernel's initramfs output (or for OpenRC/systemd when real system will take control) -- tty0 and ttyS0 will not show it. Only preferred console ttyS2 will get it. It's not possible to output to or receive input from multiple consoles at the same time. There's a misunderstanding that systemd is capable of doing that, see https://github.com/systemd/systemd/issues/3403#issuecomment-239690447 -- but notice that the quote is missing the important end from original comment, > echo foo > /dev/console" still goes to serial only, though So what's happening here? Some distributions are shipping systemd (dracut) with plymouth for example which will 'mirror' output to all registered consoles. Debian did this even for sysvinit in the past via https://salsa.debian.org/debian/sysvinit/-/blob/a4f7babb3e09d3ff8b65e1612df9e6d59369316e/debian/patches/96_allow_multiple_console_output.patch as part of https://bugs.debian.org/181756 (SuSE did something similar with their blogd). A good summary with additional references is https://github.com/systemd/systemd/issues/9899. |