virtualbox kernel modules

update virtualbox kernel modules

ref:https://askubuntu.com/questions/837427/virtualbox-kernel-modules-do-not-match-this-version-of-virtualbox

1、从新安装virtualbox-dkms

2、

/sbin/rcvboxdrv setup

3、

sudo /sbin/vboxconfig

 

virtualbox 6.1安装windows xp

系统安装

1.安装系统;

2.重启->F8进入安全模式;

3.安装virtualbox guest additions驱动

4.正常启动至系统。

4k设置

在虚拟机参数设置中

displayer TAB

Scal Fact设置为200%

 

解决杂音问题

将音频输出改为alsa

 

 

VirtualBox 添加Slic 2.1

ref:

https://www.virtualbox.org/manual/ch09.html

9.13. Configuring the custom ACPI table

VirtualBox can be configured to present an custom ACPI table to the guest. Use the following command to configure this:

VBoxManage setextradata "VM name"
      "VBoxInternal/Devices/acpi/0/Config/CustomTable" "/path/to/table.bin"

Configuring a custom ACPI table can prevent Windows Vista and Windows 7 from asking for a new product key. On Linux hosts, one of the host tables can be read from /sys/firmware/acpi/tables/.

在虚拟机配置文件 <ExtraData>节添加以下参数

<ExtraDataItem name="VBoxInternal/Devices/acpi/0/Config/CustomTable" value="/Path Of Slic Table/SLIC.BIN"/>

 

 激活

导入对应Windows版本的产品证书和密钥,激活系统。Dell.xrm-ms,下面密钥为DELL_WIN7-U版的。

slmgr -ipk 342DG-6YJR8-X92GV-V7DCV-P4K27
slmgr -ilc Dell.xrm-ms
slmgr -ato

slmgr -dli

USB问题

ref:
http://www.virtualbox.org/manual/ch03.html#idm1637
https://www.virtualbox.org/manual/ch12.html#ts_usb-linux

3.11. USB support

3.11.1. USB settings

The “USB” section in a virtual machine’s Settings window allows you to configure VirtualBox’s sophisticated USB support.

VirtualBox can allow virtual machines to access the USB devices on your host directly. To achieve this, VirtualBox presents the guest operating system with a virtual USB controller. As soon as the guest system starts using a USB device, it will appear as unavailable on the host.

Note

  1. Be careful with USB devices that are currently in use on the host! For example, if you allow your guest to connect to your USB hard disk that is currently mounted on the host, when the guest is activated, it will be disconnected from the host without a proper shutdown. This may cause data loss.
  2. Solaris hosts have a few known limitations regarding USB support; please see Chapter 14, Known limitations.

In addition to allowing a guest access to your local USB devices, VirtualBox even allows your guests to connect to remote USB devices by use of the VirtualBox Remote Desktop Extension (VRDE). For details about this, see Section 7.1.4, “Remote USB”.

In the Settings dialog, you can first configure whether USB is available in the guest at all, and then choose the level of USB support: OHCI for USB 1.1, EHCI (which will also enable OHCI) for USB 2.0, or xHCI for all USB speeds.

Note

The xHCI and EHCI controllers are shipped as a VirtualBox extension package, which must be installed separately. See Section 1.5, “Installing VirtualBox and extension packs” for more information.

When USB support is enabled for a VM, you can determine in detail which devices will be automatically attached to the guest. For this, you can create so-called “filters” by specifying certain properties of the USB device. USB devices with a matching filter will be automatically passed to the guest once they are attached to the host. USB devices without a matching filter can be passed manually to the guest, for example by using the Devices / USB devices menu.

Clicking on the “+” button to the right of the “USB Device Filters” window creates a new filter. You can give the filter a name (for referencing it later) and specify the filter criteria. The more criteria you specify, the more precisely devices will be selected. For instance, if you specify only a vendor ID of 046d, all devices produced by Logitech will be available to the guest. If you fill in all fields, on the other hand, the filter will only apply to a particular device model from a particular vendor, and not even to other devices of the same type with a different revision and serial number.

