7

This question already has an answer here:

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?

marked as duplicate by Braiam, jokerdino May 21 '16 at 10:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

8

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
2

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.

enter image description here

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.

-1

You can find out which process(es) have /var/cache/app-info/xapian/default locked with lsof, then kill them with kill or pkill. However, if the program (aptd in this case) relies on the mere existence of /var/cache/app-info/xapian/default file, you will have to sudo /bin/rm /var/cache/app-info/xapian/default before trying again.

  • Isn't that a folder? In which case you'll have to use the -R flag. – Aaron Franke May 20 '16 at 3:12

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