Bug 290901 - bsdinstall: pciconf: /dev/pci: No such file or directory during install fwget after manual partitioning
Summary: bsdinstall: pciconf: /dev/pci: No such file or directory during install fwget...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 15.0-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: John Baldwin
URL:
Keywords:
Depends on:
Blocks: 15.0-metabug
  Show dependency treegraph
 
Reported: 2025-11-08 18:01 UTC by Peter
Modified: 2025-12-08 21:35 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2025-11-08 18:01:27 UTC
follow up from:
https://lists.freebsd.org/archives/freebsd-stable/2025-October/003534.html
FreeBSD 15.0-BETA3 - no iwlwifi0 wifi firmware after install

During the install, I successfully connect to wifi and download 
pkgbase.  After booting into the freshly installed system, no wifi and 
this in /var/log/messages:

Oct 30 01:04:29 freeburg kernel: iwlwifi0: <iwlwifi> mem 
0x603db9c000-0x603db9ffff at device 20.3 on pci0
Oct 30 01:04:29 freeburg kernel: iwlwifi0: Detected crf-id 0x3617, 
cnv-id 0x20000302 wfpm id 0x80000000
Oct 30 01:04:29 freeburg kernel: iwlwifi0: PCI dev 43f0/0070, rev=0x351, 
rfid=0x10a100
Oct 30 01:04:29 freeburg kernel: iwlwifi0: Detected Intel(R) Wi-Fi 6 
AX201 160MHz
Oct 30 01:04:29 freeburg kernel: iwlwifi-QuZ-a0-hr-b0-77.ucode: could 
not load binary firmware /boot/firmware/iwlwifi-QuZ-a0-hr-b0-77.ucode either
Oct 30 01:04:29 freeburg syslogd: last message repeated 1 times
Oct 30 01:04:29 freeburg kernel: iwlwifi-QuZ-a0-hr-b0-77_ucode: could 
not load binary firmware /boot/firmware/iwlwifi-QuZ-a0-hr-b0-77_ucode either
Oct 30 01:04:29 freeburg kernel: iwlwifi_QuZ_a0_hr_b0_77_ucode: could 
not load binary firmware /boot/firmware/iwlwifi_QuZ_a0_hr_b0_77_ucode either
Oct 30 01:04:29 freeburg kernel: iwlwifi0: could not load firmware image 
'iwlwifi-QuZ-a0-hr-b0-77.ucode'
Oct 30 01:04:29 freeburg kernel: iwlwifi0: File size way too small!
Oct 30 01:04:29 freeburg kernel: iwlwifi0: no suitable firmware found!
Oct 30 01:04:29 freeburg kernel: iwlwifi0: iwlwifi-QuZ-a0-hr-b0-77 is 
required
Oct 30 01:04:29 freeburg kernel: iwlwifi0: check 
git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
Oct 30 01:04:29 freeburg kernel: iwlwifi0: On FreeBSD the firmware 
package can be installed running fwget(8).

During the install the fwget step, it says nothing to download.

My workaround has been to open a shell during the install and 
copy /boot/firmware/iwlwifi-QuZ-a0-hr-b0-77.ucode 
to /mnt/boot/firmware/iwlwifi-QuZ-a0-hr-b0-77.ucode. Only then do I have 
wifi on a fresh install and can run 'fwget', which downloads all the 
other iwlwifi...ucode files.

