How to install Tiny11 on GhostBSD

Now that we migrated from Windows and have a running GhostBSD system we may need an application that won't run via Wine on GhostBSD. But we can use a hypervisor and run Windows in a virtual machine. So that' s the opposite way when we tested GhostBSD on Windows.

To do this we first need to install the hypvervisor component and a GUI for it. On FreeBSD systems the hypvervisor is called bhyve and one GUI for it is called bhyvemgr.

If we go to System->Administration->Software Station we can select the needed components:

  • GhostBSD-bhyve
  • bhyvemgr

Please note that bhyve-firmware and edk2-bhyve are also required but they are dependencies in bhyvemgr, so they will be automatically installed and we don't have to select them there.

You may have also noticed that bhyvemgr is available in 3 flavors: bhyvemgr-gtk2, bhyvemgr-qt5 and bhyvemgr-qt6, these are different GUI toolkits, you can see a comparison here. I chose the Qt6 variant because it had the smallest install footprint.



You can check the estimated installation size with this command in the terminal (-n will do a dry run):
pkg install -n bhyvemgr-gtk2-1.13.1_1

You will now find the Byhvemgr under Applications->System Tools. Before we can use it we have to follow its network configuration guide.

Open a terminal and type sudo pluma, you now have a text editor with root privileges which are needed to edit the /etc/rc.conf file, open it in Pluma. Paste the network configuration from the GitHub page and save the rc.conf file. Make sure the network adapter name matches the one in your Network Manager. Also do a "Restart Networking" in the Network Manager or we won't see the new bridge device (bhyve0) in bhyvemgr. 

We can use the default settings in bhyvemgr. We now have to get a Windows 11 image, we will use the custom image Tiny11 from NTDEV for it. You can build your own Tiny11 image with the tiny11builder but in this example we will use a ready ISO from the Internet Archive.

Of course you can also download the official ISO from Microsoft but it will be almost double the size (4.3 GB vs 7.9 GB) and you will have to disable the TPM requirement during the setup. You can install it with TPM support but that will require additional setup.

Unfortunately bhyvemgr is not shipped with a PolicyKit, meaning it does not gain superuser privileges by asking for a password. That means you either have to give its components root privileges as shown in the docs or you have to run bhyvemgr as root. But for terms of simplicity we will use the latter method.

Don't do the following step, I just keep it for documentary reasons: Open a terminal and type sudo bhyvemgr. Then click on the "Add" button and enter all the details of the virtual machine and finally click the button "Create Virtual Machine".

Unfortunately this does not work, it will just display the message "Trying to create [name] virtual machine..." in the lower part of the dialog. The file bhyvemgr.log in ~/.config/byhvemgr will show you the message "[name]: : Can not create zroot/bhyvemgr/[name]: dataset". We need to start bhyvemgr as a normal user and grant the tools it uses root privileges.

Copy this text to your clipboard:

## byhvemgr tools
%wheel ALL=(ALL:ALL) NOPASSWD: /usr/sbin/bhyve, /usr/sbin/bhyvectl, /bin/chmod, /usr/sbin/chown, /sbin/ifconfig, \
/usr/bin/install, /bin/kill, /sbin/kldload, /sbin/pfctl, /usr/bin/pgrep, /bin/rm, \
/usr/sbin/service, /sbin/zfs

Open a terminal. Now open the sudoers file with visudo:

sudo visudo /usr/local/etc/sudoers

Go all the way down with the Page Down (PgDn) key, go to the end of the line with the End key. Press the i key to change to insert mode. Go one character to the right with the arrow key and press Enter twice. Now paste the previously copied text with Ctrl+Shift+V. Press the Escape (Esc) key and type :wq to write the file and quit visudo.

Now we can do the second try. If the settings dialog pops up just save it and close it. Now add the virtual machine as in the screenshot above. It should be created right away, in my case I got the error "ZfsCreateDataset : zroot/bhyvemgr/tiny11 : cannot create 'zroot/bhyvemgr/tiny11': parent does not exist" in the log file because it seems bhyvemgr only creates the dataset once and I deleted it in the meantime. I created it manually with "sudo zfs create zroot/bhyvemgr" and then listed it with "zfs list".

Turns out there is an unexpected behavior of GhostBSD in that bhyvemgr expects a different mountpoint then the one actually created.

Thanks to the support of the author Alonso Cárdenas we could track down the issue and I set the mountpoint manually.

sudo zfs create -o mountpoint=/zroot/bhyvemgr zroot/bhyvemgr

This should be fixed in the next release of bhyvemgr (v1.14.1) and not be necessary to be done manually.

Too bad I can't show you a successful start of the now working creation of the virtual machine. As I am still using the emulator QEMU I get the error "tiny11 VM exited due to an error" in the GUI and "tiny11 VM : bhyve : vm_openf: No such file or directory" in the log file. Unlike QEMU/KVM, QEMU/WHPX does not yet support the passing of the VMX CPU parameter (I'm on an Intel machine) and therefore the nesting of another hypervisor is not working.

But the good news is that they seem to be working on that. Anyway if you are on bare metal then this should work.

Comments

Popular posts from this blog

How to install GhostBSD on Windows

Why does it say "User &" on the login screen?

The almost 10 year old mouse wheel bug in FreeBSD nobody cares about