In detail, the following criteria are available:

  1. Vendor and product ID. With USB, each vendor of USB products carries an identification number that is unique world-wide, the “vendor ID”. Similarly, each line of products is assigned a “product ID” number. Both numbers are commonly written in hexadecimal (that is, they are composed of the numbers 0-9 and the letters A-F), and a colon separates the vendor from the product ID. For example, 046d:c016 stands for Logitech as a vendor, and the “M-UV69a Optical Wheel Mouse” product.Alternatively, you can also specify “Manufacturer” and “Product” by name.To list all the USB devices that are connected to your host machine with their respective vendor and product IDs, you can use the following command (see Chapter 8, VBoxManage):
    VBoxManage list usbhost

    On Windows, you can also see all USB devices that are attached to your system in the Device Manager. On Linux, you can use the lsusb command.

  2. Serial number. While vendor and product ID are already quite specific to identify USB devices, if you have two identical devices of the same brand and product line, you will also need their serial numbers to filter them out correctly.
  3. Remote. This setting specifies whether the device will be local only, or remote only (over VRDP), or either.

On a Windows host, you will need to unplug and reconnect a USB device to use it after creating a filter for it.

As an example, you could create a new USB filter and specify a vendor ID of 046d (Logitech, Inc), a manufacturer index of 1, and “not remote”. Then any USB devices on the host system produced by Logitech, Inc with a manufacturer index of 1 will be visible to the guest system.

Several filters can select a single device — for example, a filter which selects all Logitech devices, and one which selects a particular webcam.

You can deactivate filters without deleting them by clicking in the checkbox next to the filter name.

3.11.2. Implementation notes for Windows and Linux hosts

On Windows hosts, a kernel mode device driver provides USB proxy support. It implements both a USB monitor, which allows VirtualBox to capture devices when they are plugged in, and a USB device driver to claim USB devices for a particular virtual machine. As opposed to VirtualBox versions before 1.4.0, system reboots are no longer necessary after installing the driver. Also, you no longer need to replug devices for VirtualBox to claim them.

On newer Linux hosts, VirtualBox accesses USB devices through special files in the file system. When VirtualBox is installed, these are made available to all users in the vboxusers system group. In order to be able to access USB from guest systems, make sure that you are a member of this group.

On older Linux hosts, USB devices are accessed using the usbfs file system. Therefore, the user executing VirtualBox needs read and write permission to the USB file system. Most distributions provide a group (e.g. usbusers) which the VirtualBox user needs to be added to. Also, VirtualBox can only proxy to virtual machines USB devices which are not claimed by a Linux host USB driver. The Driver= entry in /proc/bus/usb/devices will show you which devices are currently claimed. Please refer to Section 12.8.7, “USB not working” also for details about usbfs.

 

If USB is not working on your Linux host, make sure that the current user is a member of the vboxusers group. Please keep in mind that group membership does not take effect immediately but rather at the next login. If available, the newgrp command may avoid the need for logout/login.
如果虚拟机无法使用USB
1.安装VirtualBox extension package
2.将当前用户添加到vboxusers 组中。

Ubuntu Linux添加源实现自动更新

Debian-based Linux distributions

Add the following line to your /etc/apt/sources.list. According to your distribution, replace ‘<mydist>‘ with ‘artful‘, ‘zesty‘, ‘yakkety‘, ‘xenial‘, ‘vivid‘, ‘utopic‘, ‘trusty‘, ‘raring‘, ‘quantal‘, ‘precise‘, ‘stretch‘, ‘lucid‘, ‘jessie‘, ‘wheezy‘, or ‘squeeze‘:

deb http://download.virtualbox.org/virtualbox/debian <mydist> contrib

(Up to version 3.2 the packages were located in the non-free section. Starting with version 4.0 they are located in the contrib section.)

The Oracle public key for apt-secure can be downloaded

  • here for Debian 8 (“Jessie”) / Ubuntu 16.04 (“Xenial”) and later
  • here for older distributions.

You can add these keys with

