Is your QubesOS installation no longer booting, and you need to recover a qube (VM)? You’re in the right place.
Recently, my Qubes test install encountered issues after the machine crashed during a dom0 update. While it still booted, the system was unresponsive and most Qubes command line tools didn’t function properly. There was limited information online, so I had to dig through old forum threads and unrelated blog posts.
Here’s the solution I came up with (spoiler: it worked perfectly).
Install Qubes on a New Disk
The first step is to install Qubes on a new disk. Do NOT install it on the same disk as your failed Qubes installation!
You can download qubes here, and don’t forget to verify the downloaded file.
The fingerprint of the master signing key is: 427F 11FD 0FAA 4B08 0123 F01C DDFA 1A3E 3687 9494.
Mounting the Broken Install
First, create a new disposable qube on your fresh Qubes installation and try to attach the failed disk via the GUI.
If that doesn’t work, you can identify the disk with lsblk and manually attach it to your new disposable VM using the following command.sudo qvm-block attach dispXXX sys-usb:sdX
You can then either mount it using the Thunar file manager (GUI) or via the command line:
| |
I tried attaching it directly to dom0 but had no success. While that would have saved a step, I encountered strange errors that I couldn’t resolve. However, using a fresh VM made it easy.
Recover the old VM Disks
When recovering an AppVM, you only need to copy the “private” volume. The root volume is provided by the template.
Ensure that the same version of Fedora/Debian is installed as template in your new installation, matching the one from your old setup.
To transfer the disk images, use the following commands to dump the volumes of the mounted disk into a new image files.
To recover the private volume, use the following command:sudo dd if=/dev/qubes_dom0/vm-xxx-private of=xxx_restore_private.img bs=4M
If it’s not an AppVM, you will also need to save the root volume:sudo dd if=/dev/qubes_dom0/vm-xxx-root of=xxx_restore_root.img bs=4M
You can recover the templates the same way if you had installed extra programs there, but I recommend simply installing them again in a fresh template.
Transfer to dom0
If your files exceed the available space in dom0 , you’ll need to resize it:
| |
You must transfer the saved images to dom0 to make them functional again. You can do this using the following command (executed in dom0 ):qvm-run --pass-io <src_domain> 'cat /path/to/file_in_src_domain' > /path/to/file_name_in_dom0
for example:qvm-run --pass-io disp4321 'cat /home/user/restore/xxx_restore_private.img' > ORIG_VM-private.img
Recreate and Recover VMs
Create a qube in the GUI with the same disk size as the original qube.
Next, overwrite the new “private” image with the old one, and the “root” image as well (if it’s not an AppVM).
| |
This process may take some time, but once it’s complete, you’ll be able to start the qube and use it as usual.
You may need to scan for programs and services to add them to the start menu. This can be done through the GUI in the qube’s settings.
Cleanup
I recommend making a backup of all restored qubes and performing a fresh install, where you can restore the recovered qubes from that backup.
Otherwise, your dom0 disk size might remain incorrect, and you could end up with unnecessary data lingering in dom0.
I hope this guide helped you successfully recover your Qubes installation.
