Template won't reinstall

Hi

I’m trying to reinstall a template but its not working. I tried the automatic way but got a errors. I emptied the cached packages (0 bytes). I rebooted, no good.

[terry@dom0 Desktop]$ sudo qubes-dom0-update --action=reinstall qubes-template-debian-10
WARNING: Replacing a template will erase all files in template's /home and /rw !
Template VM halted
Using sys-firewall as UpdateVM to download updates for Dom0; this may take some time...
Fedora 25 - x86_64 - Updates                    903 kB/s |  24 MB     00:27    
Fedora 25 - x86_64                              2.2 MB/s |  50 MB     00:22    
Qubes Dom0 Repository (updates)                 248 kB/s | 1.0 MB     00:04    
determining the fastest mirror (15 hosts).. done..0 kB/s | 2.7 kB     00:00 ETA
Qubes Templates repository                      1.2 kB/s | 6.2 kB     00:05    
Installed package qubes-template-debian-10-4.0.1-201912251612.noarch not available.
Error: No packages marked for reinstall.

I deleted the template. I tried the manual way

@dom0 Desktop]$ sudo qubes-dom0-update qubes-template-debian-10
Using sys-firewall as UpdateVM to download updates for Dom0; this may take some time...
Last metadata expiration check: 0:19:35 ago on Wed Feb 24 20:45:27 2021.
Dependencies resolved.
================================================================================
 Package                  Arch   Version              Repository           Size
================================================================================
Installing:
 qubes-template-debian-10 noarch 4.0.6-202101091318   qubes-templates-itl 873 M

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

Total download size: 873 M
Installed size: 3.4 G
DNF will only download packages for the transaction.
Downloading Packages:
[MIRROR] qubes-template-debian-10-4.0.6-202101091318.noarch.rpm: Curl error (23): Failed writing received data to disk/application for https://mirrors.edge.kernel.org/qubes/repo/yum/r4.0/templates-itl/rpm/qubes-template-debian-10-4.0.6-202101091318.noarch.rpm [Failed writing body (8613 != 16384)]
[FAILED] qubes-template-debian-10-4.0.6-202101091318.noarch.rpm: Curl error (23): Failed writing received data to disk/application for https://mirrors.edge.kernel.org/qubes/repo/yum/r4.0/templates-itl/rpm/qubes-template-debian-10-4.0.6-202101091318.noarch.rpm [Failed writing body (8613 != 16384)]

The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Error downloading packages:
  Curl error (23): Failed writing received data to disk/application for https://mirrors.edge.kernel.org/qubes/repo/yum/r4.0/templates-itl/rpm/qubes-template-debian-10-4.0.6-202101091318.noarch.rpm [Failed writing body (8613 != 16384)]

Tried it a couple of times. Notice that the failure point is different each time, like (4517 != 16384).

Is this an underlying hardware problem (disk is only 2 years old!), or am I missing something in the process?

I’m having the same issue (trying for debian-11). I’m on a brand new system and brand new local SSD though.

Does cloning the existing template, and switching all AppVM to it as a template, then deleting default template and installing it again (via qvm-template-gui, for example) helps?
If it helps, you should switch back all the AppVMs back to newly installed template, and delete cloned old template.

I am having this same issue.

Haven’t spot this is for R4.0.x but you probably need to increase private storage size.