Why do I need to re-load kernel modules for virtualbox after a kernel update?

6,035

Solution 1

The VirtualBox host modules are build from source code on your machine. Modules for one kernel will not necessarily work (or work properly) on another kernel. They are typically recompiled after the kernel is upgraded.

When you install a new kernel version, your old kernel is still running. As Javier Rivera says, you must reboot to use the new kernel.

So if your goal is to run VirtualBox on the new kernel, you need to reboot; the modules will be loaded when you do (after being rebuilt from source if necessary).

However, if your goal is to use the old modules with the old kernel, you can manually reload them with modprobe (as you've been doing).

If you believe it's a bug that VirtualBox modules don't keep working for the running kernel before reboot, you can bugreport that. If you're using the version of VirtualBox provided officially in Ubuntu (rather than the version from Oracle's software source), I recommend reporting this against downstream VirtualBox (i.e., against Ubuntu's VirtualBox). Please read this guide carefully first. There's also helpful information on bug reporting in this question.

If you can produce this with the upstream version of VirtualBox (especially if it happens on non-Ubuntu systems, but I don't think that's essential here), I recommend reporting it (or also reporting it) upstream (search first).

I recommend not accepting this answer immediately; maybe someone can better explain why the modules are unloaded.

Solution 2

If you had to run '/etc/init.d/vboxdrv setup' after the update and before loading the new kernel modules, ensure that dkms is installed and updated properly. This is the component that recompiled the modules when you reboot after updating the kernel, it should also load the modules when finished. That is the only circumstance where I could get it to fail in my testing. If that is not the case, I would take Eliah's advice and file a bug report.

Share:
6,035

Related videos on Youtube

Ammon
Author by

Ammon

Updated on September 18, 2022

Comments

  • Ammon
    Ammon over 1 year

    After the last kernel upgrade in Ubuntu 12.10 I had to manually re-load two kernel modules for Virtualbox.

    modprobe vboxdrv and modprobe vboxnetflt

    I don't know enough about the system to say if this is a bug, or if it's supposed to be like that, but it is rather inconvenient. As a user new to Ubuntu, it was fairly time consuming to find out what had to be done.

    It was an automatic update, which asked me to reboot when it finished. After re-boot, virtual machines wouldn't run until I had re-loaded the modules.

    So my questions are: is this normal? Will it happen with other packages, or just Virtualbox? Is the updater supposed to do this automatically? Should I file a bug report, and if so, to whom?

    • Javier Rivera
      Javier Rivera over 11 years
      You should restart after a kernel upgrade unless you are using some tool to hot-patch the current running kernel. Otherwise you will be using the old kernel. Restarting will take care of module reloading.