sudo apt-key add oracle_vbox_2016.asc
sudo apt-key add oracle_vbox.asc

or combine downloading and registering:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

The key fingerprint for oracle_vbox_2016.asc is

B9F8 D658 297A F3EF C18D  5CDF A2F6 83C5 2980 AECF
Oracle Corporation (VirtualBox archive signing key) <[email protected]>

The key fingerprint for oracle_vbox.asc is

7B0F AB3A 13B9 0743 5925  D9C9 5442 2A4B 98AB 5139
Oracle Corporation (VirtualBox archive signing key) <[email protected]>

(As of VirtualBox 3.2, the signing key was changed. The old Sun public key for apt-secure can be downloaded  here.)

To install VirtualBox, do

sudo apt-get update
sudo apt-get install virtualbox-5.2

Replace virtualbox-5.2 by virtualbox-5.1 to install VirtualBox 5.1.30 Note: Ubuntu/Debian users might want to install the dkms package to ensure that the VirtualBox host kernel modules (vboxdrvvboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next apt-get upgrade. For Debian it is available in Lenny backports and in the normal repository for Squeeze and later. The dkms package can be installed through the Synaptic Package manager or through the following command:

sudo apt-get install dkms

What to do when experiencing The following signatures were invalid: BADSIG … when refreshing the packages from the repository?

# sudo -s -H
# apt-get clean
# rm /var/lib/apt/lists/*
# rm /var/lib/apt/lists/partial/*
# apt-get clean
# apt-get update

RPM-based Linux distributions

Starting with VirtualBox 3.0.12 we provide a yum-style repository for Oracle Linux/Fedora/RHEL/openSUSE. Note that 3.0.x .rpm packages are named VirtualBox-3.0.x while 3.1.x .rpm packages are named VirtualBox-3.1-3.1.x. This naming scheme allows to use the older 3.0.x packages without changing the repository.

Furthemore, all .rpm packages are signed. The Oracle public key for rpm can be downloaded here. You can add this key (not necessary for yum users, see below!) with

sudo rpm --import oracle_vbox.asc

or combine downloading and registering:

wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | rpm --import -

The key fingerprint is

7B0F AB3A 13B9 0743 5925  D9C9 5442 2A4B 98AB 5139
Oracle Corporation (VirtualBox archive signing key) <[email protected]>

After importing the public key, the package signature can be checked with

rpm --checksig PACKAGE_NAME

Note that importing the key is not necessary for yum users (Oracle Linux/Fedora/RHEL/CentOS) when using one of the virtualbox.repo files from below as yum downloads and imports the public key automatically!

The package signature is checked by yum/zypper as well:

如何在VirtualBox虚拟机中安装Android x86

Android x86最近出了一个5.1的新版本,其中包括了Intel新的houdini版本,以及其和ART虚拟机的集成。

最近想对其做一个研究。但是,直接找一台机器装实在太浪费。因此,决定将其安装在VirtualBox的虚拟机中。

首先,下载安装光盘镜像文件。最新版的Android-x86安装盘.iso文件,可以从这里下载到。笔者下载的是最新版,文件名是“android-x86-5.1-rc1.iso”。

然后,在VirtualBox中创建一个虚拟机,用来安装Android-x86。具体步骤如下:

1)点击左上角的“New”按键,在新对话框中,名字随便取一个,类型选择“Linux”,版本选择“Linux 2.6 /3.x /4.x (32-bit)”:

%image_alt%

2)选择“Next”,在新对话框中,设置虚拟机的内存大小。笔者设置为2GB:

%image_alt%

3)点击“Next”,在接下来的对话框中,选择“Create a virtual hard disk now”:

%image_alt%

4)点击“Create”,在新对话框中,选择磁盘镜像文件类型为VDI,即第一项:

%image_alt%

5)点击“Next”,选择动态分配:

%image_alt%

6)再点击“Next”,填入磁盘镜像文件的文件名和容量的上限,笔者选择10GB,应该够用了:

%image_alt%

7)点击“Create”后,虚拟机就创建成功了。

