NetBSD Problem Report #47566

From t-hash@abox3.so-net.ne.jp  Thu Feb 14 12:28:39 2013
Return-Path: <t-hash@abox3.so-net.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id CFB5E63EEE0
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 14 Feb 2013 12:28:38 +0000 (UTC)
Message-Id: <201302141019.r1EAJok9026370@ms-omx11.plus.so-net.ne.jp>
Date: Thu, 14 Feb 2013 19:19:49 +0900
From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@gnats.NetBSD.org
Subject: kernel ignores root device parameter specified in boot loader

>Number:         47566
>Category:       port-i386
>Synopsis:       kernel ignores root device parameter specified in boot loader
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 14 12:30:00 +0000 2013
>Last-Modified:  Sun Jun 30 10:40:01 +0000 2013
>Originator:     Takahiro HAYASHI
>Release:        NetBSD 6.99.16 (201301271040Z from nyftp)
>Organization:
>Environment:
System: NetBSD  6.99.16 NetBSD 6.99.16 (MONOLITHIC) #0: Sun Jan 27 17:20:26 UTC 2013  builds@b6.netbsd.org:/home/builds/ab/HEAD/i386/201301271040Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/MONOLITHIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	Recent kernel ignores root device parameter specified in
	boot loader and always boots from hdXa.

	I installed NetBSD/amd64 on wd0a and NetBSD/i386 on wd0f.
	(This pc has one disk, so hd0 is wd0.)
	They are in same MBR partition.  I don't use any dkwedges.
	/boot.cfg on wd0a has following lines:

menu=nbamd64 (hd0a):dev hd0a:;rndseed /var/db/entropy-file;boot
menu=nbi386 (hd0f):dev hd0f:;rndseed /var/db/entropy-file;boot
default=1

	When I choose second line to boot i386, the boot loader loads
	the kenrel from wd0f:/netbsd but the kernel sets the root to wd0a
	because it tries to read 64-bit version of /sbin/init from wd0a
	and complain about it (ENOEXEC), finally stops with error.

11989372+553852+472252 [601344+592200]=0xd8f570
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.99.16 (MONOLITHIC) #0: Sun Jan 27 17:20:26 UTC 2013
        builds@b6.netbsd.org:/home/builds/ab/HEAD/i386/201301271040Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/MONOLITHIC
total memory = 3068 MB
avail memory = 3004 MB
[...snip...]
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
exec /sbin/init: error 8
init: trying /sbin/oinit
exec /sbin/oinit: error 2
init: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init path (default /sbin/init):

>How-To-Repeat:
	1) Carve up a BSD partition other than wd0a, assuming wd0f.
	2) Put kernel on wd0f.
	3) Boot kernel from boot loader by typing "dev hd0f:" and "boot"
>Fix:
	No idea.

--
t-hash

>Audit-Trail:
From: David Young <dyoung@pobox.com>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-i386/47566: kernel ignores root device parameter specified
 in boot loader
