Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 857069 - genkernel always sets kernel loglevel to 7
Summary: genkernel always sets kernel loglevel to 7
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-08 20:29 UTC by Bogdan Luca
Modified: 2022-07-08 22:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bogdan Luca 2022-07-08 20:29:24 UTC
At linuxrc:1425-1430 we're (trying to) restoring the kernel loglevel set before the script starts:
---
if ! is_quiet && [[ "${CONSOLE_LOGLEVEL}" != "${GK_CONSOLE_LOGLEVEL}" ]]
then
	good_msg "Restoring console log level (${CONSOLE_LOGLEVEL}) ..."
	echo ${CONSOLE_LOGLEVEL} > /proc/sys/kernel/printk \
		&& log_msg "COMMAND: 'echo \"${CONSOLE_LOGLEVEL}\" > /proc/sys/kernel/printk'"
fi
---

CONSOLE_LOGLEVEL is set at initrd.defaults:54 :
---
CONSOLE_LOGLEVEL=$(cut -b1 /proc/sys/kernel/printk 2>/dev/null || echo 7)
---

The issue is that initrd.defaults is sourced at linuxrc:4, before it mounts /proc at linuxrc:35:
---
. /etc/initrd.defaults
[...]
mount -t proc -o noexec,nosuid,nodev proc /proc >/dev/null 2>&1
---

Because of that "cut -b1 /proc/sys/kernel/printk" fails, and CONSOLE_LEVEL is set to the default value 7.

This was introduced in commit 60ecb8b6d85b70d07e9aacb12771dde7cd86adf3 - "linuxrc: Move global variables to initrd.defaults", which moved setting of console loglevel from linuxrc (after mounting /proc) to initrd.defaults (sourced before mounting /proc).