Solution 1:

sudo dpkg-reconfigure virtualbox-dkms

if you need to get back to that dialog again.

Ubuntu 18.04 + virtualbox-dkms will only bring up that dialog box if you do not have a Machine Owner Key (MOK) already enrolled. If a MOK is already enrolled, dkms will just uninstall and reinstall the virtualbox dkms drivers.

The Secure Boot enabled method is the "safe" method. Tell it to enroll a new MOK. It will generate it and "prepare" it for enrolling after you specify a "transport" password and reboot.

When you reboot, MOK Manager instead of GRUB will display in blue. Choose, [Enroll MOK]. Enter the "transport" password previously entered before the reboot. You will never be asked for this "transport" password again so you can forget about it now. Verify the MOK certificate information (creation date) shows the time you generated it. Continue enrolling the MOK.

You can reboot back into Ubuntu and run

sudo dpkg-reconfigure virtualbox-dkms

again. It should just uninstall and reinstall.

Future dkms kernel drivers should automatically be signed with the MOK key without further special action on your part.