3 bugs: unable to delete an interface via web UI, serial console and pci passthrough

timsf

Cadet
Joined
Feb 12, 2018
Messages
2
Hi there,

I was kicking the tyres of the TrueNAS-12.0-BETA.iso today in a VMware VM, eager to see whether I'd be able to dedicate one of the nics to a bhyve VM on my baremetal system running FreeNAS 11.3 when I finally upgrade it, rather than just giving it a virtio network interface.

After installing TrueNAS 12 beta, I tried to delete one of the network interfaces from the UI. It asked me to test the changes, then save the changes, but going back to the network summary, both interfaces were still present. Confirming that in a root shell, ifconfig still showed both interfaces, both with DHCP-assigned addresses.

When deleting the interface from the UI, middlewared.log showed:

[2020/07/18 08:56:11] (DEBUG) middlewared.interface_pre_sync_hook():1415 - No HA hardware detected, skipping interfaces setup.
[2020/07/18 08:56:12] (INFO) InterfaceService.sync():1774 - Interfaces in database: NONE
[2020/07/18 08:56:12] (DEBUG) EtcService.generate():363 - No new changes for /etc/dhclient.conf
[2020/07/18 08:56:12] (DEBUG) EtcService.generate():363 - No new changes for /etc/local/avahi/avahi-daemon.conf
[2020/07/18 08:56:12] (DEBUG) middlewared._update_birthday_data():1393 - Synchronization/update birthday data

So instead, I removed the interface from the command line using `ifconfig em1 delete`, and confirmed that that state was correctly shown in the web UI.

Then, I walked through wizard to create a FreeBSD 12 bhyve VM. I saw that when clicking on the "Serial" connection to the VM, we get a new browser window with a terminal that was trying to do a "cu -l /dev/nmdmundefinedB" which looks like another bug.

So, I just got the actual serial device from the VM info page, and ran the correct 'cu' command from a terminal, and continued installing the VM, and was able to access the VM as expected after it rebooted after installation.

When I tried to add a PCI device though, I only see "--" in the list of devices that can be added in the UI. pciconf -l shows the device as:

em1@pci0:2:5:0: class=0x020000 card=0x075015ad chip=0x100f8086 rev=0x01 hdr=0x00
vendor = 'Intel Corporation'
device = '82545EM Gigabit Ethernet Controller (Copper)'
class = network
subclass = ethernet

Hacking about a bit (I'd *never* do this on anything other than a throwaway VMware install!) and digging very briefly through /usr/local/lib/python3.8/site-packages/middlewared/plugins/vm.py, I tried modifying freenas-v1.db, adding an entry to the vm_devices table that I thought might get me what I need:

INSERT INTO vm_device VALUES(5,'PCI','{"pptdev: "2/5/0"}',1,NULL);

but /var/log/libvirt/bhyve/1_test.log was still not showing the passthru device in the bhyve command being run.

So then on the command line, I tried the correct bhyve command, only to be told:

truenas# /usr/sbin/bhyve -c cpus=1,sockets=1,cores=1,threads=1 -m 512 -S -A -w -H -s 0:0,hostbridge -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s 3:0,ahci,hd:/dev/zvol/tank/test-xhgmp -s 30:0,xhci,tablet -s 2:0,ahci -s 4:0,e1000,tap0,mac=00:a0:98:7e:69:f8 -s 31,lpc -l com1,/dev/nmdm1A -s 29,fbuf,vncserver,tcp=0.0.0.0:18665,w=1024,h=768 -s 7,passthru,2/5/0 1_test
bhyve: PCI device at 2/5/0 is not using the ppt(4) driver
device emulation initialization error: No such file or directory
truenas#

so digging around vm.py a bit more, it looks like we're searching for ppt devices only, which would explain why we're not finding any on the system. So, I then tried:

truenas# devctl detach em1
truenas# devctl set driver pci0:2:5:0: ppt
devctl: Failed to set pci0:2:5:0: driver to ppt: No such file or directory
truenas#

and at this point, I'm sort of at the limit of my FreeBSD knowledge...

As a last hope, I tried adding a loader.conf variable (via the web UI) to set pptdevs=2/5/0, and rebooted, but had the same problem as the above, and on reboot, em1 got configured as a network interface in the host, so I'm guessing my attempt to reserve the device for the bhyve VM failed.

I'm going to give up now, but I'm curious if I'm doing something wrong here?

thanks!

tim
 

Valery91

Cadet
Joined
Feb 7, 2022
Messages
1
I had a similar problem. I tried many different ways, including those that were announced in this Computools blog - it helped me only partially. I will also wait for answers from other users. It is interesting to know how to solve this problem.
 
Top