divx118 / crouton-packages

Kernel-headers packages to use with crouton
56 stars 16 forks source link

Installing Kernel Headers from PPA #2

Closed sanicki closed 9 years ago

sanicki commented 9 years ago

I followed the instructions here to install kernel headers from PPA on my Chromebook Pixel. However after logging back in when I launch Virtualbox 4.3 and attempt to start either an x86 or x64 VM I receive the error "Kernel driver not installed." I have confirmed the rc.local was written correctly. Unsure how to proceed.

divx118 commented 9 years ago

Did you install virtualbox from ubuntu ppa or downloaded it from the oracle site? If you downloaded it from the oracle site can you try:

$ sudo /etc/init.d/vboxdrv setup

If you installed from the ubuntu ppa can you give me the output of

 $ cat /var/log/vbox-install.log
sanicki commented 9 years ago

Installed using deb http://download.virtualbox.org/virtualbox/debian trusty contrib

sudo /etc/init.d/vboxdrv setup produces:

Uninstalling old VirtualBox DKMS kernel modules ...done.
Trying to register the VirtualBox kernel modules using DKMSError! Your kernel headers for kernel 3.8.11 cannot be found.
Please install the linux-headers-3.8.11 package,
or use the --kernelsourcedir option to tell DKMS where it's located
 ...failed!
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...failed!
  (Look at /var/log/vbox-install.log to find out what went wrong)

cat /var/log/vbox-install.log produces:

Uninstalling modules from DKMS
  removing old DKMS module vboxhost version  4.3.16

