Saturday, August 8, 2009

VirtualBox 3.0 Instead of VMware Workstation 6.5?

As described in other posts in this blog, I was using VMware Workstation 3.5 and VMware Player to run Windows XP in virtual machines (VMs) on a 64-bit Ubuntu Linux 9.04 (also known as "Jaunty Jackalope") host system. I had run into intractable audio problems and decided to try other approaches. It appeared that VirtualBox, in particular, had come a long way since my previous look at it, in summer 2008. A survey in 2007 had found that it was gaining ground on VMware. More recently, 1 2 3 4 brief reviews posted in the first half of 2009 suggested that VirtualBox 2 was maturing and that VirtualBox 3 promised significant improvements over what I had encountered. VirtualBox 3.0.4 was now available as freeware, so I downloaded the appropriate version for my Ubuntu operating system. (Synaptic did not yet have version 3.0.) Since Ubuntu is Debian-based, I typed the following into Ubuntu's Applications > Accessories > Terminal, as suggested in the instructions on the download page cited above: sudo gedit /etc/apt/sources.list At the end of that file, I saw a bunch of commands that began with "deb http" and so forth. So, following the instructions, I added the appropriate line to the end of the file. In my case, that line was: deb http://download.virtualbox.org/virtualbox/debian jaunty non-free And then I continued with the instructions. Specifically, I went to the page where I could get the Sun public key for apt-secure. When that webpage opened up, I saved it with its default name (sun_vbox.asc). Then, back at the instructions page, I copied and pasted one long line into Terminal. That line was: wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add - Terminal was not too talkative at this point; it just said OK. The next step was to enter the command to install VirtualBox: sudo apt-get install virtualbox-3.0 This didn't work; I got "Couldn't find package virtualbox-3.0." That was because my default download location was not where the installer expected it. Departing from the instructions, I used Ubuntu's File Browser (Nautilus) to navigate to my download folder. There, I double-clicked on the downloaded virtualbox*.deb file. This opened Debian's Package Installer. I told it to install the package, and I went with the default options. I did not need to do the instruction that called for the installation of the dkms package, because I checked in Synaptic and found that dkms was already installed on my system. I also didn't check the checksum on the download. After the Debian installer was done, I looked for the icon that I could click on to start VirtualBox. There didn't seem to be one. I went to the command line in Terminal and typed "virtualbox." This gave me the message, "The program 'virtualbox' is currently not installed. You can install it by typing: sudo apt-get install virtualbox-ose." My understanding, from the VirtualBox Editions webpage, was that, among other things, the "ose" (Open Source) version did not have USB support. This would be problematic at best. So if I typed the command just quoted, it seemed I would be installing the Open Source edition and would not get USB support. The full package, with USB support, was free too, so I felt I should continue on the present path and try to get the full package to run. I went back to the instructions webpage and saw that I had skipped the instruction about the "key fingerprint." I had not known what that was and, following the standard protocol for Interpreting Signs in Foreign Countries, I had therefore assumed that if I didn't understand it, it must not apply to me. So now I found another set of instructions, and started from the beginning with those. They were as follows: sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian jaunty non-free' >> /etc/apt/sources.list" (which was easier than the approach recommended above) and then wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add - which gave me that OK again, and then the instructions said, "The key fingerprint should be the following," which once again left me clueless. I searched for, but did not find, an explanation of this. The best I could find was that this appeared to be an optional way of verifying that I had the genuine article. I punted and, once again, moved on to the next step. According to this second set of instructions, the next step was to type this: sudo apt-get update That did a bunch of things, ending with the message, "You may want to run apt-get update to correct these problems." This was baffling; I had just run "apt-get update" as superuser. I tried it just as myself (i.e., without the "sudo" in front), but this gave me a Permission Denied error. In a thread pitting a total newbie against a seasoned veteran, I saw the advice to use "sudo apt-get install -f" to "install any missing packages." When I ran that command, it found some packages that were "no longer required"; it suggested that I run "sudo apt-get autoremove" to remove them. And when I did that, it brought up the Update Manager with lots of updates to install. I don't know why these updates had not appeared under the familiar panel icon that used to tell me I had updates to download and install. Anyway, after the updates were done, I went back and tried "sudo apt-get update" again. This time, no error messages. The next instruction, then, was this: sudo apt-get install virtualbox-3.0 dkms That informed me that I had already done this. So, OK. Next, the instructions told me how to respond to several questions that did not come up in my installation process. One of them involved the "vboxusers group." I didn't know what that was, but it sounded like maybe I could find out by running the next command, which was sudo usermod -G vboxusers ray where "ray" was my username. Terminal swallowed that command without comment. But what came next was most crucial: these alternate instructions gave me the all-important command to reboot the system. Oops. I hadn't thought of that, and the other instructions hadn't said it. So, OK, I rebooted. After restarting the computer, sure enough, Ubuntu's menu gave me Applications > System Tools > Sun VirtualBox. OK, now, how to use it? I started it up and tried to register it, as part of the startup process, but I got "Failed to register the VirtualBox product" followed by a huge list of problems. I had to use xkill to kill it. I tried again. Same thing. Third time around, I clicked "Cancel" instead of registering. And so, there I was, looking at VirtualBox. Based on some instructions, I went into File > Virtual Media Manager > Add. I navigated to the VMware .vmdk file for the VMware VM that I wanted to try opening in VirtualBox. (They advised backing it up first.) Weirdly, when I clicked OK, the dialog vanished. I tried again, and I saw that the thing had indeed been added. So this time, with that .vmdk file highlighted, I clicked New and went into their Create New Virtual Disk Wizard. They didn't warn that a dynamically expanding VM would be slower, so I went with that option. I called this new VM "Test." But when I was done, all I had was a second line, "Test," following the .vmdk file. I killed the Virtual Media Manager and tried the Machine > New menu pick. This gave me the option of choosing to use an existing hard disk. I chose that, and specified its default, which was the .vmdk file I had already added. This gave me a screen that showed my "Test" machine as being powered off. Its size and everything looked right. I clicked Start. This gave me a dialog box whose frame indicated that Test was running. But the box itself was black. I chose its Reset option and saw that it must have been running Windows XP, or trying to, because now I got that option that Windows gives you when you crash your system: did I want to reboot normally, or go into Safe Mode? I chose the latter. This gave me the usual list of drivers, or whatever they are, that WinXP is installing, down to the Mup.sys and agp440.sys items. And there it froze. So my new Test machine was indeed trying to load and run WinXP, when it gave me that black screen; but it just wasn't able to run. I started looking through the menu picks that VirtualBox offered me for that Test machine. There were three main menu options: Machine, Devices, and Help. Under Devices, I saw that there was the option to Install Guest Additions. This, I vaguely recalled, was like VMware Tools. Maybe that was the problem. So while the WinXP startup into Safe Mode was still frozen at the agp440.sys line, I selected that. Instead of getting information about the Guest Additions, I got a screen called VirtualBox - Guru Meditation. It said, "A critical error has occurred while running the virtual machine and the machine execution has been stopped." It went on to suggest that I consult the VirtualBox Community webpage. There, the only meaningful option was the Forums webpage, and there I selected the forum on Windows guests. But searches for posts on "critical error has occurred" or on "safe mode" did not turn up any helpful advice. I tried a Google search for those terms across all forums and got lots of hits. In one post, the solution was to repair the WinXP installation by booting from the WinXP installation CD. I killed the VM, inserted that CD, and clicked on Start again. I had to hit F12 to get the boot menu, when it was first starting up, and then I hit C on the keyboard to choose booting from the CD. But this gave me "FATAL: Could not read from the boot medium! System halted." A Google search for that phrase led to another thread involving a rude reply to a newbie by the same "seasoned veteran" ("Sasquatch") as above. As I went on, I saw more of those, and started to wonder whether VirtualBox was still in the private-club phase of development. Someone's post pointed me toward the VirtualBox FAQs, but those didn't seem to address this issue. After another reset and the same result, I went into VirtualBox's Machine > Show Log option. I noticed that, if there was no VM dialog open, the log ended with "Changing the VM state from 'DESTROYING' to 'TERMINATED,'" but if there was a VM running and hung, the log ended with "Guest Log: BIOS: int13_harddisk: function 02, parameters out of range 0000/0000/0001!" if it hung while attempting a Normal or Safe Mode boot of WinXP; but if the system hung while attempting to boot from CD, the log ended with "Guest Log: Could not read from the boot medium! System halted" and, slightly before that, "CDROM boot failure code : 0004. (I had to Refresh or Close the Log Viewer to get it to show this. The most recent log, in the Log Viewer, was named VBox.log, as distinct from VBox.log.1, VBox.log.2, etc.) Not getting solutions from the VirtualBox forums, I tried a Google search across multiple sources. One of the webpages turned up in that search was my own post from the previous year, where I had been stymied by the same problem. Another post said that you can't leave VM Tools installed in a VM that you're bringing over from VMware. So what I had to do was to fire up VMware, open a VM, remove Tools, save the VM, and then repeat the foregoing steps to make a new version of the Test VM for VirtualBox. Ah, but there's many a slip 'twixt cup and lip. I started VMware Player and tried to start the VM from which I had copied Test. Player said I had "insufficient permissions to access the file." I went into Terminal and typed "sudo nautilus," so as to check the permissions, but for the first time ever, I got "ray is not in the sudoers file. This incident will be reported." I tried using Player to open another VM, but it froze. In Workstation, I tried the same things with those same VMs and got the same results. I found some advice on how to fix the sudoers issue. The advice was basically as follows: (1) Restart the computer and choose the Recovery Mode option from the GRUB menu. (2) Choose the root ("Drop to root shell prompt") option. (3) Type "adduser ray admin" (without the quotation marks), where "ray" was the username I wanted to have working again, and hit Enter. (4) Type "exit" and resume a normal boot. (Those instructions also addressed some other options that didn't apply to me.) When Ubuntu had booted, I opened up a Terminal session and typed "sudo nautilus" and it worked. So now that the sudoers issue was fixed, I cloned a VM that I had just been working with, a few hours earlier, with the idea of opening that in Workstation and removing its VMware Tools. Meanwhile, I had seen a couple of references to the User's Manual, which was available in PDF or online form at the Downloads page. In PDF form it was 261 pages. The online version presumably didn't have any references to the error messages noted above, else it would have come up in the searches cited above; or perhaps it did come up, but was far enough down in the results list that I didn't notice it. Ditto for the How-Tos and tutorials. But now that I had a specific culprit - namely, VMware Tools - I searched the manual for particular references to that. But there weren't any references to it. There also didn't seem to be any solutions for the particular problems I was having in the Troubleshooting section. So it seemed I had saved quite a bit of time by not reading those 261 pages. By this time, the clone was done. I powered it on in Workstation and, when it was fully up and running, went to Control Panel > Add or Remove Programs and removed VMware Tools. I shut down the clone VM and restarted VirtualBox. I went through the steps, above, to open that VM in VirtualBox. Unfortunately, I got the same outcomes as above. So having VMware Tools installed was not the issue, or at least not the only issue. I had come across a post in which someone said they had enabled PAE mode. I wasn't sure what this was all about, so I went through the various possibilities in VirtualBox's Machine > Settings menu pick. Among other things, while I was there I noticed that I could set the boot order here, and that the options (e.g., booting the CD-ROM before the hard drive) were clearer than those provided by using the F12 option at bootup. I found the PAE option pretty quickly: it was under System > Processor in the Settings dialog. The tooltip that came up when I moused over that option said, "When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine." I had not a clue as to what that meant. Another poster said they had also enabled Nested Paging, which I found there in the Settings dialog under System > Acceleration. While I was there, I went on through the Settings and changed several other things, notably giving 64MB of RAM to the video. I started the new VM and, when Windows gave me the option, I selected Safe Mode. Unfortunately, it froze once again, so it seemed I hadn't found the solution. That froze again, so - now that I had changed the boot order to prioritize the CD-ROM drive - I restarted the VM. But the bootloader still ignored the CD-ROM, so once again I reset the system and, this time, hit F12 during the splash screen to give me the boot device selection menu. I chose the CD-ROM and, once again, I got the FATAL message quoted above. Well, there was always the option of installing Windows XP from scratch in a new VM. I had a 64-bit WinXP CD, so I went through the setup sequence for a New virtual machine. This time, I told it to create a new 25GB hard disk instead of using an existing one, and call it P4VB. It created the P4VB virtual machine in the /home/ray/.VirtualBox/HardDisks folder. When I looked, that .VirtualBox folder was also the home of a Machines folder. I didn't want these things there; I didn't have enough space on that drive for several VMs. According to one post, this was easy enough to solve: just move the folder and then go into VirtualBox (which apparently some people also call VBox or VB) and select File > Preferences > General. But it looked like people had had some problems with that, so instead of moving I copied (rather than moving) the .VirtualBox folder to the new location. Then I double-clicked on the P4VB VM, there in VB, and changed those folder location settings. I finished that and then double-clicked on P4VB again. Now, to back up for a moment. When I had finished creating the new VB VM, where I was going to install 64-bit Win XP, VB got me started automatically in a wizard that was going to help me set up my hard drive. I wasn't ready for that right then, however - I wanted to finish the move process (above) while it would hopefully still be simple to do so. But now that I had finished the move, I wondered if I could get that wizard restarted. But after double-clicking on P4VB, what I got instead was a dialog box that said this:

VirtualBox - Error VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot. Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.
That didn't seem like something that the wizard would have fixed. I clicked "Continue" to see what would happen next. The answer is: Nothing. I was back at the VB basic screen, but now the note under P4VB said "Aborted" instead of "Powered Off." With P4VB highlighted, I chose Settings. Going down through the various Settings possibilities, I re-enabled PAE/NX and Nested Paging (above). I changed it to have 2 CPUs, since I had a dual-core processor. I gave it 64MB of video RAM and enabled 3D acceleration. I told it to mount the CD/DVD drive and use the VBoxGuestAdditions.iso image file. I tried starting the VM again, but I got this:
VirtualBox - Error VT-x is not available. (VERR_VMX_NO_VMX). Unknown error creating VM (VERR_VMX_NO_VMX).
So this was apparently the time when I needed to change the host BIOS as described in the previous error message (above). I shut down everything and restarted the computer. I didn't see the needed option in the CMOS Setup Utility for my BIOS, but another post suggested that maybe support for VT-x would be available after I updated the BIOS. I checked the manufacturer's webpage for my Gigabyte motherboard. There was indeed a BIOS update. I flashed the BIOS and took another look at it. About this time, I realized that I was looking (as shown above) for AMD-V, not VT-x (the Intel counterpart to AMD-V). So, as the saying goes, I wondered why the Frisbee was getting bigger, and then it hit me. AMD-V was short for AMD Virtualization, and "Virtualization" was the first option in the Advanced BIOS Features page in my BIOS setup. I dunno - I guess it had seemed too obvious. But now I was really ready. All I had to do (maybe) was switch it from Disabled to Enabled - the latter being described, in the sidebar, as "Hardware assisted Virtualization Technology which help improve performance of system running Virtual Machine Softwares." Exactly what I had been looking for all along. Jeez. But, OK, on with the show. I saved the BIOS change and booted the system. Back into VirtualBox > Settings. With everything set as I desired, I saved out and started the P4VB virtual machine again. New error: "FATAL: No bootable medium found! System halted." No surprise there: I hadn't installed WinXP x64 yet. Time to do that. Now, here was where I had made a mistake. I had set the settings to run the VBox Guest Additions ISO file on the CD drive. What I really wanted, first, was to install the WinXP CD in the host CD drive. So I fixed that, inserted the WinXP CD, and tried again. It ran Windows Setup. I installed the Guest Additions. Now the VB Machine > Auto-Resize Guest Display option worked; WinXP filled the whole screen. I was able to activate Windows. I ran Windows Updates. The first update that I needed, it said, was Service Pack 2 for Windows XP Professional, x64 Edition. But it didn't actually do anything. It said it was downloading, but hours passed and nothing happened. I was able to download other files in the meantime, but nothing doing in Windows Update. Trying again, I selected everything else that I could except Service Pack 2. When that was done, I tried again on Service Pack 2. Now it was willing to be friendly, and I was able to continue installing other updates. While that was going on, I was looking into how I could get access to my data partitions in VB3. David Hodgins pointed out that there were sharing and raw mode options. Raw mode seemed to mean having complete and direct access to the hard drive. It was covered in section 9.10 of the help manual included in VB (Help > Contents > Sun VirtualBox > Advanced topics > Using a raw host hard disk from a guest). Sharing was more familiar; it seemed to be what I had been doing in VMware. It was covered in section 4.6 of the manual (Help > Contents > Sun VirtualBox > Guest Additions > Folder sharing). To set up these shares, I proceeded as follows:
  1. In Windows XP inside my P4VB virtual machine, I went to Start > Run > compmgmt.msc > Enter. This opened up Computer Management. There, in Storage > Disk Management, I right-clicked on the CD-ROM drive and changed it to drive Z. Since I had installed the VB Guest Additions, and since the Guest Additions pretended to be running from the CD-ROM drive, this changed them to drive Z as well. I closed Computer Management.
  2. In the outer frame where VirtualBox was running (i.e., not inside the Windows virtual machine), I selected Devices > Shared Folders > Machine Folders, and then clicked on the +folder icon at the right side. This opened up the Add Share dialog. In the Folder Path box, I navigated to the hard drive partition I wanted to add as drive D inside my WinXP VM. (Drive C, of course, contained the virtual machine's Windows program files.) I clicked on "Make permanent" and then OK.
  3. I closed the Shared Folders dialog and opened Windows Explorer and went to My Network Places > Entire Network > VirtualBox Shared Folders. I saw that the partition I had just selected as a share was now listed there. (If it's not listed, hit F5 to refresh the view.)
  4. I wanted that shared partition to appear under My Computer, just like drive C and any other normal drive would be. So I right-clicked on it and chose Map Network Drive. This opened the Map Network Drive dialog. I clicked on the drop-down arrow for the Drive box and selected D (which was free, now that I had reassigned the CD-ROM). Leaving "Reconnect at logon" checked, I clicked Finish. To test it, there in Windows Explorer, I opened up drive D under My Computer and, sure enough, I could create and delete files, just like normal. I hit F2 to rename it as needed.
I repeated steps 2-4 for each hard drive partition I wanted to have visible in this VM. This was much like the procedure I had used to share partitions in VMware. At this point, VB was extremely slow in the process of downloading Windows updates; it was also extremely slow when I tried to move files. I rebooted the virtual machine, thinking that maybe it needed to clear its head after that drive-mapping exercise. It did help, but it was still very slow. It seemed that this problem had been around for a long time and was not going away soon. So it looked like I had better investigate the alternatives. Samba sharing seemed to be a faster way of sharing network drives (i.e., these other partitions on my computer). I figured I had better undo my present sharing before proceeding with the Samba approach. I wasn't sure how to do that, so I just did it in reverse order from what I described above: first, right-click on the partition shown under My Computer in Windows Explorer and choose Disconnect for each partition, and then go into VB's Devices > Shared Folders and click on the -folder option for each shared folder. Then, in Nautilus (with the left panel set to Tree view), I went to File System > media. In the right panel, I right-clicked on the first partition I wanted to share and chose Sharing Options. I clicked on "Share this folder" and then on the "Install service" button. I got a dialog saying something about restarting my session, but when I clicked to go ahead with that, instead I found myself back at the Folder Sharing dialog. There, I clicked on Create Share. It said it was going to set up sharing automatically, but then I got an error telling me, "You do not have permission to create a usershare." I fiddled around with this for a while and then tried a very clear tutorial on setting up Samba shares on Ubuntu. Like so many things in life, it went smoothly but did not seem to accomplish anything. While I was waiting for the last of the Windows updates to be downloaded and installed, I fired up VMware Player again. Alas, its audio was still not functioning properly. So when the Windows updates were all installed in VirtualBox, I decided to try again on the sharing approach that used VB's Shared Folders dialog (steps 2-4, above). I thought maybe that would be faster now; maybe I had inadvertently slowed things down by attempting to set up shares while Internet Explorer was downloading (it hadn't even gotten to the point of installing) various Windows updates. I had been moving some files around in Windows Explorer, so I went back to that task. I found it was a little faster now. There was a problem where I could not select multiple files in Windows Explorer using Ctrl-click; it didn't work normally. Then I realized that the right Ctrl key was the default key for moving the cursor outside the Windows VM, so that it could be used in the VB frame. I went into File > Preferences and changed it so that the right Winkey would do that job instead. But VB with sharing remained so horribly slow that I just could not imagine using it. Actually, it was not just a sharing thing: the process of using Windows Update via Windows Explorer was also extremely slow and seemed to freeze several times, whereas I hadn't been having that problem in VMware on the same computer. I posted a question on using Samba shares. I got a response, but by that point I had gone back to using VMware instead of VirtualBox, at least for the time being.

2 comments:

Poli

Failed to register VirtualBox product. Invalid IP address.

If you use Windows and run Virtualbox on it, try this.. When the dialog box is open, hit ctrl+alt+del and kill the VBOXSVC.exe task. Then close the Virtual Box. Then start Virtual Box program again. The registration windows should be gone and when you go to "Menu / Help" the "Register VirtualBox" should be grayed out. Worked for me.

Anonymous

Also worked for me, except when I reopened VirtualBox the registration dialog came up automatically. This time though when I entered in my information it went through without the invalid ip error. I also disabled the firewall on my box just incase, but that alone didn't solve the problem I had to kill the process during registration for things to work.

Windows XP Service Pack 3
VirtualBox Version 3.0.6 r52128