Re: FreeBSD OS installation stuck after selecting Boot installer

From: Anantharam, Arjun <arjun.anantharam_at_intel.com>
Date: Sat, 20 Jul 2024 00:04:55 UTC
Hi,

The location from which we are trying to boot FreeBSD is a VFS or RAMDisk method:
OK lsdev
disk devices:
     disk0:    4194304 X 512 blocks
       disk0p1: EFI
      disk0p2: FreeBSD UFS
 http: (unknown)
 net devices:
    net0:
     net1:
     net2:
     net3:


Looks like FreeBSD does not have access to this RAMDisk and hence unable to boot the image. I was digging through FreeBSD forums and found some relevant details. I guess the first step would be to build FreeBSD to prepare it as RAMDisk image, so from the links below i could gather something like this ?
Some Examples:
https://forums.freebsd.org/threads/how-would-i-load-root-image-into-memory-backed-fs-and-run-the-system-from-that.78021/
https://www.reddit.com/r/freebsd/comments/tzm2xi/run_from_ram/
https://forums.freebsd.org/threads/mount-memory-disk-on-boot.61090/
https://forums.freebsd.org/threads/questions-about-ramdisk-in-freebsd.20345/

mdmfs (https://man.freebsd.org/cgi/man.cgi?query=mdmfs&sektion=8&manpath=freebsd-release-ports#EXAMPLES) and mdconfig(https://man.freebsd.org/cgi/man.cgi?query=mdconfig&sektion=8&manpath=freebsd-release-ports):

  1.  Prepare RAMDisk image

mdconfig -a -t vnode -s 10g -u 0
newfs /dev/md0
mount /dev/md0 /mnt
dump -0aLf - / | (cd /mnt && restore -rf -)
dd if=/dev/md0 of=/path/to/ramdisk.img bs=1M
      2. Edit /boot/loader.conf:

initrd_load="YES"
initrd_type="mfs_root"
initrd_name="/boot/ramdisk.img"
vfs.root.mountfrom="ufs:/dev/md0"
vfs.root.mountfrom.options="ro,noatime"

    3. Set Boot Variables in the Bootloader

OK set initrd_load="YES"
OK set initrd_type="mfs_root"
OK set initrd_name="/boot/ramdisk.img"
OK set vfs.root.mountfrom="ufs:/dev/md0"
OK set vfs.root.mountfrom.options="ro,noatime"
OK boot

Can someone please clarify if this is a right approach? Any inputs are appreciated!!

Thanks,
Arjun
________________________________
From: Andrew Turner <andrew@fubar.geek.nz>
Sent: Wednesday, July 10, 2024 11:36 AM
To: Anantharam, Arjun <arjun.anantharam@intel.com>
Cc: Warner Losh <imp@bsdimp.com>; Mark Millard <marklmi@yahoo.com>; freebsd-arm@freebsd.org <freebsd-arm@freebsd.org>
Subject: Re: FreeBSD OS installation stuck after selecting Boot installer


On 10 Jul 2024, at 17:03, Anantharam, Arjun <arjun.anantharam@intel.com> wrote:

Hi,

On most of our hardware, i still run into mount issues. Can anyone provide some guidance on this ?
This iso/img file boot is the only option right now for us to boot FreeBSD(no PXE boot option yet), so any inputs are appreciated!!


The issue appears to be the interface the NVMe provides to the kernel.

found-> vendor=0x8086, dev=0x1457, revid=0x21
        domain=0, bus=0, slot=1, func=1
        class=01-08-02, hdrtype=0x00, mfdev=1
        cmdreg=0x0000, statreg=0x0010, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=255
        powerspec 3  supports D0 D3  current D0
        MSI supports 1 message, 64 bit, vector masks
        MSI-X supports 257 messages in map 0x18
        map[10]: type Prefetchable Memory, range 64, base 0x2220000000, size 25, memory disabled

This looks like the NVMe device that the nvme driver attaches to. The class=01-08-02 indicates it’s an NVMe device using the enterprise nvmhci.

…

found-> vendor=0x8086, dev=0x1458, revid=0x21
        domain=0, bus=0, slot=1, func=7
        class=01-08-00, hdrtype=0x00, mfdev=1
        cmdreg=0x0000, statreg=0x0010, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=255
        powerspec 3  supports D0 D3  current D0
        MSI-X supports 257 messages in map 0x18
        map[10]: type Prefetchable Memory, range 64, base 0x2224000000, size 25, memory disabled

This is the NVMe device the nvme driver doesn’t attach to. As the class is 01-08-00 the driver doesn’t attach. The problem is the 00 at the end.

I don’t know the difference between the different interfaces so am unsure how difficult it would be to support this device.

Andrew