7

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? – GabrielaGarcia May 13 at 17:01
  • 1
    Is there a particular line that is extremely slower than the rest? – WinEunuuchs2Unix May 13 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? – farukdgn May 13 at 19:34
  • 1
    @WinEunuuchs2Unix No, they are all downloaded so quickly that I can't measure. – farukdgn May 13 at 19:36
  • 1
    Try running top while an update is in progress, to see what processes are hogging the CPU. – user535733 May 29 at 1:53
2
+50

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.

  • while some config file of the command-not-found package is trying to read the content of /var/lib/apt/lists/ it seems to be also possible that this directory is containing some error... – starkus May 30 at 10:13
  • ...so maybe it's not line 7 in your sources.list which is faulty, it could be the not shown line 8 which causes the trouble. You could regenerate your sources.list using a generator. Also you could move /var/lib/apt/lists/ to /var/lib/apt/lists.backup/ and run an apt update. – starkus May 31 at 4:59
0

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) – farukdgn May 29 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 at 14:58
0

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
0

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.

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.