这篇文章之前的名字是:VirtualBox内存分配偏小导致引起Win7重启,现在才发现自己误导了很多人。
之前的出现的状况是,在VirtualBox虚拟机里面,安装了两台虚拟机,在使用的过程中经常出现宿主主机Win7自动重启的情况。我一直认为是内存不足的原因引起系统重启。
在VirtualBox 4.2.18 (released 2013-09-06,下载地址https://www.virtualbox.org/wiki/Downloads)版本之前,使用Virtualbox的时候经常出现宿主主机重启的现象。引起的原因不是宿主主机的内存不足,而已VirtualBox的一个bug。从VirtualBox 4.2.18 的change log(https://www.virtualbox.org/wiki/Changelog)中可以验证这一点,下面的红色的第二条即引起宿主主机(我是在Win7下安装的VirtualBox)。如过宿主主机是32位操作系统(32bit Win7系统),而VirtualBox里面安装的是64位操作系统(我虚拟机安装的是64位centos),这样可能经常引起宿主主机重启。在经常碰到这个问题的时候,我也曾经想到过向oracle开发团队,提出自己的问题,而因为自己的偷懒而没有反馈。
This is a maintenance release. The following items were fixed and/or added:
- VMM: properly handle NMIs on Linux hosts with X2APIC enabled
- VMM: fixed potential crashes with 64-bit guests on 32-bit hosts (bug #11979)
- GUI / seamless: properly handle mouse wheel scroll events
- GUI, VBoxManage: when unregistering a VM, also unregister the hard disk images which are used exclusively (bug #10311)
- GUI: prevent crashes under certain conditions on X11 hosts
- 3D: multiscreen fixes (incorrect mouse position, flickers)
- 3D Support: several fixes for the Windows WDDM video driver (multiscreen, seamless)
- Snapshots: made live snapshots work again (bug #9255)
- Teleportation: made it work again (bug #9455)
- VBoxManage: on snapshot take, --pause is default and --live is for doing live snapshots
- VBoxSVC: don't crash on systems with many VLAN interfaces (Solaris hosts only)
- Network: after the host resumes from suspend, disconnect and reconnect the virtual network cables to force renewing the DHCP leases for the guests. So far only Mac OS X hosts and Windows hosts (bug#10063).
- NAT: on name server changes force a reconnect of the virtual network cable to notify the guest (Mac OS X hosts only)
- Mac OS X installer: keep previously installed Extension Packs on VirtualBox upgrade
- Linux hosts / guests: Linux 3.11 fixes (bug #12001)
- Solaris hosts: fixed a potential kernel panic caused due to unexpected preemption due to logging.
- Windows hosts: fixed an issue with USB2 devices being inaccessible when plugged into USB3 ports.
- Linux Additions: added PCI device identifier to vboxvideo.ko fixing DRI initialization under certain conditions (bug #11957)
- Linux Additions: fixed udev detection in the init script with Linux 3.x kernels
另外,win7或者360工具的补丁更新会引起相同自动重启的状况。至于由于内存不足引起的宿主主机重启的情况应该不会发生。
目前我VirtualBox同时运行了3个64bit的centos系统,内存使用约75%,VirtualBox的资源消耗比较较少,这也是我一直坚持使用VirtualBox的原因。
前端时间,因为使用VirtualBox导致电脑经常重启,我尝试使用了下VMWare。今天上班发现不能ssh登录到centos,发现VMWare不能联网,桥接、NAT等方式都是过,都没法ping通网络。修改网络配置参数也不能使用,决定使用回VirtualBox。于是去Oracle网站上看看VirtualBox的更新,也发现了导致主机重启的bug原因所在。直接把VMWare删除掉,也不想纠结不能上网的原因了,毕竟还有狠多事情要做,还是直接卸载掉,眼不见为净。