Solved Bhyve can boot only an OS that can be loaded into the RAM memory if a device like the graphic card is passed through.

Hello.

I've installed and succesfully booted NiceHash OS from my USB stick using bhyve and at the same time I have passed through the USB controller and the graphic card. So. The NiceHash bootloader is the only bootloader that allows me to do that. I've installed Ubuntu and Void Linux on the same USB stick but they haven't been able to boot. To achieve that goal I have used two tricks :

1) I've used a "special" bhyve bootloader compiled for me by Corvin Kohne,called "BHYVE_BHF_CODE.fd" ; any other offocial bhyve bootloader provided by FreeBSD 13R,FreeBSD 13-STABLE and FreeBSD 14-CURRENT will not work in this scenario. It means that any OS will be not able to boot.

2) I've attached to the USB controller the USB stick where I have installed the NiceHASH os img file (wrote to the usb stick using the command : dd if=nhos-1.2.9.img of=/dev/da3 (the USB stick's device )

I've realized that using the UEFI bootloader provided by Corvin I can boot only the NiceHash OS. Now,I don't want that you get involved into this bhyve's problem. I don't want that you know how has been compiled the Corvin's boot loader. I would like that you point your attention to the bootloader of the NiceHash OS. My idea is that if I'm able to understand which kind of bootloader it is,I can use it to boot all the OS that actually aren't able to boot. The only "keyword" that can help to understand why it works is the word "gfxterm.mod" that I see as soon as NiceHash OS will start booting.

I've also recorded a short video,to show you what happens.

You can give a look at it here : https://drive.google.com/file/d/1buezaHbfJAV5xitQWXogQeGwhmu4H3eO/view?usp=sharing

The bhyve arguments which work (only with the bootloader of the NiceHash OS) are the following :

Code:
bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \

-s 0,hostbridge \
-s 1:0,passthru,1/0/0 \
-s 2:0,passthru,2/0/0 \
-s 2:1,passthru,2/0/1 \
-s 2:2,passthru,2/0/2 \
-s 2:3,passthru,2/0/3 \
-s 9,virtio-net,tap0 \
-s 10,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
-l com1,stdio \          
vm0
 
Last edited:
I'm not interested in malwares. I'm interested to understand which kind of bootloader it uses....and I would like to see a thumb straight also here :)
 
NiceHash OS flash drive is divided into two partitions, SYSTEM and NHOS. SYSTEM partition contains bootloader, Linux kernel and RAM file system, while NHOS partition contains NiceHash OS configuration file.
Maybe start by examining the SYSTEM partition?

Btw:
 
Check also the situation below :

Code:
bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/da3p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495.img \
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 4:0,passthru,1/0/0 \
-s 9,virtio-net,tap0 \
-s 10,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
-l com1,stdio \
vm0

It seems that the NiceHash bootloader starts in every condition and it has the precedence over the bootloader used by any Virtual Machine declared between the bhyve parameters. Even in the example above, the impish-cuda-11-5-nvidia-495.img file should boot first of all,but no. Is the USB stick that I have connected to the USB controller,at slot 1/0/0 with the NiceHash OS that boots.
 
I did not mean to impune NiceHash OS but personally I would steer clear.

The r/NiceHash/ reddit looks like it is for 'NiceHash' Crypto Currency.
I think it's a different thing.
 
As you may have assumed, my beef is a bootloader from a know crook.
You realize how powerful a bootloader is. I am talking network access.
A bootloader can easily change variables and even write extra things into EFI, easy enough to do anything as the author please.
 
Are you saying he is using this OS or recommended it?
Where did this idea come from?
That guy works at Beckhoff and I would be surprised if he had anything to do with that OS.

Corvin compiled the version of the bootloader to help me fixing the problems I have with bhyve. It seems that the uefi bootloader of freebsd (13 and 14) has some problems with my USB controller. He has nothing to do with NiceHash OS. I've discovered by myself that it is the only OS that can boot with the Corvin's uefi bootloader. I want to understand why. When I will have understood it,I can replicate it.
 
As you may have assumed, my beef is a bootloader from a know crook.
You realize how powerful a bootloader is. I am talking network access.

Is there a method to boot a physical installation of an OS turning it's physical bootloader into a networked bootloader ?
 
I've booted the Ubuntu Live installation support. Trick is that bhyve boot the OS only if it is loaded into the RAM memory. NiceHash OS has nothing special. Like this :

Code:
bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \
-s 0,hostbridge \
-s 2:0,passthru,1/0/0 \ -> here I have attached the USB Stick with the Ubuntu live image written inside using dd.
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 9,virtio-net,tap0 \
-s 10,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
-l com1,stdio \                   
vm0

there is a bug for sure,somewhere.
 
Maybe start by examining the SYSTEM partition?

Btw:

It was off topic at the beginning,but later it became on topic. Try to "learn" the art of how to have patience :D
 
you guys like this systemd so much. I don't want this thing, feeding my machine. Ubuntu Debian.....

FreeBSD Special
#Debian="NO"
#Ubuntu="NO"
Slackware="YES"
Artix="YES"
Crux="YES"
#systemd="NO" "NO" "NO" /* blow it up along with all your dependency */
BSDINIT="YES" "YES" "YES"
SysvINIT="YES"
RUNIT="YES"
?
 
groping in the dark.

From eternal_noob 's latest picture, I assume he is groping in the dark.

1645925664129.png
 
A "raw" idea to overcome the bug is to do something like this :

Assuming that the physical installation of Ubuntu to load in bhyve is located on /dev/nvd0p7 :

1)
Code:
dd if=/dev/nvd0p7 of=/mnt/da3p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495-new.img

2)

Code:
bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/da3p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495-new.img \
-s 2:0,passthru,1/0/0 \ -> remove from the USB controller any disk that can boot
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 9,virtio-net,tap0 \
-s 10,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
-l com1,stdio \                
vm0

3)

Code:
dd if=/mnt/da3p2/bhyve/os/Linux/impish-cuda-11-5-nvidia-495-new.img of=/dev/nvd0p7

what do u think ? I'm sure there is a faster and better approach.
 
Back
Top