Apt-Fast In Sparky Linux
Table of Contents
Background
I have an old eeePC netbook that I thought I'd revive by loading Sparky Linux onto it. One of the things I set up on it is apt-fast, which the README on the github repository describes like this:
apt-fast is a shellscript wrapper for apt-get and aptitude that can drastically improve apt download times by downloading packages in parallel, with multiple connections per package.
I've used it for a while on ubuntu but Sparky Linux didn't have it in the repositories. The apt-fast documentation has instructions for installing it on debian (and derivatives) and since Sparky Linux is based on debian (the current version, SparkyLinux 6.7 (Po-Tolo) is based on debian bullseye) I decided to try that. Ultimately I got it working, but as is often the case, it wasn't quite so straightforward as I would like for it to have been.
Unusual Ingredients List:
- SparkyLinux 6.7 (Po-Tolo)
- fish shell
The Intructions
Although the PPA system is built for Ubuntu, the recommendation from apt-fast is to use it with debian-based systems too (apt-fast is just a shell-script that runs aria2
and apt
(or apt-get
, etc.) so it's not like there's a lot of dependencies that might conflict). This is what they say to do.
Create An Apt Entry
First I created a file for the sources at /etc/apt/sources.list.d/apt-fast.list
and put these lines in it.
deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
Bionic came out in 2018 so they maybe haven't updated the instructions in a while.
Add the Keyring and Install
Once the file was in place I ran the commands.
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
apt-get update
apt-get install apt-fast
The first output I saw was a warning:
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
This is something I've seen on ubuntu as well so fixing it seemed like a useful thing to do, especially since at the end of the regular output I got an error.
Between the warning and the final error there was the usual output that I've seen:
Executing: /tmp/apt-key-gpghome.YL04bWmGAF/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
gpg: key 1EE2FF37CA8DA16B: public key "Launchpad PPA for apt-fast" imported
gpg: Total number processed: 1
gpg: imported: 1
Then came this, the error I mentioned, which is not what I usually see:
gpg: no writable keyring found: Not found
gpg: error reading '[stdin]': General error
gpg: import from '[stdin]' failed: General error
gpg: Total number processed: 0
I don't know if this is a debian problem or a sparky linux problem, but since you're not supposed to be using this method anyway, I went looking for a different solution.
The apt-key Solution
The Start of the Solution
The first part of the solution was pointed to by this Stack Overflow Answer. There was a problem with the answer, though, in that the person asking the question was using a URL that pointed to a gpg file, so the answers all assumed you could download it with curl, wget, etc. (all the answers that I could understand, anyway). So now that I had the answer I had a new problem - how do you get the file from the keyserver?
Getting the GPG File
Once again to the web, this time this answer from SuperUser seemed to work.
First, I made a temporary directory and pointed GNUPGHOME
to it so that I wasn't adding anything to my actual gpg setup (this is fish-shell syntax).
set -x GNUPGHOME $(mktemp -d)
echo $GNUPGHOME
showed that this created a file at /tmp/tmp.dUDUEgFQ0x
(but I didn't actually need to know that, I'm just mentioning it).
Taking the --recv-keys
argument from the instructions above (apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
) I added the key.
gpg --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
Next I made a place to put the gpg file.
sudo mkdir /etc/apt/keyrings
Then I output the file in my home directory (the GNUPGHOME
environment variable is only available to my user, so I put the file somewhere that I didn't need to be root, i.e. my home directory).
gpg -o A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg --export A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
Then I moved the file into the directory I created for it.
sudo mv A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg /etc/apt/keyrings/
The SuperUser answer I linked to used gpg -ao
but the a
option makes it an "armored" file, and part of the Stack Overflow answer for setting up the key is about de-armoring it so I just left that option out.
Now Back to Setting it Up
So now that we have the keyring we need to edit the /etc/apt/sources.list.d/apt-fast.list
file that we created at the beginning of this.
This is what I started with.
deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
And I changed it to refer to the gpg file that I created.
deb [signed-by=/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg] http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
deb-src [signed-by=/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg] http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main
Update and Install
So then I updated apt and installed it.
sudo apt update
sudo apt install apt-fast
And it worked.
And Now, Another Problem
This got me to a working apt-fast
installation but the fact that I was using bionic
seemed off to me so I decided to update the apt-fast.list
. Under the instructions for adding the PPA is this note.
Note that the PPA version bionic might need to be updated with the recent Ubuntu LTS codename to stay up-to-date.
So I went and looked up the Ubuntu Release Cycle and saw that "jammy" is the most recent version so I updated the apt-fast.list
file to match.
deb [signed-by=/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg] http://ppa.launchpad.net/apt-fast/stable/ubuntu jammy main
deb-src [signed-by=/etc/apt/keyrings/A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B.gpg] http://ppa.launchpad.net/apt-fast/stable/ubuntu jammy main
And then I installed the newer version.
sudo apt update
sudo apt install apt-fast
And I got a nice long stack-trace and error message at the bottom of which was this:
dpkg-deb: error: archive '/var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive /var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb (--unpack):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/apt-fast_1.9.12-1~ubuntu22.04.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
The part of it that seemed like it might matter the most was the fragment:
uses unknown compression for member 'control.tar.zst', giving up~
What is a zst
file? According to wikipedia it's a "Zstandard" file and Debian and Ubuntu added support for using it to compress deb
packages back in 2018. There is a package listed in apt
called zstd
that it says supports zst
compression so I installed it but the error remained.
Once again, someone ran into this and asked about it on Stack Exchange. One of the answers said:
Debian’s dpkg package didn’t support zstd compression prior to version 1.21.18. Support was added just in time for Debian 12.
Since the SparkyLinux install is based on Debian 11 that seemed like it might be the problem. I checked the dpkg-version and got back:
Debian 'dpkg' package management program version 1.20.12 (i386).
So that seemed like the likely culprit. The ubuntu release dates page noted that there was a LTS version between "bionic" and "jammy" called "focal" so I edited the apt-fast.list
file again, replacing "jammy" with "focal" and re-ran the installation and so far… it works.
What Have We Learned Today Children?
Further down in the installation instructions it says that you can just download the files and install them along with the aria2
package, so going through this whole thing was kind of unnecessary, but getting around the apt-key problem was something that I'd wondered about before, so it might be useful in the future, if PPA creators keep using it and they don't come up with an automatic fix for it.
I guess the main thing I learned is that I should have read to the end of the instructions and picked the easy way out instead of trying to force the old familiar way to work.
Links Collected
- FWDekker. Answer to “Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead” [Internet]. Stack Overflow. 2022 [cited 2023 Jun 16]. Available from: https://stackoverflow.com/a/71384057
- Kitt S. Answer to “zst compression not supported by apt/dpkg” [Internet]. Unix & Linux Stack Exchange. 2021 [cited 2023 Jun 16]. Available from: https://unix.stackexchange.com/a/669008
- fuzzydrawrings. Answer to “gpg: only download a key from a keyserver” [Internet]. Super User. 2021 [cited 2023 Jun 16]. Available from: https://superuser.com/a/1643115
- ilikenwf/apt-fast: apt-fast: A shellscript wrapper for apt that speeds up downloading of packages. [Internet]. [cited 2023 Jun 16]. Available from: https://github.com/ilikenwf/apt-fast
- zstd. In: Wikipedia [Internet]. 2023 [cited 2023 Jun 16]. Available from: https://en.wikipedia.org/w/index.php?title=Zstd&oldid=1157564498