Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

port-i386/47566: kernel ignores root device parameter specified in boot loader

7 views
Skip to first unread message

Takahiro HAYASHI

unread,
Feb 14, 2013, 7:30:13 AM2/14/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org
>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 bui...@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
bui...@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

David Young

unread,
Feb 15, 2013, 12:00:26 AM2/15/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: David Young <dyo...@pobox.com>
To: gnats...@NetBSD.org
Cc: port-i386-...@netbsd.org, gnats...@netbsd.org,
netbs...@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
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
dyo...@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--

Takahiro HAYASHI

unread,
Feb 15, 2013, 9:00:03 PM2/15/13
to gnats...@netbsd.org, port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org
hi, thank you for your response.

On Thu, 14 Feb 2013 22:55:49 -0600
David Young <dyo...@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

Takahiro HAYASHI

unread,
Feb 15, 2013, 9:00:24 PM2/15/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: Takahiro HAYASHI <t-h...@abox3.so-net.ne.jp>
To: gnats...@NetBSD.org, port-i386-...@NetBSD.org,
gnats...@NetBSD.org, netbs...@NetBSD.org
Cc:
Subject: Re: port-i386/47566: kernel ignores root device parameter specified in boot loader

David Young

unread,
Feb 19, 2013, 4:30:20 PM2/19/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: David Young <dyo...@pobox.com>
To: gnats...@NetBSD.org
Cc: port-i386-...@netbsd.org, gnats...@netbsd.org,
netbs...@netbsd.org, Takahiro HAYASHI <t-h...@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
Try this,
ftp://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/x86_autoconf.diff

Takahiro HAYASHI

unread,
Feb 19, 2013, 7:01:15 PM2/19/13
to gnats...@netbsd.org, David Young, netbs...@netbsd.org, port-i386-...@netbsd.org, gnats...@netbsd.org, Takahiro HAYASHI
On Tue, 19 Feb 2013 15:29:30 -0600
David Young <dyo...@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

Takahiro HAYASHI

unread,
Feb 19, 2013, 7:05:19 PM2/19/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: Takahiro HAYASHI <t-h...@abox3.so-net.ne.jp>
To: gnats...@NetBSD.org
Cc: David Young <dyo...@pobox.com>, netbs...@NetBSD.org,
port-i386-...@NetBSD.org, gnats...@NetBSD.org,
Takahiro HAYASHI <t-h...@abox3.so-net.ne.jp>
Subject: Re: port-i386/47566: kernel ignores root device parameter specified in boot loader

Izumi Tsutsui

unread,
Apr 28, 2013, 10:20:17 AM4/28/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: Izumi Tsutsui <tsu...@ceres.dti.ne.jp>
To: dyo...@pobox.com, mle...@NetBSD.org
Cc: gnats...@NetBSD.org, tsu...@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 <dyo...@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

Michael van Elst

unread,
Apr 28, 2013, 11:35:13 AM4/28/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: Michael van Elst <mle...@serpens.de>
To: Izumi Tsutsui <tsu...@ceres.dti.ne.jp>
Cc: dyo...@pobox.com, mle...@NetBSD.org, gnats...@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 <dyo...@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: mle...@serpens.de
"A potential Snark may lurk in every tree."

Izumi Tsutsui

unread,
Apr 28, 2013, 12:00:22 PM4/28/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: Izumi Tsutsui <tsu...@ceres.dti.ne.jp>
To: mle...@serpens.de
Cc: dyo...@pobox.com, gnats...@NetBSD.org, tsu...@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

Michael van Elst

unread,
Apr 28, 2013, 4:25:17 PM4/28/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

From: mle...@serpens.de (Michael van Elst)
To: gnats...@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)

tsu...@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.

--

Takahiro HAYASHI

unread,
Jun 30, 2013, 6:38:41 AM6/30/13
to gnats...@netbsd.org, port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org
On Sun, 28 Apr 2013 16:00:12 +0000 (UTC)
Izumi Tsutsui <tsu...@ceres.dti.ne.jp> wrote:

> The following reply was made to PR port-i386/47566; it has been noted by GNATS.
>
> From: Izumi Tsutsui <tsu...@ceres.dti.ne.jp>
> To: mle...@serpens.de
> Cc: dyo...@pobox.com, gnats...@NetBSD.org, tsu...@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

Takahiro HAYASHI

unread,
Jun 30, 2013, 6:40:09 AM6/30/13
to port-i386-...@netbsd.org, gnats...@netbsd.org, netbs...@netbsd.org, Takahiro HAYASHI
The following reply was made to PR port-i386/47566; it has been noted by GNATS.

0 new messages