So I tried to install virtual box on my 18.04. It told me to reinstall virtualbox dkms. After looking around the forums I determined I needed to run sudo apt-get --reinstall virtualbox-dkms. When I do, Ubuntu says dpkg was interrupted. you must manually run sudo dpkg --configure -a to correct the problem. I do this and it just hangs forever. Am I missing something I need to fix this?

Edit: The line it gets stuck on is:

building initial module for 4.15.0-23 generic
  • How did you solve this? I also have this problem. – lonix Jun 30 '18 at 7:42
  • Do you have secure boot enabled? – Mike Dacre Jul 3 '18 at 0:21
  • Welcome to Ask Ubuntu! Could you please add a little more detail? What exactly did you do, what did you expect to happen and what happened instead? Did you encounter any warning or error messages? Please reproduce them in their entirety in your question. You can select, copy and paste terminal content and most dialogue messages in Ubuntu. Please edit your post to add information instead of posting a comment. (see How do I ask a good question?) – David Foerster Jul 8 '18 at 3:08

What fixed it for me was running Ubuntu's "Software Updater" in graphical mode and rebooting as it asked me to do. Terminal apt is back to normal :)


It seems like this is an issue with secure boot, I have the same problem and found the solution in this forum: https://ubuntuforums.org/showthread.php?t=2393436.

Try to reboot and disable Secure Boot, then reboot, and either reinstall virtualbox-dkms or run dpkg-reconfigure virtualbox-dkms. It should work now.

If you want secure boot to work still, you then need to re-enable secure boot and sign the modules following this guide: https://blog.ubuntu.com/2017/08/11/how-to-sign-things-for-secure-boot

This is unfortunate, because it means if you want secure boot enabled, then every time there is a kernel upgrade, you need to:

  1. Reboot and disable secure boot
  2. Run dpkg-reconfigure virtualbox-dkms
  3. Reboot and re-enable secure boot
  4. Sign all the new modules
  5. Reboot one last time (or possibly just modprobe the modules)

That is a lot of fuss and rebooting, but it should at least work. Of course, you could also just leave secure boot disabled until you reboot into Windows.


There is a better way to do this that does not require multiple reboots. Apparently, what is happening is that the MOK module signing is waiting in the background for a root password. Check out this answer for more information: reconfiguration issues with dpkg

  • My system always boots in insecure mode and I still have the same issue. – Ramon Suarez Jul 11 '18 at 9:03
  • It's possible that this issue happens for multiple reasons. Essentially something is blocking the ability to create new unsigned kernel modules (I believe). For me and other people that was secure boot, but perhaps for you it is was an apt or dkms bug of some sort, given the solution that worked for you. – Mike Dacre Jul 12 '18 at 19:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.