NetBSD Problem Report #54480

From www@netbsd.org  Sun Aug 18 12:52:51 2019
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 5E62A7A176
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 18 Aug 2019 12:52:51 +0000 (UTC)
Message-Id: <20190818125250.852807A1E8@mollari.NetBSD.org>
Date: Sun, 18 Aug 2019 12:52:50 +0000 (UTC)
From: venture37@geeklan.co.uk
Reply-To: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Subject: sysinst attempts to mount wrong disk
X-Send-Pr-Version: www-1.0

>Number:         54480
>Category:       install
>Synopsis:       sysinst attempts to mount wrong disk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 18 12:55:00 +0000 2019
>Closed-Date:    Sun Sep 08 09:13:08 +0000 2019
>Last-Modified:  Wed Oct 23 06:35:01 +0000 2019
>Originator:     Sevan Janiyan
>Release:        HEAD
>Organization:
>Environment:
NetBSD 9.99.9 i386 i386
>Description:
I have a i386 system with a CF card attached via USB multicard reader. CF card appears as sd1.
Running sysinst and choosing to upgrade the sd1 disk fails as it attempts to mount wd0 to /targetroot

The multicard reader presents several sd(4) devices which represents the different media slots.
sd0 is the sd card slot on this device but it's marked as drive offline. sd1 is the CF card slot.
>How-To-Repeat:
Attempt to perform an upgrade on a system with active devices numbered non-sequentially.
>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/54480: sysinst attempts to mount wrong disk
Date: Sun, 18 Aug 2019 16:41:46 +0200

 On Sun, Aug 18, 2019 at 12:55:00PM +0000, venture37@geeklan.co.uk wrote:
 > Attempt to perform an upgrade on a system with active devices numbered non-sequentially.

 That is not enough to reproduce it, please provide more details:
 fdisk -v and disklabel -r output for all disk devices, rough sketch of
 menu selections used (but that is pretty obvious in this case).

 The most important point is: as what device sees the "native" system
 on the sd card you are trying to upgrade the disk device, i.e. how is it
 called in that systesm etc/fstab?

 My bet would be on wd0.

 Martin