I figure if I have wifi during install, it should work on fresh boot, as 
my /etc/wpa_supplicant.conf is setup correctly by the installer.


]Peter[
Comment 1 Peter 2025-11-08 18:04:17 UTC
That was the original post, but here is more info from BETA4, the one I meant to link to [copy + paste from]:
https://lists.freebsd.org/archives/freebsd-stable/2025-November/003560.html

During the install, I successfully connect to wifi and download 
pkgbase.  After booting into the freshly installed system, no wifi or 
any firmware was installed. This is on an HP ZBook laptop.

Tested with BETA{1,3,4}. Same results.

I delete the install and try again:

At the end of the install, I select 'shell' into the new system, and run 
'fwget':

# fwget
pciconf: /dev/pci: No such file or directory
No firmware packages to install.
#

That is also the exact message the installer gives me during the 
firmware step: 'No firmware packages to install.'

same error in bsdinstall_log:

DEBUG: f_include: file=[/usr/share/bsdconfig/strings.subr]
DEBUG: f_include_lang: 
file=[/usr/libexec/bsdconfig/include/messages.subr] lang=[C.UTF-8]
DEBUG: packages/packages.subr: Successfully loaded.
pciconf: /dev/pci: No such file or directory
DEBUG: f_dialog_max_size: bsddialog --print-maxsize = [MaxSize: 67, 240]
DEBUG: f_getvar: var=[height] value=[8] r=0
DEBUG: f_getvar: var=[width] value=[41] r=0


So I try alt+F4, and run fwget there:

# fwget
  Needed firmware packages: 'gpu-firmware-intel-kmod-tigerlake 
wifi-firmware-iwlwifi-kmod-22000'
  pkg: Error extracting the archive: 'Write error'
  pkg: No signature found
  pkg: Repository FreeBSD-ports cannot be opened. 'pkg update' required
  pkg: Fail to create temporary directory: 
/usr/local/share/licenses/.pkgtemp.gpu-firmware-intel-kmod-tigerlake-20230625.1500068.i683tDzxwROk:Read-only 
file system
  pkg: Fail to create temporary file for 
/usr/local/share/licenses/gpu-firmware-intel-kmod-tigerlake-20230625.1500068/catalog.mk:No 
such file or director

Using the memstick for install, so I can mount that memstick and copy 
the iwlwifi-QuZ-a0-hr-b0-77.ucode to the fresh system: 
/mnt/boot/firmware/. Then I have wifi, and 'fwget' works when I boot 
into the fresh system.

Is this expected behavior to manually copy firmware for wifi from the 
memstick, or I need to have ethernet to run 'fwget' ?

I'm guessing fwget never works during install because of: "pciconf: 
/dev/pci: No such file or directory" error message, right?

]Peter[
Comment 2 Peter 2025-11-09 20:25:50 UTC
Did some more testing today.        

During the 'partition' part of the bsdinstall,

If I do
  "Auto (ZFS)": 'devfs' is mounted on /mnt/dev on alt+F4 
  this was done in a VM because it uses the whole disk.
 
  I always choose "Shell" because I don't use the whole disk for "zroot", but a smaller [gpt] partition.
  [ 15.0 BETA5 is p7, p2 is shared swap, p3 is 14-STABLE, p4 is 15.0 BETA1, p6 is data, etc, or on VMs I use separate disk for OS and only time I use auto partitions ]

  It just occurred to me that "partition by hand" option also expects me to mount devfs on /mnt/dev.

using the "Shell" option for partitioning on baremetal laptop:

So with 15.0-BETA5 on baremetal.
try 1:
  Did manual partitions, mounted them under /mnt:
  bsdinstall did the install
  no firmware and no /dev/pci

try 2:
  Did manual partitions, mounted them under /mnt
  mounted devfs under /mnt/dev
  bsdinstall did the install
  bsdinstall found the wifi and gpu firmware I needed.
 
So issue is my assumption that "Shell" only cared about manual partitions/mounts, not me mounting devfs which I though bsdinstaller did after partitions are done.
 
My shell script to for creating partitions and mounts was built from looking at /var/log/bsdinstall_log.
That log file has nothing on devfs [14.x was when I was building my partition scripts],
  and looking at my fstab right now running X/i3/shell/firefox I don't have devfs in /etc/fstab, but it's mounted:

freeburg:$ grep devfs /etc/fstab
freeburg:$ mount | grep devfs
devfs on /dev (devfs)
freeburg:$ uname -a 
FreeBSD freeburg.ru.kupaet.com 15.0-BETA1 FreeBSD 15.0-BETA1 releng/15.0-n280655-36a923a476dc GENERIC amd64
freeburg:$
 
I guess I need to add devfs to my /etc/fstab, and add it to my partition script [as /boot/efi was not in /var/log/bsdinstall_log either as i remember].
 
I say partition step should only care about partitions, and if devfs is not mounted, mount it after partitions are setup.
  Also log that devfs is mounted.
Comment 3 John Baldwin freebsd_committer freebsd_triage 2025-11-14 17:27:36 UTC
You don't need devfs in your fstab, but it does need to get mounted.  Normally for /dev, the kernel mounts it since the kernel needs /dev devices to exist to find the device node for the root filesystem.  For alternate roots like chroots/jails, devfs has to be mounted explicitly inside the alternate root.  Probably the installer just needs to ensure it is mounted at /mnt/dev before running commands via chroot.  That may mean just moving the existing mount of /mnt/dev out of the auto path and into an "always" path.  In particular, it doesn't hurt (AFAIK) to mount it more than once, so I'm not sure we need to try to do a special case for /mnt/dev already being mounted.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2025-11-14 17:46:14 UTC
I don't think it really hurts to mount devfs multiple times but we could easily test -c $BSDINSTALL_CHROOT/dev/null and mount devfs if it doesn't exist.
Comment 5 John Baldwin freebsd_committer freebsd_triage 2025-11-15 13:21:39 UTC
I have an untested patch that should ensure devfs and /packages are mounted inside the chroot when using the "Shell" option at https://reviews.freebsd.org/D53770.  Testing it will be a bit tedious I'm afraid so it may be a bit until I get to that.
Comment 6 Peter 2025-11-18 02:55:08 UTC
tested with FreeBSD-15.0-RC1-amd64-memstick.img on baremetal.

Applied the patch to the memstick, and did the "Shell" partitions.
I ran my partition script, I did not mount /mnt/dev.
Exited shell, and alt+F4 showed that dev got mounted at /mnt/dev.
Firmware part ran successfully and installed my wifi and gpu firmware.
Fresh boot into 15.0-RC1, wifi was working.
much gooder. thanks.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-12-08 21:35:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f63a8c0a0915a3eceac179d4d18b2c03b1319fa2

commit f63a8c0a0915a3eceac179d4d18b2c03b1319fa2
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-08 21:33:30 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-08 21:33:30 +0000

    bsdinstall: Mount /dev and /packages after using the shell to partition disks

    Normally after partitions are created by the installer, the 'mount'
    script is used to mount the target disk partitions under /mnt.  The
    tail end of this script also mounts a couple of additional filesystems
    under /mnt so that chrooted programs can work such as devfs and
    /packages.

    When the "Shell" option is used to permit the user to manually mount
    the destination filesystem, the "mount" script is not used as the user
    is instructed to mount the target filesystems and construct
    /mnt/etc/fstab, etc.  However, this means that the user is responsible
    for mounting devfs (which is not included in /etc/fstab) and /packages
    as well.  The help message for the "Shell" option doesn't mention
    these requirements, so users may not know to do so.  This can lead to
    confusing errors as chrooted commands can fail to find needed /dev
    entries.  For example, running fwget to fetch wireless firmware fails
    because /dev/pci doesn't exist.

    To make this less painful for users using this option, split out the
    bottom half of the 'mount' script that mounts these non-fstab-related
    filesystems into a separate 'mount_aux' script.  Invoke 'mount_aux'
    after using "Shell" to create the filesystem to ensure that these
    filesystems are always present.

    PR:             290901
    Reported by:    Peter <freebsd@peterk.org>
    Tested by:      Peter <freebsd@peterk.org>
    Differential Revision:  https://reviews.freebsd.org/D53770

 tools/build/mk/OptionalObsoleteFiles.inc       |  1 +
 usr.sbin/bsdinstall/scripts/Makefile           |  1 +
 usr.sbin/bsdinstall/scripts/auto               |  1 +
 usr.sbin/bsdinstall/scripts/mount              | 10 +------
 usr.sbin/bsdinstall/scripts/mount_aux (new +x) | 39 ++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 9 deletions(-)