Accidentally attached SATA SSD to appvm and crashed dom 0, anyway to revert?

I was testing giving a PCI based storage device their own sys-qubes for backups, and accidentally attached the SATA device which is my Dom 0 generic SSD, to the new qube and slowly watched my system die, as all vms started halting, also got an error that said something like "can’t find dom 0 sata’ or something similar. I knew it was hopeless but I tried to detach and then delete that qube from the gui, but with no hard drive connected anymore… it didn’t respond.

I thought maybe this wouldn’t save and just hard reset. Nope, doesn’t boot anymore.

Is there any way to access shell and qvm-something to delete that sys-qube and reattach my sata drive mapping?

I have qubes I never backed up :frowning:

Damn I feel like an idiot.

not sure if it will work, but I’ll try attaching the drive of the crashed install to a working qubes install using this method, How to mount a Qubes partition from another OS | Qubes OS

Then will try cloning the vms, as mentioned here, Secondary storage | Qubes OS

But it doesn’t make sense to me how I’ll be able to clone the vms of the external and get them detected or in a usable state in the working qubes install. So it’s probably pointless, but I’m getting desperate. Been a month without a properly working system.

You can boot from whatever linux rescue media you like, decrypt & mount the Qubes OS file system as with any other Linux.

Then either edit the Qubes config file that contains the attached device (probably /var/lib/qubes/qubes.xml - better create a backup first) or chroot to that install and use qvm-block etc. to detach the drive.

Anyway I don’t see too much security benefits from a dedicated SATA PCI controller.

Are you sure it’s possible to use chroot?

I’m new to chroot, but mounted the messed up drive in a new qubes install’s dom 0, then followed this guide How to: Chroot into a broken system via live CD/ISO or alternate Linux system | TurnKey GNU/Linux

Then tried commands

qvm-device pci detach sys-MSATA:00:1f.2

Which didn’t seem to work.

Then tried to see if I can just delete the qube. Seems whatever command I enter in chroot I get the following:

failed to connect to qubesd service

And a bunch of other commands.

I tried going back and mounting all the folders on the drive for chroot, and redid the command to remove the template, now it says doesn’t exist, but when I do sudo pvs and lvs, still clearly there.

:frowning:

Well I was able to backup some stuff by getting access to the various home directories.

The error has changed from a hang to now a kernal panic.

Not sure what to do next. I’ll save this HD for troubleshooting later and will pick up another HD today and just start over.

Hm looks like the qvm-* commands require qubesd to be running which of course it is not in a chroot environment. You also wouldn’t want it to be running as it would attempt to attach the device to that VM etc.

Then edit /var/lib/qubes.xml manually and remove the incorrect PCI device (should be in some tag). Ideally Qubes should start just fine afterwards. Better make a backup of the config file though…

I just ran into this same problem. I fixed my problem thanks to this forum post! Here’s what I did:
I booted the system in TAILS.
Found the Dom0 partition as per the instructions here: How to mount a Qubes partition from another OS | Qubes OS
Found /var/lib/Qubes/qubes.xml in Dom0.
Ran in TAILS lspci and found that SATA is: id="00_1f.2
Found the line that had 00_1f.2, and that was under sys-usb.
I deleted that line.
Rebooted the system.
It worked!