Subject: apt-get update fails in ascii if a local mirror is used using a file:/// URL due to missing .xz files

From: Daniel Abrecht <[email-masked]>
Date: Thu, 14 Dec 2017 16:23:54 +0000

Package: amprolla
Version: 3
Tags: ascii

In devuan ascii, apt tries to use .xz archives before .gz archives by
default, but the .xz archives are missing. This doesn't cause any
problems when using http or https transport to access the repos, since
apt will just use the .gz archive when it can't download the .xz
archive. But it fails if a local mirror is used using a file:/// url.
I'm using apt-mirror for my local mirror, but that shouldn't matter.

My current workaround for this is to create a config file at
/etc/apt/apt.conf.d/20archivetypes to specify which archive type to use.
It contains the following line:
Acquire::CompressionTypes::Order:: "gz";

This Problem doesn't affect devuan jessie.

There are multiple possible solutions:
 1) Generate the .xz files
 2) Don't list the .xz files in the release files etc.
 3) Change the behaviour of apt to fallback to other compression types
when accessing a repo over a file:/// url
 4) Creating a config file to change the order using a package

Here is the output of a failed apt-get update. It will only fail if the
files it tries to download have changed since the last successful update:
> root@duck:~# apt-get update
> Get:1 file:/var/local/apt-repo ascii InRelease [63.5 kB]
> Get:1 file:/var/local/apt-repo ascii InRelease [63.5 kB]
> Get:2 file:/var/local/apt-repo ascii-updates InRelease [63.5 kB]
> Get:3 file:/var/local/apt-repo ascii-security InRelease [62.9 kB]
> Get:2 file:/var/local/apt-repo ascii-updates InRelease [63.5 kB]
> Get:3 file:/var/local/apt-repo ascii-security InRelease [62.9 kB]
> Get:4 file:/var/local/apt/mirror/devuanfwojg73k6r.onion/devuan
ascii-proposed InRelease [122 kB]
> Get:4 file:/var/local/apt/mirror/devuanfwojg73k6r.onion/devuan
ascii-proposed InRelease [122 kB]
> Get:5 file:/var/local/apt-repo ascii/main Sources [8,675 kB]
> Err:5 file:/var/local/apt-repo ascii/main Sources
>   Hash Sum mismatch
>   Hashes of expected file:
>    - Filesize:8675180 [weak]
>    -
SHA256:536af199dd5d825a4866a8de4960d98f8cb20921d6de52df8c20ae0376be8bb2
>   Hashes of received file:
>   Release file created at: Wed, 13 Dec 2017 23:04:02 +0000
> Get:6 file:/var/local/apt-repo ascii/main amd64 Packages [9,667 kB]
> Err:6 file:/var/local/apt-repo ascii/main amd64 Packages
>
> Get:7 file:/var/local/apt-repo ascii-updates/main Sources [3,740 B]
> Err:7 file:/var/local/apt-repo ascii-updates/main Sources
>   Hash Sum mismatch
>   Hashes of expected file:
>    - Filesize:3740 [weak]
>    -
SHA256:669f1a2b277cd1e7d2fd4349adc2ee82d53c676afc54376fb0e1ce2405ce4b83
>   Hashes of received file:
>   Release file created at: Thu, 14 Dec 2017 03:18:02 +0000
> Get:8 file:/var/local/apt-repo ascii-updates/main amd64 Packages [6,540 B]
> Err:8 file:/var/local/apt-repo ascii-updates/main amd64 Packages
>
> Get:9 file:/var/local/apt-repo ascii-security/main Sources [115 kB]
> Err:9 file:/var/local/apt-repo ascii-security/main Sources
>   Hash Sum mismatch
>   Hashes of expected file:
>    - Filesize:115364 [weak]
>    -
SHA256:906afc78836447f892c7f063b5991641deb05e5688dc5cb6d6634c9c8543b0c5
>   Hashes of received file:
>   Release file created at: Wed, 13 Dec 2017 23:04:01 +0000
> Get:10 file:/var/local/apt-repo ascii-security/main amd64 Packages
[280 kB]
> Err:10 file:/var/local/apt-repo ascii-security/main amd64 Packages
>
> Get:11 file:/var/local/apt/mirror/devuanfwojg73k6r.onion/devuan
ascii-proposed/main amd64 Packages [19.7 kB]
> Reading package lists... Done
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii/main/source/Sources.xz  Hash Sum
mismatch
>    Hashes of expected file:
>     - Filesize:8675180 [weak]
>     -
SHA256:536af199dd5d825a4866a8de4960d98f8cb20921d6de52df8c20ae0376be8bb2
>    Hashes of received file:
>    Release file created at: Wed, 13 Dec 2017 23:04:02 +0000
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii/main/binary-amd64/Packages.xz
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii-updates/main/source/Sources.xz
Hash Sum mismatch
>    Hashes of expected file:
>     - Filesize:3740 [weak]
>     -
SHA256:669f1a2b277cd1e7d2fd4349adc2ee82d53c676afc54376fb0e1ce2405ce4b83
>    Hashes of received file:
>    Release file created at: Thu, 14 Dec 2017 03:18:02 +0000
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii-updates/main/binary-amd64/Packages.xz
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii-security/main/source/Sources.xz
Hash Sum mismatch
>    Hashes of expected file:
>     - Filesize:115364 [weak]
>     -
SHA256:906afc78836447f892c7f063b5991641deb05e5688dc5cb6d6634c9c8543b0c5
>    Hashes of received file:
>    Release file created at: Wed, 13 Dec 2017 23:04:01 +0000
> E: Failed to fetch
file:/var/local/apt-repo/dists/ascii-security/main/binary-amd64/Packages.xz

> E: Some index files failed to download. They have been ignored, or old
ones used instead.

Here is the output of apt-get update after the workaround:
> root@duck:~# apt-get update
> Get:1 file:/var/local/apt-repo ascii InRelease [63.5 kB]
> Get:1 file:/var/local/apt-repo ascii InRelease [63.5 kB]
> Get:2 file:/var/local/apt-repo ascii-updates InRelease [63.5 kB]
> Get:3 file:/var/local/apt-repo ascii-security InRelease [62.9 kB]
> Get:2 file:/var/local/apt-repo ascii-updates InRelease [63.5 kB]
> Get:3 file:/var/local/apt-repo ascii-security InRelease [62.9 kB]
> Get:4 file:/var/local/apt/mirror/devuanfwojg73k6r.onion/devuan
ascii-proposed InRelease [122 kB]
> Get:4 file:/var/local/apt/mirror/devuanfwojg73k6r.onion/devuan
ascii-proposed InRelease [122 kB]
> Get:5 file:/var/local/apt-repo ascii/main Sources [8,675 kB]
> Get:6 file:/var/local/apt-repo ascii/main amd64 Packages [9,666 kB]
> Get:7 file:/var/local/apt-repo ascii-updates/main Sources [3,678 B]

> Get:8 file:/var/local/apt-repo ascii-updates/main amd64 Packages
[6,477 B]
> Get:9 file:/var/local/apt-repo ascii-security/main Sources [115 kB]

> Get:10 file:/var/local/apt-repo ascii-security/main amd64 Packages
[280 kB]
> Reading package lists... Done