I made recently a VM inside Freenas with Ubuntu and Pi-Hole to get out some advertisements from my network.
All was configured as described here :
The main problem that remains is that after a restart of the VM ( ubuntu) the system does not reboot correctly. I did not entered in details about the boot process of the VM inside Freenas but apparently is an issue with the EFI file location. The longer explanation is given here :
So … how to fix it ?
first you need to open the VNC to the VM machine ( ubuntu in this case). Then you type “exit” to get from shell to the EFI menu system and navigate to “Boot Maintenance Manager” and then select “Boot from file” to locate and select your grubx64.efi file.
After booting, execute this command as root (use sudo !!):
grub-install –efi-directory=/boot/efi –boot-directory=/boot –removable
then after reboot of the VM you get back the VNC terminal.
If your VM restarted correctly then it is fine.
If not, then you have to copy some files to be sure that the reboot will happen next time also.
More specifically you have to copy the grubx64.efi from /boot/efi/EFI/ubuntu to /boot/efi/EFI/BOOT.
Do this as root (use sudo !!!) :
cp /boot/efi/EFI/ubuntu/grubx4.efi /boot/efi/EFI/BOOT/grubx64.efi
cp /boot/efi/EFI/ubuntu/grubx4.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
NB: If grubx64.efi gets updated you will need to re-create bootx64.efi.
So if the VM ubuntu make an automatic update of the grub utility then you may get the VM(ubuntu+PiHole) not restarting correctly. If you do not reboot ever the Frenas and VM then you are fine, but if you get regular restarts ( updates or maintenance) then please remember to do all this steps again.
Unfortunately I do not have yet a permanent fix.
For making updates to the VM machine ( ubuntu , in my case) it is better to apply only the security patches and for that is better to use
and not the classical apt-get
sudo apt-get update
sudo apt-get upgrade