Cannot load VirtualBox after upgrading Ubuntu

If your computer uses SecureBoot, you may occasionally encounter this problem after upgrading the operating system. Thankfully, the solution is simple after some initial setup the first time.

The error generally reads something like: Could not load ‘modprobe vboxdrv’

First time:

  1. Create signing keys:

    openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive name/"

  2. Sign the module (vboxdrv for this example):

    sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)

  3. Register the keys to Secure Boot:

    sudo mokutil --import MOK.der

  4. Supply a password for later use after reboot
  5. Reboot and follow instructions to Enroll MOK (Machine Owner Key).
  6. Restart after enrolling
  7. After the reboot, you may also need to load the module:
    sudo modprobe vboxdrv

After future updates you might re-encounter the problem, then you just need:

  1. sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
  2. sudo modprobe vboxdrv

REFERENCES:

Ubuntu grub timeout warning on update

Shortly updating to Ubuntu Trusty (14.04), I noticed the following warning on my console during updates. I finally got around to looking into it deeper and found that many users have seen this too.

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

If you edit the ‘grub’ file, you can comment out the GRUB_HIDDEN_TIMEOUT line by adding a hash in front of it.

sudo vi /etc/default/grub

Verify that the error is fixed by executing the following:

sudo update-grub

If you are interested, you can also go and look at the updated ‘grub’ file at

/boot/grub/grub.cfg

NOTE: I’d also seen that the following command could be used, but it was of no use in my testing.

/usr/share/grub/default/grub

REFERENCES:

Remove old Ubuntu kernels

If you update your Ubuntu kernel frequently, eventually you will come to the realization that it is taking a lot of space to keep the old versions around on disk. Another annoyance is that your Grub loader will show a very long list. Sure, you can keep them around forever, should you need to recover them, but for most people it’s safe to remove them. You can manually select and remove the packages in Synaptic, but the easiest way I’ve found is to sun the following script instead. It will remove all old kernel version (except the current one!):

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

Occasionally, you might also want to follow that with the following to clean up other artifacts too…
sudo apt-get autoremove

REFERENCES: