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.

  • 1
    Have you tried another server?
    – user880592
    May 13 '19 at 17:01
  • 1
    Is there a particular line that is extremely slower than the rest? May 13 '19 at 17:32
  • @GabrielaGarcia No, but as I said, the files are downloaded immediately. If I execute apt update, it even says "Fetched 470 kB in 2s (271 kB/s)". Would it still be helpful if I tried other servers? May 13 '19 at 19:34
  • 1
    @WinEunuuchs2Unix No, they are all downloaded so quickly that I can't measure. May 13 '19 at 19:36
  • 1
    Try running top while an update is in progress, to see what processes are hogging the CPU.
    – user535733
    May 29 '19 at 1:53

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.


try running the following:

sudo apt update && sudo apt upgrade

This might update any outdated versions that may be breaking apt update.

Also, try reinstalling python3:

sudo apt purge python3 && sudo apt autoremove && sudo apt install python3

Hopefully this works.

  • 1
    apt upgrade doesn't solve it. I can't try your second suggestion because it tries to remove many of system packages (kde-runtime, kubuntu-desktop etc) May 29 '19 at 19:14
  • 1
    Do not ever remove the preinstalled python or python3! (unless you really know what you're doing.) Many important packages depend on it and will stop working. Fixing this can be troublesome.
    – Byte Commander
    May 31 '19 at 14:58

You should remove any old repositories from your computer. Then run

sudo apt update && sudo apt autoremove

and then

sudo apt update && sudo apt upgrade

It might work give a try.

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

I not at tried ubuntu 19.04 versions so i'm not sure but the above commands may help you.

  • APT says N: Be aware that removing the lock file is not a solution and may break your system. Jul 5 '20 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.