So after a recent update of VirtualBox from 5.0.20 to 5.0.22 I found that a Windows 7 image I have suddenly didn't work anymore. Worse yet, everything was empty or reset to default values.
You can most likely recover from this by following these steps:
- Close VirtualBox (although you might not want to until you safeguarded vbox-prev if you find out you don't have a versioned backup file)
- Go to the directory you have your VM files
- In here look for your faulty image's directory and cd in
- Look for a vbox file with the same name as your image, but most likely containing a version number as the settings/metadata file got upgraded. DO NOT lose this file.
- Run a vboxmanage list vms
- Copy the UUID listed as inaccessible
- Run vboxmanage unregistervm <UUID>
- Copy the backup vbox file over the existing, wrong one
- Run vboxmanage registervm /path/to/file.vbox
- Most likely VBoxManage will error out with an error about a conflict with DVD images with different UUIDs (in my case)
- Edit the vbox file, remove offending line (in the case of the DVD image, might be more difficult with other error cases)
- Run vboxmanage registervm /path/to/file.vbox again
- VBoxManage should now not error out
- Start VirtualBox and your VM should be ok again
Of course the behaviour from VirtualBox is downright dangerous here. If there is such a conflict or error it should NEVER mess around with your metadata file and thus corrupt it. This is one of the biggest sins in software programming. Only after you successfully start an application are you allowed to write out any updates of settings files and whatnot.