VirtualBox Linux kernel driver just doesn't want to work properly

Every other time I try to run a VirtualBox OS, I’ll get this notice:

VirtualBox - Error In suplib0sInit:
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

'/etc/init.d/vboxdrv setup'

as root. Users of Ubuntu, Fedora or Mandriva should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

I’ve tried reinstalling the driver using the method mentioned in the error:

Stopping VirtualBox kernel modules                                   done
Uninstalling old VirtualBox DKMS kernel modules                      done
Trying to register the VirtualBox kernel modules using DKMS          done
Starting VirtualBox kernel modules                                   done

but the problem still persists!

Before I waste another 3 hours trying to get this working I figured I’d ask here.

Any ideas?

Check this
Virtual Box (Sun Version) Install HowTo

Make sure your setting here is easy
http://dl.dropbox.com/u/10573557/SUSE%20Misc/easy-paranoid.png

First of all which version of VirtualBox are you running?
Did you install VirtualBox PUEL from Oracle or OSE from openSUSE?
Which version of openSUSE are you running?
Make sure that you have added yourself to vboxusers group via:

Yast → Security and Users → User and Group Management.

Cheers!

Romanator

I just did all that but I still got the error when I rebooted.

I guess I could just have the “/etc/init.d/vboxdrv setup” run at start up as a last resort, but I have no clue how to set that up properly.

Or if opensuse has the option to save my session on logout/shutdown I guess I could live with that.
Hehe, it’s funny how I’m just now thinking about these.

What error?

What happens when you try and start Virtual Box?

In a terminal to start it: VirtualBox

The VirtualBox kernel driver error from the first post, although I just realized that I only get that error whenever I have it run at startup. Could it be that VirtualBox starts running before the driver gets a chance to load? And if that’s true is there any way to have the driver start first?

Maybe creating a script that executes the driver, and then starts the application would be a viable option. I don’t know how you would get a driver running though, I’m assuming you can’t just run it like an executable.

I’m using the “VBoxManage startvm” command and switch to run the VM directly, not “VirtualBox” by the way.

Yes, you have to start the VM after the driver is loaded. You should adjust your init script so that it Requires the vboxdrv capability in the metadata at the top of the file. But I’m guessing you aren’t using an init script but putting it in boot.local or something. That gets run too early in the boot sequence.

Okay I created this script and am having run at start-up:

echo **** | sudo -S /etc/init.d/vboxdrv start
VBoxManage startvm "Windows XP"

Everything works now, thanks guys. (And I understand that having my password visible in a script like that isn’t exactly the safest way to go around it, but, considering how I really only use this computer for music and schoolwork, I don’t mind the risk.)

This is off-topic, but I’d also like to know how run the command {VBoxManage controlvm “Windows XP” savestate} automatically whenever I click the shutdown button. Is there a configuration script I need to edit to do this? What is it called and where is it located?

Are you talking about when you click the shutdown button on the host OS?

You can edit sudoers so that you can run that command (and only that exact command) without a password.

I’m not sure why you need to run the init script manually with sudo. It should be active on boot. Check this:

chkconfig --list vboxdrv

If not on in runlevels 3 and 5 at least, then do:

chkconfig --set vboxdrv on

Yep. …

If you are talking about the host OS and you are running KDE then this is what I would do:

kwrite ~/bin/savexpstate.sh

Add this in that text file and save:

VBoxManage controlvm "Windows XP" savestate

Then give it executable rights

chmod +x ~/bin/savexpstate.sh

Then in KDE control center go to Startup and Shutdown -> Autostart -> Add script -> Browse to your home folder, click bin, then click on savexpstate.sh. Then hit OK. Then change run on for savexpstate.sh to Shutdown

It says it’s been running on those run levels. I’m guessing it just doesn’t run quick enough for the VM to start, but when I did it manually it only took a second to start up so that can’t be it. I’m using the “Startup Applications” application in control center to configure these startups by the way.

Thanks for the effort but I’m running GNOME, not KDE.

If you are running GNOME I think you can add something to /etc/gdm/PostSession/Default. Let me power up my GNOME machine and I will investigate. Give me about 20 minutes :slight_smile:

I think I got it for GNOME. As root (by doing su - in terminal try this) -

  1. Open this file
gedit /etc/gdm/PostSession/Default
  1. Add this AFTER the “#!/bin/sh” line but BEFORE the “if test -x… etc” line
su *<your username here>* -c '/usr/bin/VBoxManage controlvm "Windows XP" savestate'

e.g. For me this would be:

su andrew -c '/usr/bin/VBoxManage controlvm "Windows XP" savestate'

as my username is andrew.

Save and close the file. Now it SHOULD work when you shutdown but this is untested so I am not 100% sure if it would work or not

No, it didn’t work, although when I ran {su xypher -c ‘/usr/bin/VBoxManage controlvm “Windows XP” savestate’} in terminal I noticed it prompted me for a password before it executed. That could be what’s stopping it, but wouldn’t that have stopped the shutdown process from completing? It’s still giving me the “Waiting for the program to finish” notice.

That script (/etc/gdm/PostSession/Default) runs as root so when when you do su as root it doesn’t ask for password. How long does it take for the Windows XP Virtual Machine to save state when you do it manually via command line?

It takes around 5 seconds.

Maybe try modifying the script to something like this then?:


su *<your username here>* -c '/usr/bin/VBoxManage controlvm "Windows XP" savestate' &
sleep 5

Notice the ‘&’ and the sleep. That should give it enough time for the VM to savestate before the computer begins to shut down