text 如何在chromebook上正确安装virtualbox。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 如何在chromebook上正确安装virtualbox。相关的知识,希望对你有一定的参考价值。

Taken from:https://github.com/dnschneid/crouton/wiki/Build-kernel-headers-and-install-Virtualbox-(x86)
           https://github.com/dnschneid/crouton/wiki/Build-kernel-headers-and-install-Virtualbox-(x86)
only pasted here so I  can be sure I will always have it.


NB: do this ALTERNATIVE INSTEAD(it solves multi reboots on vagrant up)
    1. build kernel headers as per this diff method: https://github.com/divx118/crouton-packages/blob/master/README.md
    ie: from a shell in ua chroot(ubuntu)
      $ cd ~
      $ wget https://raw.githubusercontent.com/divx118/crouton-packages/master/setup-headers.sh
      $ sudo sh setup-headers.sh
    2. install this particular virtualbox(http://download.virtualbox.org/virtualbox/4.3.14/virtualbox-4.3_4.3.14-95030~Ubuntu~raring_amd64.deb) 
     ie version: VirtualBox 4.3.14 (released July 15th 2014)


General info

This guide is tested on an HP chromebook 14 which has an Intel Celeron 2955U CPU. However it should work for any x86 chromebook. Just be sure you clone the right kernel source for your device.
For installing virtualbox we need a kernel headers package to compile the virtualbox modules. However there are no kernel headers available to install that work with the kernel of your chromebook. That is why we need to build our own. In the section below we explain how you can do that.

Getting the kernel source

There's a git repo where the kernel sources can be found, but you have to know which branch you're on. Branches can be identified by chromeos-version where version is your kernel version.
On the HP chromebook 14 I have kernel 3.8.11 so I need the chromeos-3.8 branch.

Note: Older devices will use "kernel" instead of "kernel-next".

First we need some tools installed in our chroot. I did this on a precise with xfce chroot, but it should also work on others.

Note: All the shell commands on this page need to be done in the shell of your chroot(ie inside ubuntu) if not specified otherwise.

$ sudo apt-get install git-core make kernel-package
#Cloning the kernel branch chromeos-3.8 to our home folder.

$ cd ~
$ git clone https://chromium.googlesource.com/chromiumos/third_party/kernel -b chromeos-3.8
#Before we start building we need to setup our kernel config. More info can be found on the chromium dev pages

#First I had to run with -Werror, because I got one small problem when building some wifi module. This could be a problem with the gcc compiler I used.
#Just use your favorite text editor and edit "chromeos/config/base.config" in the kernel-next dir.

$ cd kernel
$ vi chromeos/config/base.config
#Search for CONFIG_ERROR_ON_WARNING=y and make it CONFIG_ERROR_ON_WARNING=n

#Look at which flavor you need for your chromebook. We have x86_64 so we setup the config for chromeos-intel-pineview.
#More info on which flavor to choose see the kernel config info site mentioned above.

$ ./chromeos/scripts/prepareconfig chromeos-intel-pineview
$ make oldconfig
#Building kernel headers and kernel image

#Now we can start building kernel_headers and kernel_image. Note that this will take some time.

$ make-kpkg --rootcmd fakeroot kernel_image kernel_headers
#After it is finished without errors you should now see two *.deb files in the directory above kernel-next. If you followed #this guide to the letter it should be your home dir.

$ ls -al ~ | grep .deb
-rw-r--r--  1 root    root    8340026 Dec 27 18:08 linux-headers-3.8.11_3.8.11-10.00.Custom_amd64.deb
-rw-r--r--  1 root    root    7656850 Dec 27 18:07 linux-image-3.8.11_3.8.11-10.00.Custom_amd64.deb
#Installing kernel headers/image

#Before we can install we need to umount /lib/modules which is bind mounted in enter-chroot.
#We also need to disable module_locking for loading the vboxdrv kernel modules and actually load the modules.
#This can be done in rc.local.

#Create the following /etc/rc.local or add this to your /etc/rc.local if you already have one.

#!/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 [ -f /etc/init.d/vboxdrv ]; then
    chmod 0666 /sys/module/lsm/parameters/module_locking
    echo 0 > /sys/module/lsm/parameters/module_locking

    /etc/init.d/vboxdrv start

    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

#end of file contents

#Also be sure to change the execution bit

$ sudo chmod +x /etc/rc.local
#You can now logout and login again in your chroot to see if the script rc.local works.
#If all is well, everything in /lib/modules is umounted so we can install our two deb files.
#You can check this with the following.

$ cat /proc/mounts | grep /lib/modules
sudo dpkg -i linux-image-3.8.11_3.8.11-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-3.8.11_3.8.11-10.00.Custom_amd64.deb

#Now you can download virtualbox and install it. After installing, logout of your chroot and log back in. Virtualbox drivers #should now be loaded. You can check it by looking at lsmod or cat /proc/modules.

#Note: The vboxdrv will stay loaded when you log out of your chroot.
#You can unload it before logging out with
$ sudo /etc/init.d/vboxdrv stop


#Or in a chronos shell
$ sudo /sbin/rmmod vboxpci
$ sudo /sbin/rmmod vboxnetadp
$ sudo /sbin/rmmod vboxnetflt
$ sudo /sbin/rmmod vboxdrv

以上是关于text 如何在chromebook上正确安装virtualbox。的主要内容,如果未能解决你的问题,请参考以下文章

Chromebook 可以在哪些 API 级别上运行?

如何在 Chromebook 上编码/运行 Ruby [关闭]

Chromebook 如何双启动:Ubuntu 17.04 GNOME 和 Chrome OS

如何在 Chromebook 上的 Visual Studio Code 中向上或向下移动一行

ARM Chromebook 上的 Android 开发环境?

从 Android 应用程序访问 Chromebook 的本地主机?