Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

Migrating a Parallels Virtual Machine to VirtualBox

September 2, 2016

The 31st of August I removed Parallels Tools from a virtual machine running Ubuntu 15.10 because the grace period of 7 days, so "generously" given by Parallels after I didn't renew my subscription, had ended. Somehow this company considers it a smart move to make their software useless if one no longer pays. I understand removing some functionality, like for example no longer able to create new virtual machines, but this? No, too close to ransomware for my taste. Especially since Parallels Desktop needs to be updated often, either to deal with changes in the host operating system, OS X, or changes in the guest operating systems.

Anyway, to be honest, it was always my plan to eventually move my work, as a freelance Perl programmer to OS X. One of the reasons I bought a Mac mini. However, I was expecting the move to be a bit more on my terms, less forced. To make the transition more gradual, I decided to move the Ubuntu 15.10 virtual machine to VirtualBox.

Uninstalling Parallels Tools

To run things smoother Parallels Desktop can make modifications to a guest operating system installed in a virtual machine. Because I was afraid these modifications are going to conflict with VirtualBox after the migration, I uninstalled Parallels Tools.

Wednesday, I tried the first solution given at How to uninstall Parallels Tools in Ubuntu Linux, which didn't work for me. Luckily there was alternative given, an easier one in my opinion, running just one command:

sudo /usr/lib/parallels-tools/install -r

And this did the trick.

Since it was already late I decided to do the rest of the required move the coming days.

Uninstalling an old version of VirtualBox

While writing this all down I noticed that I had already an older version of VirtualBox installed on my Mac mini, version 5.0.16 r105871 to be exact. Instead of just updating it I decided to uninstall it. But first I removed a bunch of virtual machines which I no longer needed; I was no longer working on the project requiring those. This freed up quite some harddisk space on my Mac.

In the end I kept three VMs; sparkvm which I used during two edX courses, Windows XP with SP3, and Ubuntu 15.10. The later was my go to VM when Parallels Desktop had a major issue with a Compiz update. I actually wanted to decommision that one by comparing files to a recent backup, but it won't let me mount an external USB drive. I got an error dialog with the following message.

Failed to attach the USB device Western Digital My Passport 0820 [1007] to the virtual machine Ecce 15.10

When I clicked details I read:

Failed to create a proxy device for the USB device. (Error: VERR_PDM_NO_USB_PORTS).

Followed by some more technical details regarding the issue. Hopefully this is fixed in the version I am about to install as I really need to be able to access external USB devices, especially hard disks.

Edit: enabling "USB 3.0 (xHCI) Controller" in the settings most likely fixes this issue, see below, near the end of this blog post.

I exported each virtual machine to a file using the "Export Appliance..." option in the File menu of VirtualBox. Next, I deleted each virtual machine. Since I use Time Machine I am not too worried if the export of the virtual machines fails at one point; rolling back is easy.

Next, I uninstalled VirtualBox not by just deleting the program from the Applications folder but by actually running the uninstaller which came with it in the file I had downloaded months ago; VirtualBox-5.0.16-105871-OSX.dmg. The reason for this is that VirtualBox installs several kernel extensions (kexts), which are not deleted by just removing the app from the Applications directory. Those kexts can be listed as follows:

kextstat -l |
    perl -n -e '/\s(org\.virtualbox\..+?)\s\((\S+)\)/ && print "$1 $2\n"'

org.virtualbox.kext.VBoxDrv 5.0.16
org.virtualbox.kext.VBoxUSB 5.0.16
org.virtualbox.kext.VBoxNetFlt 5.0.16
org.virtualbox.kext.VBoxNetAdp 5.0.16

The Perl one liner is used to print just the name and version number of only the org.virtualbox kexts.

So after I had removed (deleted) the three remaining virtual machines and quit VirtualBox I ran the DMG and selected VirtualBox_Uninstall.tool. After confirming that I was sure to open the script a terminal window was opened in which I had to confirm the uninstall by typing "yes". Next the process prompted me for a password to grant it administrative privileges.

After the script reported [Process completed] I closed the window. When I ran the above kextstat pipe again, no lines showed up; the kernel extensions had been unloaded.

Downloading and Installing VirtualBox 5.1

I downloaded VirtualBox 5.1.4 for OS X via the official VirtualBox download page. When I opened the downloaded DMG a dialog showed up. I followed the installation instructions given and double clicked the VirtualBox.pkg icon. The installer wanted to run a program to determine if the software can be installed, so I clicked Continue, and again in the installer dialog window itself, followed by a click on Install. After I entered my password VirtualBox was installed.

Migrating the Parallels Virtual Machine

I migrated my Ubuntu 15.10 Parallels Desktop virtual machine using instructions by Jummy which I have written out less concise below.

mv ~/Ubuntu\ Linux-0.hdd.0.\{5fbaabe3-6958-40ff-92a7-860e329aab41\}.hds \
   ~/VirtualBox\ VMs/Ubuntu\ 15.10/Ubuntu\ 15.10.hdd

In my case this worked!

I logged in, no problem. Next I shut down the virtual machine because I wanted to install the VirtualBox extension pack first to test USB support, followed by installing the Guest Additions in my migrated virtual machine.

Installing the VirtualBox Extension Pack

I downloaded VirtualBox 5.1.4 extension pack via the official VirtualBox download page. After the download finished I just opened the extension pack. VirtualBox asked for confirmation and I clicked Install. Next, I had to agree with the "VirtualBox Personal Use and Evaluation Licence (PUEL)", which I did by clicking on the "I Agree" button. I entered my password and nearly immediately the message that the extension pack was installed successfully showed up.

Installing Guest Additions

I started the migrated virtual machine and logged in. From the "Devices" menu I selected the bottom entry "Insert Guest Additions CD Image...". Ubuntu asked if I wanted to run the software; I confirmed. After I had entered my password the installation process started.

When the installation was done I pressed Return to close the window, as suggested by the installer and rebooted the virtual machine. After logging in I was not able to change the desktop resolution to anything higher than 1024 x 768. Worse, I still could not access a USB drive.

To fix the latter I Googled for VERR_PDM_NO_USB_PORTS, a code given in the details of the error message, and found the solution. I had to stop the virtual machine, open the settings and in the USB tab of "Ports" enable "USB 3.0 (xHCI) Controller". After I had done this I started the virtual machine once more. And this time I could use the external hard disk.

The resolution, however, is still stuck at a maximum of 1024 x 768. It's not that important as I want to migrate the coming weeks to OS X, and this minor nuisance might make this happen sooner than later.