You are not logged in.
After getting trapped by not recompiling my VirtualBox modules after a kernel (or VirtualBox) upgrade, I decided to add this to /etc/rc.local:
vboxdrvrunning() {
lsmod | grep -q "vboxdrv[^_-]"
}
vboxdrvrunning || {
/etc/rc.d/vboxdrv setup
modprobe vboxdrv
}This code checks if vboxdrv was succesfully found and loaded on startup and if not, it recompiles the VirtualBox modules and manually loads vboxdrv. So far, it seems to work correctly (in both cases).
I'd like to know if there are any drawbacks? If not, should I propose a feature request to the VirtualBox package? Or is there an improvement possible?
Offline
This actually makes more sense as a pacman hook. You can of course add this to the Virtualbox wiki, but packages aren't supposed to mess with rc.local anyway so I highly doubt this is going into the Virtualbox package.
Drawbacks:-
1. Sometimes when starting up a computer (esp. laptop) you want it used immediately, compiling vbox modules in the background delays this considerably.
2. Only compiles for the running kernel. I have my own simple script which builds for all installed kernels (based on the same loop as my nvidia-beta-all package).
In general, this being Arch, this module recompiling should be done manually by the user. Automating it just makes the system more opaque.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Thanks for your feedback. I now see I was not totally clear about the feature request: I meant a request to add a message that one can add these lines of code to /etc/rc.local, not doing this without influence of or knowledge to the user.
1. Agreed, that came to my mind, too.
2. Which script? From the AUR comments I extracted this one:
#!/bin/sh
NEWZEN=`pacman -Ql kernel26-zen | grep /modules.alias.bin | sed 's/kernel26.*\/lib\/modules\/\(.*\)\/modules.alias.bin/\1/g'`
KERN_DIR="/usr/src/linux-${NEWZEN}"
MODULE_DIR="/lib/modules/${NEWZEN}/misc"
sudo -E /etc/rc.d/vboxdrv setup
sudo depmod -a $NEWZENbut it doesn't work flawlessly anymore, I still get errors about modules not being found (IIRC).
Offline
#! /bin/bash
#VBOX_SRC_PATH=/opt/VirtualBox/src/vboxhost
VBOX_SRC_PATH=/usr/lib/virtualbox/src/
for KERNEL in `file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'`;
do
echo "Building vboxdrv for $KERNEL"
cd $VBOX_SRC_PATH
sed -i 's/$(shell uname -r)/'$KERNEL'/' ./*/Makefile
make clean && make && make install
sed -i 's/'$KERNEL'/$(shell uname -r)/' ./*/Makefile
doneDoesn't do error checking or anything, but works for me. Not sure why you're starting with -Ql kernel26-zen, you're listing every file in one installed kernel. You don't even need that section.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
2. Which script? From the AUR comments I extracted this one:
Marcel-, that piece of code is actually the start of an addition to ngoonee's pkgbuild. I keep my zen kernel with the git suffix on it, which caused problems with ngoonee's original loop. That piece of code you found there looks like what I wrote and passed along to ngoonee, who fixed it up and incorporated as an alternative way for the script to detect what kernels are installed. For the actual loop itself as implemented in the nvidia-beta-all package, probably better off looking in the pkgbuild.
Ngoonee, thanks for sharing that script. I hadn't really thought to use that same loop for building virtualbox too. I will be making use of this.
Nai haryuvalyë melwa rë
Offline
You're also making the assumption that vbox users always load vboxdrv at boot time. I only load it when I need it.
Also, "getting trapped"... isn't that a bit over-dramatic? ![]()
Last edited by tomk (2011-04-27 17:59:58)
Offline
Also, "getting trapped"... isn't that a bit over-dramatic?
Just imagine, you're all stuck in your Arch system, with NO WAY OF IMMEDIATELY BOOTING VIRTUALBOX!!! How can you get your Microsoft Office fix now?
Oh wait.... just /etc/rc.d/vboxdrv setup and modprobe and you're good to go
.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
You don't even need the modprobe
Offline
You don't even need the modprobe
Ah. Yes you're right of course. Thing is I use my own script (see above) and it doesn't modprobe =p. That's cos I normally run it after updating and before rebooting....
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
install dkms and dkms-virtualbox_bin 4.0.6-1
add "dkms_autoinstaller" on rc.conf Daemons
enjoy
greetings
Offline
That piece of code you found there looks like what I wrote
Indeed, it's from the comments of zen-kernel package in AUR and I also use the git suffix in my kernel name. The script used to work, but it doesn't anymore, so that's why I was looking for an alternative solution.
You're also making the assumption that vbox users always load vboxdrv at boot time.
No, I'm not making that assumption: I thought it might be useful to other users if such code is included in post_install(), so anyone can choose whether they want to incorporate the code or not. It's just the same as the current suggestion made there:
===> To load it automatically, add vboxdrv module
===> to the MODULES array in /etc/rc.conf.Also, "getting trapped"... isn't that a bit over-dramatic?
[sarcastic]The only thing I use this computer for is running my favourite web browser, Internet Explorer. Why isn't it available in the AUR, yet?[/sarcastic]
"I got stuck" was perhaps a better description.
You don't even need the modprobe
It is, as `vboxdrv setup` only reloads modules that are loaded at the moment it starts. vboxdrv isn't loaded at the moment the modules have to be recompiled.
Anyway, ngoonee, thanks for your script, I will try that one.
Offline