0

After running apt-get update I receive the following errors:

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I tried what is written here:

rm /var/lib/apt/lists/lock

In this case, I'm able to run apt-get upgrade successfully. But after a reboot the issue is returned.

I searched for the problem. But I didn't find a solution. A tried what is written here, but I have no output for ps -aux | grep 'apt-get'.

I use Ubuntu 16.10.

SiGe
  • 329
  • 5
  • 20

2 Answers2

3

The problem

When the system is starting, Ubuntu checks for new security (and sometimes regular) updates. That can take a little while. While it checks, other Apt-related actions are prevented.

How to stop automatic checks for updates

It's not recommended to do this because it stops automatic installation of security fixes if you have those turned on, and it will prevent Ubuntu from telling you when there are updated software packages, but you can stop it from doing that:

  1. Run the System Settings application
  2. Go into Software & Updates
  3. Go to the Updates tab
  4. Switch Automatically check for updates to Never
Chai T. Rex
  • 5,193
0

This problem with apt-get being blocked by a lock-file has been solved in 5+ other questions, the search function is your friend =)

However, For the sake of highighting the most elegant solution, here is an answer by waltinator from this simular question:

At the console, type:

sudo lsof /var/lib/dpkg/lock

to find the process that owns the lock file

To kill the process locking the file, type:

sudo kill <process ID> or sudo kill -9 <process ID> (get the process ID from lsof output above)

If output is empty, remove the lock file with ...

sudo rm /var/lib/dpkg/lock or sudo rm -f /var/lib/dpkg/lock

CalMo
  • 111