8)在虚拟机中创建一个光盘驱动器,并讲下载下来的Android-x86的光盘镜像文件关联上去。

在VirtualBox中,选择你刚才创建的那个虚拟机,然后点击上方的“Settings”按钮。
接着选择“Storage”选项卡,在右边的控制器旁边,点击那个带加号的光盘图标,在弹出的对话框中选择“Choose disk”:

%image_alt%

接下来找到你下载的那个.iso文件,并选择打开就可以了。

同时,请确保虚拟机允许光盘启动,还是在“Settings”对话框中,选择“System”,在右边的“Boot Order”中,“Optical”被选上了:

%image_alt%

9)更改一下网络配置,芯片组请选择Intel的ICH系列的,最好不要选择PIIX3,如上图。

在“Network”选项卡中,启动一个网卡适配器,选择网络类型为“NAT”或“Bridged Adapter”,名字是“eth0”,在高级选项中将适配器类型也改成Intel系列的:

%image_alt%

好了,虚拟机配置好了,下面直接启动虚拟机,进行安装。具体安装的步骤如下:

1)在光盘启动界面中,选择“Installation – Install Android-x86 to harddisk”:

%image_alt%

2)在接下来的对话框中,你应该可以看到“sda”,它就是你前面创建虚拟机时挂载上来的那个磁盘镜像。不过,这个磁盘镜像还没有格式化,还不能用于安装,所以我们先要选择“Create/Modify partitions”:

%image_alt%

3)下面让你选择是否用GPT,请确保千万选择No:

%image_alt%

4)再选择“New”,创建磁盘分区:

%image_alt%

5)选择“Primary”:

%image_alt%

6)下面的“Size”直接回车,选择默认值。然后,千万记得要将这个分区标记为可启动的:

%image_alt%

7)再选择“Write”,将改变写入磁盘,请耐心等待,这步可能要花一点时间。最后,选择“Quit”退出到前面的页面。这时,应该可以看到“sda1”了,证明分区成功:

%image_alt%

8)选择这个分区,并在下面的页面中,选择将磁盘格式化成ext3格式:

%image_alt%

9)请键入yes确认要格式化。在下面的页面中,请选择安装GRUB,但不用选择安装GRUB2:

%image_alt%

%image_alt%

10)再下面的配置,选什么都随便了,一路回车,安装就会正式进行了。

安装完成后,选择“Reboot”重启一下。别忘了,将虚拟机的光盘启动关掉,或者将启动的优先级调到硬盘之后,否则再次启动还是从光盘引导。

启动之后,画面如下:

%image_alt%

大功告成!:-)

前面的文章中介绍了如何在VirtualBox虚拟机中安装Android X86。不过,安装结束后,试了几个只有ARM版.so文件的apk程序,发现都打不开。难道是新版Android X86动态将ARM指令集转成X86指令集的houdini兼容性有问题?

经过一番研究,发现默认情况下,其实Android X86是不带houdini的,也就是不能运行只有ARM版.so文件的程序。

不过,可以通过几个步骤,将houdini安装上去,打开对动态转码的支持。而这只需要执行两步操作就可以了:

1)在“Settings”中选择“Apps compatibility”:

%image_alt%

打开“Enable native bridge”选项:

%image_alt%

但是,光打开了这个选项还没有用。打开这个选项的效果只是将系统属性“persist.sys.nativebridge”的值从false(0)改成了true(1):

%image_alt%

其它什么都没有做,其实仍然还不能运行ARM指令的程序,还需要下面的第二步。但是,即使运行了下一步,但是没有打开这个选项的话,也是不能运行ARM指令的程序的。

2)打开命令行,切换到root用户,敲入命令“enable_nativebridge”:

%image_alt%

之后,程序会自动上网下载一些东西,等到结束后,houdini的支持就算正式打开了。

那么enable_nativebridge命令到底做了什么呢?其实它只是一个shell脚本文件,位于/system/bin/目录下。

该脚本中的代码如下:

