From 438b057eb3a7029e8aa93430723de43b4ad304b4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 23 Jul 2013 20:43:11 +0200 Subject: [PATCH] Lower the default console log level It used to be set to 7 (debug) so you get lots of crap on the console. The new value of 4 is also what Ubuntu uses. Red Hat uses 3. A nice side effect is that it's more likely that the LUKS passphrase prompt doesn't get clobbered by kernel log messages. --- modules/system/boot/kernel.nix | 15 +++++++++++++++ modules/system/boot/stage-1-init.sh | 1 + 2 files changed, 16 insertions(+) diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 0a67e33ce45..27da9c86995 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -54,6 +54,16 @@ in description = "Additional user-defined kernel parameters."; }; + boot.consoleLogLevel = mkOption { + type = types.int; + default = 4; + description = '' + The kernel console log level. Only log messages with a + priority numerically less than this will appear on the + console. + ''; + }; + boot.vesa = mkOption { default = config.boot.kernelPackages.splashutils != null; example = false; @@ -146,9 +156,14 @@ in system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages; + # Implement consoleLogLevel both in early boot and using sysctl + # (so you don't need to reboot to have changes take effect). boot.kernelParams = + [ "loglevel=${toString config.boot.consoleLogLevel}" ] ++ optionals config.boot.vesa [ "splash=verbose" "vga=0x317" ]; + boot.kernel.sysctl."kernel.printk" = config.boot.consoleLogLevel; + boot.kernelModules = [ "loop" ]; boot.initrd.availableKernelModules = diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 4a13578abcd..e3e07c08580 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -66,6 +66,7 @@ mount -t devtmpfs -o "size=@devSize@" none /dev mkdir -p /run mount -t tmpfs -o "mode=0755,size=@runSize@" none /run + # Process the kernel command line. export stage2Init=/init for o in $(cat /proc/cmdline); do