Ubuntu – 16.04 apt update never ends


It started few days ago. I'm running sudo apt update command and it never ends. Terminal output is

Get:1 http://ru.archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Hit:2 http://archive.canonical.com/ubuntu xenial InRelease                     
Hit:3 http://ppa.launchpad.net/attente/java-non-latin-shortcuts/ubuntu xenial InRelease
Hit:4 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Ign:5 http://dl.google.com/linux/chrome/deb stable InRelease                   
Hit:6 http://ru.archive.ubuntu.com/ubuntu xenial-updates InRelease             
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [94,5 kB]    
Hit:8 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:9 http://ru.archive.ubuntu.com/ubuntu xenial-backports InRelease           
Fetched 341 kB in 2s (150 kB/s)

While this proccess system fan speed is boosted on my laptop and it's kinda annoying to listen to this. There is no excessive cpu activity though. Can you guys hint me why it happens?

Best Answer

It's a bug. Look at https://bugs.launchpad.net/ubuntu/+source/appstream/+bug/1579712/. The problem is that the bug is affecting the update process, so you can't update. Catch 22.

So to solve it you have to manually install the broken packages.

If the system tried to do the update, you'll probably have a rogue appstreamcli running --- using 100% of your CPU; it will also have a lock held on the apt database, which will block any upgrade attempt.

To solve it, you have to kill the rogue appstreamcli --- ypu can find its PID by running top, and then

sudo kill <PID here>

The second step is to manually update the failing packages as in: (Notice: on a 64-bit system; if you run a 32 bit system you must change the links accordingly, using i386 in lieu of amd64)

cd /tmp && mkdir asfix
cd asfix
wget https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb
wget https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i *.deb

as posted in comment #24 of the bug report.

Now you can update your system; once you successfully do that, you can safely remove the downloaded packages.

Nice bug.

BTW --- this is the same as appstreamcli hanging with 100% CPU usage during update and apt-get is stuck at "Fetched XXKb in XXsec"