3

In a Docker container I'm creating a full PC Linux image from scratch (using debootstrap and lots of other tools).

At the end of the process I'm using qemu-img convert -f raw -O vdi infile.raw outfile.vdi to generate a image file suitable for VirtualBox.

That works in essence - the disk boots inside VirtualBox.

However, when creating a new image and replacing outfile.vdi (of course with the VM powered off), then VirtualBox complains that the disk image is not okay because the UUID does not match the one stored in the VirtualBox media registry.

I am forced to remove and add the file again in the VM settings using the VirtualBox GUI so that I can start the VM again.

I guess there is some (random) UUID stored directly in the .vdi file, but I could not find a way to manually specify a fixed UUID with qemu-img.

How can I solve this problem? Perhaps another VirtualBox-compatible disk format would work better?

In case it matters: This all happens under a Windows host

Udo G
  • 12,572
  • 13
  • 56
  • 89

1 Answers1

0

In my case, the answer here: How to change UUID in virtual box helped. I do it like this:

  1. Issue the VBoxManage internalcommands sethduuid my-drive.vdi on the drive in question
  2. Using the output UUID value and replace it in the VMs .vbox file (in my case, in two places).

May be it is not quite good a way, as I restart VirtualBox, not tried to do it "live", but hopefully this answer will useful for someone.

Of course, the script can be made to do it automatically.

Also, this says uuid can be given as a parameter to VBoxManage internalcommands sethduuid <UUID> <Yourdrive>, but I have not tried as my task is not frequent one. The way to do it fully in a script given there.

Community
  • 1
  • 1
Roman Susi
  • 4,135
  • 2
  • 32
  • 47
  • The command is `VBoxManage internalcommands sethduuid "/path/to.vdi" "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX"`. And it works well. – Toothbrush Jul 28 '17 at 13:08