Errors trying to install Debian 11 (Bullseye) template from testing

Running Qubes 4.0 - I tried installing the Debian 11 template from the qubes-templates-itl-testing repo.

The first time, at the ‘Installing’ step, my machine completely froze (could not even move mouse cursor) - had to hard reset.

The second attempt, once I booted back up, gave me this error:

[miguel@dom0 ~]$ sudo qubes-dom0-update --enablerepo=qubes-templates-itl-testing qubes-template-debian-11
Using sys-firewall as UpdateVM to download updates for Dom0; this may take some time...
fedora/metalink                                             | 5.1 kB  00:00     
fedora                                                      | 4.3 kB  00:00     
fedora/primary_db                                           |  26 MB  00:20     
qubes-dom0-current/metalink                                 | 2.7 kB  00:00     
https://mirrors.dgplug.org/qubes/repo/yum/r4.0/current/dom0/fc25/repodata/repomd.xml: [Errno 14] curl#60 - "server certificate verification failed. CAfile: none CRLfile: none"
Trying other mirror.
qubes-dom0-current                                          | 3.8 kB  00:00     
https://ftp.acc.umu.se/mirror/qubes-os.org/repo/yum/r4.0/current/dom0/fc25/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for qubes-dom0-current
Trying other mirror.
qubes-dom0-current                                          | 3.8 kB  00:00     
qubes-dom0-current/primary_db                               | 1.2 MB  00:01     
qubes-templates-itl/metalink                                | 2.6 kB  00:00     
qubes-templates-itl                                         | 3.0 kB  00:00     
qubes-templates-itl/primary_db                              | 7.2 kB  00:00     
qubes-templates-itl-testing/metalink                        | 2.8 kB  00:00     
qubes-templates-itl-testing                                 | 3.0 kB  00:00     
qubes-templates-itl-testing/primary_db                      | 7.1 kB  00:00     
updates/metalink                                            | 4.8 kB  00:00     
updates                                                     | 4.7 kB  00:00     
updates/primary_db                                          |  12 MB  00:04     
--> Running transaction check
---> Package qubes-template-debian-11.noarch 0:4.0.6-202109010214 will be installed
--> Finished Dependency Resolution
qubes-template-debian-11-4.0.6-202109010214.noarch.rpm      | 1.0 GB  07:59     
Successfully verified /var/lib/qubes/dom0-updates/packages/qubes-template-debian-11-4.0.6-202109010214.noarch.rpm
Qubes OS Repository for Dom0                                                                                                     25 MB/s |  26 kB     00:00    
Dependencies resolved.
================================================================================================================================================================
 Package                                       Arch                        Version                                 Repository                              Size
================================================================================================================================================================
Installing:
 qubes-template-debian-11                      noarch                      4.0.6-202109010214                      qubes-dom0-cached                      1.0 G

Transaction Summary
================================================================================================================================================================
Install  1 Package

Total size: 1.0 G
Installed size: 3.8 G
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : qubes-template-debian-11-4.0.6-202109010214.noarch                                                                                          1/1 
debian-11: Importing data
tar: Skipping to next header
cat: write error: Broken pipe
tar: Exiting with failure status due to previous errors
Traceback (most recent call last):
  File "/bin/qvm-template-postprocess", line 5, in <module>
    sys.exit(main())
  File "/usr/lib/python3.5/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 310, in main
    loop.run_until_complete(post_install(args))
  File "/usr/lib64/python3.5/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "/usr/lib64/python3.5/asyncio/futures.py", line 294, in result
    raise self._exception
  File "/usr/lib64/python3.5/asyncio/tasks.py", line 240, in _step
    result = coro.send(None)
  File "/usr/lib/python3.5/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 235, in post_install
    import_root_img(vm, args.dir)
  File "/usr/lib/python3.5/site-packages/qubesadmin/tools/qvm_template_postprocess.py", line 98, in import_root_img
    raise qubesadmin.exc.QubesException('root.img extraction failed')
qubesadmin.exc.QubesException: root.img extraction failed
warning: %post(qubes-template-debian-11-4.0.6-202109010214.noarch) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package qubes-template-debian-11
Non-fatal POSTIN scriptlet failure in rpm package qubes-template-debian-11
  Verifying   : qubes-template-debian-11-4.0.6-202109010214.noarch                                                                                          1/1 

Installed:
  qubes-template-debian-11.noarch 4.0.6-202109010214                                                                                                            

Complete!

Since then, I get ‘no match for argument qubes-template-debian-11’.

[miguel@dom0 ~]$ sudo qubes-dom0-update --enablerepo=qubes-templates-itl-testing qubes-template-debian-11
Using sys-firewall as UpdateVM to download updates for Dom0; this may take some time...
No Match for argument qubes-template-debian-11
Nothing to download

I don’t see any Debian 11 template in my menu.

Anyone have any ideas on what to do from here?

try sudo qubes-dom0-update --action=reinstall qubes-template-debian-11

Thanks - I just tried that, and I got the exact same stack trace above during the (re) installation process.

what happen if you try to sudo dnf remove qubes-template-debian-11 then download it again ?

I get an error which, despite ‘Complete!’, continues to appear each time I try the command, so I don’t think it’s properly removing the template.

[miguel@dom0 ~]$ sudo dnf remove qubes-template-debian-11
Dependencies resolved.
================================================================================================================================================================
 Package                                      Arch                       Version                                   Repository                              Size
================================================================================================================================================================
Removing:
 qubes-template-debian-11                     noarch                     4.0.6-202109010214                        @qubes-dom0-cached                     3.8 G

Transaction Summary
================================================================================================================================================================
Remove  1 Package

Installed size: 3.8 G
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
usage: qvm-template-postprocess [--verbose] [--quiet] [--help] [--really]
                                [--skip-start] [--keep-source]
                                {post-install,pre-remove} name dir
qvm-template-postprocess: error: No Qube with this name exists
error: %preun(qubes-template-debian-11-4.0.6-202109010214.noarch) scriptlet failed, exit status 2
Error in PREUN scriptlet in rpm package qubes-template-debian-11
Error in PREUN scriptlet in rpm package qubes-template-debian-11
qubes-template-debian-11-4.0.6-202109010214.noarch was supposed to be removed but is not!
  Verifying   : qubes-template-debian-11-4.0.6-202109010214.noarch                                                                                          1/1 

Removed:
  qubes-template-debian-11.noarch 4.0.6-202109010214                                                                                                            

Complete!

I think the upper ‘root.img’ error indicates an issue extracting it with tar or cat. The problematic code in qvm_template_postprocess.py is on tar xSOf - action against the root.img file (or the cat command that precedes it) which is presumably part of the rpm package that contains the Debian 11 template.

Can anyone provide me a tip on how to obtain this root.img file so I can manually run the tar command against it to see what the underlying issue might be?

OK, I got through it in the end.

I think the original crash I experienced mid-install, is what made things go so wrong for me.

Since I couldn’t cleanly remove the existing package as the template didn’t actually exist as a Qubes template, I cheekily cloned the debian-10 template with a name ‘debian-11’. This allowed a sudo dnf remove qubes-template-debian-11 to finally succeed.

After that, a reinstall worked fine.

Thanks for your help.