# Fix E: Could not get lock /var/cache/apt/archives/lock

### Problem:

E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/

She was trying to follow one of the tips mentioned in things to do to after installing Ubuntu 14.04 when she encountered this error. Its one of the common occurring update errors in Ubuntu and also one of the least annoying ones.

### Reason:

If you are wondering what caused this error in the first place, the reason is quite evident in the error itself. The error says: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable). And this is what precisely happening.

While you are trying to install some package with apt command, some other package manager is running or an update is going on.

It is possible that you have Software Center open or another terminal is using the apt or apt-get commands.

### Solution:

The first and foremost thing is to do nothing. I mean once the other program that is using the resource completes the process, the resources will be available again.

Otherwise, look for other programs that might be using apt. Close that program.

You can also search if there is an instance of apt command running (use ps aux | grep -i apt) and then kill the process.

An easier way to do that would be to use the killall command:

sudo killall apt-get


If the above commands don’t fix the issue of E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable), try the following commands one by one to fix the issue:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock


The above commands remove the lock files and thus apt and dpkg packag management process are free to be used again. Though not necessary, you may need to reconfigure dpkg with the command below:

sudo dpkg --configure -a


I hope this quick tip helps in solving this common update error in Ubuntu. Any questions or suggestions are welcomed. Ciao 🙂