Could not get lock /var/cache/apt/archives/lock

Asked by Randymanme

On Ubunut 11.10, I attempted to use Muon Package Manager to install Mint-Meta-Gnome-DVD. Muon got stuck preparing sun-java-jre; after an hour or so, I turned it off at the commandline. Now, when I attempt to run Synaptic, I first get a notification of a broken package. After selecting the broken package filter, synaptic indicates that the unmet dependency is resolved. When I attempt to reinstall or remove the partially installed Mint-Meta-Gnome-DVD, I get the following message:

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

And when I attempt to resolve the problem in the terminal, I get the following:

randyman@randyman-Dimension-8300:~$ sudo apt-get remove mint-meta-gnome-dvd
[sudo] password for randyman:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
sun-java6-plugin : Depends: sun-java6-bin (>= 6.26-1maverick1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
randyman@randyman-Dimension-8300:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
apg geoclue-ubuntu-geoip gnome-online-accounts gnome-control-center-data
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
sun-java6-bin sun-java6-jre
Suggested packages:
sun-java6-fonts ttf-kochi-gothic ttf-sazanami-gothic ttf-kochi-mincho
ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
sun-java6-bin sun-java6-jre
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
21 not fully installed or removed.
E:
E: Unable to lock directory /var/cache/apt/archives/
randyman@randyman-Dimension-8300:~$

What should I do? Any advice will be appreciated.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
enubuntu
Solved:
Last query:
Last reply:
Revision history for this message
Best enubuntu (mr.tennents) said :
#1
Revision history for this message
Randymanme (randall43215) said :
#2

Thank you, Enrico "eNry" Carafa (mr.tennents)

sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock

did it for me.

Revision history for this message
Randymanme (randall43215) said :
#3

Thanks Enrico "eNry" Carafa, that solved my question.

Revision history for this message
vijaysiva (vijaysiva5555) said :
#4

this commands also worked:

sudo killall apt-get