[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#793786: marked as done (initramfs-tools: fix the broken netconsole feature in initramfs-tools)



Your message dated Tue, 12 Jan 2016 20:20:19 +0900
with message-id <CAEQ9gEneKu-o4Vtt2TnSrH+2yFLDcg=sw2OG7yiDd+LQwsGzPg@mail.gmail.com>
and subject line Re: Bug#793786: initramfs-tools: fix the broken netconsole feature in initramfs-tools
has caused the Debian Bug report #793786,
regarding initramfs-tools: fix the broken netconsole feature in initramfs-tools
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
793786: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793786
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: initramfs-tools
Version: 0.120
Severity: normal
Tags: patch

Dear Maintainer,

Currently there're a few issues on netconsole support in initramfs-tools:

- netconsole setting (param to kernel module) can only be set in 
/etc/initramfs-tools/modules, but not from the expected kernel command line
- debug info of initramfs-tools can be outputed to local console or saved 
to local file, which is inconvient for embeded system when the boot fails 
and there's neither console or serial console

So here's the two patches to fix them.
Please help to merge. Thank you!

Cheers,
Roger

-- Package-specific info:
-- /proc/cmdline
console=ttyS0,115200 earlyprintk netconsole=@192.168.11.150/,6666@192.168.11.1/ root=/dev/md2 initrd=0x00800040,12M panic=5 BOOTVER=0.21 mtdparts=nand_mtd:0x1000000(boot),0xfe800000(rootfs),0x800000(reserve) debug

-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'unstable'), (1, 'experimental')
Architecture: armel (armv5tel)

Kernel: Linux 4.0.0-2-kirkwood
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages initramfs-tools depends on:
ii  cpio         2.11+dfsg-4.1
ii  klibc-utils  2.0.4-2
ii  kmod         18-3
ii  udev         215-17+deb8u1

Versions of packages initramfs-tools recommends:
pn  busybox | busybox-initramfs | busybox-static  <none>

Versions of packages initramfs-tools suggests:
ii  bash-completion  1:2.1-4

-- no debconf information
>From 28ed0a7df830882641c0984bf78b442b120f822d Mon Sep 17 00:00:00 2001
From: Roger Shimizu <rogershimizu@gmail.com>
Date: Mon, 27 Jul 2015 22:19:20 +0900
Subject: [PATCH 1/2] advance the timing of insmod netconsole

Insmod netconsole before calling "load_modules" routine, which loads
all specified modules. Because "load_modules" merely uses the module
param in /etc/initramfs-tools/modules.
This makes it possible to set netconsole param in command line options.

Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
---
 init | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/init b/init
index abf7f25..0497c67 100755
--- a/init
+++ b/init
@@ -200,11 +200,10 @@ run_scripts /scripts/init-top
 
 maybe_break modules
 [ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
+[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
 load_modules
 [ "$quiet" != "y" ] && log_end_msg
 
-[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
-
 maybe_break premount
 [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
 run_scripts /scripts/init-premount
-- 
2.1.4

>From 06af4e4a7f547d36add461496be1387eca5f7200 Mon Sep 17 00:00:00 2001
From: Roger Shimizu <rogershimizu@gmail.com>
Date: Mon, 27 Jul 2015 22:44:46 +0900
Subject: [PATCH 2/2] redirect debug info to netconsole

Redirect if debug and netconsole are both set in command line options.
The redirecting code is added in both debug and netconsole entry to
make the redirection as early as possible.
Debug info saving to file feature is still available if not set
netconsole in command line options.

Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
---
 init | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/init b/init
index 0497c67..96f1635 100755
--- a/init
+++ b/init
@@ -146,7 +146,11 @@ for x in $(cat /proc/cmdline); do
 	debug)
 		debug=y
 		quiet=n
-		exec >/run/initramfs/initramfs.debug 2>&1
+		if [ -n "${netconsole}" ]; then
+			exec >/dev/kmsg 2>&1
+		else
+			exec >/run/initramfs/initramfs.debug 2>&1
+		fi
 		set -x
 		;;
 	debug=*)
@@ -165,6 +169,7 @@ for x in $(cat /proc/cmdline); do
 		;;
 	netconsole=*)
 		netconsole=${x#netconsole=}
+		[ "x$debug" = "xy" ] && exec >/dev/kmsg 2>&1
 		;;
 	BOOTIF=*)
 		BOOTIF=${x#BOOTIF=}
-- 
2.1.4


--- End Message ---
--- Begin Message ---
On Mon, Jan 11, 2016 at 10:19 AM, Ben Hutchings <ben@decadent.org.uk> wrote:
> On Mon, 2016-01-11 at 09:54 +0900, Roger Shimizu wrote:
>> On Mon, Jan 11, 2016 at 8:13 AM, Ben Hutchings <ben@decadent.org.uk> wrote:
>> > On Sun, 2016-01-10 at 16:20 +0900, Roger Shimizu wrote:
>> > > I find current v2 patch will sometimes fail because it load netconsole.ko before
>> > > loading network driver.
>> >
>> > So maybe we should run 'udevadm settle' before loading modules?
>>
> --- a/init
> +++ b/init
> @@ -207,6 +207,7 @@ run_scripts /scripts/init-top
>
>  maybe_break modules
>  [ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
> +udevadm settle  # make sure network drivers are loaded
>  [ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
>  load_modules
>  [ "$quiet" != "y" ] && log_end_msg
> --- END ---
>
> It won't be reliable for USB networking, but I think that's inevitable.

Enclosed is the log before/after your patch, for Case C (MODULES=most).

I didn't notice "udevadm settle" command, but after checking the log,
I find before this patch's "udevadm settle", there're already another
2 "udevadm settle" calling before that, and network driver is already
loaded before load netconsole / other kernel modules.
I guess the issue I met was related to driver initialization timing,
that sometimes netconsole need to wait for some time for network
driver getting ready, is rare case.

>> > > I made some changes based on patch v3, can confirmed various scenarios,
>> > > including "MODULES=most" you mentioned. So here's patch v4.

In general, current implementation (already committed into master)
works well, so I don't request to merge my "v4 patch" any more.

Sorry about the noise.

>> > The kernel parameter should be preferred if both are specified.  (In
>> > general, the most specific configuration source should take
>> > precedence.)
>>
>> Yes, I agree.
>> I meant if both are *same* specific level, param from conf/modules
>> will be preferred.
>> It's what's the test case A2 for.
>
> The kernel paramater is more specific, because that is something the
> user can (usually) edit at boot time.

For PC, it's quite convenient to re-write boot command in grub, but I
meet difficulties on embedded devices.
Quite a few Linkstation boxes don't have serial console, that's why I
rely on netconsole and spend much time on debugging / fixing it.
Being lack of serial console means it's not possible to change u-boot
variables before loading kernel.
Yes, u-boot variables can be modified by tools in u-boot-tools
package, but if you made something wrong, the boxes may be bricked for
ever (due to lack of serial console).

I understand your point, it's for most ppl's use case, so I agree to
keep initramfs-tools as it is, until we find a better solution.

Cheers,
Roger

Attachment: netconsole_log3.tar.gz
Description: GNU Zip compressed data


--- End Message ---

Reply to: