# Can't run virtualbox.

## Budoka

I am using the following wiki to install and run VirtualBox. http://wiki.gentoo.org/wiki/VirtualBox but can't get it to run.

When I execute the requested modprobes it kicks out errors.

 *Quote:*   

> # modprobe vboxdrv
> 
> modprobe: ERROR: could not insert 'vboxdrv': Exec format error
> 
> # modprobe vboxnetadp
> ...

 

If I try to run the app I get a highly cryptic, at least to me, error message concerning the modules.

 *Quote:*   

> # VirtualBox
> 
> WARNING: The VirtualBox kernel modules are not loaded.
> 
>          Please load all the needed kernel modules by:
> ...

 

I really haven't have any idea what 

```
for m in vbox{drv,netadp,netflt}; do modprobe $m; done
```

 is instructing me to do and I have hunted around the kernel for compile options for vbox with no luck.

Thanks.

----------

## slis

Hi!

The line:

```
for m in vbox{drv,netadp,netflt}; do modprobe $m; done
```

is responsible for loading modules needed by virtualbox to run.

In it's minimal requirements it needs vboxdrv, but especially when you're using custom network settings you have to load also vboxnetadp and vboxnetflt. So this command does.

The exec format error you've got probably means that you're running older kernel that this modules has build.

First try is to rebuild app-emulation/virtualbox-modules.

```
emerge app-emulation/virtualbox-modules
```

----------

## imaginasys

I know it seems too easy but did you tried :  # /etc/init.d/vboxdrv setup

Regards,

                BT  :Mr. Green: 

----------

## Sum1

I'm receiving a similar error message but ran out of time this weekend to fix it.

I found this thread and it looks to have some advice on installing/loading the correct modules --

https://forums.gentoo.org/viewtopic-t-943892-highlight-virtualbox+vboxdrv.html

----------

## Budoka

 *slis wrote:*   

> Hi!
> 
> The line:
> 
> ```
> ...

 

So where and how am I adding that line, or executing it?

Trying to rebuild generated the following error but I followed the instructions and then was able to successfully rebuild.

 *Quote:*   

> >>> Failed to emerge app-emulation/virtualbox-modules-4.1.24, Log file:
> 
> >>>  '/var/tmp/portage/app-emulation/virtualbox-modules-4.1.24/temp/build.log'
> 
>  * Messages for package app-emulation/virtualbox-modules-4.1.24:
> ...

 

However this didn't fix my initial problem and the error generated is the same.

----------

## Budoka

 *imaginasys wrote:*   

> I know it seems too easy but did you tried :  # /etc/init.d/vboxdrv setup
> 
> Regards,
> 
>                 BT 

 

 *Quote:*   

> # /etc/init.d/vboxdrv setup
> 
> bash: /etc/init.d/vboxdrv: No such file or directory
> 
> 

 

----------

## imaginasys

 *Budoka wrote:*   

>  *Quote:*   # /etc/init.d/vboxdrv setup
> 
> bash: /etc/init.d/vboxdrv: No such file or directory
> 
>  

 

Are you on systemd ?  There should be a service called "vboxdrv"

on my other computer at work, I have virtualbox on Ubuntu, and there are the following services for virtualbox:

```
bernard@M164911:/etc/init.d$ ls vbox*

vboxautostart-service  vboxballoonctrl-service  vboxdrv  vboxweb-service
```

And when I upgrade the kernel, I have to run "/etc/init.d/vboxdrv setup" to link the new modules with the kernel.

But it may be different on gentoo.    I only have KVM on my gentoo here so I can't be sure.

Sorry,

          BT 

 :Mr. Green: 

----------

## slis

 *Quote:*   

> So where and how am I adding that line, or executing it?

 

You can call it anywhere in console, as root.

Maybe it's good to add those modules to autoload at system boot?

And one another guess from me: please check where symlink /usr/src/linux is pointing to? 

When building VirtualBox modules it have to point to current kernel version.

The easiest way to check that is to call:

```
eselect kernel list
```

and if there is wrong kernel selected, you may switch to correct by using

```
eselect kernel set KERNEL
```

After that you have to re-emerge  virtualbox-modules again.

----------

## Budoka

 *slis wrote:*   

>  *Quote:*   So where and how am I adding that line, or executing it? 
> 
> You can call it anywhere in console, as root.
> 
> Maybe it's good to add those modules to autoload at system boot?
> ...

 

Thanks. I ran it from the cli as root and still get the Exec format errors. 

 *Quote:*   

>  # for m in vbox{drv,netadp,netflt}; do modprobe $m; done
> 
> modprobe: ERROR: could not insert 'vboxdrv': Exec format error
> 
> modprobe: ERROR: could not insert 'vboxnetadp': Exec format error
> ...

 

I checked my kernel symlink as you suggested and it is indeed pointing to the most recent kernel.

 *Quote:*   

> $ eselect kernel list
> 
> Available kernel symlink targets:
> 
>   [1]   linux-3.6.11-gentoo
> ...

 

Any other ideas?

----------

## slis

Please see what dmesg is telling after modprobe. 

Paste some of the last lines from dmesg somewhere and let us know.

----------

## Budoka

 *slis wrote:*   

> Please see what dmesg is telling after modprobe. 
> 
> Paste some of the last lines from dmesg somewhere and let us know.

 

This is my dmesg after doing the modprobe.

http://bpaste.net/show/91695/

I assume the last bit is pertinent to my problem.

 *Quote:*   

> [  133.285951] warning: `VirtualBox' uses 32-bit capabilities (legacy support in use)
> 
> [ 1096.176207] hda-intel 0000:00:1b.0: Unstable LPIB (65480 >= 8192); disabling LPIB delay counting
> 
> [ 5512.844501] vboxdrv: no symbol version for module_layout
> ...

 