From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/54480: sysinst attempts to mount wrong disk
Date: Sun, 18 Aug 2019 15:55:47 +0100

 Taken from the native system:

 # NetBSD /etc/fstab
 /dev/wd0a               /       ffs     rw,log           1 1

 alix# fdisk -v wd0
 Disk: /dev/rwd0
 NetBSD disklabel disk geometry:
 cylinders: 3970, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
 total sectors: 4001760, bytes/sector: 512

 BIOS disk geometry:
 cylinders: 992, heads: 64, sectors/track: 63 (4032 sectors/cylinder)
 total sectors: 3999744

 Partitions aligned to 4032 sector boundaries, offset 63

 Partition table:
 0: NetBSD (sysid 169)
     start 63, size 4001697 (1954 MB, Cyls 0/1/1-992/31/63), Active
         beg: cylinder    0, head   1, sector  1
         end: cylinder  992, head  31, sector 63
         PBR appears to be bootable
 1: <UNUSED>
 2: <UNUSED>
 3: <UNUSED>
 Bootselector disabled.
 First active partition: 0
 Drive serial number: 0 (0x00000000)



 alix# disklabel wd0

 # /dev/rwd0:
 type: unknown
 disk: USB CF Reader
 label:
 flags:
 bytes/sector: 512
 sectors/track: 63
 tracks/cylinder: 16
 sectors/cylinder: 1008
 cylinders: 3970
 total sectors: 4001760
 rpm: 3600
 interleave: 1
 trackskew: 0
 cylinderskew: 0
 headswitch: 0           # microseconds
 track-to-track seek: 0  # microseconds
 drivedata: 0

 16 partitions:
 #        size    offset     fstype [fsize bsize cpg/sgs]
  a:   3475584        63     4.2BSD   2048 16384     0  # (Cyl.      0*-
   3448*)
  b:    526113   3475647       swap                     # (Cyl.   3448*-
   3969)
  c:   4001697        63     unused      0     0        # (Cyl.      0*-
   3969)
  d:   4001760         0     unused      0     0        # (Cyl.      0 -
   3969)


 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 2018, 2019 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 9.99.9 (GENERIC) #0: Sat Aug 17 09:44:01 UTC 2019
         mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC
 total memory = 255 MB
 avail memory = 229 MB
 timecounter: Timecounters tick every 10.000 msec
 Kernelized RAIDframe activated
 running cgd selftest aes-xts-256 aes-xts-512 done
 timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
 Generic PC
 mainbus0 (root)
 Firmware Error (ACPI): A valid RSDP was not found (20190405/tbxfroot-261)
 autoconfiguration error: acpi_probe: failed to initialize tables
 ACPI Error: Could not remove SCI handler (20190405/evmisc-312)
 cpu0 at mainbus0
 cpu0: Geode(TM) Integrated Processor by AMD PCS, id 0x5a2
 cpu0: package 0, core 0, smt 0
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
 pchb0 at pci0 dev 1 function 0: vendor 1022 product 2080 (rev. 0x31)
 glxsb0 at pci0 dev 1 function 2: RNG AES
 vr0 at pci0 dev 9 function 0: vendor 1106 product 3053 (rev. 0x96)
 vr0: interrupting at irq 10
 vr0: Ethernet address 00:0d:b9:
 ukphy0 at vr0 phy 1: OUI 0x0002c6, model 0x0034, rev. 3
 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 vr1 at pci0 dev 10 function 0: vendor 1106 product 3053 (rev. 0x96)
 vr1: interrupting at irq 11
 vr1: Ethernet address 00:0d:b9:
 ukphy1 at vr1 phy 1: OUI 0x0002c6, model 0x0034, rev. 3
 ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 vr2 at pci0 dev 11 function 0: vendor 1106 product 3053 (rev. 0x96)
 vr2: interrupting at irq 15
 vr2: Ethernet address 00:0d:b9:
 ukphy2 at vr2 phy 1: OUI 0x0002c6, model 0x0034, rev. 3
 ukphy2: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 ath0 at pci0 dev 12 function 0: Atheros 5212
 ath0: interrupting at irq 9
 ath0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
 ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
 ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps
 24Mbps 36Mbps 48Mbps 54Mbps
 ath0: mac 5.6 phy 4.1 5 GHz radio 1.7 2 GHz radio 2.3
 gcscpcib0 at pci0 dev 15 function 0: vendor 1022 product 2090 (rev. 0x03)
 timecounter: Timecounter "gcscpcib0" frequency 3579545 Hz quality 1000
 gcscpcib0: Watchdog Timer via MFGPT0, GPIO
 gpio0 at gcscpcib0: 32 pins
 viaide0 at pci0 dev 15 function 2: AMD CS5536 IDE Controller (rev. 0x01)
 viaide0: bus-master DMA support present
 viaide0: primary channel wired to compatibility mode
 viaide0: primary channel interrupting at irq 14
 atabus0 at viaide0 channel 0
 viaide0: secondary channel wired to compatibility mode
 viaide0: secondary channel ignored (disabled)
 ohci0 at pci0 dev 15 function 4: vendor 1022 product 2094 (rev. 0x02)
 ohci0: interrupting at irq 12
 ohci0: OHCI version 1.0, legacy support
 usb0 at ohci0: USB revision 1.0
 gcscehci0 at pci0 dev 15 function 5: vendor 1022 product 2095 (rev. 0x02)
 gcscehci0: interrupting at irq 12
 gcscehci0: EHCI version 1.0
 gcscehci0: 1 companion controller, 4 ports: ohci0
 usb1 at gcscehci0: USB revision 2.0
 isa0 at gcscpcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 com0: console
 com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
 attimer0 at isa0 port 0x40-0x43
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 isapnp0 at isa0 port 0x279
 attimer0: attached to pcppi0
 isapnp0: no ISA Plug 'n Play devices found
 timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
 uhub0 at usb0: NetBSD (0000) OHCI root hub (0000), class 9/0, rev
 1.00/1.00, addr 1
 uhub0: 4 ports with 4 removable, self powered
 uhub1 at usb1: NetBSD (0000) EHCI root hub (0000), class 9/0, rev
 2.00/1.00, addr 1
 uhub1: 4 ports with 4 removable, self powered
 IPsec: Initialized Security Association Processing.
 wd0 at atabus0 drive 0
 wd0: <SanDisk SDCFH2-2048>
 wd0: drive supports 4-sector PIO transfers, LBA addressing
 wd0: 1953 MB, 3970 cyl, 16 head, 63 sec, 512 bytes/sect x 4001760 sectors
 wd0: 32-bit data port
 wd0: drive supports PIO mode 4, DMA mode 2
 wd0(viaide0:0:0): using PIO mode 4, DMA mode 2 (using DMA)
 WARNING: 1 error while detecting hardware; check system log.
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 kern.module.path=/stand/i386/9.99.9/modules
 clock: unknown CMOS layout
 ath0: device timeout (txq 1, txintrperiod 5)
 ath0: device timeout (txq 1, txintrperiod 4)
 ath0: device timeout (txq 1, txintrperiod 3)
 ath0: device timeout (txq 1, txintrperiod 2)

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Tue, 20 Aug 2019 06:39:14 +0000
Responsible-Changed-Why:
mine


