NetBSD Problem Report #52959

From www@NetBSD.org  Sun Jan 28 17:36:04 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id BE41D7A25E
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 28 Jan 2018 17:36:04 +0000 (UTC)
Message-Id: <20180128173603.804288E1CD@mollari.NetBSD.org>
Date: Sun, 28 Jan 2018 17:36:03 +0000 (UTC)
From: mrrooster@gmail.com
Reply-To: mrrooster@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Current kernel with EFI bootloader fails to find root on dk1 (second gpt part)
X-Send-Pr-Version: www-1.0

>Number:         52959
>Category:       port-amd64
>Synopsis:       Current kernel with EFI bootloader fails to find root on dk1 (second gpt part)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-amd64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 28 17:40:00 +0000 2018
>Closed-Date:    Mon Mar 26 19:29:04 +0000 2018
>Last-Modified:  Tue Mar 27 14:40:01 +0000 2018
>Originator:     Ian Clark
>Release:        current
>Organization:
n/a
>Environment:
NetBSD ohmyno.co.uk 8.99.12 NetBSD 8.99.12 (salome) #3: Sun Jan 28 12:59:42 GMT 2018  ian@ohmyno.co.uk:/usr/src_current/sys/arch/amd64/compile/salome amd64

>Description:
I currently run 8_BETA, booting with EFI, using bootx64.efi.

My root disk is GPT partitioned:

$ sudo gpt show wd0
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34        2014         Unused
        2048      524288      1  GPT part - EFI System
      526336   999688847      2  GPT part - NetBSD FFSv1/FFSv2
  1000215183          32         Sec GPT table
  1000215215           1         Sec GPT header

I boot with 'boot hd0b:netbsd.gz'

On 8_BETA (from last week sometime) everything works okay, the machine boots as expected.

If I boot -current however the machine tries to boot from dk0 rather than dk1 as expected. use -a and specifying dk1 works.

I've replace bootx64.efi with the latest from -current and the problem remains.

However, if I boot a live USB image (from current) and at the boot prompt locate the root dev and boot that (in my case it ends up being hd4) then the machine boots finding dk1 as it should.

I've booted with -x (and also force defined DEBUG_GEOM in x86_autoconf.c) and recorded the dmesg:

Boot from USB (mbr) bootloader: http://tsunami.ohmyno.co.uk/~ian/pr/dmesg_usb_boot.txt
Boot from EFI bootloader: http://tsunami.ohmyno.co.uk/~ian/pr/dmesg_efi_boot.txt


(there's some extra debugging I added at the bottom to work out what device was being passed to 'setroot' in kern_subr.c)
>How-To-Repeat:
Setup NetBSD on a GPT disc, with the first partition as the EFI partition and the second as the NetBSD root partition.

Boot with 'boot hd0b:netbsd' (or similar)

On 8_BETA this should work as expected
On current this fails to find the correct root device.
>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: prlw1@NetBSD.org
State-Changed-When: Wed, 21 Mar 2018 12:41:10 +0000
State-Changed-Why:
Do nonaka's changes to
sys/arch/i386/stand/efiboot/efidisk.c:
     $NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $
sys/arch/i386/stand/efiboot/devopen.c:
     $NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $

fix things for you?


From: Ian Clark <mrrooster@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to
 find root on dk1 (second gpt part)
Date: Fri, 23 Mar 2018 20:14:14 +0000

 Hiya,

 Have tried with a kernel incorporating the changes mentioned....

 sys/arch/i386/stand/efiboot/efidisk.c:
      $NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $
 sys/arch/i386/stand/efiboot/devopen.c:
      $NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $

 However it still finds dk0 on boot rather than the correct dk1.

 Cheers,

 Ian

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to
 find root on dk1 (second gpt part)
Date: Fri, 23 Mar 2018 21:46:56 +0000

 the dmesg URLs seem to be down

From: John Nemeth <jnemeth@cue.bc.ca>
To: gnats-bugs@NetBSD.org, port-amd64-maintainer@netbsd.org,
        gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, mrrooster@gmail.com
Cc: 
Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to find root on dk1 (second gpt part)
Date: Fri, 23 Mar 2018 22:21:58 -0700

 On Mar 23,  8:15pm, Ian Clark wrote:
 }
 } The following reply was made to PR port-amd64/52959; it has been noted by GNATS.
 } 
 } From: Ian Clark <mrrooster@gmail.com>
 } To: gnats-bugs@netbsd.org
 } Cc: 
 } Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to
 }  find root on dk1 (second gpt part)
 } Date: Fri, 23 Mar 2018 20:14:14 +0000
 } 
 }  Have tried with a kernel incorporating the changes mentioned....
 }  
 }  sys/arch/i386/stand/efiboot/efidisk.c:
 }       $NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $
 }  sys/arch/i386/stand/efiboot/devopen.c:
 }       $NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $
 } 
 }  However it still finds dk0 on boot rather than the correct dk1.

      These are changes to the boot loader, not the kernel.  You
 would need to copy a new version of efiboot to your EFI partition.

 }-- End of excerpt from Ian Clark

