I cannot run apt update properly - apt update hangs [duplicate]
Version: Ubuntu 16.04
I have used it some weeks, but now it gives me this message when I'm trying to install software and update or upgrade:
Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
/var/lib/apt/lists/ locked
followed by this:
Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable).
and another error:
** (appstreamcli:4560): WARNING **: Exception: Unable to get write lock on /var/cache/app-info/xapian/default: already locked
What should I do?
I just encountered the same issue. The solution is to delete away the lock files in the xapian/default folder:
sudo rm /var/cache/app-info/xapian/default/flintlock /var/lib/dpkg/lock
Generally this means that the update process is already running. But in this special case it seems to be a temporarily problem with the Ubuntu repositories update servers today. When you start the computer, the system searches for updates automatically. When you run sudo apt update
manually at the same time you receive this message. Today the reason is different, there seems to be an appstream
bug. Even when the update process is not running and you execute sudo apt update
the process does not complete successfully and the CPU usage gets stuck on 100%. As a workaround -> disable the xenial-backports
repository and run sudo apt update
again. Now the error should be gone. The bug already has been reported and confirmed on Launchpad.
Reference - bug reports addressing the issue on Launchpad - already confirmed by several users :
Refresh hangs indefinitely, appstreamcli using 100% CPU and apt-get update hangs after hit/get
Update information 2016-05-20 11.00 UTC : solution available in Ubuntu repositories
A fix has been released : appstream 0.9.4-1ubuntu1
libappstream3 0.9.4-1ubuntu1
.
After having upgraded to this appstream
version you can re-enable xenial-backports
.