Just upgraded last month form 16.3 to 17.2 - I installed the latest version of VB from Oracle and tried to set it up for a Windows VM. I got an error message (see image).
I tried the command suggested in the message in Terminal [sudo /sbin/vboxconfig] and this was the result:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
I could not find a /var/log/ directory in my home (.var) or under root.
It may be a secure boot issue. When you install a virtual machine (whether VirtualBox or VirtualMachine), you actually need to have the virtual machine's signed key signed by your MOK.der key in /var/lib/shim-signed/mok. Use mokutil to add the key and sign it, then run sudo update-grub to update your grub file. There are more detailed instructions which you can find on the Internet simply by Googling it.
Maybe it is a secure boot issue like @reahcsa suggests. I just installed VirtualBox 7.1.4 on Zorin OS 17.2 like 3 days ago from the Oracle site for a project I'm in the middle of. The VirtualBox in Software (6.1.5) threw an error about building, something about needing at least VB 7 for my kernel. Or something. I didn't really pay attention I just started searching the web for version 7+. One of the machines I created was a Win10 and it didn't throw that error. I don't have secure boot on host or guest.
Oh edit to add I didn't upgrade from Zorin 16.3 though. I only used 17+ on this machine.
Edit wait, maybe the error did occur when I tried to build a machine! I was in such a hurry to get my project done I didn't really pay attention.
I thought about the secure boot, but I turned that off on my machine way back when I installed Zorin 16.1 a few years ago. I did a clean install of 17.2 - saved all my files and booted from a USB and wiped my drive for Zorin 17.2. I guess it can't hurt to go into my BIOS and double check.
I thought about that but I had checked and the gcc is 11.4.8 on my Zorin OS 17.2. The download I chose from the Oracle site was Ubuntu 22.04 version. So I don't know what the difference it, except I never updated this machine from 16.3.
Correct, gcc is installed by default, but at version 11, whereas version 12 is needed in this case. Why there are two different packages for each version, I don't know...
If the user is hitting a dependency snag looking for a higher version, they likely have a higher repository added that is sourcing Virtualbox, instead of the default Zorin OS repositories.