The apt search is very slow in official Ubuntu bionic or focal images. E.g. time apt search firefox
takes around 8 minutes!
It seems, it is due to the lz4 compressed indexes in /var/lib/apt/lists
. I’ve found a workaround.
sudo nano /etc/apt/apt.conf.d/02compress-indexes
and replace Acquire::GzipIndexes true;
with Acquire::GzipIndexes false;
Then delete and recreate the indexes:
sudo rm -rf /var/lib/apt/lists/*
sudo apt update
Now the time apt search firefox
takes only 2 seconds!
But we are loosing some space, the /var/lib/apt/lists/
folder with lz4 compression is about 245MB, without it is 325MB. So by about 80MB more.