Did you try to copy, move or back up and restore your VirtualBox virtual machines and now one or more of them cannot boot because of “some UUID problem?” Here we will show you how you can change the UUID in VirtualBox HHDs.
When we set up a Virtual Machine in VirtualBox, it’s given a Universal Unique IDentifier, or UUID for short. This is a 128-bit number, specific to the virtual hardware. Here’s the thing: the Hard Disk Drives attached to the VMs we make also have their own UUIDs. Those are also presumed to be unique. When they are not, problems emerge.
The most usual case may appear after you try to copy or back up a virtual machine. When trying to run “a second version” of the VM, VirtualBox might announce that its HDD’s UUID isn’t the one it was waiting on.
That’s when you should reset the HDD’s UUID and reattach it to the VM as a new device. It is easy to do but demands the use of a command-line tool, coupled with some clicks in a rarely visited part of VirtualBox’s GUI.
VirtualBox comes with a command-line tool, VboxManage, that, as its name states, helps you manage your virtual machines.
VboxManage is the Swiss Army knife of VirtualBox. It is the command-line interface to the program, offering a lot of functionality not encountered in the “main” GUI-based app.
With it, you can create new virtual machines, modify their parameters, clone them, or reset a virtual HDD’s UUID. And that last one is precisely what we require here.
If you have VirtualBox, VboxManage is already installed. To check it out, enter in a terminal:
Two commands worth remembering
Although we won’t need them for this article, two VboxManage commands worth remembering when troubleshooting VMs are:
The first one displays a list of all your virtual machines that are “attached” to VirtualBox.
The second one can show information about the virtual hard disk files you feed it.
Although the process we will employ is uncomplicated and bulletproof, you can use the second one on your virtual hard disk file before and after the procedure. This way, you’ll be sure its UUID has changed.
Release the HDD
From VirtualBox’s main window, with your VM stopped, select “File -> Virtual Media Manager.”
From the window that appears on your screen, identify your problematic hard disk drive. Click on it to select it. Then, click on the “Release” button to detach the selected HDD from VirtualBox. Confirm that you want to release it when VirtualBox asks you if you are sure. Then click on “Remove.”
VirtualBox will notify you that “As this hard disk is inaccessible, its image file can not be deleted.” Click on “Remove.” If the error message is different, skip this step to avoid really deleting your virtual hard disk.
Change its UUID
Go back to your terminal and enter:
Replace “FILENAME” with your actual virtual hard disk file.
The program should notify you of the new UUID assigned to the virtual hard disk file.
Re-attach your virtual HDD
Return to the Virtual Media Manager window and click on “Add.” Find and select the updated virtual hard disk file to connect it again to VirtualBox.
Close the Virtual Media Manager window and revisit the settings of the virtual machine that was affected by the problem.
Move to the “Storage” settings of your virtual machine and pick the appropriate controller. Click on the icon with the HDD and the plus sign. Select “Choose existing disk” and then, from the window that pops up, your updated virtual hard disk file.
Click OK to save the changes and exit the window. Start your virtual machine and, if everything went according to plan, it should boot with no problems.