GT2416, I too have been working hard to try and get Pi-Hole working in a VM under TrueNAS 12.0-U4.1 with mixed results. However, I think I did it a little different than you.
First, instead of Ubuntu, I used Debian 10.9.0 as that is what the current version of Raspian is based upon. I created a virtual machine with 1gb memory, 10gb disk and 2 cores with 2 threads. The amount of memory and disk are no-brainers, but I just guessed at the number of cores and threads to throw at it. As the Raspberry Pi I was trying to replace had 4 cores, I thought 2 cores and 2 threads each should be enough.
I installed Debian with only a couple of small problems. I had to make sure that the VNC device was set to 800x600 during the install, otherwise the screen ended up garbled. And Debian wouldn't boot after the install but this was a known problem with bhyve which required a simple fix. When the boot fails, let it time out (about 90 seconds) and then the UEFI Shell appears. At the "Shell>" prompt, type "exit" to start the Boot Manager then select "Boot Maintenance Manager", the "Boot from File" and select the first item listed, then select "<EFI>" then "<debian>" and finally "grubx64.efi". The system should now boot normally.
Once the system has booted, you must login as root then "cd /boot/efi/EFI", "mkdir BOOT", "cd BOOT", "cp ../debian/* ." and finally "cp grubx64.efi bootx64.efi". Doing this will now allow your new Debian VM to boot normally every time, but the same steps may be required anytime you update the Grub boot loader. This is a bhyve problem and not a Debian problem.
You should now install sudo and create the pi account (if you didn't do it during the install process) and any other software you may want to use.
Now install the Pi-Hole software as usual using the standard "curl -sSL
https://install.pi-hole.net | bash" and go through the normal Pi-hole scripts. If you use "unbound", then that can be added later. When finished installing, use your browser to connect to Pi-Holes admin console and do any further setup that you require.
When the install and setup has been completed, reboot your new Pi-Hole server to make sure everything starts correctly. You should now have a fully running Pi-Hole running in a VM on your TrueNAS server.
As a last step, you will want to make sure that your VM is set to autostart when the server reboots and also make sure that the VNC device is set to "NOT delay VM boot till VNC connects". This should allow the VM to start up without intervention should your server go down. That's what's supposed to happen
But ...
... this is where I'm having problems!
First, during the setup, I chose to use an unused network interface on my server. Plugged a network cable into the interface and into a switch and everything worked great while the system was up. But I wanted to make sure it would restart after a system reboot. So, at a quiet time, I rebooted my server and then all hell broke loose! That network interface started pumping out huge amounts of data and the server became unresponsive. I have yet to figure out what caused this, but I think it might have something to do with the way my network devices are configured. I've read as much documentation as I could find, but nothing stood out. When I got the system stabilized by unplugging the network cable, I restarted the VM and then everything worked great again.
This got me to thinking. My server does not used either the DNS or DHCP from the Pi-Hole. It's network interface is statically defined with address, default gateway and uses the gateway's DNS so no problem there, but all my clients use the Pi-Hole for both their DNS and DHCP. So I'm not sure if somehow they were getting into a race condition which caused the high network traffic.
Anyway, I think I'm close, but just haven't figured out the steps need to get to the finish line. So if you want to try these steps and see if you get any further, I would love to hear back from you. If you still want to go the Ubuntu route, the good luck and I hope you get it working.
Greg ...