Cannot install templates: qvm-template-postprocess error "root.img extraction failed"

I used to have a fedora-35-minimal template which I then deleted (qvm-remove fedora-35-minimal).

Today I wanted to test some things on Fedora so I tried reinstalling it.

I tried the following commands (as well as qvm-template directly) but they always result in the error message reported below.

[user@dom0 ~]$ sudo qubes-dom0-update --enablerepo=qubes-templates-itl-testing qubes-template-fedora-35-minimal
[user@dom0 ~]$ sudo qubes-dom0-update --action=reinstall --enablerepo=qubes-templates-itl-testing qubes-template-fedora-35-minimal
Installing template 'fedora-35-minimal'...
fedora-35-minimal: Importing data
Traceback (most recent call last):
  File "/usr/bin/qvm-template-postprocess", line 5, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 430, in main
    loop.run_until_complete(post_install(args))
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 296, in post_install
    import_root_img(vm, args.dir)
  File "/usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 110, in import_root_img
    raise qubesadmin.exc.QubesException(
qubesadmin.exc.QubesException: root.img extraction failed
ERROR: Command '['qvm-template-postprocess', '--really', '--no-installed-by-rpm', 'post-install', 'fedora-35-minimal', '/var/tmp/tmp2_t8ydzq/var/lib/qubes/vm-templates/fedora-35-minimal']' returned non-zero exit status 1.

I’ve tried to investigate QubesException: root.img extraction failed and found this solution: Errors trying to install Debian 11 (Bullseye) template from testing - #6 by mig5
Unfortunately, after cloning an existing (Debian*) template, and naming it fedora-35-minimal, I get an error when trying to uninstall it:
(*I don’t have any fedora templates right now :slight_smile:)

[user@dom0 ~]$ sudo dnf remove fedora-35-minimal
No match for argument: fedora-35-minimal
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!

So, I set the testing repo:

[user@dom0 ~]$ sudo dnf remove --enablerepo=qubes-templates-itl-testing fedora-35-minimal
Error: Unknown repo: 'qubes-templates-itl-testing'

I then tried to install the fedora-34-minimal AND then the fedora-34 templates from the stable repo, AND I got the same root.img extraction failed error as before.

What else should I try?

I don’t actively use Fedora (don’t have it in fact) but it would be nice to understand why I can’t install templates.

If you could try qvm-template-gui, you could easily visually check which repos you have enabled and which templates comes from which repo, as well as to install them from there.

Why do you state repo in this command?

Same error, doesn’t work.

I don’t know, I was trying out a bunch of things and realized only after this was posted…

Update: I tried re-installing a Whonix template and the same issue occurs… Now I would really like to solve this.

Any idea is appreciated.

Maybe there are some remnant volumes that are getting in the way?
Check if you have volumes from removed templates left:
sudo lvs