NetBSD Problem Report #54776

From www@netbsd.org  Tue Dec 17 20:14:40 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 EBA017A14F
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 17 Dec 2019 20:14:39 +0000 (UTC)
Message-Id: <20191217201438.C4CDB7A1B2@mollari.NetBSD.org>
Date: Tue, 17 Dec 2019 20:14:38 +0000 (UTC)
From: hvozda@ack.org
Reply-To: hvozda@ack.org
To: gnats-bugs@NetBSD.org
Subject: install media does not contain support for LVM
X-Send-Pr-Version: www-1.0

>Number:         54776
>Category:       port-amd64
>Synopsis:       install media does not contain support for LVM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 17 20:15:00 +0000 2019
>Closed-Date:    Fri Apr 24 19:02:27 +0000 2020
>Last-Modified:  Fri Apr 24 19:02:27 +0000 2020
>Originator:     Erc Hvozda
>Release:        0.9_RC1
>Organization:
Automation Programming, Inc
>Environment:
NetBSD  9.0_RC1 NetBSD 9.0_RC1 (GENERIC) #0: Wed Nov 27 16:14:52 UTC 2019  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
It appears that the install media does not have all the required drivers to support LVM on amd64.

lvcreate fails with:
File descriptor 12 () leaked on lvm invocation. Parent PID 12:
  Failure to communicate with kernel device-mapper driver.
  striped: Required device-mapper target(s) not detected in your kernel
  Run 'lvcreate --help' for more information.

This has been an ongoing problem since NetBSD 8.0_RC*

I tried to submit a PR for it; but I miserably failed to do so "^/

I view this idea of NetBSD install media containing all the minimums to be "emergency boot media" in the event of FAIL a important tool to have in one's back pocket.

I cannot tell you how many times over the years it has saved me.

I can remember a time when ccd and RAIDframe was not on the install media as well.

I believe LVM meets that bar...
>How-To-Repeat:
Boot a system with 2 hard disks with the amd64 NetBSD 9.0_RC1 media

Drop out of the installer to the shell and do this:

gpt create wd0
gpt add -t raid -b 64 wd0
gpt create wd1
gpt add -t raid -b 64 wd1
cat > /tmp/x
START array
1 2 0
START disks
/dev/dk0
/dev/dk1
START layout 63 1 1 1
START queue
fifo 100
^D
raidctl -C /tmp/x raid0
raidctl -I 202012170 raid0
raidctl -i raid0
raidctl -A yes raid0
lvm pvcreate /dev/rraid0d
lvm vgcreate -s 4m vg0 /dev/rraid0d
lvm lvcreate --name foo -L 10m vg0

>Fix:
I'm not as in the know as I was with NetBSD once upon a time, but perhaps ensuring that kernel contains the driver or it is shipped on the media since we are no longer using floppies?

For a comparable, the 7.0_RC* amd64 install media did not have this issue...

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Wed, 18 Dec 2019 10:11:26 +0100

 The various install media differ a bit - which did you use for your test?
 The DVD (.iso) image and the USB (.img) should work, the ramdisk install
 kernel might not.

 Martin

From: "Eric S. Hvozda" <hvozda@ack.org>
To: gnats-bugs@netbsd.org
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Wed, 18 Dec 2019 10:15:16 -0500

 > On Dec 18, 2019, at 4:15 AM, Martin Husemann <martin@duskware.de> wrote:
 > 
 > The various install media differ a bit - which did you use for your test?
 > The DVD (.iso) image and the USB (.img) should work, the ramdisk install
 > kernel might not.

 The ISO...

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Wed, 18 Dec 2019 18:40:52 +0100

 On Wed, Dec 18, 2019 at 05:35:01PM +0000, Eric S. Hvozda wrote:
 >  The ISO...

 So it is clearly not the missing drivers (as this uses the GENERIC kernel).

 My bet would be missing /dev device nodes.

 Martin

From: "Eric S. Hvozda" <hvozda@ack.org>
To: gnats-bugs@netbsd.org
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Wed, 18 Dec 2019 22:09:17 -0500

 > On Dec 18, 2019, at 12:45 PM, Martin Husemann <martin@duskware.de> wrote:
 > 
 > My bet would be missing /dev device nodes.

 I will check this tomorrow and report back...

