Virtualization: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 6: Line 6:


* To get a resolution of 1280*1024, be sure to install the VirtualBox additions (emerge this, then install them inside the virtual machine, which means inside Windows via the ISO image).
* To get a resolution of 1280*1024, be sure to install the VirtualBox additions (emerge this, then install them inside the virtual machine, which means inside Windows via the ISO image).
== Command line tools ==
* To shutoff a started VM, issue:
VBoxManage controlvm vm-name poweroff


== Network ==
== Network ==
Line 12: Line 18:


* If you want several guest VMs to see each other in the network, do not use NAT. Use Bridged Networking. It works really well and allow your guests to be seen as other computers on your normal LANs. Thus the gateway should be your usual router.
* If you want several guest VMs to see each other in the network, do not use NAT. Use Bridged Networking. It works really well and allow your guests to be seen as other computers on your normal LANs. Thus the gateway should be your usual router.
* When using Bridged Networking, you must choose the actual interface of the host machine (eth0 or wlan0 for instance). Note that in the guest, the network interface will still be eth0 no matter what you chose for the VirtualBox adapter.
* Note that with wifi adapters (network cards), usually Bridged Networking won't work, so you should fall back to NAT.


* If you create a new VirtualBox machine, with a cloned Gentoo disk image, udev will probably get confused by the change of the MAC address for the network card (VBox generates a new one when creating a new machine). It will have the effect of renaming eth0 to eth1. To fix the problem you can just delete the file:
* If you create a new VirtualBox machine, with a cloned Gentoo disk image, udev will probably get confused by the change of the MAC address for the network card (VBox generates a new one when creating a new machine). It will have the effect of renaming eth0 to eth1. To fix the problem you can just delete the file:
Line 20: Line 28:


* To duplicate a HD, you must use the VBoxManage program with the clonehd argument (and give the absolute path to the disk to be cloned). This allows the new disk to have a different uuid and thus be used without problems.
* To duplicate a HD, you must use the VBoxManage program with the clonehd argument (and give the absolute path to the disk to be cloned). This allows the new disk to have a different uuid and thus be used without problems.
* To extend the size of a HD, use:
modifyhd /home/elvanor/path/hd.vdi --resize 50000
* To unregister a HD with the command line, use:
VBoxManage closemedium disk d6ab9a3c-dc6c-4f19-87ce-1937ea930e71
* To associate a hard drive with a VM:
VBoxManage storageattach windowsxp --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /srv/com.kameleoon/windowsxp.vdi
* You must after that resize the partitions (first by modifying the partition table via fdisk, and then by using resize2fs - despite the name, it works with ext4).
* To compact a Windows hard drive (and gain space on your VDI file), follow the following tutorial:
https://www.howtogeek.com/312883/how-to-shrink-a-virtualbox-virtual-machine-and-free-up-disk-space/


== DirectX ==
== DirectX ==


* DirectX does not work on VirtualBox, which means that the DX PNG transparency fix does not work on IE 6 on a VirtualBox VM.
* DirectX does not work on VirtualBox, which means that the DX PNG transparency fix does not work on IE 6 on a VirtualBox VM.
== Connecting via RDP on a headless remote box ==
* The simplest way to add authentication is to use the VBoxAuthSimple module. You obtain a password hash with the command:
VBoxManage internalcommands passwordhash "secret"
* To register the new user, type:
VBoxManage setextradata <vm> "VBoxAuthSimple/users/<user>" <hash>
* You can then view this directly in the VBox XML configuration file.


== Bugs ==
== Bugs ==


* VirtualBox uses a kernel module (for speed reasons). This unfortunately can mean that VBox has the ability to panic the kernel (the whole system can crash)!
* VirtualBox uses a kernel module (for speed reasons). This unfortunately can mean that VBox has the ability to panic the kernel (the whole system can crash)!
* Currently if you start multiple Linux guests, I am experiencing lockups. This seems to happen when there is no activity on the computer.
* On Windows 7 (x86), you must use the PIIX3 chipset, not ICH 9. With ICH 9 there are random lockups (freezes) every 20-30 seconds.

Latest revision as of 14:30, 27 September 2017

Virtualization is the ability to run several different OS on one host.

VirtualBox

  • VirtualBox is an excellent free virtualization program. Very nice and polished GUI, it can run Windows without any problems and is really impressive.
  • To get a resolution of 1280*1024, be sure to install the VirtualBox additions (emerge this, then install them inside the virtual machine, which means inside Windows via the ISO image).

Command line tools

  • To shutoff a started VM, issue:
VBoxManage controlvm vm-name poweroff

Network

  • Inside a VBox host, there is another internal NAT. You can give the guest an IP of 10.0.2.x; the gateway should be 10.0.2.2 (this is actually the address of your host). Note that you should *not* give an IP of 192.168.0.x to a VM guest!
  • If you want several guest VMs to see each other in the network, do not use NAT. Use Bridged Networking. It works really well and allow your guests to be seen as other computers on your normal LANs. Thus the gateway should be your usual router.
  • When using Bridged Networking, you must choose the actual interface of the host machine (eth0 or wlan0 for instance). Note that in the guest, the network interface will still be eth0 no matter what you chose for the VirtualBox adapter.
  • Note that with wifi adapters (network cards), usually Bridged Networking won't work, so you should fall back to NAT.
  • If you create a new VirtualBox machine, with a cloned Gentoo disk image, udev will probably get confused by the change of the MAC address for the network card (VBox generates a new one when creating a new machine). It will have the effect of renaming eth0 to eth1. To fix the problem you can just delete the file:
/etc/udev/rules.d/70-persistent-net.rules

Managing Media (Hard Drives)

  • To duplicate a HD, you must use the VBoxManage program with the clonehd argument (and give the absolute path to the disk to be cloned). This allows the new disk to have a different uuid and thus be used without problems.
  • To extend the size of a HD, use:
modifyhd /home/elvanor/path/hd.vdi --resize 50000
  • To unregister a HD with the command line, use:
VBoxManage closemedium disk d6ab9a3c-dc6c-4f19-87ce-1937ea930e71
  • To associate a hard drive with a VM:
VBoxManage storageattach windowsxp --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /srv/com.kameleoon/windowsxp.vdi
  • You must after that resize the partitions (first by modifying the partition table via fdisk, and then by using resize2fs - despite the name, it works with ext4).
  • To compact a Windows hard drive (and gain space on your VDI file), follow the following tutorial:
https://www.howtogeek.com/312883/how-to-shrink-a-virtualbox-virtual-machine-and-free-up-disk-space/

DirectX

  • DirectX does not work on VirtualBox, which means that the DX PNG transparency fix does not work on IE 6 on a VirtualBox VM.

Connecting via RDP on a headless remote box

  • The simplest way to add authentication is to use the VBoxAuthSimple module. You obtain a password hash with the command:
VBoxManage internalcommands passwordhash "secret"
  • To register the new user, type:
VBoxManage setextradata <vm> "VBoxAuthSimple/users/<user>" <hash>
  • You can then view this directly in the VBox XML configuration file.

Bugs

  • VirtualBox uses a kernel module (for speed reasons). This unfortunately can mean that VBox has the ability to panic the kernel (the whole system can crash)!
  • On Windows 7 (x86), you must use the PIIX3 chipset, not ICH 9. With ICH 9 there are random lockups (freezes) every 20-30 seconds.