VirtualBox (简体中文)
相关文章
VirtualBox 是类似 VMware 的虚拟 PC 模拟器,处于不断的开发中。使用 Qt 图形界面,提供了无界面运行和 SDL 命令行工具进行运行管理。它包含guest additions为一些虚拟系统提供附加功能,包括文件共享、剪贴板和图形加速,支持 “无缝” 窗口整合模式。
Contents
- 1 在arch linux的安装步骤
- 2 安装 Arch Linux的客户端
- 3 Arch Linux 客户机共享文件夹
- 4 VirtualBox虚拟机从其他虚拟机导入/导出的管理
- 5 虚拟磁盘管理
- 6 从其他虚拟机中迁移
- 7 配置
- 8 高级配置
-
9 故障排除
- 9.1 modprobe Exec 格式错误
- 9.2 VERR_ACCESS_DENIED
- 9.3 键盘和鼠标都在我的虚拟机
- 9.4 无法发送CTRL + ALT+ Fn键到我的虚拟机
- 9.5 解决ISO映像问题
- 9.6 VirtualBox的GUI没有应用我的GTK主题
- 9.7 OpenBSD系统无法使用时,虚拟化指令不可用
- 9.8 VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)
- 9.9 USB 子系统在宿主机和虚拟机没有作用
- 9.10 主机模式网络接口创建失败
- 9.11 WinXP: 位深不能大于 16
- 9.12 虚拟系统使用串行端口
- 9.13 Windows 8.x Error Code 0x000000C4
- 9.14 Windows 8 VM fails to boot with error "ERR_DISK_FULL"
- 9.15 Linux guests have slow/distorted audio
- 9.16 客户端启动后的Xorg死机
- 9.17 "NS_ERROR_FAILURE" and missing menu items
- 9.18 USB modem
- 9.19 "The specified path does not exist. Check the path and then try again." error in Windows guests
- 9.20 挂载失败导致的啟动问题
- 9.21 复制和粘贴在 Arch Linux 客户机没有作用
- 9.22 唤醒后异常
- 9.23 Btrfs 系统镜像
- 9.24 vagrant 啟动问题
- 9.25 没有64位客户端选项
- 9.26 主机上的虚拟机启动操作系统死机
- 9.27 向客户端发送CTRL+ALT+F1
- 9.28 在运行于无显示器的服务器上的系统上启动虚拟机
- 9.29 从主机端访问虚拟机上的服务器
- 9.30 守护进程工具
- 10 参阅
在arch linux的安装步骤
为了启动的VirtualBox虚拟机在您的Arch Linux中,按照下列安装步骤。
安装基本软件包
安装 GPL 版本的 virtualbox 软件包。作为依赖安装的 virtualbox-host-modules 包含了archlinux 默认内核使用的模块。
如果使用linux-lts内核,需要安装virtualbox-host-modules-lts.
要使用基于 Qt 的 VirtualBox
命令,需要安装 qt4 软件包。如果使用简单的基于 SDL 的 VBoxSDL
命令或者 VBoxHeadless
命令,则不需要安装 qt4。
安装VirtualBox内核模块
Next, to fully virtualize your guest installation, VirtualBox provides the following kernel modules: vboxdrv
, vboxnetadp
, vboxnetflt
, and vboxpci
. These must be added to your host kernel.
The binary compatibility of kernel modules depends on the API of the kernel against which they have been compiled. The problem with the Linux kernel is that these interfaces might not be the same from one kernel version to another. In order to avoid compatibility problems and subtle bugs, each time the Linux kernel is upgraded, it is advised to recompile the kernel modules against the Linux kernel version that has just been installed. This is what Arch Linux packagers actually do with the VirtualBox kernel modules packages: each time a new Arch Linux kernel is released, the Virtualbox modules are upgraded accordingly.
Therefore, if you are using a kernel from the official repositories or a custom one (self-compiled or installed from the AUR), the kernel module package you will need to install will thus vary.
运行官方内核的主机
- 如果你使用的是 linux 内核, 当你安装 virtualbox-host-modules 软件包的时候,需要安装virtualbox package.
- 如果你使用的是 LTS 稳定内核 (linux-lts), 你需要安装 virtualbox-host-modules-lts 软件包。 virtualbox-host-modules 现在可以移除。
- 如果你使用的是 linux-ckAUR kernel, 需要构建 virtualbox-ck-host-modulesAUR 软件包。
定制内核的主机
If you use or intend to use a self-compiled kernel from sources, you have to know that VirtualBox does not require any virtualization modules (e.g. virtuo, kvm,...). The VirtualBox kernel modules provide all the necessary for VirtualBox to work properly. You can thus disable in your kernel .config file these virtualization modules if you do not use other hypervisors like Xen, KVM or QEMU.
The virtualbox-host-modules
package works fine with custom kernels of the same version of the Arch Linux stock kernel such as linux-ckAUR. Since the virtualbox-host-modules
comes with the official Arch Linux kernel (linux) as a dependency and if you do not use that kernel, install virtualbox-host-dkms instead.
If you are using a custom kernel which is not of the same version of the Arch Linux stock one, you will have to install the virtualbox-host-dkms too. The latter comes bundled with the source of the VirtualBox kernel modules that will be compiled to generate these modules for your kernel.
As the virtualbox-host-dkms package requires compilation, make sure you have the kernel headers corresponding to your custom kernel version to prevent this error from happening Your kernel headers for kernel your custom kernel version cannot be found at /usr/lib/modules/your custom kernel version/build or /usr/lib/modules/your custom kernel version/source
.
- If you use a self-compiled kernel and have used
make modules_install
to install its modules, folders/usr/lib/modules/your custom kernel version/build
and(...)/source
will be symlinked to your kernel sources. These will act as the kernel headers you need. If you have not removed these kernel sources yet, you have nothing to do. - If you use a custom kernel from AUR, make sure the package linux-headers is installed.
一旦virtualbox-host-dkms 安装完成后,只要用下面命令生成内核模块:
# dkms install vboxhost/<virtualbox-host-source 版本> -k <你的自制内核模块版本>/<你的架构>
To automatically recompile the VirtualBox kernel modules when their sources get upgraded (i.e. when the virtualbox-host-dkms package gets upgraded) and avoid to type again the above dkms install
command manually afterwards, enable the dkms
service with:
# systemctl enable dkms.service
If this service is not enabled while the virtualbox-host-dkms package is being updated, the VirtualBox modules will not be updated and you will have to type in manually the dkms install
command described above to compile the latest version of the Virtualbox kernel modules. If you do not want to type in manually this command, if the dkms
service is automatically loaded at startup, you just need to reboot and your VirtualBox modules will be recompiled silently.
However, if you want to keep this daemon disabled, you can use an initramfs hook that will automatically trigger the dkms install
command described above at boot time. This will require a reboot to recompile the VirtualBox modules. To enable this hook, install the vboxhost-hookAUR package and add vboxhost
to your HOOKS array in /etc/mkinitcpio.conf
. Again, make sure the right linux headers are available for the new kernel otherwise the compilation will fail.
加载VirtualBox的内核模块
VirtualBox 在 Linux 上运行需要使用自己的内核模块,包括一个必须的 vboxdrv。这个模块必须在虚拟机运行前启动。如果需要,可以在 Arch Linux 启动时自动加载。
手动加载模块:
# modprobe vboxdrv
若要启动时加载 VirtualBox 驱动,在 /etc/modules-load.d
创建 *.conf
文件 (例如:virtualbox.conf
),包括所有应加载的模块:
/etc/modules-load.d/virtualbox.conf
vboxdrv
启动 VirtualBox 图形管理员:
$VirtualBox
The following modules are optional but are recommended if you do not want to be bothered in some advanced configurations (precised here after): vboxnetadp
, vboxnetflt
and vboxpci
.
-
vboxnetadp
andvboxnetflt
are both needed when you intend to use the bridged or host-only networking feature. More precisely,vboxnetadp
is needed to create the host interface in the VirtualBox global preferences, andvboxnetflt
is needed to launch a virtual machine using that network interface.
-
vboxpci
is needed when your virtual machine needs to pass through a PCI device on your host.
Finally, if you use the aforementioned "Host-only" or "bridge networking" feature, make sure net-tools is installed. VirtualBox actually uses ifconfig
and route
to assign the IP and route to the host interface configured with VBoxManage hostonlyif
or via the GUI in Settings > Network > Host-only Networks > Edit host-only network (space) > Adapter.
添加用户到 vboxusers组
将需要运行 Virtualbox 的用户名添加到 vboxusers 用户组,文件夹共享和其它功能需要正确的组才能工作。新组设置不会应用到当前会话,请重新登录或者通过命令 newgrp
或 sudo -u username -s
启动一个新环境。
# gpasswd -a $USER vboxusers
Guest 附加光盘
建议在运行VirtualBox 的主机系统上安装virtualbox-guest-iso 软件包 。 这个包是一个磁盘镜像,用来安装虚拟系统的附加功能。 The .iso file will be located at /usr/lib/virtualbox/additions/VBoxGuestAdditions.iso
, and may have to be mounted manually inside the virtual machine. Once mounted, you can run the guest additions installer inside the guest.
扩展包
Since VirtualBox 4.0, non-GPL components have been split from the rest of the application. Despite being released under a non-free license and being only available for personal use, you might be interested in installing the Oracle Extension Pack which provides additional features. To avoid manual manipulation, the virtualbox-ext-oracleAUR package is available, and a prebuilt version can be found in the seblu repository.
If you prefer to use the traditional and manual way: download the extension manually and install it via the GUI (File > Preferences > Extensions) or via VBoxManage extpack install <.vbox-extpack>
, make sure you have a toolkit (like Polkit, gksu, etc.) to grant privileged access to VirtualBox. The installation of this extension requires root access.
使用正确的前端
现在,你已经准备好使用VirtualBox的。祝贺!
多个前端提供给您,其中两个是默认提供:
- If you want to use VirtualBox in command-line only (only launch and change settings of existing virtual machines), you can use the
VBoxSDL
command. VBoxSDL does only provide a simple window that contains only the pure virtual machine, without menus or other controls. - If you want to use VirtualBox in command-line without any GUI running (e.g. on a server) to create, launch and configure virtual machines, use the
VBoxHeadless
which produces no visible output on the host at all, but instead only delivers VRDP data.
If you installed the qt4 optional dependency, you can run VirtualBox
and have a nice-looking GUI interface with menus usable via the mouse.
Finally, you can use PhpVirtualBox to administrate your virtual machines via a web interface.
Refer to the VirtualBox manual to learn how to create virtual machines.
安装 Arch Linux的客户端
安装Arch Linux在虚拟机内部
在 VirtualBox 中安装 Arch 非常简单直接,而且最好通过 pacman 安装 Guest Addition,不要使用 VirtualBox 中的 "Install Guest Additions" 或挂载的 ISO 安装。
Boot the Arch installation media through one of the virtual machine's virtual drives. Then, complete the installation of a basic Arch system as explained in the Beginners' guide or the Installation guide without installing any graphic driver: we will install one provided by VirtualBox just at the next step.
安装模式为EFI
If you want to install Arch Linux in EFI mode inside VirtualBox, in the settings of the virtual machine, go in the Settings tab, and check the checkbox Enable EFI (special OSes only). After selecting the kernel from the Arch Linux installation media's menu, the media will hang for a minute or two and will continue to boot the kernel normally afterwards. Be patient.
When booting in EFI mode, VirtualBox will first attempt to run /EFI/BOOT/BOOTX64.EFI
from the ESP. If that first option fails, VirtualBox will then try the EFI shell script startup.nsh
from the root of the ESP. Unless you want to manually launch your bootloader from the EFI shell every time, you will need to move your bootloader to that default path. Do not bother with the VirtualBox Boot Manager (accessible with F2
at boot): EFI entries added to it manually at boot or with efibootmgr will persist after a reboot but are lost when the VM is shut down.
在 VirtualBox EFI 模式下使用 Arch
我对这方面的设置有非常不好的经历,但是依然可以办到。
UPD. Using efibootmgr has the same effect as using VirtualBox boot menu (see the note below): settings disappear after VM shutdown.首先要说的是 efibootmgr
*完全无效*。虽然看起来是正常的,但是所有更动似乎在重啟后就失效。在进行正常 UEFI/GPT 安装后重啟,你会被丢到 EFI shell。送出 exit 后会看到菜单,选中 Boot Management Manager -> Boot Options -> Add Boot Option。使用文件浏览器找到 grub efi 文件并选中,添加你要的标签。之后,菜单选中 Change Boot Order,使用方向键选中你的 Arch 选项,按下 +
移到最上方。现在 GRUB 应该默认啟动了。
其它选项: 1) 将引导程序移到 \EFI\boot\bootx64.efi
, 2) 创建 \startup.nsh
脚本,运行选定的引导程序,就像这样:
\startup.nsh
HD16a0a1:\EFI\refind\refindx64.efi
Here I'm using consistent mapping name (HD16a0a1). It is probably a good idea, because they do survive configuration changes.
安装客户端增强包
客户端增强包(The Guest Additions)能够激活共享文件夹功能,改善显卡加速支持和在主机端及客户端之间启用双向剪贴板。鼠标集成是另一项功能,用于减少在客户端中使用鼠标后将其释放的需要。
After completing the installation of the guest system, install the VirtualBox Guest Additions which include drivers and applications that optimize the guest operating system. These can be installed via virtualbox-guest-utils, which provides virtualbox-guest-modules as a required dependency.
Arch Linux 客户端
参阅Arch Linux VirtualBox客户端
Windows 客户端
在你的虚拟机中安装Windows(XP 等等)后,只需选择设备 → 安装增强功能
这将会挂载ISO镜像,接着Windows应该自动运行客户端增强包安装向导(The guest additions installer)。按照说明进行到底。
安装VirtualBox guest内核模块
运行官方内核Guests
- If you are using the linux kernel, make sure the virtualbox-guest-modules package is still installed. The latter has been installed when you installed the virtualbox-guest-utils package.
- If you are using the LTS version of the kernel (linux-lts), you need to install the virtualbox-guest-modules-lts package. virtualbox-guest-modules can now be removed if you want.
- If you are using the linux-ckAUR, kernel, build the virtualbox-ck-guest-modulesAUR package. virtualbox-guest-modules can now be removed in this case too, if you want.
运行定制内核Guests
As this installation step is quite similar to the Vitualbox kernel modules section for the host described above, please refer to that section for more information and replace all virtualbox-host-modules, virtualbox-host-dkms and vboxhost-hookAUR statements by virtualbox-guest-modules, virtualbox-guest-dkms and vboxguest-hookAUR respectively.
加载Virtualbox 内核模块
手动加载内核模块:
# modprobe -a vboxguest vboxsf vboxvideo
开机时自动加载VirtualBox模块Kernel modules#Automatic module handling 创建*.conf
文件 (e.g. virtualbox.conf
) 在/etc/modules-load.d/
加入如下几行:
/etc/modules-load.d/virtualbox.conf
vboxguest vboxsf vboxvideo
Alternatively, enable the vboxservice
service which loads the modules and synchronizes the guest's system time with the host.
加载VirtualBox guest 服务
After the rather big installation step dealing with VirtualBox kernel modules, now you need to start the guest services. The guest services are actually just a binary executable called VBoxClient
which will interact with your X Window System. VBoxClient
manages the following features:
- shared clipboard and drag and drop between the host and the guest;
- seamless window mode;
- the guest display is automatically resized according to the size of the guest window;
- checking the VirtualBox host version
All of these features can be enabled independently with their dedicated flags:
$ VBoxClient --clipboard --draganddrop --seamless --display --checkhostversion
As a shortcut, the VBoxClient-all
bash script enables all of these features. You should set VBoxClient
to be automatically loaded as your desktop environment or window manager starts. In practice,
- if you are using a desktop environment, you just need to check a box or add the
/usr/sbin/VBoxClient-all
to the autostart section in your desktop environment settings (the DE will typically set a flag to a .desktop file in~/.config/autostart
, see the Autostart section for more details); - if you do not have any desktop environment, add the following line to the top of
~/.xinitrc
above anyexec
options. See Xinitrc for detail.
~/.xinitrc
/usr/bin/VBoxClient-all
VirtualBox can also synchronize the time between the host and the guest. To do this, run VBoxService
as root. To set this to run automatically on boot, simply enable the vboxservice
service.
Now, you should have a working Arch Linux guest. Note that features like clipboard sharing are disabled by default in VirtualBox, and you will need to turn them on in the per-VM settings if you actually want to use them (e.g. Settings > General > Advanced > Shared Clipboard).
If you want to share folders between your host and your Arch Linux guest, read on.
启用文件共享
在安装 virtualbox-guest-utils 之后,你应该运行 VBoxClient-all
啟动共享剪贴板、调整屏幕大小等服务。
- 若你运行会啟动
/etc/xdg/autostart/vboxclient.desktop
的服务,例如 GNOME 或 KDE,便不需再进行额外动作。 - If you use
.xinitrc
to launch things instead, you must add the following to your.xinitrc
before launching your WM.
# VBoxClient-all &
Shared folders are managed on the host, in the settings of the Virtual Machine accessible via the GUI of VirtualBox, in the Shared Folders tab. There, Folder Path, the name of the mount point identified by Folder name, and options like Read-only, Auto-mount and Make permanent can be specified. These parameters can be defined with the VBoxManage
command line utility. See there for more details.
No matter which method you will use to mount your folder, all methods require some steps first.
To avoid this issue /sbin/mount.vboxsf: mounting failed with the error: No such device
, make sure the vboxsf
kernel module is properly loaded. It should be, since we enabled all guest kernel modules previously.
Two additional steps are needed in order for the mount point to be accessible from users other than root:
- the virtualbox-guest-utils package created a group
vboxsf
(done in a previous step); - your username must be in this group, use this command
gpasswd -a $USER vboxsf
to add your username and usenewgrp
to apply the changes immediately;
Arch Linux 客户机共享文件夹
共享文件夹是主机上的 VirtualBox 程序控制。可以添加、自动挂载并设置成只读。主机系统创建的共享文件夹位于 /media/sf_SHAREDFOLDERNAME。要使用共享文件,需要在安装完 Guest Additions 软件包之后执行:
$sudo groupadd vboxsf $sudo gpasswd -a $USER vboxsf
和主机系统同步日期
要同步系统间的日期,
Systemd
下次开机开始同步:
# systemctl enable vboxservice.service
立即启动同步:
# systemctl start vboxservice.service
手动挂载
Use the following command to mount your folder in your Arch Linux guest:
# mount -t vboxsf shared_folder_name mount_point_on_guest_system
The vboxsf filesystem offers other options which can be displayed with this command:
# mount.vboxsf
For example if the user was not in the vboxsf group, we could have used this command to give access our mountpoint to him:
# mount -t vboxsf -o uid=1000,gid=1000 home /mnt/
Where uid and gid are values corresponding to the users we want to give access to. These values are obtained from the id
command run against this user.
自动挂载
In order for the automounting feature to work you must have checked the auto-mount checkbox in the GUI or used the optional --automount
argument with the command VBoxManage sharedfolder
.
The shared folder should now appear in /media/sf_shared_folder_name
. If users in media
cannot access the shared folders, check that media
has permissions 755 or has group ownership vboxsf
if using permission 750. This is currently not the default if media is created by installing the virtualbox-guest-utils
.
You can use symlinks if you want to have a more convenient access and avoid to browse in that directory, e.g.:
$ ln -s /media/sf_shared_folder_name ~/my_documents
引导时挂载
You can mount your directory with fstab. However, to prevent startup problems with systemd, comment=systemd.automount
should be added to /etc/fstab
. This way, the shared folders are mounted only when those mount points are accessed and not during startup. This can avoid some problems, especially if the guest additions are not loaded yet when systemd read fstab and mount the partitions.
desktop /media/desktop vboxsf uid=user,gid=group,rw,dmode=700,fmode=600,comment=systemd.automount 0 0
As of 2012-08-02, mount.vboxsf does not support the nofail option:
desktop /media/desktop vboxsf uid=user,gid=group,rw,dmode=700,fmode=600,nofail 0 0
VirtualBox虚拟机从其他虚拟机导入/导出的管理
If you plan to use your virtual machine on another hypervisor or want to import in VirtualBox a virtual machine created with another hypervisor, you might be interested in reading the following steps.
添加删除
Guest additions are available in most hypervisor solutions: VirtualBox comes with the Guest Additions, VMware with the VMware Tools, Parallels with the Parallels Tools, etc. These additional components are designed to be installed inside a virtual machine after the guest operating system has been installed. They consist of device drivers and system applications that optimize the guest operating system for better performance and usability by providing these features.
If you have installed the additions to your virtual machine, please uninstall them first. Your guest, especially if it is using an OS from the Windows family, might behave weirdly, crash or even might not boot at all if you are still using the specific drivers in another hypervisor.
使用正确的虚拟磁盘格式
这一步将取决于虚拟磁盘映像直接或不能转换的能力。
自动工具
Some companies provide tools which offer the ability to create virtual machines from a Windows or GNU/Linux operating system located either in a virtual machine or even in a native installation. With such a product, you do not need to apply this and the following steps and can stop reading here.
- Parallels Transporter which is non free, is a product from Parallels Inc. This solution basically consists in an piece of software called agent that will be installed in the guest you want to import/convert. Then, Parallels Transporter, which only works on OS X, will create a virtual machine from that agent which is contacted either by USB or Ethernet network.
- VMware vCenter Converter which is free upon registration on the VMware webiste, works nearly the same way as Parallels Transporter, but the piece of software that will gather the data to create the virtual machine only works on a Windows platform.
手动转换
First, familiarize yourself with the #Formats supported by VirtualBox and those supported by third-party hypervisors.
- Importing or exporting a virtual machine from/to a VMware solution is not a problem at all if you use the VMDK or OVF disk format, otherwise converting #VMDK to VDI and VDI to VMDK is possible and the aforementioned VMware vCenter Converter tool is available.
- Importing or exporting from/to QEMU is not a problem neither: some QEMU formats are supported directly by VirtualBox and conversion between #QCOW2 to VDI and VDI to QCOW2 is still available if needed.
- Importing or exporting from/to Parallels hypervisor is the hardest way: Parallels does only support its own HDD format (even the standard and portable OVF format is not supported!).
- To export your virtual machine to Parallels, you will need to use the Parallels Transporter tool described above.
- To import your virtual machine to VirtualBox, you will need to use the VMware vCenter Converter described above to convert the VM to the VMware format first. Then, apply the solution to migrate from VMware.
创建虚拟机的配置为你的虚拟机管理程序
Each hypervisor have their own virtual machine configuration file: .vbox
for VirtualBox, .vmx
for VMware, a config.pvs
file located in the virtual machine bundle (.pvm
file), etc. You will have thus to recreate a new virtual machine in your new destination hypervisor and specify its hardware configuration as close as possible as your initial virtual machine.
Pay a close attention to the firmware interface (BIOS or UEFI) used to install the guest operating system. While an option is available to choose between these 2 interfaces on VirtualBox and on Parallels solutions, on VMware, you will have to add manually the following line to your .vmx file.
ArchLinux_vm.vmx
firmware = "efi"
Finally, ask your hypervisor to use the existing virtual disk you have converted and launch the virtual machine.
虚拟磁盘管理
支持VirtualBox的格式
VirtualBox supports the following virtual disk formats:
- VDI: The Virtual Disk Image is the VirtualBox own open container used by default when you create a virtual machine with VirtualBox.
- VMDK: The Virtual Machine Disk has been initially developed by VMware for their products. The specification was initially closed source, but it became now an open format which is fully supported by VirtualBox. This format offers the ability to be split into several 2GB files. This feature is specially useful if you want to store the virtual machine on machines which do not support very large files. Other formats, excluding the HDD format from Parallels, do not provide such an equivalent feature.
- VHD: The Virtual Hard Disk is the format used by Microsoft in Windows Virtual PC and Hyper-V. If you intend to use any of these Microsoft products, you will have to choose this format.
- VHDX (read only): This is the eXtended version of the Virtual Hard Disk format developed by Microsoft, which has been released on 2012-09-04 with Hyper-V 3.0 coming with Windows Server 2012. This new version of the disk format does offer enhanced performance (better block alignment), larger blocks size, and journal support which brings power failure resiliency. VirtualBox should support this format in read only.
- Version 2 of the HDD: The HDD format is developed by Parallels Inc and used in their hypervisor solutions like Parallels Desktop for Mac. Newer versions of this format (i.e. 3 and 4) are not supported due to the lack of documentation for this proprietary format.
- QED: The QEMU Enhanced Disk format is an old file format for QEMU, another free and open source hypervisor. This format was designed from 2010 in a way to provide a superior alternative to QCOW2 and others. This format features a fully asynchronous I/O path, strong data integrity, backing files, and sparse files. QED format is supported only for compatibility with virtual machines created with old versions of QEMU.
- QCOW: The QEMU Copy On Write format is the current format for QEMU. The QCOW format does support zlib-based transparent compression and encryption (the latter has flaw and is not recommended). QCOW is available in two versions: QCOW and QCOW2. The latter tends to supersede the first one. QCOW is currently fully supported by VirtualBox. QCOW2 comes in two revisions: QCOW2 0.10 and QCOW2 1.1 (which is the default when you create a virtual disk with QEMU). VirtualBox does not support this QCOW2 format (both revisions have been tried).
- OVF: The Open Virtualization Format is an open format which has been designed for interoperability and distributions of virtual machines between different hypervisors. VirtualBox supports all revisions of this format via the
VBoxManage
import/export feature but with known limitations.
- RAW: This is the mode when the virtual disk is exposed directly to the disk without being contained in a specific file format container. VirtualBox supports this feature in several ways: converting RAW disk to a specific format, or by cloning a disk to RAW, or by using directly a VMDK file which points to a physical disk or a simple file.
磁盘映像格式转换
VMDK to VDI and VDI to VMDK
VirtualBox can handle back and forth conversion between VDI and VMDK by itself with VBoxManage clonehd
.
VMDK to VDI:
$ VBoxManage clonehd source.vmdk destination.vdi --format VDI
VDI to VMDK:
$ VBoxManage clonehd source.vdi destination.vmdk --format VMDK
VHD to VDI and VDI to VDH
VirtualBox can handle conversion back and forth this format with VBoxManage clonehd
too.
VHD to VDI:
$ VBoxManage clonehd source.vhd destination.vdi --format VDI
VDI to VHD:
$ VBoxManage clonehd source.vdi destination.vhd --format VHD
QCOW2 to VDI and VDI to QCOW2
VBoxManage clonehd
cannot handle the QEMU format conversion; we will thus rely on another tool. The qemu-img
command from qemu can be used to convert images back and forth from VDI to QCOW2.
QCOW2 to VDI:
$ qemu-img convert -pO vdi source.qcow2 destination.vdi
VDI to QCOW2:
$ qemu-img convert -pO qcow2 source.vdi destination.qcow2
As QCOW2 comes in two revisions (see #Formats supported by VirtualBox, use the flag -o compat=
to specify the revision.
$ qemu-img convert -pO qcow2 source.vdi destination.qcow2 -o compat=0.10
or
$ qemu-img convert -pO qcow2 source.vdi destination.qcow2 -o compat=1.1
从其他虚拟机中迁移
qemu-img
程序可以用来将映像从一种格式转换到另一种格式,或为一个映像添加压缩或加密。
# pacman -S qemu
从QEMU映像转换
To convert a QEMU image for use with VirtualBox, first convert it to raw format, then use VirtualBox's conversion utility to convert and compact it in its native format.
$ qemu-img convert -O raw test.qcow2 test.raw $ VBoxManage modifyvdi /full/path/to/test.vdi compact or $ qemu-img convert -O raw test.qcow2 test.raw (of course you must have installed qemu package for that) $ VBoxManage convertfromraw /full/path/to/test.raw /full/path/to/test.vdi $ VBoxManage modifyvdi /full/path/to/test.vdi compact
从VMware映像转换
运行
$ VBoxManage clonehd source.vmdk target.vdi --format VDI
对于当前VirtualBox版本来说也许是不必要的(有待证实)
挂载虚拟磁盘
VDI
Mounting vdi images only works with fixed size images (a.k.a. static images); dynamic (dynamically size allocating) images are not easily mountable.
The offset of the partition (within the vdi) is needed, then add the value of offData
to 32256
(e.g. 69632 + 32256 = 101888):
$ VBoxManage internalcommands dumphdinfo <storage.vdi> | grep "offData"
The can now be mounted with:
# mount -t ext4 -o rw,noatime,noexec,loop,offset=101888 <storage.vdi> /mntpoint/
You can also use mount.vdi script that, which you can use as (install script itself to /usr/bin/
):
# mount -t vdi -o fstype=ext4,rw,noatime,noexec vdi_file_location /mnt/
Alternately you can use qemu's kernel module that can do this [attrib]:
# modprobe nbd max_part=16 # qemu-nbd -c /dev/nbd0 <storage.vdi> # mount /dev/nbd0p1 /mnt/dir/ # # to unmount: # umount /mnt/dir/ # qemu-nbd -d /dev/nbd0
If the partition nodes are not propagated try using partprobe /dev/nbd0
; otherwise, a vdi partition can be mapped directly to a node by: qemu-nbd -P 1 -c /dev/nbd0 <storage.vdi>
.
压缩磁盘映像
Compacting virtual disks only works with .vdi
files and basically consists in the following steps.
Boot your virtual machine and remove all bloat manually or by using cleaning tools like bleachbit which is available for Windows systems too.
Wiping free space with zeroes can be achieved with several tools:
- If you were previously using Bleachbit, check the checkbox System > Free disk space in the GUI, or use
bleachbit -c system.free_disk_space
in CLI; - 在 UNIX基本系统,使用
dd
or preferably dcfldd (see here to learn the differences) :
# dcfldd if=/dev/zero of=/fillfile bs=4M
- When
fillfile
reaches the limit of the partition, you will get a message like1280 blocks (5120Mb) written.dcfldd:: No space left on device
. This means that all of the user-space and non-reserved blocks of the partition will be filled with zeros. Using this command as root is important to make sure all free blocks have been overwritten. Indeed, by default, when using partitions with ext filesystem, a specified percentage of filesystem blocks is reserved for the super-user (see the-m
argument in themkfs.ext4
man pages or usetune2fs -l
to see how much space is reserved for root applications). - When the aforementioned process has completed, you can remove the file
fillfile
you created.
- On Windows, there are two tools available:
-
-
sdelete
from the Sysinternals Suite, typesdelete -s -z c:
, where you need to reexecute the command for each drive you have in your virtual machine; - or, if you love scripts, there is a PowerShell solution, but which still needs to be repeated for all drives.
PS> ./Write-ZeroesToFreeSpace.ps1 -Root c:\ -PercentFree 0
-
Once the free disk space have been wiped, shut down your virtual machine.
The next time you boot your virtual machine, it is recommended to do a filesystem check.
- On UNIX-based systems, you can use
fsck
manually;
- On GNU/Linux systems, and thus on Arch Linux, you can force a disk check at boot thanks to a kernel boot parameter;
- On Windows systems, you can use:
- either
chkdsk c: /F
wherec:
needs to be replaced by each disk you need to scan and fix errors; - or
FsckDskAll
from here which is basically the same software aschkdsk
, but without the need to repeat the command for all drives;
- either
Now, remove the zeros from the vdi
file with VBoxManage modifyhd
:
$ VBoxManage modifyhd your_disk.vdi --compact
增加虚拟磁盘
If you are running out of space due to the small hard drive size you selected when you created your virtual machine, the solution adviced by the VirtualBox manual is to use VBoxManage modifyhd
. However this command only works for VDI and VHD disks and only for the dynamically allocated variants. If you want to resize a fixed size virtual disk disk too, read on this trick which works either for a Windows or UNIX-like virtual machine.
First, create a new virtual disk next to the one you want to increase:
$ VBoxManage createhd -filename new.vdi --size 10000
where size is in MiB, in this example 10000MiB ~= 10GiB, and new.vdi is name of new hard drive to be created.
Next, the old virtual disk needs to be cloned to the new one which this may take some time:
$ VBoxManage clonehd old.vdi new.vdi --existing
Detach the old hard drive and attach new one, replace all mandatory italic arguments by your own:
$ VBoxManage storageattach VM_name --storagectl SATA --port 0 --medium none $ VBoxManage storageattach VM_name --storagectl SATA --port 0 --medium new.vdi --type hdd
To get the storage controller name and the port number, you can use the command VBoxManage showvminfo VM_name
. Among the output you will get such a result (what you are looking for is in italic):
[...] Storage Controller Name (0): IDE Storage Controller Type (0): PIIX4 Storage Controller Instance Number (0): 0 Storage Controller Max Port Count (0): 2 Storage Controller Port Count (0): 2 Storage Controller Bootable (0): on Storage Controller Name (1): SATA Storage Controller Type (1): IntelAhci Storage Controller Instance Number (1): 0 Storage Controller Max Port Count (1): 30 Storage Controller Port Count (1): 1 Storage Controller Bootable (1): on IDE (1, 0): Empty SATA (0, 0): /home/wget/IT/Virtual_machines/GNU_Linux_distributions/ArchLinux_x64_EFI/Snapshots/{6bb17af7-e8a2-4bbf-baac-fbba05ebd704}.vdi (UUID: 6bb17af7-e8a2-4bbf-baac-fbba05ebd704) [...]
Download GParted live image and mount it as a virtual CD/DVD disk file, boot your virtual machine, increase/move your partitions, umount GParted live and reboot.
Finally, unregister the virtual disk from VirtualBox and remove the file:
$ VBoxManage closemedium disk old.vdi $ rm old.vdi
从.vbox文件中手动更换虚拟磁盘
If you think that editing a simple XML file is more convenient than playing with the GUI or with VBoxManage
and you want to replace (or add) a virtual disk to your virtual machine, in the .vbox configuration file corresponding to your virtual machine, simply replace the GUID, the file location and the format to your needs:
ArchLinux_vm.vbox
<HardDisk uuid="{670157e5-8bd4-4f7b-8b96-9ee412a712b5}" location="ArchLinux_vm.vdi" format="VDI" type="Normal"/>
then in the <AttachedDevice>
sub-tag of <StorageController>
, replace the GUID by the new one.
ArchLinux_vm.vbox
<AttachedDevice type="HardDisk" port="0" device="0"> <Image uuid="{670157e5-8bd4-4f7b-8b96-9ee412a712b5}"/> </AttachedDevice>
Linux主机和其他操作系统之间的转移
The information about path to harddisks and the snapshots is stored between <HardDisks> .... </HardDisks>
tags in the file with the .vbox extension. You can edit them manually or use this script where you will need change only the path or use defaults, assumed that .vbox is in the same directory with a virtual harddisk and the snapshots folder. It will print out new configuration to stdout.
#!/bin/bash NewPath="${PWD}/" Snapshots="Snapshots/" Filename="$1" awk -v SetPath="$NewPath" -v SnapPath="$Snapshots" '{if(index($0,"<HardDisk uuid=") != 0){A=$3;split(A,B,"="); L=B[2]; gsub(/\"/,"",L); sub(/^.*\//,"",L); sub(/^.*\\/,"",L); if(index($3,"{") != 0){SnapS=SnapPath}else{SnapS=""}; print $1" "$2" location="\"SetPath SnapS L"\" "$4" "$5} else print $0}' "$Filename"
配置
网络
VirtualBox 客户端可以通过不同的方式连接网络;其中,有#NAT和#桥接链接。#NAT是最简单的且作为一个新虚拟机的默认方式。
VirtualBox手册涵盖了主机模式和内网选项。这些都被忽略了,因为在大多数情况下与操作系统无关。
NAT
在VirtualBox中:
- 访问虚拟机的设置菜单;
- 点击左边的网络‘’;最后,
- 在“连接方式”的下拉列表中选择NAT。
与VirtualBox捆绑的DHCP服务使得客户端系统能够与DHCP一起配置,第一张卡的NAT IP地址是 10.0.2.0,第二张是10.0.3.0,往后以此类推。
桥接
桥接网络可能被以多种方式启动;其中,有要求以较少控制为代价进行最小启动的原生方式。对于较新版本,VirtualBox可以在没有第三方工具的帮助下,在客户端和无线主机接口间进行桥接。
在继续之前,加载必要模块:
# modprobe vboxnetflt
在VirtualBox中:
- 访问虚拟机的设置菜单;
- 点击左边列表中的网络
- 在链接方式的下拉列表中选择Bridged Adapter(桥接适配器);最后,
- 在界面名称下拉列表中,选择客户端操作系统被包含在内,主机用于连接网络的接口。
Start the virtual machine and configure its network as usual; e.g., DHCP or static. 打开虚拟机,像往常一样配置其网络;例如 DHCP 或 static(静态网络)。
主机端和客户端之间的键盘和鼠标
- 为了捕获键盘和鼠标,点击虚拟机内部。
- 想要释放,按下右
Ctrl
.
想要获得在主机端和客户端之间的无缝鼠标集成功能,在客户端内安装#客户端增强包。
主机端和客户端间的共享文件夹
在虚拟机的设置中,找到数据空间标签,然后加入你想要共享的文件夹。
- 注意:为了使用这个功能你需要安装客户端增强包。
在Linux主机中,设备 → 安装增强功能 确定(被要求下载CD镜像时) 挂载(被要求注册和挂载时)
In a Linux host, create one or more folders for sharing files, then set the shared folders via the virtualbox menu (guest window). 在Linux主机端中,为共享的文件创建一个或更多的文件夹,然后通过Virtualbox菜单中设置(Windows客户端)
在Windows客户端中,从VirtualBox 1.5.0开始,共享文件夹是可浏览的,所以在Windows资源管理器中是可视的。打开Windows资源管理器,在我的网络位置(My Networking Places) → 整个网络(Entire Network) → VirtualBox Shared Folders(VirtualBox共享文件夹)。
启动Windows资源管理器(运行资源管理器命令),游览 网络位置(network places) -> (+)号展开: 整个网络(entire network)&rarr; VirtualBox Shared Folders(VirtualBox共享文件夹) &rarr;\\Vboxsvr → 然后你就可以在此展开所有已配置的文件夹了,并且在客户端文件系统中为Linux文件夹创建快捷方式。你也可以使用“添加网络位置向导(Add network place wizard)”找到“VBoxsvr”。
此外,在Windows命令行提示符中,你也可以使用以下命令:
net use x: \\VBOXSVR\sharename
虽然VBOXSVR
是一个固定名称,但请用你所想要用于共享的盘符替代x:
,用VBoxManage指定的共享名替换sharename。
在Windows客户端中,为了以VirtualBox共享文件夹改善文件的读取与保存(如MS Office),编辑c:\windows\system32\drivers\etc\hosts如下:
127.0.0.1 localhost vboxsvr
在Linux客户端中,实用以下命令:
# mount -t vboxsf [-o OPTIONS] sharename mountpoint (注意:共享名是任意的,或者和VirtualBox对话框中选定的一样(在主机端文件系统中共享目录的挂载点)。
- 自动挂载共享文件夹可以通过Linux客户端 /etc/fstab 文件来实现。你可以指定uid=#,gid=#(# 用实际的数字uid和gid替换),以便以普通用户权限(而不是root权限)来挂载共享文件夹。(这个对于为了在Linux客户端中使用而挂载主机上~/home的一部分是很有用的。为了做到这点,依照以下格式添加一个条目到Linux客户端中的/etc/fstab:
sharename mountpoint vboxsf uid=#,gid=# 0 0
用在VBoxManage中指定的共享名替换sharename
,并用你想要共享的路径替换mountpoint(如 /mnt/share)。通常的挂载申请,就是说,如果还没有的话,先创建这个文件夹。注意,如果你已经让VirtualBox“自动挂载”这个共享文件夹,这一步可能就不必了,而且你的文件夹可以在/media 下找到。
除了mount命令提供的标准选项外,以下是可选的:
iocharset=CHARSET
设置用于I/O操作的字符集(默认utf8),并且:
convertcp=CHARSET
用于指定用于共享文件夹名称的字符集(默认utf8)
Clone a virtual disk and assigning a new UUID to it
UUIDs are widely used by VirtualBox. Each virtual machines and each virtual disk of a virtual machine must have a different UUID. When you launch a virtual machine in VirtualBox, the latter will keep track of all UUID of your virtual machine instance. See the VBoxManage list
to list the items registered with VirtualBox.
If you cloned a virtual disk manually by copying the virtual disk file, you will need to assign a new UUID to the cloned virtual drive if you want to use the disk in the same virtual machine or even in another (if that one has already been opened, and thus registered, with VirtualBox).
You can use this command to assign a new UUID to your virtual disk:
$ VBoxManage internalcommands sethduuid /path/to/disk.vdi
高级配置
虚拟机管理启动
启动虚拟机服务
此后查找将用于考虑虚拟机作为服务systemd服务的实现。
/etc/systemd/system/vboxvmservice@.service
[Unit] Description=VBox Virtual Machine %i Service Requires=systemd-modules-load.service After=systemd-modules-load.service [Service] User=username Group=vboxusers ExecStart=/usr/bin/VBoxHeadless -s %i ExecStop=/usr/bin/VBoxManage controlvm %i savestate [Install] WantedBy=multi-user.target
To enable the service that will launch the virtual machine at next boot, use:
# systemctl enable vboxvmservice@your_virtual_machine_name
To start the service that will launch directly the virtual machine, use:
# systemctl start vboxvmservice@your_virtual_machine_name
VirtualBox 4.2 introduces a new way for UNIX-like systems to have virtual machines started automatically, other than using a systemd service.
启动虚拟机键盘快捷键
It can be useful to start virtual machines directly with a keyboard shortcut instead of using the VirtualBox interface (GUI or CLI). For that, you can simply define key bindings in .xbindkeysrc
. Please refer to Xbindkeys for more details.
Example, using the Fn
key of a laptop with an unused battery key (F3
on the computer used in this example):
"VBoxManage startvm 'Windows 7'" m:0x0 + c:244 XF86Battery
在虚拟机中使用特定的设备
使用 USB 摄像头 / 麦克风
- 要确保没有在运行虚拟机,以及没有使用摄像头 / 麦克风。
- 进入VirtualBox主界面并打开Arch系统的设置界面,到USB设备页。
- 要确保勾选上“启用USB控制器”选项。 还要确保选择“启用USB 2.0(EHCI)控制器”选项。
- 点击“从设备列表中添加筛选器”按钮 (就是那个有“+”图标的连接线).
- 从列表中选择你的USB摄像头 / 麦克风设备。
- 然后再点击OK,启动你的VM
获得可探测的Web-cam和其他USB设备
Make sure you filter any devices that are not a keyboard or a mouse so they do not start up at boot and this insures that Windows will detect the device at start-up.
访问guest 服务
To access Apache server on a Virtual Machine from the host machine only, simply execute the following lines on the host:
$ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/HostPort" 8888 $ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/GuestPort" 80 $ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/Protocol" TCP
Where 8888 is the port the host should listen on and 80 is the port the VM will send Apache's signal on.
To use a port lower than 1024 on the host machine, changes need to be made to the firewall on that host machine. This can also be set up to work with SSH or any other services by changing "Apache" to the corresponding service and ports.
To communicate between the VirtualBox guest and host using ssh, the server port must be forwarded under Settings > Network. When connecting from the client/host, connect to the IP address of the client/host machine, as opposed to the connection of the other machine. This is because the connection will be made over a virtual adapter.
在Windows客户端中激活D3D加速
Recent versions of Virtualbox have support for accelerating OpenGL inside guests. This can be enabled with a simple checkbox in the machine's settings, right below where video ram is set, and installing the Virtualbox guest additions. However, most Windows games use Direct3D (part of DirectX), not OpenGL, and are thus not helped by this method. However, it is possible to gain accelerated Direct3D in your Windows guests by borrowing the d3d libraries from Wine, which translate d3d calls into OpenGL, which is then accelerated. These libraries are now part of Virtualbox guest additions software.
After enabling OpenGL acceleration as described above, reboot the guest into safe mode (press F8 before the Windows screen appears but after the Virtualbox screen disappears), and install Virtualbox guest additions, during install enable checkbox "Direct3D support". Reboot back to normal mode and you should have accelerated Direct3D.
在USB key上使用VirtualBox
When using VirtualBox on a USB key, for example to start an installed machine with an ISO image, you will manually have to create VDMKs from the existing drives. However, once the new VMDKs are saved and you move on to another machine, you may experience problems launching an appropriate machine again. To get rid of this issue, you can use the following script to launch VirtualBox. This script will clean up and unregister old VMDK files and it will create new, proper VMDKs for you:
#!/bin/bash # Erase old VMDK entries rm ~/.VirtualBox/*.vmdk # Clean up VBox-Registry sed -i '/sd/d' ~/.VirtualBox/VirtualBox.xml # Remove old harddisks from existing machines find ~/.VirtualBox/Machines -name \*.xml | while read file; do line=`grep -e "type\=\"HardDisk\"" -n $file | cut -d ':' -f 1` if [ -n "$line" ]; then sed -i ${line}d $file sed -i ${line}d $file sed -i ${line}d $file fi sed -i "/rg/d" $file done # Delete prev-files created by VirtualBox find ~/.VirtualBox/Machines -name \*-prev -exec rm '{}' \; # Recreate VMDKs ls -l /dev/disk/by-uuid | cut -d ' ' -f 9,11 | while read ln; do if [ -n "$ln" ]; then uuid=`echo "$ln" | cut -d ' ' -f 1` device=`echo "$ln" | cut -d ' ' -f 2 | cut -d '/' -f 3 | cut -b 1-3` # determine whether drive is mounted already checkstr1=`mount | grep $uuid` checkstr2=`mount | grep $device` checkstr3=`ls ~/.VirtualBox/*.vmdk | grep $device` if [[ -z "$checkstr1" && -z "$checkstr2" && -z "$checkstr3" ]]; then VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/$device.vmdk -rawdisk /dev/$device -register fi fi done # Start VirtualBox VirtualBox
Note that your user has to be added to the "disk" group to create VMDKs out of existing drives.
Run a native Arch Linux installation inside VirtualBox
If you have a dual boot system between Arch Linux and another operating system, it can become rapidly tedious to switch back and forth if you need to work in both. Also, by using virtual machines, you just have a tiny fragment of your computer power, which can cause issues when working on projects requiring performance.
This guide will let you reuse, in a virtual machine, your native Arch Linux installation when you are running your second operating system. This way, you keep the ability to run each operating system natively, but have the option to run your Arch Linux installation inside a virtual machine.
Make sure you have a persistent naming scheme
Depending on your hard drive setup, device files representing your hard drives may appear differently when you will run your Arch Linux installation natively or in virtual machine. This problem occurs when using FakeRAID for example. The fake RAID device will be mapped in /dev/mapper/
when you run your GNU/Linux distribution natively, while the devices are still accessible separately. However, in your virtual machine, it can appear without any mapping in /dev/sdaX
for example, because the drivers controlling the fake RAID in your host operating system (e.g. Windows) are abstracting the fake RAID device.
To circumvent this problem, we will need to use an addressing scheme that is persistent to both systems. This can be achieved using UUIDs in your /etc/fstab
file. Make sure your fstab file is using UUIDs, otherwise fix this issue. Read fstab and Persistent block device naming.
/etc/fstab
is not the only location where UUIDs are used. Bootloaders and boot managers make use of them too. Now, make sure these are really using UUIDs.
If you are still using the old GRUB Legacy, maybe is it time to upgrade, since this package is now dropped from the official Arch Linux repositories. If you want to keep it, edit /boot/grub/menu.lst
and replace the root=/dev/sdXX
statement in your Arch Linux boot entry by the Linux UUID mapping in /dev/disk/by-uuid/
corresponding to your root partition.
title Arch Linux root kernel /vmlinuz-linux root=/dev/disk/by-uuid/0a3407de-014b-458b-b5c1-848e92a327a3 ro vga=773 initrd /initramfs-linux-vbox.img
Repeat the process here, for the fallback entry.
If you are running the most recent version of GRUB; you have nothing to do. Yet another reason to upgrade to GRUB 2.
Make sure your mkinitcpio image is correct
Make sure your mkinitcpio configuration uses the HOOK block
:
/etc/mkinitcpio.conf
[...] HOOKS="base udev autodetect modconf block filesystems keyboard fsck" [...]
If it is not present, add it and regenerate your initramfs:
# mkinitcpio -p linux
Create a VM configuration to boot from the physical drive
创建一个原始只读磁盘的.vmdk映像
Now, we need to create a new virtual machine which will use a RAW disk as virtual drive, for that we will use a ~ 1Kio VMDK file which will be mapped to a physical disk. Unfortunately, VirtualBox does not have this option in the GUI, so we will have to use the console and use an internal command of VBoxManage
.
Boot the host which will use the Arch Linux virtual machine. The command will need to be adapted according to the host you have.
- On a GNU/Linux host
There is 3 ways to achieve this: login as root, changing the access right of the device with chmod
, adding your user to the disk
group. The latter way is the more elegant, let us proceed that way:
# gpasswd -a your_user disk
Apply the new group settings with:
$ newgrp
Now, you can use the command:
$ VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sdb -register
Adapt the above command to your need, especially the path and filename of the VMDK location and the raw disk location to map which contain your Arch Linux installation.
- On a Windows host
# wmic diskdrive get name,size,model
Model Name Size WDC WD40EZRX-00SPEB0 ATA Device \\.\PHYSICALDRIVE1 4000783933440 KINGSTON SVP100S296G ATA Device \\.\PHYSICALDRIVE0 96024821760 Hitachi HDT721010SLA360 ATA Device \\.\PHYSICALDRIVE2 1000202273280 Innostor Ext. HDD USB Device \\.\PHYSICALDRIVE3 1000202273280
In this example, as the Windows convention is \\.\PhysicalDriveX
where X is a number from 0, \\.\PHYSICALDRIVE1
could be analogous to /dev/sdb
from the Linux disk terminology.
To use the VBoxManage
command on Windows, you can either, change the current directory to your VirtualBox installation folder first with cd C:\Program Files\Oracle\VirtualBox\
# .\VBoxManage.exe internalcommands createrawvmdk -filename C:\file.vmdk -rawdisk \\.\PHYSICALDRIVE1
or use the absolute path name:
# "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename C:\file.vmdk -rawdisk \\.\PHYSICALDRIVE1
- On another OS host
There are other limitations regarding the aforementioned command when used in other operating systems like OS X, please thus read carefully the manual page, if you are concerned.
创建虚拟机配置文件
After, we need to create a new machine (replace the VM_name to your convenience) and register it with VirtualBox.
$ VBoxManage createvm -name VM_name -register
Then, the newly raw disk needs to be attached to the machine. This will depend if your computer or actually the root of your native Arch Linux installation is on an IDE or a SATA controller.
If you need an IDE controller:
$ VBoxManage storagectl VM_name --name "IDE Controller" --add ide $ VBoxManage storageattach VM_name --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /path/to/file.vmdk
otherwise:
$ VBoxManage storagectl VM_name --name "SATA Controller" --add sata $ VBoxManage storageattach VM_name --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium /path/to/file.vmdk
While you continue using the CLI, it is recommended to use the VirtualBox GUI, to personalise the virtual machine configuration. Indeed, you must specify its hardware configuration as close as possible as your native machine: turning on the 3D acceleration, increasing video memory, setting the network interface, etc.
Install the Guest Additions
Finally, you may want to seamlessly integrate your Arch Linux with your host operating system and allow copy pasting between both OSes. Please refer to #Install the Guest Additions for that, since this Arch Linux virtual machine is basically an Arch Linux guest.
安装VirtualBox的本地Arch Linux系统
In some cases it may be useful to install a native Arch Linux system while running another operating system: one way to accomplish this is to perform the installation through VirtualBox on a raw disk. If the existing operating system is Linux based, you may want to consider following Install from Existing Linux instead.
This scenario is very similar to #Run a native Arch Linux installation inside VirtualBox, but will follow those steps in a different order: start by #Create a raw disk .vmdk image, then #Create the VM configuration file.
Now, you should have a working VM configuration whose virtual VMDK disk is tied to a real disk. The installation process is exactly the same as the steps described in #Installation steps for Arch Linux guests, but #Make sure you have a persistent naming scheme and #Make sure your mkinitcpio image is correct.
After completing the installation, boot your computer natively with an GNU/Linux installation media (whether it be Arch Linux or not), chroot into your installed Arch Linux installation and #Install and configure a bootloader.
将本机Windows安装到虚拟机
If you want to migrate an existing native Windows installation to a virtual machine which will be used with VirtualBox on GNU/Linux, this use case is for you. This section only covers native Windows installation using the MSDOS/Intel partition scheme. Your Windows installation must reside on the first MBR partition for this operation to success. Operation for other partitions are available but have been untested (see #Known limitations for details).
A couple of tasks are required to be done inside your native Windows installation first, then on your GNU/Linux host.
Tasks on Windows
The first three following points comes from this outdated VirtualBox wiki page, but are updated here.
- Remove IDE/ATA controllers checks (Windows XP only): Windows memorize the IDE/ATA drive controllers it has been installed on and will not boot if it detects these have changed. The solution proposed by Microsoft is to reuse the same controller or use one of the same serial, which is impossible to achieve since we are using a Virtual Machine. MergeIDE, a German tool, developped upon another other solution proposed by Microsoft can be used. That solution basically consists in taking all IDE/ATA controller drivers supported by Windows XP from the initial driver archive (the location is hard coded, or specify it as the first argument to the
.bat
script), installing them and registering them with the regedit database.
- Use the right type of Hardware Abstraction Layer (old 32 bits Windows versions): Microsoft ships 3 default versions:
Hal.dll
(Standard PC),Halacpi.dll
(ACPI HAL) andHalaacpi.dll
(ACPI HAL with IO APIC). Your Windows install could come installed with the first or the second version. In that way, please disable the Enable IO/APIC VirtualBox extended feature.
- Disable any AGP device driver (only outdated Windows versions): If you have the files
agp440.sys
orintelppm.sys
inside theC:\Windows\SYSTEM32\drivers\
directory, remove it. As VirtualBox uses a PCI virtual graphic card, this can cause problems when this AGP driver is used.
- Create a Windows recovery disk: In the following steps, if things turn bad, you will need to repair your Windows installation. Make sure you have an install media at hand, or create one with Create a recovery disk from Vista SP1, Create a system repair disc on Windows 7 or Create a recovery drive on Windows 8.x).
Tasks on GNU/Linux
- Reduce the native Windows partition size to the size Windows actually needs with
ntfsresize
available from ntfs-3g. The size you will specify will be the same size of the VDI that will be created in the next step. If this size is too low, you may break your Windows install and the latter might not boot at all.
- Use the
--no-action
option first to run a test: # ntfsresize --no-action --size 52Gi /dev/sda1
- If only the previous test succeeded, execute this command again, but this time without the aforementioned test flag.
- Install VirtualBox on your GNU/Linux host (see #Installation steps for Arch Linux hosts if your host is Arch Linux).
- Create the Windows disk image from the beginning of the drive to the end of the first partition where is located your Windows installation. Copying from the beginning of the disk is necessary because the MBR space at the beginning of the drive needs to be on the virtual drive along with the Windows partition. In this example two following partitions
sda2
andsda3
will be later removed from the partition table and the MBR bootloader will be updated.
# sectnum=$(( $(cat /sys/block/''sda/sda1''/start) + $(cat /sys/block/''sda/sda1''/size) ))
- Using
cat /sys/block/sda/sda1/size
will output the number of total sectors of the first partition of the disksda
. Adapt where necessary.
# dd if=''/dev/sda'' bs=512 count=$sectnum | VBoxManage convertfromraw stdin ''windows.vdi'' $(( $sectnum * 512 ))
- We need to display the size in byte,
$(( $sectnum * 512 ))
will convert the sector numbers to bytes.
- Since you created your disk image as root, set the right ownership to the virtual disk image:
# chown your_user:your_group windows.vdi
- Create your virtual machine configuration file and use the virtual disk created previously as the main virtual hard disk.
- Try to boot your Windows VM, it may just work. First though remove and repair disks from the boot process as it may interfere (and likely will) booting into safe-mode.
- Attempt to boot your Windows virtual machine in safe mode (press the F8 key before the Windows logo shows up)... if running into boot issues, read #Fix MBR and Microsoft bootloader. In safe-mode, drivers will be installed likely by the Windows plug-and-play detection mechanism view. Additionally, install the VirtualBox Guest Additions via the menu Devices > Insert Guest Additions CD image.... If a new disk dialog does not appear, navigate to the CD drive and start the installer manually.
- You should finally have a working Windows virtual machine. Do not forget to read the #Known limitations.
修复MBR和Microsoft引导
如果您的Windows虚拟机拒绝引导, 你可能需要修复你的虚拟机.
- Boot a GNU/Live live distribution inside your virtual machine before Windows starts up.
- Remove other partitions entries from the virtual disk MBR. Indeed, since we copied the MBR and only the Windows partition, the entries of the other partitions are still present in the MBR, but the partitions are not available anymore. Use
fdisk
to achieve this for example.
fdisk ''/dev/sda'' Command (m for help): a Partition number (''1-3'', default ''3''): ''1''
- Write the updated partition table to the disk (this will recreate the MBR) using the
m
command insidefdisk
.
# testdisk > Disk /dev/sda...' > [Proceed] > [Intel] Intel/PC partition > [MBR Code] Write TestDisk MBR to first sector > Write a new copy of MBR code to first sector? (Y/n) > Y > Write a new copy of MBR code, confirm? (Y/N) > A new copy of MBR code has been written. You have to reboot for the change to take effect. > [OK]
- With the new MBR and updated partition table, your Windows virtual machine should be able to boot. If you are still encountering issues, boot your Windows recovery disk from on of the previous step, and inside your Windows RE environment, execute the commands described here.
已知的限制
- Your virtual machine can sometimes hang and overrun your RAM, this can be caused by conflicting drivers still installed inside your Windows virtual machine. Good luck to find them!
- Additional software expecting a given driver beneath may either not be disabled/uninstalled or needs to be uninstalled first as the drivers that are no longer available.
- Your Windows installation must reside on the first partition for the above process to work. If this requirement is not met, the process might be achieved too, but this had not been tested. This will require either copying the MBR and editing in hexadecimal see VirtualBox: booting cloned disk or will require to fix the partition table manually or by repairing Windows with the recovery disk you created in a previous step. Let us consider our Windows installation on the second partition; we will copy the MBR, then the second partition where to the disk image.
VBoxManage convertfromraw
needs the total number of bytes that will be written: calculated thanks to the size of the MBR (the start of the first partition) plus the size of the second (Windows) partition.{ dd if=/dev/sda bs=512 count=$(cat /sys/block/sda/sda1/start) ; dd if=/dev/sda2 bs=512 count=$(cat /sys/block/sda/sda2/size) ; } | VBoxManage convertfromraw stdin windows.vdi $(( ($(cat /sys/block/sda/sda1/start) + $(cat /sys/block/sda/sda2/size)) * 512 ))
.
故障排除
modprobe Exec 格式错误
确认你使用的是最新系统:
pacman -Syu
VERR_ACCESS_DENIED
To access the raw vmdk image on a windows host, run the VirtualBox GUI as administrator.
键盘和鼠标都在我的虚拟机
This means your virtual machine has captured the input of your keyboard and your mouse. Simply press the right Ctrl
key and your input should control your host again.
To control transparently your virtual machine with your mouse going back and forth your host, without having to press any key, and thus have a seamless integration, install the guest additions inside the guest. Read from the #Install the Guest Additions step if you guest is Arch Linux, otherwise read the official VirtualBox help.
无法发送CTRL + ALT+ Fn键到我的虚拟机
Your guest operating system is a GNU/Linux distribution and you want to open a new TTY shell by hitting Ctrl+Alt+F2
or exit your current X session with Ctrl+Alt+Backspace
. If you type these keyboard shortcuts without any adaptation, the guest will not receive any input and the host (if it is a GNU/Linux distribution too) will intercept these shortcut keys. To send Ctrl+Alt+F2
to the guest for example, simply hit your Host Key (usually the right Ctrl
key) and press F2
simultaneously.
解决ISO映像问题
While VirtualBox can mount ISO images without problem, there are some image formats which cannot reliably be converted to ISO. For instance, ccd2iso ignores .ccd and .sub files, which can give disk images with broken files.
In this case, you will either have to use CDEmu for Linux inside VirtualBox or any other utility used to mount disk images.
VirtualBox的GUI没有应用我的GTK主题
See Uniform Look for Qt and GTK Applications for information about theming Qt based applications like Virtualbox.
OpenBSD系统无法使用时,虚拟化指令不可用
While OpenBSD is reported to work fine on other hypervisors without virtualisation instructions (VT-x AMD-V) enabled, an OpenBSD virtual machine running on VirtualBox without these instructions will be unusable, manifesting with a bunch of segmentation faults. Starting VirtualBox with the -norawr0 argument may solve the problem. You can do it like this:
$ VBoxSDL -norawr0 -vm name_of_OpenBSD_VM
VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)
这种情形可能会在虚拟机没有正常退出时发生,解除锁定虚拟机并不难:
$ VBoxManage controlvm virtual_machine_name poweroff
USB 子系统在宿主机和虚拟机没有作用
Your user must be in the vboxusers
group, and you need to install the extension pack if you want USB 2 support. Then you will be able to enable USB 2 in the VM settings and add one or several filters for the devices you want to access from the guest OS.
Sometimes, on old Linux hosts, the USB subsystem is not auto-detected resulting in an error Could not load the Host USB Proxy service: VERR_NOT_FOUND
or in a not visible USB drive on the host, even when the user is in the vboxusers group. This problem is due to the fact that VirtualBox switched from usbfs to sysfs in version 3.0.8. If the host does not understand this change, you can revert to the old behaviour by defining the following environment variable in any file that is sourced by your shell (e.g. your ~/.bashrc
if you are using bash):
~/.bashrc
VBOX_USB=usbfs
Then make sure, the environment has been made aware of this change (reconnect, source the file manually, launch a new shell instance or reboot).
Also make sure that your user is a member of the storage
group.
主机模式网络接口创建失败
Make sure all required kernel modules are loaded. See #Load the VirtualBox kernel modules.
To be able to create a Host-Only Network Adapter or a Bridged Network Adapter the kernel modules vboxnetadp
and vboxnetflt
need to be loaded, you also need to make sure the net-tools package is installed. It's possible to load these kernel modules manually with
# modprobe -a vboxnetadp vboxnetflt
若要开机自动加载,每个模块添加一行到 /etc/modules-load.d/virtualbox.conf
:
vboxdrv vboxnetadp vboxnetflt
更多信息请看这个主题。
WinXP: 位深不能大于 16
若你运行于 16 位色深,图标可能看起来糊糊的。但是当你试图调到更高色深,系统可能会受限于较低的分辨率,甚至根本不允许更改色深。若要修正此问题,运行 regedit
并添加下列键值到虚拟 XP 注册表:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services] "ColorDepth"=dword:00000004
接著在桌面属性窗口改变色深。若没有反应,可透过一些方法强制屏幕重绘 (按下 Host+F
重绘/进入全屏)。
虚拟系统使用串行端口
确认你的串行端口权限
$ /bin/ls -l /dev/ttyS* crw-rw---- 1 root uucp 4, 64 Feb 3 09:12 /dev/ttyS0 crw-rw---- 1 root uucp 4, 65 Feb 3 09:12 /dev/ttyS1 crw-rw---- 1 root uucp 4, 66 Feb 3 09:12 /dev/ttyS2 crw-rw---- 1 root uucp 4, 67 Feb 3 09:12 /dev/ttyS3
添加你的用户到 uucp
组。
# gpasswd -a $USER uucp
然后重新登陆。
Windows 8.x Error Code 0x000000C4
If you get this error code while booting, even if you choose OS Type Win 8, try to enable the CMPXCHG16B
CPU instruction:
$ vboxmanage setextradata virtual_machine_name VBoxInternal/CPUM/CMPXCHG16B 1
Windows 8 VM fails to boot with error "ERR_DISK_FULL"
Situation: Your Windows 8 VM refuses to start. VirtualBox throws an error stating the virtual disk is full. However, you are certain that the disk is not full. Bring up your VM's settings at Settings > Storage > Controller:SATA and select "Use Host I/O Cache".
Linux guests have slow/distorted audio
The AC97 audio driver within the Linux kernel occasionally guesses the wrong clock settings when running inside Virtual Box, leading to audio that is either too slow or too fast. To fix this, create a file in /etc/modprobe.d
with the following line:
options snd-intel8x0 ac97_clock=48000
客户端启动后的Xorg死机
Faulty or missing drivers may cause the guest to freeze after starting Xorg, see for example [1] and [2]. Try disabling 3D acceleration in Settings > Display, and check if all Xorg drivers are installed.
If you encounter this message when first time starting the virtual machine:
Failed to open a session for the virtual machine debian. Could not open the medium '/home/.../VirtualBox VMs/debian/debian.qcow'. QCow: Reading the L1 table for image '/home/.../VirtualBox VMs/debian/debian.qcow' failed (VERR_EOF). VD: error VERR_EOF opening image file '/home/.../VirtualBox VMs/debian/debian.qcow' (VERR_EOF). Result Code: NS_ERROR_FAILURE (0x80004005) Component: Medium
Exit VirtualBox, delete all files of the new machine and from virtualbox config file remove the last line in MachineRegistry
menu (or the offending machine you are creating):
~/.config/VirtualBox/VirtualBox.xml
... <MachineRegistry> <MachineEntry uuid="{00000000-0000-0000-0000-000000000000}" src="/home/void/VirtualBox VMs/debian/debian.vbox"/> <MachineEntry uuid="{00000000-0000-0000-0000-000000000000}" src="/home/void/VirtualBox VMs/ubuntu/ubuntu.vbox"/><MachineEntry uuid="{00000000-0000-0000-0000-000000000000}" src="/home/void/VirtualBox VMs/lastvmcausingproblems/lastvmcausingproblems.qcow"/></MachineRegistry> ...
This happens sometimes when selecting QCOW/QCOW2/QED disk format when creating a new virutal disk.
USB modem
If you have a USB modem which is being used by the guest OS, killing the guest OS can cause the modem to become unusable by the host system. Killing and restarting VBoxSVC
should fix this problem.
"The specified path does not exist. Check the path and then try again." error in Windows guests
This error message often appears when running an .exe file which requires administrator priviliges from a shared folder in windows guests. See the bug report for details.
There are several workarounds:
- Disable UAC from Control Panel -> Action Center -> "Change User Account Control settings" from left side pane -> set slider to "Never notify" -> OK and reboot
- Copy the file from the shared folder to the guest and run from there
- Control Panel -> Network and Internet -> Internet Options -> Security -> Trusted Sites -> Sites -> Add "VBOXSVR" as a website
- Start -> type "gpedit.msc" and press Enter -> Computer Configuration -> Administrative Templates -> Windows Components -> Internet Explorer -> Internet Control Panel -> Security Page -> Size to Zone Assignment List -> Add "VBOXSVR" to "2" and reboot
挂载失败导致的啟动问题
若你在内核升级后 systemd 设定遇到问题,你应该透过 init=/bin/bash
开啟系统 (如果应急 shell 对你没有作用)。
root=/dev/mapper/vg_main-lv_root ro vga=792 resume=/dev/mapper/vg_main-lv_swap init=/bin/bash
接著附加写入权限挂载 root-文件系统:
# mount / -o remount,rw
根据 #Arch Linux 客户机共享文件夹 更改 /etc/fstab
]],然后在 Bash shell 运行 systemd:
# exec /bin/systemd
复制和粘贴在 Arch Linux 客户机没有作用
Since updating virtualbox-guest-additions
to version 4.2.0-2
copy&paste from Host OS to Arch Linux Guest stopped working. It seems to be due to VBoxClient-all
requiring root access. In previous versions adding VBoxClient-all & to ~/.xinitrc was sufficient to make copy&paste work. Update ~/.xinitrc to match sudo VBoxClient-all &
and add the line , NOPASSWD: /usr/bin/VBoxClient-all
to your username in the sudoers file and restart X. It should all work again. The line in the sudoers file should look similar to this:
# Allow sudo for user 'you' and let him run VBoxClient-all without requiring a password you ALL = PASSWD: ALL, NOPASSWD: /usr/bin/VBoxClient-all
唤醒后异常
有个已知臭虫导致唤醒后异常: https://www.virtualbox.org/ticket/11289。避开的方法很简单: 每次都按 Host+q 或菜单关闭虚拟机。
Btrfs 系统镜像
In 2010 there were reports that OS disk images would not start if they were attached via a virtual SATA device. It was reportedly fixed, and seemed to be. But as of around March 2013, that particular bug report has been repoened. This can be fixed by enabling the use of the host I/O cache, which is disabled by default with virtual SATA interfaces.
vagrant 啟动问题
在最新版的 VirtualBox(4.2.14-1),运行 vagrant up
命令伴随以下错误:
Command: ["import", "/Users/username/.vagrant.d/boxes/precise32/virtualbox/box.ovf"] Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Interpreting /Users/username/.vagrant.d/boxes/precise32/virtualbox/box.ovf... OK. 0%... Progress object failure: NS_ERROR_CALL_FAILED
在这个修正释出前,你需要使用其它方法解决,或是将 VirtualBox 降级。
有个临时的解决方法是在 ~/.vagrant.d/boxes/BoxName/virtualbox
為每个 box 创建 manifest:
openssl sha1 *.vmdk *.ovf > box.mf
你可以降级 VirtualBox。若你的缓存有旧的软件包,可以透过下列命令降级:
sudo pacman -U /var/cache/pacman/pkg/virtualbox-4.2.12-3-x86_64.pkg.tar.xz
这个错误似乎同时出现在所有平台: http://www.marshut.com/pzisi/progress-object-failure-ns-error-call-failed-when-running-vagrant-up-in-getting-started-guide.html#qhihz
It's unclean for the moment. It could be regression inside Virtualbox or a issue inside Vagrant. When you delete the cache you can downgrade via ArchLinux downgrader (I did not test it correctly, but I assume this works, else check the wiki page for downgrading: Downgrading packages
更多信息请到 GitHub issue 页面查看 Clean install on OS X 10.8.4 w/ latest VirtualBox not working
根据 Vagrant creator on Twitter,这是 VirtualBox 的臭虫。在 2013 年 06 月 25 日,他说他们在 SVN 修正此臭虫,并且正在等待释出。同时,我可以确认这是跨平台的问题,4.2.14 在我的 Win7 上面是坏的。
这个问题在 virtualbox-4.2.16-1 这份 VirtualBox 版本释出时已解决
没有64位客户端选项
When launching a VM client, and no 64-bit options are available, make sure your CPU virtualization capabilities (usually named VT-x
) are enabled in the BIOS.
主机上的虚拟机启动操作系统死机
This is a known incompatiblity with SMAP enabled kernels affecting (mostly) Intel Broadwell chipsets.
The matter is currently being investigated, with a wide variety of WIP vboxhost module patches out in the wild that are meant to solve the issue.
At the moment of writing though, the only 100% guaranteed solution to this problem is disabling SMAP support in your kernel by appending the "nosmap" option to your kernel boot command line.
向客户端发送CTRL+ALT+F1
如果你的客户端操作系统是Linux发行版,且你又想打开一个新的tty文本shell或者通过键入Ctrl
+Alt
+F1
来退出 X ,你可以简单地敲击你的'Host Key'向客户端操作系统发送这个命令(通常为键盘右边的Ctrl
) + F1
或 F2
,以此类推。
在运行于无显示器的服务器上的系统上启动虚拟机
Add this line to /etc/rc.local
exec /bin/su -c 'VBoxManage startvm --type headless <UUID|NAME>' PREFERED_USER >/dev/null 2>&1
Where <UUID|NAME> is the guest identifier, and PREFERRED_USER is the user profile that contains the VM definitions and .vdi files.
Since exec replaces the currently running process, you will not be able to start a second VM, or execute any other commands, after the exec. Try the following if this is a problem:
su -c 'VBoxHeadless -s <UUID|NAME> &' -s /bin/sh PREFERED_USER >/dev/null 2>&1
Using fully qualified path to su and VBoxHeadless is recommend. Add additional lines like above to start additional VMs. Commands following these in rc.local will be executed. Based on some rooting around in the VBox documentation, I get the impression this will be a little more robust than 'VBoxManage ... --type headless' in future VBox releases.
To determine the available VMs for a user:
su -c 'VBoxManage list vms' PREFERED_USER
To save the state of a running VM:
su -c 'VBoxManage controlvm <UUID|NAME> savestate' PREFERED_USER
rc.local.shutdown would be a good spot for this.
从主机端访问虚拟机上的服务器
To access apache on a VM from the Host machine ONLY, simply execute the following lines on the Host:
$ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/HostPort" 8888 $ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/GuestPort" 80 $ VBoxManage setextradata GuestName "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/Protocol" TCP
Where 8888 is the port the host should listen on and 80 is the port the VM will send Apache's signal on. To use a port lower than 1024 on the host machine changes need to be made to the firewall on the host machine. This can also be set up to work with SSH, etc.. by changing "Apache" to whatever service and using different ports.
Note: "pcnet" refers to the network card of the VM. If you use an Intel card in your VM settings change "pcnet" to "e1000"
- from [3]
It might also be necessary to allow connections from the outside to the server in your VM. E.g. if the guest OS is Arch, you may want to add the line
httpd: ALL
to your /etc/hosts.allow file.
守护进程工具
While VirtualBox can mount ISO images without a problem, there are some image formats which cannot reliably be converted to ISO. For instance, ccd2iso ignores .ccd and .sub files, which can give disk images with broken files. cdemu, fuseiso, and MagicISO will do the same. In this case there is no choice but to use Daemon Tools inside VirtualBox.
Recent Daemon Tools versions won't install, so use this old one: [4]