Dom0 says qubes-template-focal already installed even after deletion

I was looking to use anbox in an Ubuntu Focal VM and downloaded, verified, and passed to dom0 Focal template from Parrot security and Ubuntu Focal templates.

The “focal” template appeared in the “Create New Qube” GUI, but I don’t think I was able to start a focal VM. Anyway, I deleted the focal template after running qvm-prefs focal installed_by_rpm false and then sudo dnf remove qubes-template-focal.

Then today I decided to try again. When I ran sudo dnf install qubes-template ubuntu-focal.rpm (renamed from the original downloaded .rpm package), dom0 tells me: Package qubes-template-focal-4.0.6-202103140033.noarch is already installed. This appears twice in a row. Then at the end of the output Dependencies resolved. Nothing to do. Complete!

If I try to delete qubes-template-focal-4.0.6-202103140033.noarch by running sudo dnf remove qubes-template-focal-4.0.6-202103140033.noarch, then I eventually get: Error in PREUN scriptlet in rpm packge qubes-template-focal \n Verifying: qubes-template-focal-4.0.6-202103140033.noarch \n Failed: qubes-template-focal-4.0.6-202103140033.noarch \n Error: Transaction failed

Is my first (presumed) deletion of ubuntu.rpm related to this error, as well as my inability to install a freshly downloaded ubuntu.rpm? None of the outputs mention log files-- do these exist?

Perhaps there is a way to install anbox or another android emulator without ubuntu? Thanks!

The focal templates are, as was made clear, for 4.0.
They wont work in 4.1 without adding new 4.1 packages which you will
have to build yourself.
You didn’t need to use qvm-prefs at all - just dnf remove.

I don’t know what state your system is currently in - log files are in

I forgot to mention that I am using a version of R4.1, specifically the 10-03-27 .iso from OpenQA. Perhaps this build of 4.1 is too different from the one for which the ubuntu template was built?

When trying to remove the apparently still present qubes-template-focal-4.0.6-202103140033.noarch with sudo dnf remove <focal-template>, then /var/log/dnf.rpm.log shows a qvm-template-postprocess: error: No Qube with this name exists, which is correct, yet I cannot even create a qube off of that template. The next line specifies error: %preun(<focal-template>) scriptlet failed, exit status 2.

When I run sudo dnf install qubes-template <focal-template>.rpm, then /var/log/dnf.log says DEBUG reviving: 'qubes-dom0-cached' can be revived - repomd matches . Then DEBUG qubes-dom0-cached: using metadata from Sun 30 May 2021 11:51:08 PM <timezone>. Maybe dom0 has a cache that still thinks I have an ubuntu template?

So then I ran sudo dnf clean all after reading a bit about dnf cache online, and in dnf.log it shows that 5 files were removed. But when I try again to install the focal template, I get the same message that I have focal installed. dnf.log indicates that dom0 downloading from remote: qubes-dom0-cached after I cleared the cache, and dom0 then still is using metadata from Sun 30 May 2021...

/var/log/dnf.rpm.log doesn’t seem to have related information.

I found a similar issue in this g00gle groups discussion.

I followed the step of remove /var/lib/qubes/updates/repodata/*, but accidentally took it a step further and deleted /var/lib/qubes/updates/rpm/*.

Now I logically get a dnf install qubes-template <focal>.rpm error:
Errors during downloading metadata for repository 'qubes-dom0-cached'
- Curl error (37): Couldn't read a file:// file for file:///var/lib/qubes/updates/repodata/.xml
And eventually
Failed to download metadata for repo 'qubes-dom0-cached': Cannot download repomd.xmlAll mirrors were tried.

So I guess at this point I’m wondering where I can get a new /var/lib/qubes/updates/repodata/repomd.xml file.

See the discussion in #5948 - it seems connected with that.