State-Changed-From-To: open->feedback
State-Changed-By: martin@NetBSD.org
State-Changed-When: Tue, 20 Aug 2019 06:39:14 +0000
State-Changed-Why:
This should work now, can you please re-test?


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54480 CVS commit: src/usr.sbin/sysinst
Date: Tue, 20 Aug 2019 06:38:18 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Aug 20 06:38:18 UTC 2019

 Modified Files:
 	src/usr.sbin/sysinst: disks.c

 Log Message:
 PR install/54480: when upgrading a system and re-mounting the target /
 with proper options, and the installed system does not use NAME= syntax
 in fstab(5), use the device name we used to get here, instead of the
 name from fstab, it might be different to what the real system calls the
 device (compact flash root showing up as wd0 native, but sd? on the
 card reader used for updating it right now).

 This is an abuse of the upgrade functionality and in general pretty dangerous
 when multiple devices are used in the upgraded fstab (e.g. separate /usr),
 and it used to work more by accident with the old code.

 However, it is a quite usefull way to upgrade tiny systems with compact flash
 root, and it used to work - so support it properly (as far as we can).


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/disks.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/54480 (sysinst attempts to mount wrong disk)
Date: Fri, 6 Sep 2019 22:26:17 +0100

 On 20/08/2019 07:39, martin@NetBSD.org wrote:
 > This should work now, can you please re-test?

 Yes, issue seems to be resolved. I've just upgraded from 9.99.9 to
 9.99.10 without issue.

 Thank you for the fix :)


 Sevan

State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 08 Sep 2019 09:13:08 +0000
State-Changed-Why:
Confirmed fix, thanks for the report!


From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54480 CVS commit: [netbsd-9] src/usr.sbin/sysinst
Date: Wed, 23 Oct 2019 06:30:17 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Wed Oct 23 06:30:16 UTC 2019

 Modified Files:
 	src/usr.sbin/sysinst [netbsd-9]: disks.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #369):
 	usr.sbin/sysinst/disks.c: revision 1.51
 PR install/54480: when upgrading a system and re-mounting the target /
 with proper options, and the installed system does not use NAME= syntax
 in fstab(5), use the device name we used to get here, instead of the
 name from fstab, it might be different to what the real system calls the
 device (compact flash root showing up as wd0 native, but sd? on the
 card reader used for updating it right now).
 This is an abuse of the upgrade functionality and in general pretty dangerous
 when multiple devices are used in the upgraded fstab (e.g. separate /usr),
 and it used to work more by accident with the old code.
 However, it is a quite usefull way to upgrade tiny systems with compact flash
 root, and it used to work - so support it properly (as far as we can).


 To generate a diff of this commit:
 cvs rdiff -u -r1.44.2.8 -r1.44.2.9 src/usr.sbin/sysinst/disks.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

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