Dom0 factory reset

Hi,

I did something stupid and now my dom0 won 't boot due to missing files. I have a backup I can restore from but it is like 2 months old.

I was wondering if there was a way to just reinstall dom0 or “do a factory reset on just dom0”.

I don’t see any reason why I can’t use the same vm block devices, at the very least for my standalone vms. I have access to dom0 root and all the file systems so I could even get the config files for all the qubes etc.

Is there any way to do this? If not, I should at least be able to boot my standalone vms with a normal xen installation on normal linux? Does anyone know how to do that? I used kpartx to mount the root of my standalone and all the partitions are there including the EFI partition so I don’t see why I couldn’t at least keep the standalones.

If dom0 reset isn’t apart of the installer, maybe it is a feature worth consideration?

Your backup is Qubes backup or just disk image created with dd?
If it’s just disk image, then you can restore old dom0 by using dd on /dev/mapper/qubes_dom0-root.
If you have some config files that you manually changed in dom0 then you can also copy them from new dom0 to restored old dom0.

I just still have the old disk that my qubes installation was on. so yes a basallyI have a disk image of everything.

I just messed up my dom0 so the old installation won’t boot. I was going to reinstall on a separate disk (I already renamed the vg from the old installation). So essentially all I need to replace is dom0 with the factory version. I don’t even have any non-default templates. I want to keep my old vms if possible, either my importing my old qubes raw disk data (the old pool) or by replacing the dom0 on the old installation with the new working one.

Ideally, Id like to just take the dom0 from the new installation and replace the old dom0 in the other pool with it so then I can just go back to my old installation. I could backup all the config files on the old dom0 before replacing it.

I’d just like to know what configs/files are important to backup, as well as maybe a tip on how exatly to replace the old dom0 with the new one. I’d imagine I could just change the new ones volume group to the old volume group after backing up and deleting the old dom0. I’m just not sure of the commands or if the UUID is allowed to change etc.

You need to first backup your old dom0 root. You can boot from LiveUSB or some other system and not from old/new Qubes.
Then mount your disk with new Qubes and make a disk image:
dd if=/dev/mapper/qubes_dom0-root of=/path/to/backup/location/qubes_dom0-root-new.img bs=1M status=progress
Unmount your new Qubes.
Mount your disk with old Qubes and make a backup disk image:
dd if=/dev/mapper/qubes_dom0-root of=/path/to/backup/location/qubes_dom0-root-old.img bs=1M status=progress
Write new disk image over old disk image:
dd if=/path/to/backup/location/qubes_dom0-root-new.img of=/dev/mapper/qubes_dom0-root bs=1M status=progress

I don’t know which files you need to replace to make everything work as before, but all config files should be in these directories:

/etc
/var

You can start with replacing every files in these directories from old dom0 to new dom0. Maybe it’ll work.