Cannot install templates: qvm-template-postprocess error "root.img extraction failed" (even after complete QubesOS reinstall)

*** UPDATE ***
Even after a complete reinstall of QubesOS and starting clean, I am unable to download ANY template.

The post below shows fedora-35-minimal but I also just tried debian-11-minimal and the error is the same.

I even tried installing the kernel-latest weekly build by fepitre : QubesOS 4.1 (alpha) Signed Weekly Builds

Note: the updatevm doesn’t make a difference (tried sys-firewall, sys-whonix, sys-vpn)

Old post below:


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, but it does NOT work for me: Errors trying to install Debian 11 (Bullseye) template from testing - #6 by mig5

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.

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

Just tried with a clean Qubes OS (re)installation and the error persists.

Does it try to download the template but fails at some point or does it fail immediately after you start it?
Maybe it’s just a network failure that causes the download to fail?

No, the download is successful.

If the template isn’t cached then it’s fully downloaded before install, otherwise it’s retrieved from .cache/qvm-template.

And in case you might ask, I have tried deleting it and re-downloading but the error is still the same:

qubesadmin.exc.QubesException: root.img extraction failed

This one seems to be your case:

You can post there and try to narrow down the issue.

Appears to be the same issue, thank you.
I’ll try to comment there and see what comes up.

Solved reinstalling vim:

sudo qubes-dom0-update -y vim

I’m wondering how vim in default, clean install can be wrong?