-------- Uninstall Beginning --------
Module:  vboxhost
Version: 4.3.16
Kernel:  3.8.11 (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.8.11/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.8.11/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

vboxnetadp.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.8.11/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

vboxpci.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.8.11/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

------------------------------
Deleting module version: 4.3.16
completely from the DKMS tree.
------------------------------
Done.
Attempting to install using DKMS

Creating symlink /var/lib/dkms/vboxhost/4.3.16/source ->
                 /usr/src/vboxhost-4.3.16

DKMS: add completed.
Failed to install using DKMS, attempting to install without
Makefile:183: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
divx118 commented 9 years ago

Ok, lets see if you have the kernel headers installed First we need to know if /lib/module/3.8.11 is unmounted

$ cat /proc/mounts |grep /lib/modules/3.8.11

If the above command gives you some output then first we need to unmount /lib/modules/3.8.11 else skip this step.

$ sudo umount /lib/modules/3.8.11

Here you should see a build symlink build -> /usr/src/linux-headers-3.8.11

$ ls -al /lib/modules/3.8.11

Here you should see the dir /usr/src/linux-headers-3.8.11

$ ls -al /usr/src
sanicki commented 9 years ago
$ sudo umount /lib/modules/3.8.11
$ ls -al /lib/modules/3.8.11
total 676
drwxr-xr-x  3 root root   4096 Sep 21 15:36 .
drwxr-xr-x  4 root root   4096 Sep 21 15:38 ..
lrwxrwxrwx  1 root root     29 Sep 21 15:34 build -> /usr/src/linux-headers-3.8.11
drwxr-xr-x 10 root root   4096 Sep 21 15:34 kernel
-rw-r--r--  1 root root 210558 Sep 21 15:36 modules.alias
-rw-r--r--  1 root root 202077 Sep 21 15:36 modules.alias.bin
-rw-r--r--  1 root root   6884 Aug 31 01:43 modules.builtin
-rw-r--r--  1 root root   8268 Sep 21 15:36 modules.builtin.bin
-rw-r--r--  1 root root  18249 Sep 21 15:36 modules.dep
-rw-r--r--  1 root root  29154 Sep 21 15:36 modules.dep.bin
-rw-r--r--  1 root root    208 Sep 21 15:36 modules.devname
-rw-r--r--  1 root root   8940 Aug 31 01:43 modules.order
-rw-r--r--  1 root root    131 Sep 21 15:36 modules.softdep
-rw-r--r--  1 root root  74959 Sep 21 15:36 modules.symbols
-rw-r--r--  1 root root  89012 Sep 21 15:36 modules.symbols.bin
$ ls -al /usr/src
total 12
drwxr-xr-x  3 root root 4096 Sep 21 15:38 .
drwxr-xr-x 12 root root 4096 Sep 13 19:13 ..
drwxr-xr-x 23 root root 4096 Sep 21 14:56 linux-headers-3.8.11
lrwxrwxrwx  1 root root   32 Sep  9 09:53 vboxhost-4.3.16 -> ../share/virtualbox/src/vboxhost
divx118 commented 9 years ago

In this state, run sudo /etc/init.d/vboxdrv setup again. This should compile the modules and insmod them. I think /lib/modules was not unmounted by the rc.local, so can you give me the output of the following.

$ ls -al /etc/rc.local

and

$ cat /etc/rc.local
sanicki commented 9 years ago
$ sudo /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modules ...done.
Removing old VirtualBox pci kernel module ...done.
Removing old VirtualBox netadp kernel module ...done.
Removing old VirtualBox netflt kernel module ...done.
Removing old VirtualBox kernel module ...done.
Trying to register the VirtualBox kernel modules using DKMS ...done.
Starting VirtualBox kernel modules ...failed!
  (modprobe vboxdrv failed. Please use 'dmesg' to find out why)
$ ls -al /etc/rc.local
-rw-r--r-- 1 root root 1121 Sep 21 15:46 /etc/rc.local
$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# umount bindmounts /lib/modules from enter-chroot
for m in `cat /proc/mounts | /usr/bin/cut -d ' ' -f2 | grep /lib/modules| grep -v "^/$" `; do
        umount "$m"
done

# disable module locking and try to load vboxdrv
if [ `find /lib/modules -name vboxdrv.ko` ]; then
    chmod 0666 /sys/module/lsm/parameters/module_locking
    echo 0 > /sys/module/lsm/parameters/module_locking

    modprobe vboxdrv
    modprobe vboxpci
    modprobe vboxnetadp
    modprobe vboxnetflt

    i="0"
    while [ $i -lt 5 ]; do
        loaded=$( cat /proc/modules|grep -o vboxdrv ) || loaded="empty"
        if [ "$loaded" = "vboxdrv" ]; then
            break
        fi
        sleep 1
        i=$((i+1))
    done
    echo 1 > /sys/module/lsm/parameters/module_locking
    chmod 0400 /sys/module/lsm/parameters/module_locking
fi

exit 0
divx118 commented 9 years ago

Ah there is your issue /etc/rc.local doesn't have execution rights.

$ sudo chmod +x /etc/rc.local

Now logout of your chroot and log back in. Then start virtualbox it should work now.

BTW Starting VirtualBox kernel modules ...failed! after "/etc/init.d/vboxdrv setup" because I forgot to let you disable module_locking. So that error can be ignored.

Strange that rc.local doesn't get the execution rights. I will review my setup script and see why it failed to give the execution rights.

sanicki commented 9 years ago

After logging back in I get the same error when trying to start a VM, but now ls -al /etc/rc.local produces:

$ ls -al /etc/rc.local
-rwxr-xr-x 1 root root 1121 Sep 21 15:46 /etc/rc.local

Also tried this:

$ sudo /etc/init.d/vboxdrv setup
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 ...failed!
  (modprobe vboxdrv failed. Please use 'dmesg' to find out why)
divx118 commented 9 years ago

run the rc.local script from the commandline.

sudo /etc/rc.local

On Mon, Sep 22, 2014 at 1:08 AM, Scott Sanicki notifications@github.com wrote:

After loggin back in I get the same error, but now ls -al /etc/rc.local produces:

$ ls -al /etc/rc.local -rwxr-xr-x 1 root root 1121 Sep 21 15:46 /etc/rc.local

— Reply to this email directly or view it on GitHub https://github.com/divx118/crouton-packages/issues/2#issuecomment-56316246 .

sanicki commented 9 years ago

Curious...

$ sudo /etc/rc.local 
/etc/rc.local: 20: [: /lib/modules/3.8.0-31-generic/misc/vboxdrv.ko: unexpected operator
divx118 commented 9 years ago

You have 2 vboxdrv.ko installed. Do

$ sudo rm -f /lib/modules/3.8.0-31-generic/misc/vboxdrv.ko

then try again running /etc/rc.local

sanicki commented 9 years ago

That seems to have done the trick. Thanks!

What could have been the cause?

divx118 commented 9 years ago

I think you have installed other kernel headers, but I will change the rc.local script so it just looks in the kernel that your chromebook is running for the vboxdrv.ko. So this doesn't happen again. Thanks for the feedback.

sanicki commented 9 years ago

No worries. Thanks for the help!

divx118 commented 9 years ago

This should be solved now by push https://github.com/divx118/crouton-packages/commit/70411a1f0d7f21c751e34bd21276110500b80086