I prefer to install packages distributed by VirtualBox rather than packages built by the distro maintainers as I don't have to wait for a new package when a new kernel is released. Unfortunately this involves rebuilding the vbox kernel modules after the new kernel is booted. So I decided to devise a way to automate this.
First I wrote a script to check if the vbox modules are loaded and if not to run the setup script. It's just this:
#!/bin/sh
First I wrote a script to check if the vbox modules are loaded and if not to run the setup script. It's just this:
#!/bin/sh
sleep 120
if ! lsmod | grep -s vbox > /dev/null
then
/usr/lib/virtualbox/vboxdrv.sh setup
fi
The sleep is needed as in some init systems cron comes up even before all the modules are loaded. Next, I installed a crontab entry that runs the script above once at bootup, using the @reboot notation:
This goes into root's crontab, using crontab -e.
And voilà, that's all that's needed.
if ! lsmod | grep -s vbox > /dev/null
then
/usr/lib/virtualbox/vboxdrv.sh setup
fi
The sleep is needed as in some init systems cron comes up even before all the modules are loaded. Next, I installed a crontab entry that runs the script above once at bootup, using the @reboot notation:
@reboot /root/bin/vboxdrv
This goes into root's crontab, using crontab -e.
And voilà, that's all that's needed.
No comments:
Post a Comment