I messed up quite badly by accidentally deleting a VM in Boxes. This particular VM had some important files on it. I would greatly appreciate any help on how to recover this image. Needless to say, keeping important stuff on a VM without proper backup routines in place is bad on so many levels. But here I am…
Host-OS: Pop!_OS 20.04 LTS 64-bit
I will try to recap what happened below, step by step.
Before all problems started I had a total of 2 VMs in Boxes. The one with the important stuff I will call “img01” and is an Ubuntu 22.04 LTS machine. The other one is based on a different OS and is not related to this situation.
In an effort to create a new VM, for another use case, I started off by cloning “img01”. We can call this new one “img02”. The plan was to revert “img02” to a “clean state” snapshot which was created in “img01” long time ago (before the important files were created).
Apparently the snapshots associated with “img01” didn’t show up for “img02” in Boxes. After some digging I found the snapshot xml files under ~/.config/libvirt/qemu/snapshot/. The relevant subfolders here are called boxes-unknown/ (for “img01”) and boxes-unknown-2/ (for “img02”). I figured I could simply copy the snapshot files from boxes-unknown/ to boxes-unknown-2/.
By doing this the snapshots were associated with “img02” in Boxes, after restarting the application. So under the properties for “img02”, I revert the state to a particular snapshot. Everything seems ok, but when the reverting process is finished the “img02” VM won’t start, and gives an error message in Boxes. This is not exactly shocking.
(*) No big deal. In Boxes, I right-click to delete the “img02” VM, as it is not working anyway. For a split second the dialog with the “Undo” button shows up. Then, BOTH “img01” and “img02” disappear in the GUI. I panic and reboot the computer. When starting Boxes again, ONLY the non-working “img02” is available.
(* This is what happened, to the best of my memory, when the deleting took place. But I would say that there is a slight chance that I accidentally clicked the “img01” icon instead of “img02”. This would make more sense, given the actual outcome.)
So, what do I do now? Where do the files go when the VMs are deleted in Boxes? And for how long? I would assume this is OS dependent. In the desktop Trash-folder there are no Boxes related files.
There are some traces of “img01” under ~/.config/libvirt/ and ~/.config/gnome-boxes/, but it’s quite confusing (to me at least) because of the similarities with “img02”.
Under ~/.local/share/gnome-boxes/images there are two files, “boxes-unknown” and the unrelated image for the other VM. They appear to be QCOW2 files. It would make more sense to me if the remaining image file was named “boxes-unknown-2”, instead of “boxes-unknown”. The file is time-stamped yesterday, when the “img02” VM was created.
Again, any suggestions on how to solve this mess are greatly appreciated. Let me know if you need to know more details. I could also provide you with logs etc. In that case, please describe where the log files are located or if I should be using some specific terminal commands.