VirtualBox: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) |
||
(41 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
2018-04 Parallels is what I use on the MacBook [[Plover]]. | |||
I sometimes use Vagrant on Plover and then I use VirtualBox, not Parallels; it's easier. Mostly though those needs are met by [[Docker]] now. | |||
Docker everywhere yippee! | |||
== Headless and/or remote access for VirtualBox== | |||
I run VirtualBox on [[Bellman]], and I can run X11 apps (such as virtualbox) on Plover. All I need do is ssh to Bellman using -Y option. | |||
But I want to be able to start and operate the virtual machines and control it without needing the GUI at all. | |||
For this example I named the virtual machine "server". | |||
The basic command VBoxManage is documented here in [https://www.virtualbox.org/manual/ch08.html Chapter 8] of the manual. | |||
Q: Is VirtualBox installed and running? | |||
A: | |||
vboxmanage list vms | |||
vboxmanage list runningvms | |||
vboxmanage showvminfo server --details | |||
I can see there is a machine called "server" and it has ArcGIS Enterprise installed. I probably even had a license when I set it up! | |||
Q. Can I start it? | |||
A. Let's try even though my license is expired! | |||
vboxmanage startvm --type headless server | |||
Waiting for VM "server" to power on... | |||
VM "server" has been successfully started. | |||
Check current state: | |||
vboxmanage list runningvms | |||
"server" {8b99e47b-5ed4-4e29-b74f-0c0866240048} | |||
Save machine state (use startvm to restore): '''vboxmanage controlvm server savestate''' | |||
Stop running machine: '''vboxmanage controlvm server acpipowerbutton''' | |||
Pause running machine: '''vboxmanage controlvm server pause''' | |||
Resume paused machine: '''vboxmanage controlvm server resume''' | |||
Enable remote display: (under the covers it's an RDP server) '''vboxmanage modifyvm server --vrde on''' | |||
This only takes effect if the machine is not running. | |||
Snapshots: | |||
List snapshots: '''vboxmanage snapshot server list''' | |||
Take a snapshot: '''vboxmanage snapshot server take ''''snapshotname''''''' | |||
Restore from a snapshot: '''vboxmanage snapshot server restore ''''snapshotname''''''' | |||
Delete a snapshot: '''vboxmanage snapshot server delete ''''snapshotname''''''' | |||
== VirtualBox on Mac == | |||
2019-Dec-06 I just upgraded and it went fine, you can probably ignore this. Catalina and VM 6.x | |||
It used to be that very time I upgraded I had this problem. Upgrade fails. Uninstall and upgrade fails. | |||
I think it is because kernel modules don't get unloaded. This seems to work: | |||
# Download new version. | |||
# Run uninstaller. | |||
# Reboot. | |||
# Run installer. | |||
=== Migration from Parallels to VirtualBox === | |||
I tried to move a VM from Parallels to VirtualBox. I gave up. It's just not worth the struggle. | |||
== VirtualBox for software development == | |||
I am using VirtualBox for development work now. | |||
As the host operating system I use Ubuntu on the desktop and Mac OS X on the laptop. I used to use Windows 7 at work because that's the "official" desktop OS. I switched to Ubuntu, moved development to a VM, and no one noticed! | |||
In virtual machines (as guest operating systems) I use Win 7 32 bit, and Win 7 64 bit, switching machines as required for testing and development. | |||
On Ubuntu I run OpenOffice and Firefox and Gimp sundry other open source tools to get non-development work done. | |||
== Grab bag of tricks == | |||
=== Expand a hard drive === | |||
This used to be hard, now it's easy so I deleted this section! | |||
=== Installing video drivers === | |||
I was able to get into Safe Mode by doing a "Reset" (Host-R) while the machine was starting up. This forces it into the menu where you can pick Safe Mode. | |||
=== Cloning === | |||
YAY YAY YAY Kudos to VirtualBox developers. The current version 4.1 has a working CLONE button. I can delete half my notes! | |||
=== Setting up a second monitor === | |||
In version 4, you have to stop the machine, open Settings, go to Display and adjust the slider to add a second monitor. I have not tried more than 2. Each monitor appears in a separate window and you can move them around and maximize them or go to full screen mode. | |||
=== 3D Acceleration === | |||
Does not work for me. 11-Aug-2010 | |||
Under Settings->Display->3D Acceleration | |||
I jumped through the hoops, booting in SAFE mode, installing the drivers, and rebooting only to get a black screen. I had to turn 3D off again to get back up and running. | |||
=== Using workspaces === | |||
On Ubuntu I make extensive use of workspaces, so Workspace 1 is normal Ubuntu with a browser, and Workspace 2 is my Windows environment. From Windows you can type the Host key (right control on Ubuntu) to escape from the Windows virtual machine then Ctl-Alt-Arrow key to move to a different workspace. It becomes automatic after a few hours of use. | |||
Mac has workspaces too, use Ctl-1, Ctl-2... to switch. | |||
== MSDOS for legacy applications == | |||
I need to set up a MSDOS virtual machine to run a program that talks to my vintage Magnavox GPS reference station. | I need to set up a MSDOS virtual machine to run a program that talks to my vintage Magnavox GPS reference station. | ||
Line 11: | Line 124: | ||
Here we go. | Here we go. | ||
== Create a machine. == | === Create a machine. === | ||
One CPU with 640K would be enough but I have to give it a minimum of 4MB! No network card. Minimum video RAM. No CDROM drive. This is so easy. | One CPU with 640K would be enough but I have to give it a minimum of 4MB! No network card. Minimum video RAM. No CDROM drive. This is so easy. | ||
Line 21: | Line 134: | ||
The whole point is to talk to a Magnavox GPS receiver, and that happens on COM1 | The whole point is to talk to a Magnavox GPS receiver, and that happens on COM1 | ||
VBoxManage modifyvm MSDOS --uart1 0x3F8 4 | VBoxManage modifyvm MSDOS --uart1 0x3F8 4 --uartmode1 /dev/ttyS0 | ||
Show the results of our labours | Show the results of our labours | ||
Line 27: | Line 140: | ||
VBoxManage showvminfo MSDOS | VBoxManage showvminfo MSDOS | ||
== Create virtual hard disk. == | === Create virtual hard disk. === | ||
It does not have to be big. | It does not have to be big. 20 megabytes should be plenty. | ||
VBoxManage createhd --filename | VBoxManage createhd --filename MSDOS_20MB.vdi --size 20 | ||
== Connect the hard disk to the machine. == | === Connect the hard disk to the machine. === | ||
VBoxManage storagectl MSDOS --name IDE0 --add ide | VBoxManage storagectl MSDOS --name IDE0 --add ide | ||
VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 0 --type hdd --medium MSDOS.vdi | VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 0 --type hdd --medium MSDOS.vdi | ||
== Put the (virtual) MSDOS installer floppy into the (virtual) floppy drive == | === Put the (virtual) MSDOS installer floppy into the (virtual) floppy drive === | ||
You can still download the installer from Microsoft MSDN! | You can still download the installer from Microsoft MSDN! So I thought. It's an UPGRADER, you have to have MSDOS installed already. Microsoft, once again I spit on you. What are you thinking? | ||
So instead I turned to FreeDOS from http://www.freedos.org/ | |||
# Register the FreeDos disc image | |||
VBoxManage openmedium dvd `pwd`/fdfullcd.iso | |||
# Attach the disc to the machine | |||
VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 1 --type dvddrive --medium `pwd`/fdfullcd.iso | |||
# Add a floppy drive to the machine | # Add a floppy drive to the machine | ||
VBoxManage storagectl MSDOS --name FD0 --add floppy | VBoxManage storagectl MSDOS --name FD0 --add floppy | ||
# Register the floppy disk | # Register the floppy disk image | ||
VBoxManage openmedium floppy `pwd`/Magnavox.IMG | |||
# Attach it | |||
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.IMG | |||
VBoxManage openmedium floppy `pwd`/ | |||
=== Fire it up. === | |||
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/ | |||
VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1 | |||
Oracle VM VirtualBox Headless Interface 3.2.8 | |||
(C) 2008-2010 Oracle Corporation | |||
All rights reserved. | |||
Listening on port 5000. | |||
YAY! On the Macintosh now I can use the Microsoft RDP client that I downloaded from http://www.microsoft.com/mac/products/remote-desktop/default.mspx | |||
After running through the FreeDOS installation, I remove the virtual CD, change the boot order, and attach the Magnavox floppy disk image. | |||
VBoxManage modifyvm MSDOS --boot1 disk | |||
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.img | |||
VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1 | |||
I copied the one little file that I needed to the virtual hard disk and disconnected the virtual floppy. | |||
== Install the Magnavox command program. == | VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium none | ||
=== Install the Magnavox command program. === | |||
Mount the image of the floppy drive and copy the contents to the virtual hard drive. | Mount the image of the floppy drive and copy the contents to the virtual hard drive. | ||
=== Settings === | |||
Storage settings | |||
[[image:virtualbox_storage.jpg]] |
Latest revision as of 03:16, 7 December 2019
2018-04 Parallels is what I use on the MacBook Plover. I sometimes use Vagrant on Plover and then I use VirtualBox, not Parallels; it's easier. Mostly though those needs are met by Docker now. Docker everywhere yippee!
Headless and/or remote access for VirtualBox
I run VirtualBox on Bellman, and I can run X11 apps (such as virtualbox) on Plover. All I need do is ssh to Bellman using -Y option. But I want to be able to start and operate the virtual machines and control it without needing the GUI at all.
For this example I named the virtual machine "server".
The basic command VBoxManage is documented here in Chapter 8 of the manual.
Q: Is VirtualBox installed and running?
A:
vboxmanage list vms vboxmanage list runningvms vboxmanage showvminfo server --details
I can see there is a machine called "server" and it has ArcGIS Enterprise installed. I probably even had a license when I set it up!
Q. Can I start it?
A. Let's try even though my license is expired!
vboxmanage startvm --type headless server Waiting for VM "server" to power on... VM "server" has been successfully started.
Check current state:
vboxmanage list runningvms "server" {8b99e47b-5ed4-4e29-b74f-0c0866240048}
Save machine state (use startvm to restore): vboxmanage controlvm server savestate
Stop running machine: vboxmanage controlvm server acpipowerbutton
Pause running machine: vboxmanage controlvm server pause
Resume paused machine: vboxmanage controlvm server resume
Enable remote display: (under the covers it's an RDP server) vboxmanage modifyvm server --vrde on This only takes effect if the machine is not running.
Snapshots:
List snapshots: vboxmanage snapshot server list
Take a snapshot: vboxmanage snapshot server take ''snapshotname''
Restore from a snapshot: vboxmanage snapshot server restore ''snapshotname''
Delete a snapshot: vboxmanage snapshot server delete ''snapshotname''
VirtualBox on Mac
2019-Dec-06 I just upgraded and it went fine, you can probably ignore this. Catalina and VM 6.x
It used to be that very time I upgraded I had this problem. Upgrade fails. Uninstall and upgrade fails. I think it is because kernel modules don't get unloaded. This seems to work:
- Download new version.
- Run uninstaller.
- Reboot.
- Run installer.
Migration from Parallels to VirtualBox
I tried to move a VM from Parallels to VirtualBox. I gave up. It's just not worth the struggle.
VirtualBox for software development
I am using VirtualBox for development work now.
As the host operating system I use Ubuntu on the desktop and Mac OS X on the laptop. I used to use Windows 7 at work because that's the "official" desktop OS. I switched to Ubuntu, moved development to a VM, and no one noticed!
In virtual machines (as guest operating systems) I use Win 7 32 bit, and Win 7 64 bit, switching machines as required for testing and development.
On Ubuntu I run OpenOffice and Firefox and Gimp sundry other open source tools to get non-development work done.
Grab bag of tricks
Expand a hard drive
This used to be hard, now it's easy so I deleted this section!
Installing video drivers
I was able to get into Safe Mode by doing a "Reset" (Host-R) while the machine was starting up. This forces it into the menu where you can pick Safe Mode.
Cloning
YAY YAY YAY Kudos to VirtualBox developers. The current version 4.1 has a working CLONE button. I can delete half my notes!
Setting up a second monitor
In version 4, you have to stop the machine, open Settings, go to Display and adjust the slider to add a second monitor. I have not tried more than 2. Each monitor appears in a separate window and you can move them around and maximize them or go to full screen mode.
3D Acceleration
Does not work for me. 11-Aug-2010 Under Settings->Display->3D Acceleration
I jumped through the hoops, booting in SAFE mode, installing the drivers, and rebooting only to get a black screen. I had to turn 3D off again to get back up and running.
Using workspaces
On Ubuntu I make extensive use of workspaces, so Workspace 1 is normal Ubuntu with a browser, and Workspace 2 is my Windows environment. From Windows you can type the Host key (right control on Ubuntu) to escape from the Windows virtual machine then Ctl-Alt-Arrow key to move to a different workspace. It becomes automatic after a few hours of use.
Mac has workspaces too, use Ctl-1, Ctl-2... to switch.
MSDOS for legacy applications
I need to set up a MSDOS virtual machine to run a program that talks to my vintage Magnavox GPS reference station.
I've done it in the past with VMWare but have pretty much switched over to VirtualBox now.
The problem is, at the moment the server connected to the GPS station is in the garage. I moved put the Magnavox in the garage because that's where the antenna wire is right now. Both antennas. The GPS antenna and the 420 MHz transceiver that will transmit DGPS corrections.
Anyway more on that later / elsewhere. The whole point of this page is to describe how to set up a virtual machine to run on a server, using VirtualBox.
I intend to try to get it going from the command line. In theory I should be able to open a VNC session to see the DOS window, let's see if the theory pans out.
Here we go.
Create a machine.
One CPU with 640K would be enough but I have to give it a minimum of 4MB! No network card. Minimum video RAM. No CDROM drive. This is so easy.
VBoxManage createvm --name MSDOS --ostype DOS --register VBoxManage modifyvm MSDOS --memory 1 --nic1 none --audio none VBoxManage modifyvm MSDOS --bioslogodisplaytime 1
The whole point is to talk to a Magnavox GPS receiver, and that happens on COM1
VBoxManage modifyvm MSDOS --uart1 0x3F8 4 --uartmode1 /dev/ttyS0
Show the results of our labours
VBoxManage showvminfo MSDOS
Create virtual hard disk.
It does not have to be big. 20 megabytes should be plenty.
VBoxManage createhd --filename MSDOS_20MB.vdi --size 20
Connect the hard disk to the machine.
VBoxManage storagectl MSDOS --name IDE0 --add ide VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 0 --type hdd --medium MSDOS.vdi
Put the (virtual) MSDOS installer floppy into the (virtual) floppy drive
You can still download the installer from Microsoft MSDN! So I thought. It's an UPGRADER, you have to have MSDOS installed already. Microsoft, once again I spit on you. What are you thinking?
So instead I turned to FreeDOS from http://www.freedos.org/
# Register the FreeDos disc image VBoxManage openmedium dvd `pwd`/fdfullcd.iso # Attach the disc to the machine VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 1 --type dvddrive --medium `pwd`/fdfullcd.iso # Add a floppy drive to the machine VBoxManage storagectl MSDOS --name FD0 --add floppy # Register the floppy disk image VBoxManage openmedium floppy `pwd`/Magnavox.IMG # Attach it VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.IMG
Fire it up.
VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1 Oracle VM VirtualBox Headless Interface 3.2.8 (C) 2008-2010 Oracle Corporation All rights reserved. Listening on port 5000.
YAY! On the Macintosh now I can use the Microsoft RDP client that I downloaded from http://www.microsoft.com/mac/products/remote-desktop/default.mspx
After running through the FreeDOS installation, I remove the virtual CD, change the boot order, and attach the Magnavox floppy disk image.
VBoxManage modifyvm MSDOS --boot1 disk VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.img VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1
I copied the one little file that I needed to the virtual hard disk and disconnected the virtual floppy.
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium none
Mount the image of the floppy drive and copy the contents to the virtual hard drive.
Settings
Storage settings