Date: Thu, 14 Feb 2013 22:55:49 -0600

 --HzaOE8X7KzPzAQEl
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Thu, Feb 14, 2013 at 12:30:01PM +0000, Takahiro HAYASHI wrote:
 > >Number:         47566
 > >Category:       port-i386
 > >Synopsis:       kernel ignores root device parameter specified in boot loader
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    port-i386-maintainer
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Thu Feb 14 12:30:00 +0000 2013
 > >Originator:     Takahiro HAYASHI
 > >Release:        NetBSD 6.99.16 (201301271040Z from nyftp)
 > >Organization:
 > >Environment:
 > System: NetBSD  6.99.16 NetBSD 6.99.16 (MONOLITHIC) #0: Sun Jan 27 17:20:26 UTC 2013  builds@b6.netbsd.org:/home/builds/ab/HEAD/i386/201301271040Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/MONOLITHIC amd64
 > Architecture: x86_64
 > Machine: amd64
 > >Description:
 > 	Recent kernel ignores root device parameter specified in
 > 	boot loader and always boots from hdXa.
 > 
 > 	I installed NetBSD/amd64 on wd0a and NetBSD/i386 on wd0f.
 > 	(This pc has one disk, so hd0 is wd0.)
 > 	They are in same MBR partition.  I don't use any dkwedges.
 > 	/boot.cfg on wd0a has following lines:

 Does this patch help?

 change 1:

         Use the sizeof() the right thing to compute the length of the
         btinfo_userconfcommands.  This prevents an anonymous (4-bytes long,
         only long enough for the 'len' member) bootinfo_common from being sent
         to the kernel.

 change 2:

         Don't track in add_biosdisk_bootinfo() whether the BTINFO_BOOTWEDGE and
         BTINFO_BOOTDISK bootinfo has been BI_ADD()'d, because the bootloader
         might need to re-BI_ADD() if the bootloader have to try to boot a few
         kernels (netbsd, ..., netbsd.gz) before finding one.

         A better place to protect against BI_ADD()'ing the same BTINFO_* twice
         is in bi_add().

 Dave

 -- 
 David Young
 dyoung@pobox.com    Urbana, IL    (217) 721-9981

 --HzaOE8X7KzPzAQEl
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="i386-stand.patch"

 --- sys/arch/i386/stand/lib/biosdisk.c	2012-09-20 01:03:41.000000000 0000
 +++ sys/arch/i386/stand/lib/biosdisk.c	2012-10-02 23:55:45.000000000 0000
 @@ -694,22 +694,8 @@
  static void
  add_biosdisk_bootinfo(void)
  {
 -	static bool done;
 -
 -	if (bootinfo == NULL) {
 -		done = false;
 -		return;
 -	}
 -	
 -	if (done)
 -		return;
 -
  	BI_ADD(&bi_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
  	BI_ADD(&bi_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
 -
 -	done = true;
 -
 -	return;
  }

  #endif
 --- sys/arch/i386/stand/lib/exec.c	2012-09-20 01:03:41.000000000 0000
 +++ sys/arch/i386/stand/lib/exec.c	2012-10-02 23:57:41.000000000 0000
 @@ -627,7 +627,7 @@
  	count = 0;
  	for (uc = userconf_commands; uc != NULL; uc = uc->uc_next)
  		count++;
 -	len = sizeof(btinfo_userconfcommands) +
 +	len = sizeof(*btinfo_userconfcommands) +
  	      count * sizeof(struct bi_userconfcommand);

  	/* Allocate the userconf commands list */

 --HzaOE8X7KzPzAQEl--

From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
        gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/47566: kernel ignores root device parameter specified in boot loader
Date: Sat, 16 Feb 2013 10:59:41 +0900

 hi, thank you for your response.

 On Thu, 14 Feb 2013 22:55:49 -0600
 David Young <dyoung@pobox.com> wrote:

 > Does this patch help?

 nope.
 I installed patched /boot and bootxx_ffsv2 but the kernel
 on wd0f still mounts wd0a as root partition.

 --
 t-hash

From: David Young <dyoung@pobox.com>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org, Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
Subject: Re: port-i386/47566: kernel ignores root device parameter specified
 in boot loader
Date: Tue, 19 Feb 2013 15:29:30 -0600

 On Sat, Feb 16, 2013 at 02:00:14AM +0000, Takahiro HAYASHI wrote:
 > The following reply was made to PR port-i386/47566; it has been noted by GNATS.
 > 
 > From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
 > To: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
 >         gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: port-i386/47566: kernel ignores root device parameter specified in boot loader
 > Date: Sat, 16 Feb 2013 10:59:41 +0900
 > 
 >  hi, thank you for your response.
 >  
 >  On Thu, 14 Feb 2013 22:55:49 -0600
 >  David Young <dyoung@pobox.com> wrote:
 >  
 >  > Does this patch help?
 >  
 >  nope.
 >  I installed patched /boot and bootxx_ffsv2 but the kernel
 >  on wd0f still mounts wd0a as root partition.

 Try this,
 ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff

 Dave

 -- 
 David Young
 dyoung@pobox.com    Urbana, IL    (217) 721-9981

From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: David Young <dyoung@pobox.com>, netbsd-bugs@NetBSD.org,
        port-i386-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
        Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
Subject: Re: port-i386/47566: kernel ignores root device parameter specified in boot loader
Date: Wed, 20 Feb 2013 09:00:33 +0900

 On Tue, 19 Feb 2013 15:29:30 -0600
 David Young <dyoung@pobox.com> wrote:

 > Try this,
 > ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff

 Woot!
 The kernel with your patch boots from expected partition.

 I revert /boot and bootxx_ffsv2, then boot the new kernel
 with '-a'. It shows certainly wd0f as root dev.
 Thanks again.

 --
 t-hash

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: dyoung@pobox.com, mlelstv@NetBSD.org
Cc: gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-i386/47566: kernel ignores root device parameter specified
	 in boot loader
Date: Sun, 28 Apr 2013 23:15:27 +0900

 > David Young <dyoung@pobox.com> wrote:
 > 
 > > Try this,
 > > ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff
 > 
 > Woot!
 > The kernel with your patch boots from expected partition.
 > 
 > I revert /boot and bootxx_ffsv2, then boot the new kernel
 > with '-a'. It shows certainly wd0f as root dev.
 > Thanks again.

 Is anyone working on this?
 Shouldn't this be committed and pulled up to 6.1?

 ---
 Izumi Tsutsui

From: Michael van Elst <mlelstv@serpens.de>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: dyoung@pobox.com, mlelstv@NetBSD.org, gnats-bugs@NetBSD.org
Subject: Re: port-i386/47566: kernel ignores root device parameter specified
 in boot loader
Date: Sun, 28 Apr 2013 17:32:36 +0200

 On Sun, Apr 28, 2013 at 11:15:27PM +0900, Izumi Tsutsui wrote:
 > > David Young <dyoung@pobox.com> wrote:
 > > 
 > > > Try this,
 > > > ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff
 > > 
 > > Woot!
 > > The kernel with your patch boots from expected partition.
 > > 
 > > I revert /boot and bootxx_ffsv2, then boot the new kernel
 > > with '-a'. It shows certainly wd0f as root dev.
 > > Thanks again.
 > 
 > Is anyone working on this?
 > Shouldn't this be committed and pulled up to 6.1?

 If nobody complains I can commit it.


 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: mlelstv@serpens.de
Cc: dyoung@pobox.com, gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-i386/47566: kernel ignores root device parameter specifiedin
	 boot loader
Date: Mon, 29 Apr 2013 00:56:34 +0900

 > > > > Try this,
 > > > > ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff
 > > > 
 > > > Woot!
 > > > The kernel with your patch boots from expected partition.
 > > > 
 > > > I revert /boot and bootxx_ffsv2, then boot the new kernel
 > > > with '-a'. It shows certainly wd0f as root dev.
 > > > Thanks again.
 > > 
 > > Is anyone working on this?
 > > Shouldn't this be committed and pulled up to 6.1?
 > 
 > If nobody complains I can commit it.

 It seems done by christos@
 http://mail-index.netbsd.org/source-changes/2013/04/28/msg043382.html

 BTW, the submitter said he didn't use wedge but met the problem.
 Does that mean BTINFO_BOOTWEDGE is always setup by /boot for any disks?
 ---
 Izumi Tsutsui

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-i386/47566: kernel ignores root device parameter specifiedin boot loader
Date: Sun, 28 Apr 2013 20:20:12 +0000 (UTC)

 tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) writes:

 > BTW, the submitter said he didn't use wedge but met the problem.
 > Does that mean BTINFO_BOOTWEDGE is always setup by /boot for any disks?

 Yes.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Takahiro HAYASHI <t-hash@abox3.so-net.ne.jp>
To: gnats-bugs@netbsd.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Subject: Re: port-i386/47566: kernel ignores root device parameter specifiedin boot loader
Date: Sun, 30 Jun 2013 16:46:36 +0900

 On Sun, 28 Apr 2013 16:00:12 +0000 (UTC)
 Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> wrote:

 > The following reply was made to PR port-i386/47566; it has been noted by GNATS.
 > 
 > From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
 > To: mlelstv@serpens.de
 > Cc: dyoung@pobox.com, gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
 > Subject: Re: port-i386/47566: kernel ignores root device parameter specifiedin
 > 	 boot loader
 > Date: Mon, 29 Apr 2013 00:56:34 +0900
 > 
 >  > > > > Try this,
 >  > > > > ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff
 >  > > > 
 >  > > > Woot!
 >  > > > The kernel with your patch boots from expected partition.
 >  > > > 
 >  > > > I revert /boot and bootxx_ffsv2, then boot the new kernel
 >  > > > with '-a'. It shows certainly wd0f as root dev.
 >  > > > Thanks again.
 >  > > 
 >  > > Is anyone working on this?
 >  > > Shouldn't this be committed and pulled up to 6.1?
 >  > 
 >  > If nobody complains I can commit it.
 >  
 >  It seems done by christos@
 >  http://mail-index.netbsd.org/source-changes/2013/04/28/msg043382.html

 Could anyone please request pull-up this fix to netbsd-6?


 >  BTW, the submitter said he didn't use wedge but met the problem.
 >  Does that mean BTINFO_BOOTWEDGE is always setup by /boot for any disks?
 >  ---
 >  Izumi Tsutsui
 >  

 --
 t-hash

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.