NetBSD Problem Report #59350
From www@netbsd.org Thu Apr 24 08:15:06 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B59401A923E
for <gnats-bugs@gnats.NetBSD.org>; Thu, 24 Apr 2025 08:15:06 +0000 (UTC)
Message-Id: <20250424081505.711A11A923F@mollari.NetBSD.org>
Date: Thu, 24 Apr 2025 08:15:05 +0000 (UTC)
From: netbsd@precedence.co.uk
Reply-To: netbsd@precedence.co.uk
To: gnats-bugs@NetBSD.org
Subject: PVHVM kernel cannot access cd unless vdev=hdc
X-Send-Pr-Version: www-1.0
>Number: 59350
>Category: port-xen
>Synopsis: PVHVM kernel cannot access cd unless vdev=hdc
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-xen-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 24 08:20:00 +0000 2025
>Last-Modified: Thu Apr 24 10:05:01 +0000 2025
>Originator: Stephen Borrill
>Release: 10.1_STABLE
>Organization:
Precedence Technologies Ltd
>Environment:
NetBSD 10.1_STABLE NetBSD 10.1_STABLE (GENERIC) #0: Sun Apr 20 09:06:24 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
When specifying a block device for a domU, a guest device mapping needs to be specified. This is ignored in PV mode, but not in PVHVM mode. In the example below, a file-backed disk is device hda (old format configuration) and an ISO image is presented as a CDROM with device hdc (new key/value configuration):
disk = [ 'file:/usr/pkg/etc/xen/disks/nbpv,hda,w',
'format=raw, devtype=cdrom, access=ro, vdev=hdc, target=/usr/pkg/etc/xen/iso/boot.iso' ]
The disk is presented as a PV xbd device, the CD device is presented as an emulated CD drive. The CD device must be hdc in the configuration. If set to hdc it will appear as:
wdc1 at isa0 port 0x170-0x177 irq 15
atabus0 at wdc1 channel 0
atapibus0 at atabus0: 2 targets
cd0 at atapibus0 drive 0: cdrom removable
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
If the CD device is hdb (or hdd) it will be mis-detected as a hard-disk and so the CD will not be usable:
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
atabus0 at wdc0 channel 0
wd0 at atabus0 drive 0
wd0:
wd0: drive supports 1-sector PIO transfers, chs addressing
wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors
The same problem also affects NetBSD HVM domUs on XenServer or XCP-ng as by default the emulated CD device is xvdd (the equivalent of hdd). It is therefore not possible to install NetBSD from CD on XenServer without manual changes.
>How-To-Repeat:
1) Download a NetBSD ISO image to /root.
2) Create a domU configuration called nbhvm as follows:
name = "nbhvm"
type="hvm"
memory = 1024
vif = [ 'type=ioemu,bridge=bridge0' ]
disk = [ 'format=raw, devtype=cdrom, access=ro, vdev=hdc, target=/root/NetBSD-10.1_STABLE-amd64.iso' ]
boot = d
3) xl create nbhvm
4) Connect to 127.0.0.1:0 with a VNC viewer
5) Note that boot was successful
6) xl destroy hbhvm
7) Alter domU configuration so that vdev=hdb
8) xl create nbhvm
9) Connect to 127.0.0.1:0 with a VNC viewer
10) Note that boot was not successful as the emulated CD drive was not available to the kernel
>Fix:
Ensure you always use hdc if using a NetBSD dom0.
If using XenServer/XCP-ng, determine the vbd used for the emulated CD device for the VM and alter userdevice to 2 (will be 3 by default):
[root@xenserver1 ~]# xe vm-list name-label="NetBSD 10" --minimal
30126d92-842a-ce8b-2939-c58f174d727f
[root@xenserver1 ~]# xe vm-param-set uuid=30126d92-842a-ce8b-2939-c58f174d727f platform:viridian=false
[root@xenserver1 ~]# xe vbd-list vm-uuid=30126d92-842a-ce8b-2939-c58f174d727f type=CD --minimal
515192ef-9019-e3d2-1322-48d51abfb080
[root@xenserver1 ~]# xe vbd-param-set uuid=515192ef-9019-e3d2-1322-48d51abfb080 userdevice=2
>Audit-Trail:
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@netbsd.org
Cc: port-xen-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-xen/59350: PVHVM kernel cannot access cd unless vdev=hdc
Date: Thu, 24 Apr 2025 11:59:41 +0200
On Thu, Apr 24, 2025 at 08:20:00AM +0000, netbsd@precedence.co.uk wrote:
> [...[
> If the CD device is hdb (or hdd) it will be mis-detected as a hard-disk and so the CD will not be usable:
>
> wdc0 at isa0 port 0x1f0-0x1f7 irq 14
> atabus0 at wdc0 channel 0
> wd0 at atabus0 drive 0
> wd0:
> wd0: drive supports 1-sector PIO transfers, chs addressing
> wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors
this is probably because in this case, the CD device appears as a slave
IDE device, without master. In the ATA/ATAPI spec this is not a
supported configuration, although with some hardware configuration it may
work.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.