[plain] view plain copy

  1. #!/system/bin/sh
  2. PATH=/system/bin:/system/xbin
  3. houdini_bin=0
  4. dest_dir=/system/lib$1/arm$1
  5. binfmt_misc_dir=/proc/sys/fs/binfmt_misc
  6. cd $dest_dir
  7. if [ ! -s libhoudini.so ]; then
  8.     if touch .dl_houdini; then
  9.         rm -f .dl_houdini
  10.     else
  11.         cd .. && cp -a arm$1 /data/local/tmp
  12.         mount -t tmpfs tmpfs arm$1 && cd arm$1 &&
  13.                 cp -a /data/local/tmp/arm$1/* . && rm -rf /data/local/tmp/arm$1
  14.     fi
  15. fi
  16. cd /data/local/tmp
  17. while [ ! -s $dest_dir/libhoudini.so ]; do
  18.     while [ “$(getprop net.dns1)” = “” ]; do
  19.         sleep 10
  20.     done
  21.     if [ -z “$1” ]; then
  22.         [ “`uname -m`” = “x86_64” ] && url=http://goo.gl/Xl1str || url=http://goo.gl/PA2qZ7
  23.     else
  24.         url=http://goo.gl/L00S7l
  25.     fi
  26.     wget $url -cO houdini.tgz &&
  27.         bzcat houdini.tgz | tar xvf – -C $dest_dir && rm -f houdini.tgz && break
  28.     rm -f houdini.tgz
  29.     sleep 30
  30. done
  31. if [ ! -e $binfmt_misc_dir/register ]; then
  32.     mount -t binfmt_misc none $binfmt_misc_dir
  33. fi
  34. cd $binfmt_misc_dir
  35. if [ -e register ]; then
  36.     # register Houdini for arm binaries
  37.     if [ -z “$1” ]; then
  38.         echo ‘:arm_exe:M::\\x7f\\x45\\x4c\\x46\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28::'”$dest_dir/houdini:P” > register
  39.         echo ‘:arm_dyn:M::\\x7f\\x45\\x4c\\x46\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x28::'”$dest_dir/houdini:P” > register
  40.     else
  41.         echo ‘:arm64_exe:M::\\x7f\\x45\\x4c\\x46\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7::'”$dest_dir/houdini64:P” > register
  42.         echo ‘:arm64_dyn:M::\\x7f\\x45\\x4c\\x46\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\xb7::'”$dest_dir/houdini64:P” > register
  43.     fi
  44.     if [ -e arm${1}_exe ]; then
  45.         houdini_bin=1
  46.     fi
  47. else
  48.     log -pe -thoudini “No binfmt_misc support”
  49. fi
  50. if [ $houdini_bin -eq 0 ]; then
  51.     log -pe -thoudini “houdini$1 enabling failed!”
  52. else
  53.     log -pi -thoudini “houdini$1 enabled”
  54. fi
  55. [ “$(getprop ro.zygote)” = “zygote64_32” -a -z “$1” ] && exec $0 64
  56. exit 0

其实主要就做了两件事情:

一是,根据命令是否带参数,以及支持的平台是32位的还是64位的等条件,从网上下载了一个压缩包,并解压缩到“/system/lib/arm”或者“/system/lib64/arm64”目录下。如果没有任何参数的直接运行“enable_nativebridge”命令的话,且在32位系统上的话,则下载链接为:http://goo.gl/PA2qZ7;如果没有任何参数的运行命令,且在64位系统上的花,则下载链接为:http://goo.gl/Xl1str;如果带参数运行“enable_nativebridge”命令的话(参数一般是“64”),则下载链接为:http://goo.gl/L00S7l

二是,往目录“/proc/sys/fs/binfmt_misc”下的名为“register”的文件中写入了两串字符串,从而告诉Linux内核,所有使用ARM指令集的可执行和动态库ELF文件都用houdini程序打开,而所有ARM64指令集的可执行和动态库ELF文件都用houdini64程序打开(关于binfmt_misc的详细解释,可以参考《Linux下如何指定某一类型程序用特定程序打开(通过binfmt_misc)》)。