apt-get update is slow after 19.04

apt-get update (and apt update) command on my computer got very slow after upgrading to Ubuntu 19.04. There seems nothing wrong with the network since the downloads complete almost immediately. But the step after that (which does not print anything) takes incredibly long time (10 minutes or more). My hard drive seems working during that time.

enter image description here

I have cleared apt-get cache by both removing /var/apt/cache and using apt-get clear command but the problem persisted.

When I press Ctrl+C to end the process, the following message is printed out:

enter image description here

After seeing that message, I tried to execute apt-get update again and searched cnf-update-db in running processes.

enter image description here

There isn't a performance issue on my computer other than this one.

If I let the process complete once, it becomes faster in subsequent tries. But after some time, it becomes slow again.


It seems that your command-not-found package is corrupted somehow. You could purge it, remove its configuration, reinstall it and then reconfigure it as well as finally update it with:

sudo aptitude purge command-not-found
sudo aptitude purge ~c command-not-found
sudo aptitude install command-not-found
sudo dpkg-reconfigure command-not-found
sudo update-command-not-found

These are the files the command-not-found package contains: https://packages.ubuntu.com/en/disco/all/command-not-found/filelist

Good luck.