Removed key dom0 packages. Can't reinstall them (No package available)

Today it’s my turn. I have done a very dumb thing and my system became basically broken.

TL;DR Removed core packages in Qubes. Had the system almost unusable but managed to fix the issue. I’m posting here just to share the experience in case anybody sees themselves in this situation in the future.

What made it break?

I was removing a dom0 package, which I thought was non-essential (xwininfo).
When removing the package it asked for confirmation:

[user@dom0 ~]$ sudo dnf remove xwininfo
Dependencies resolved.
========================================================================================================================
 Package                               Arch          Version                            Repository                 Size
========================================================================================================================
Removing:
 ModemManager-glib                     x86_64        1.6.4-1.fc25                       @anaconda                 1.0 M
 NetworkManager-wifi                   x86_64        1:1.4.6-1.fc25                     @anaconda                 137 k
 Thunar                                x86_64        1.6.11-1.fc25                      @anaconda                 6.5 M
 albatross-xfwm4-theme                 noarch        1.7.3-4.fc24                       @anaconda                 106 k
 anaconda-gui                          x86_64        1000:25.20.9-17.fc25               @qubes-dom0-cached        1.7 M
 anaconda-user-help                    noarch        22.4-4.fc24                        @anaconda                 152 k
 anaconda-widgets                      x86_64        1000:25.20.9-17.fc25               @qubes-dom0-cached         93 k
 bluebird-xfwm4-theme                  noarch        1.2-4.fc24                         @anaconda                  88 k
 dzen2                                 x86_64        0.8.5-17.20100104svn.fc24          @qubes-dom0-cached        141 k
 enchant                               x86_64        1:1.6.0-14.fc25                    @anaconda                 130 k
 fros                                  noarch        1.1-8.fc24                         @anaconda                  42 k
[...] 
 qubes-desktop-linux-common            noarch        4.0.21-1.fc25                      @qubes-dom0-cached        387 k
 qubes-manager                         noarch        4.0.45-1.fc25                      @qubes-dom0-cached        5.7 M
[...]
Transaction Summary
========================================================================================================================
Remove  107 Packages

Installed size: 199 M
Is this ok [y/N]: y

I must have been in autopilot. 107 packages removed and I typed yes :frowning: Among other things there were packages like qubes-manager and qubes-desktop-linux-common.

What broke?

  1. couldn’t install packages - essential to revert the issue (see bellow)
  2. couldn’t backup - qubes-backup was uninstalled
  3. couldn’t start new qubes
    qubes world start but their windows would not open. qvm-run also didn’t work.
  4. window decorations broken
    on qubes that were running (e.g. sys-firewall) but where I didn’t have any window open before, the colored borders started not showing up.

Couldn’t install packages

This was the key issue. For some reason it stopped recognizing packages:

note: the parts inside the ~~~~ were in red and the rest was white (to symbolize they were running in sys-firewall)

[user@dom0 ~]$ sudo qubes-dom0-update wmctrl
Using sys-firewall as UpdateVM to download updates for Dom0; this may take some time...
~~~~~~~~~
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora-updates.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora-updates.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Invalid configuration value: failovermethod=priority in /var/lib/qubes/dom0-updates/etc/yum.repos.d/fedora-updates.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Warning: Enforcing GPG signature check globally as per active RPM security policy (see 'gpgcheck' in dnf.conf(5) for how to squelch this message)
Last metadata expiration check: 3:26:04 ago on Sun May 23 05:07:54 2021.
Package wmctrl-1.07-19.fc24.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
~~~~~~~~~
Qubes OS Repository for Dom0                                                                                                                                   35 MB/s |  36 kB     00:00    
No package wmctrl available.
Error: Unable to find a match.

note: just ignore the failovermethod=priority. That has to do with another issue and should have no impact.

As you can see, first it says the packages is already installed but then No package available. As a result, you’re not able to install any packages.

Fedora dnf history undo also didn’t work because the packages were no longer cached and the dnf command doesn’t know how to get packages (only the wrapper qubes-dom0-update does).

1 Like

Solution

The solution was to:

  1. save the names of all the packages in a single line in a dom0 file called packages.txt.

  2. sudo qubes-dom0-update --action=reinstall $(cat packages.txt)
    To make the packages become available in dom0’s cache again.

  3. sudo dnf install $(cat packages.txt)
    Finally installed the packages but using dnf tool in dom0 (since qubes-dom0-update didn’t work properly)

2 Likes

Thanks for sharing your experience!

I just want to remind everyone that this is why it’s so important to back up before you encounter any problems. Make backups a regular habit. In this situation, there was a way to recover without restoring from a backup, but that won’t always be the case!

1 Like