From: Ian Clark <mrrooster@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to
 find root on dk1 (second gpt part)
Date: Mon, 26 Mar 2018 17:00:23 +0100

 On 24 March 2018 at 05:21, John Nemeth <jnemeth@cue.bc.ca> wrote:
 > On Mar 23,  8:15pm, Ian Clark wrote:
 > }
 > } The following reply was made to PR port-amd64/52959; it has been noted by GNATS.
 > }
 > } From: Ian Clark <mrrooster@gmail.com>
 > } To: gnats-bugs@netbsd.org
 > } Cc:
 > } Subject: Re: port-amd64/52959: Current kernel with EFI bootloader fails to
 > }  find root on dk1 (second gpt part)
 > } Date: Fri, 23 Mar 2018 20:14:14 +0000
 > }
 > }  Have tried with a kernel incorporating the changes mentioned....
 > }
 > }  sys/arch/i386/stand/efiboot/efidisk.c:
 > }       $NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $
 > }  sys/arch/i386/stand/efiboot/devopen.c:
 > }       $NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $
 > }
 > }  However it still finds dk0 on boot rather than the correct dk1.
 >
 >      These are changes to the boot loader, not the kernel.  You
 > would need to copy a new version of efiboot to your EFI partition.
 >
 Well, that seems to have sorted it.

 The latest bootloader now boots the following kernel just fine:

 $ uname -a
 NetBSD ohmyno.co.uk 8.99.14 NetBSD 8.99.14 (salome) #0: Mon Mar 26
 14:54:13 BST 2018

 Cheers everyone! That's marvellous.

 Ian

State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 26 Mar 2018 19:29:04 +0000
State-Changed-Why:
Fixed by nonaka (who was replying to another report).


From: John Nemeth <jnemeth@cue.bc.ca>
To: gnats-bugs@NetBSD.org, port-amd64-maintainer@netbsd.org,
        netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, maya@NetBSD.org,
        mrrooster@gmail.com
Cc: 
Subject: Re: port-amd64/52959 (Current kernel with EFI bootloader fails to find root on dk1 (second gpt part))
Date: Tue, 27 Mar 2018 00:16:15 -0700

 On Mar 26,  7:29pm, maya@NetBSD.org wrote:
 }
 } Synopsis: Current kernel with EFI bootloader fails to find root on dk1 (second gpt part)
 } 
 } State-Changed-From-To: feedback->closed
 } State-Changed-By: maya@NetBSD.org
 } State-Changed-When: Mon, 26 Mar 2018 19:29:04 +0000
 } State-Changed-Why:
 } Fixed by nonaka (who was replying to another report).

      Does this not require a pullup to netbsd-8?

 }-- End of excerpt from maya@NetBSD.org

From: Martin Husemann <martin@duskware.de>
To: John Nemeth <jnemeth@cue.bc.ca>
Cc: gnats-bugs@NetBSD.org, maya@NetBSD.org, mrrooster@gmail.com
Subject: Re: port-amd64/52959 (Current kernel with EFI bootloader fails to
 find root on dk1 (second gpt part))
Date: Tue, 27 Mar 2018 09:53:57 +0200

 On Tue, Mar 27, 2018 at 12:16:15AM -0700, John Nemeth wrote:
 >      Does this not require a pullup to netbsd-8?

 Is this something different than ticket #648 ?

 Martin

From: John Nemeth <jnemeth@cue.bc.ca>
To: Martin Husemann <martin@duskware.de>, John Nemeth <jnemeth@cue.bc.ca>
Cc: gnats-bugs@NetBSD.org, maya@NetBSD.org, mrrooster@gmail.com
Subject: Re: port-amd64/52959 (Current kernel with EFI bootloader fails to find root on dk1 (second gpt part))
Date: Tue, 27 Mar 2018 07:16:38 -0700

 On Mar 27,  9:53am, Martin Husemann wrote:
 } On Tue, Mar 27, 2018 at 12:16:15AM -0700, John Nemeth wrote:
 } >      Does this not require a pullup to netbsd-8?
 } 
 } Is this something different than ticket #648 ?

      Looks like it was included in that ticket.  That was a really
 quick pullup.

 }-- End of excerpt from Martin Husemann

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.