From: Martin Husemann <martin@duskware.de>
To: "Eric S. Hvozda" <hvozda@ack.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Thu, 19 Dec 2019 09:20:18 +0100

 On Wed, Dec 18, 2019 at 10:09:17PM -0500, Eric S. Hvozda wrote:
 > 
 > > On Dec 18, 2019, at 12:45 PM, Martin Husemann <martin@duskware.de> wrote:
 > > 
 > > My bet would be missing /dev device nodes.
 > 
 > I will check this tomorrow and report back...

 I looked, and they seem to be created on demand by the userland tools
 (and not MAKEDEV, which is invoked differently for the /dev-on-tmpfs setup
 the ISO uses).

 Need to dig deeper...

 Martin

From: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
To: gnats-bugs@netbsd.org
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org, hvozda@ack.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Fri, 20 Dec 2019 00:01:59 +0900

 2019=E5=B9=B412=E6=9C=8819=E6=97=A5(=E6=9C=A8) 17:25 Martin Husemann <marti=
 n@duskware.de>:
 >
 > The following reply was made to PR port-amd64/54776; it has been noted by=
  GNATS.
 >
 > From: Martin Husemann <martin@duskware.de>
 > To: "Eric S. Hvozda" <hvozda@ack.org>
 > Cc: gnats-bugs@netbsd.org
 > Subject: Re: port-amd64/54776: install media does not contain support for=
  LVM
 > Date: Thu, 19 Dec 2019 09:20:18 +0100
 >
 >  On Wed, Dec 18, 2019 at 10:09:17PM -0500, Eric S. Hvozda wrote:
 >  >
 >  > > On Dec 18, 2019, at 12:45 PM, Martin Husemann <martin@duskware.de> w=
 rote:
 >  > >
 >  > > My bet would be missing /dev device nodes.
 >  >
 >  > I will check this tomorrow and report back...
 >
 >  I looked, and they seem to be created on demand by the userland tools
 >  (and not MAKEDEV, which is invoked differently for the /dev-on-tmpfs set=
 up
 >  the ISO uses).

 It looks to me that _create_control() somehow failed in your
 situation. I suspect nbsd_get_dm_major() code which gets called by
 _control_device_number() to determine major#.
 Note that these functions are NetBSD specific part in lvm2 code.

 external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c
  ...
  198 /* Open control device if doesn't exist create it. */
  199 static int _open_control(void)
  200 {
  201         char control[PATH_MAX];
  202         uint32_t major =3D 0, minor =3D 0;
  203
  204         if (_control_fd !=3D -1)
  205                 return 1;
  206
  207 #ifdef RUMP_ACTION
  208         rump_init();
  209 #endif
  210         snprintf(control, sizeof(control), "%s/control", dm_dir());
  211
  212         if (!_control_device_number(&major, &minor))
  213                 log_error("Is device-mapper driver missing from kernel=
 ?");
  214
  215         if (!_control_exists(control, major, minor) &&
  216             !(control, major, minor)) <-------- here
  217                 goto error;
  218
  219         if ((_control_fd =3D open(control, O_RDWR)) < 0) {
  220                 log_sys_error("open", control);
  221                 goto error;
  222         }
  223
  224         return 1;
  225
  226 error:
  227         log_error("Failure to communicate with kernel
 device-mapper driver.");
  228         return 0;

 >
 >  Need to dig deeper...
 >
 >  Martin
 >

From: "Eric S. Hvozda" <hvozda@ack.org>
To: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Cc: gnats-bugs@netbsd.org, port-amd64-maintainer@netbsd.org,
        gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Thu, 19 Dec 2019 10:20:13 -0500

 I believe I see the problem.

 In the past, / was writable on the install media; before version 8, /dev =
 was a tmpfs.

 In 8 and 9RC1, /dev does not have a separate filesystem and therefore is =
 read-only

 I don=E2=80=99t know why the /dev mount point was removed (omitted?), =
 but I suspect that the lack of a writable /dev is why the problem =
 exists.

 I suspect I can do a work around with a small tmpfs and union mount.

 I will test this and report back.

 However, is there any reason to not have a writable /dev as it was =
 before=E2=80=A6?=

From: "Eric S. Hvozda" <hvozda@ack.org>
To: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Cc: gnats-bugs@netbsd.org, port-amd64-maintainer@netbsd.org,
        gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Thu, 19 Dec 2019 11:39:17 -0500

 --Apple-Mail=_0F12AD1D-BE48-4668-A7F6-F92807A8F55C
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8


 > On Dec 19, 2019, at 10:20 AM, Eric S. Hvozda <hvozda@ack.org> wrote:
 >=20
 > I will test this and report back.

 Indeed, if I do this:

 mount -t tmpfs -o-s=3D10m tmpfs /mnt2
 mount -t union /mnt2 /dev
 mkdir /dev/mapper
 mknod /dev/mapper/control b 194 0

 then:

 lvm lvcreate --name foo -L 4m vg0=20

 works as expected.

 So having a writable /dev and ensuring the =E2=80=9Ccontrol=E2=80=9D =
 exists, makes life much happier...



 --Apple-Mail=_0F12AD1D-BE48-4668-A7F6-F92807A8F55C
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/html;
 	charset=utf-8

 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
 charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
 -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
 class=3D""><br class=3D""><div><blockquote type=3D"cite" class=3D""><div =
 class=3D"">On Dec 19, 2019, at 10:20 AM, Eric S. Hvozda &lt;<a =
 href=3D"mailto:hvozda@ack.org" class=3D"">hvozda@ack.org</a>&gt; =
 wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><span =
 style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 orphans: auto; text-align: start; text-indent: 0px; text-transform: =
 none; white-space: normal; widows: auto; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; float: none; display: inline =
 !important;" class=3D"">I will test this and report =
 back.</span></div></blockquote></div><br class=3D""><div =
 class=3D"">Indeed, if I do this:</div><div class=3D""><br =
 class=3D""></div><div class=3D"">mount -t tmpfs -o-s=3D10m tmpfs =
 /mnt2</div><div class=3D"">mount -t union /mnt2 /dev</div><div =
 class=3D"">mkdir /dev/mapper</div><div class=3D"">mknod =
 /dev/mapper/control b 194 0</div><div class=3D""><br class=3D""></div><div=
  class=3D"">then:</div><div class=3D""><br class=3D""></div><div =
 class=3D"">lvm lvcreate --name foo -L 4m vg0&nbsp;</div><div =
 class=3D""><br class=3D""></div><div class=3D"">works as =
 expected.</div><div class=3D""><br class=3D""></div><div class=3D"">So =
 having a writable /dev and ensuring the =E2=80=9Ccontrol=E2=80=9D =
 exists, makes life much happier...</div><div class=3D""><br =
 class=3D""></div><div class=3D""><br class=3D""></div></body></html>=

 --Apple-Mail=_0F12AD1D-BE48-4668-A7F6-F92807A8F55C--

From: Martin Husemann <martin@duskware.de>
To: "Eric S. Hvozda" <hvozda@ack.org>
Cc: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>, gnats-bugs@netbsd.org
Subject: Re: port-amd64/54776: install media does not contain support for LVM
Date: Thu, 19 Dec 2019 18:14:27 +0100

 On Thu, Dec 19, 2019 at 10:20:13AM -0500, Eric S. Hvozda wrote:
 > In the past, / was writable on the install media; before version 8,
 > /dev was a tmpfs.

 Indeed - and it was apparently me some years back that changed it
 (in src/distrib/common/Makefile.bootcd):

 ---8<---
 revision 1.28
 date: 2015-05-25 17:38:33 +0200;  author: martin;  state: Exp;  lines: +90 -19;  commitid: NOTKl2IY8AGSeQmy;
 2nd try: make amd64, i386, sparc64 and vax iso images use full sets.
 While there fix an old bug that makefs used the build hosts /etc/group
 and passwd information when creating the image.
 Thanks to Andreas Gustafsson for extensive testing.
 --->8---

 I dimly remember trying to get memory usage down for VAX CDs, and the tmpfs
 costs kernel memory. Back then I saw no downside with this aproach - but now
 you have shown there is ;-)

 I'll make it configurable and only have VAX use the expanded /dev, leaving
 it empty for all others, so init will union mount the tmpfs automatically.

 Let me fire up a test build....


 Martin

Responsible-Changed-From-To: port-amd64-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Thu, 19 Dec 2019 17:15:34 +0000
Responsible-Changed-Why:
I broke it


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54776 CVS commit: src/distrib
Date: Fri, 20 Dec 2019 19:46:51 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Dec 20 19:46:51 UTC 2019

 Modified Files:
 	src/distrib/common: Makefile.bootcd
 	src/distrib/vax/cdroms/installcd: Makefile

 Log Message:
 Do not populate /dev on CD images by default, instead rely on init
 doing the tmpfs / MAKEDEV magic.
 On images for machines with serious ram shortage (where the additional
 tmpfs hurts, like VAX) override this with CDDEV_POPULATE=true.
 Should fix PR port-amd64/54776.


 To generate a diff of this commit:
 cvs rdiff -u -r1.42 -r1.43 src/distrib/common/Makefile.bootcd
 cvs rdiff -u -r1.18 -r1.19 src/distrib/vax/cdroms/installcd/Makefile

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

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 21 Apr 2020 17:22:27 +0000
State-Changed-Why:
Hi! Does the committed patch help with this problem? (should it be pulled up?)


From: "Eric S. Hvozda" <hvozda@ack.org>
To: gnats-bugs@netbsd.org
Cc: martin@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
        maya@netbsd.org
Subject: Re: port-amd64/54776 (install media does not contain support for LVM)
Date: Tue, 21 Apr 2020 16:14:11 -0400

 > On Apr 21, 2020, at 1:22 PM, maya@netbsd.org wrote:
 >=20
 > Synopsis: install media does not contain support for LVM
 >=20
 > State-Changed-From-To: open->feedback
 > State-Changed-By: maya@NetBSD.org
 > State-Changed-When: Tue, 21 Apr 2020 17:22:27 +0000
 > State-Changed-Why:
 > Hi! Does the committed patch help with this problem? (should it be =
 pulled up?)

 Yes, please pull up.

 All went well on NetBSD v9.99.56 amd64.

 I created /dev/mapper and /dev/mapper/control and all went as expected.

 Thank You!=

State-Changed-From-To: feedback->needs-pullups
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 22 Apr 2020 09:47:41 +0000
State-Changed-Why:
Add to the todo pile


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: maya@NetBSD.org
State-Changed-When: Fri, 24 Apr 2020 13:37:56 +0000
State-Changed-Why:
pullup-9 #849


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54776 CVS commit: [netbsd-9] src/distrib
Date: Fri, 24 Apr 2020 17:40:54 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Apr 24 17:40:54 UTC 2020

 Modified Files:
 	src/distrib/common [netbsd-9]: Makefile.bootcd
 	src/distrib/vax/cdroms/installcd [netbsd-9]: Makefile

 Log Message:
 Pull up following revision(s) (requested by maya in ticket #849):

 	distrib/vax/cdroms/installcd/Makefile: revision 1.19
 	distrib/common/Makefile.bootcd: revision 1.43

 Do not populate /dev on CD images by default, instead rely on init
 doing the tmpfs / MAKEDEV magic.

 On images for machines with serious ram shortage (where the additional
 tmpfs hurts, like VAX) override this with CDDEV_POPULATE=true.

 Should fix PR port-amd64/54776.


 To generate a diff of this commit:
 cvs rdiff -u -r1.41 -r1.41.2.1 src/distrib/common/Makefile.bootcd
 cvs rdiff -u -r1.17 -r1.17.2.1 src/distrib/vax/cdroms/installcd/Makefile

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Fri, 24 Apr 2020 19:02:27 +0000
State-Changed-Why:
pullup to -9 done



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.