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
Acquire::GzipIndexes true; with
Then delete and recreate the indexes:
sudo rm -rf /var/lib/apt/lists/* sudo apt update
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.