----------

## slis

I'm going out of ideas.

How'd you compiled your kernel? Is it gentoo-sources && manual make && install? Have you installed modules (make modules_install)?

I've found that this could be related to /usr/src/linux/Module.symvers isn't exist.

In my opinion, the surest thing to get it working would be:

1. make clean && make && make modules_install in /usr/src/kernel

2. install latest kernel image and reboot

3. emerge virtualbox virtuabox-modules

Hope it helps somehow.

----------

## bonkko

I'm using gentoo in a 64 bit environment (64 bit kernel)

I have the same problem of budoka (modprobe fails)and I did the steps described by Slis.Things don't change and error don't go away.IMHO this is a development error: Virtualbox Library ( .so files ) may be  compiled by Oracle with  32 bit ABI.Otherwise the code may be affected by presence of explicit 32 bit syscall or ASM(I did not read the VBOX code,It's only one hipotesys).Does Last old relase of Vbox have the same problem in 64 bit Environment?

(Sorry for my English)

----------

## slis

bonkko,

which version of app-emulation/virtualbox-modules do you have installed?

----------

## bonkko

 *slis wrote:*   

> bonkko,
> 
> which version of app-emulation/virtualbox-modules do you have installed?

 

4.1.24 (The portage version)

----------

## queen

 *bonkko wrote:*   

>  *slis wrote:*   bonkko,
> 
> which version of app-emulation/virtualbox-modules do you have installed? 
> 
> 4.1.24 (The portage version)

 

I am having the same problem too. 

I tried to emerge again virtualbox-modules and I get 

```
Installing (1 of 1) app-emulation/virtualbox-modules-4.2.12

 * Removing app-emulation/virtualbox-modules-4.2.12 from moduledb.

 * Updating module dependencies for 3.4.9-gentoo ...

 * 

 * /lib/modules/3.4.9-gentoo/build/System.map not found.

 * You must manually update the kernel module dependencies using depmod.                                                                                                                 [ !! ]

 * 

 * Adding module to moduledb.

 * Starting with the 3.x release new kernel modules were added,

 * be sure to load all the needed modules.

 * 

 * Please add "vboxdrv", "vboxnetflt" and "vboxnetadp" to:

 * /etc/conf.d/modules

```

Indeed it doesn't have System.map in that directory. 

I am tempted to cp System.map from /boot. 

dmesg says:

```
 vboxdrv: no symbol version for module_layout
```

depmod -a didn't help.

you used genkernel to build the kernel?

you have KMS build in the kernel? 

check 

```
  grep KMS /usr/src/linux/.config 
```

----------

## queen

I solved the problem. 

Bonqo, here is what I did. You should follow these instructions:

1. cd /usr/src/linux

2.  make clean 

3. compile your kernel. make sure you have KMS enabled in the kernel. In my case I had it already. Check with the command 

```
 grep KMS /usr/src/linux/.config

4. emerge again virtualbox-modules. In my case I re-emerge other packages of virtualbox too (just to be on the safe side). 

5. reboot

6. now run 
```

/etc/init.d/vboxdrv setup

you shouldn't have any errors when you emerge again virtualbox-modules.

Note: In my case I forgot to emerge again the package before rebooting. It worked as well.

----------

## rldawson

Here is a small tidbit that could be helpful:

```
emerge module-rebuild;module-rebuild rebuild;echo "modules=\"vboxdrv  vboxnetadp vboxnetflt vboxpci\"" >> /etc/conf.d/modules
```

----------

## queen

 *rldawson wrote:*   

> Here is a small tidbit that could be helpful:
> 
> ```
> emerge module-rebuild;module-rebuild rebuild;echo "modules=\"vboxdrv  vboxnetadp vboxnetflt vboxpci\"" >> /etc/conf.d/modules
> ```
> ...

 

This is really cool. I didn't know there is such a program.

----------

## NeddySeagoon

Hmm,  @module-rebuild is a set in portage-2.2

----------

## queen

 *NeddySeagoon wrote:*   

> Hmm,  @module-rebuild is a set in portage-2.2

 

Nice. When portage-2.2 will be stable?

----------

## jasn

Actually on my system with;

```
sys-apps/portage-2.1.12.4
```

The following sets exist:

```
    live-rebuild

    module-rebuild

    preserved-rebuild

    security

    selected

    system

    world

    x11-module-rebuild
```

Good Luck..

----------

