error upon apt-get autoremove

Asked by gopal

This is a HP Laptop with 2.5GB RAM and Ubuntu 9.10 installed.
I tried to enter the terminal command "sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts", in an attempt to update my java. This didn't properly go through, so I tried to re-issue this command but failed. When I tried to run sudo apt-get autoremove", it gives the error as follows:
E: Could not get lock /var/lib/dpkg/lock - open (1]: Resource temporarily unavailable)
E: Unable to lock the administration directory (var/lib/dpkg/), is another process using it?

Now, what is a clean up solution?
<email address hidden>

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

If you are sure that there are no other programs open that could possibly be using the package database, you can simply delete the lock file

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

If there is another process using the database, it is technically possible to munch your package manager.

you can get a list of processes using the file with

lsof | grep dpkg | grep lock

Revision history for this message
gopal (parathuruthil) said :
#2

Thanks.
I tried meanwhile to restart the notebook, and while the grub was just being loaded, pressed the ESC key to run maintenance. Clean and dpkg processes were run, and I opted not to continue some of the listed updates. Then I did a normal reboot.
I then found the file/folder /var/lib/dpkg/lock was of zero bytes. I didn't run the rm command.
Perhaps the problem is now resolved, I think

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#3

sudo fuser -vki /var/lib/dpkg/lock;sudo dpkg --configure -a

Will unlock the packages

Revision history for this message
gopal (parathuruthil) said :
#4

Thanks actionparsnip, that solved my question.