PDA

View Full Version : [ubuntu] Apt-get Lockfile error 21 File is a directory



NewbieNik
July 5th, 2009, 07:48 PM
OK, so I updated Jaunty 64bit around 3 weeks ago. Since then I cannot run any apt-get commands even using sudo and su.
Each time I get the error that says:-

E: Could not open lock file /var/lib/dpkg/lock - open (21 Is a directory)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Looking in the /var/lib/dpkg directory there is indeed a "lock" folder. I have tried renaming, removing and verbally abusing this folder, but each time it is immediately recreated. I have tried killing the update process, but not sure this worked as there was no difference (If someone could pass me the correct method to kill this process, it would be appreciated)

As this affects all apt-get commands I cannot run updates, purges nor forces.

So how do I fix this problem? I REALLY don't want to do another re-install (3rd one on this system)

Thanks in advance.

taurus
July 5th, 2009, 07:59 PM
What groups do you belong to? Do you belong to group admin?


id

NewbieNik
July 5th, 2009, 08:02 PM
Yeah, I'm in the sudoers.

Sudo-ing any command is fine, it's just the apt-get commands that fail as it is looking for a "lock" file in the /var/lib/dpkg folder, but can only find a folder...I assume.

As I said in the original post, this happens if I run it with SU so it's affecting the root user too.

taurus
July 5th, 2009, 08:11 PM
Does synaptic work? I have a lock file in /var/lib/dpkg and don't have any problem using apt-get from a terminal.



-rw-r----- 1 root root 0 2009-07-02 17:30 lock

NewbieNik
July 5th, 2009, 08:17 PM
Nah, Synaptic fubar'd too!

As I said, there is a lock FOLDER in /var/lib/dpkg, but no lock FILE. I cannot create a file because I cannot remove the folder. I assume this is because the update service is still running.
Is there a way I can find the PID of the update process and kill it? That way I can try creating a blank file with root only access and run apt or synaptic again.

Thanks for your help so far.

taurus
July 5th, 2009, 08:19 PM
ps -A

Soul-Sing
July 5th, 2009, 08:21 PM
mostly this is a problem when another package update / installation application is already running.(ad/remove/synaptic/apt-get)

if thats not the case
try:

sudo rm /var/lib/dpkg/lock

then should it say something about other lock..


sudo rm /var/cache/apt/archives/lock


sudo apt-get update

NewbieNik
July 5th, 2009, 08:33 PM
You my friend, are a star. I had to use the rmdir command for the /var/lib/dpkg/lock, but it's now running sweet. Must have been the cache that was replacing the folder.

Thank you, thank you ,thank you.

How do I close this thread?


mostly this is a problem when another package update / installation application is already running.(ad/remove/synaptic/apt-get)

if thats not the case
try:

sudo rm /var/lib/dpkg/lock

then should it say something about other lock..


sudo rm /var/cache/apt/archives/lock


sudo apt-get update

NewbieNik
July 5th, 2009, 08:43 PM
Ooooh, as an aside, that failed. Told me that /var/lib/dpkg/triggers was not a folder.
It was right, it was a file.

ran:-
sudo rm /var/lib/dpkg/triggers
sudo apt-get update

all working sweet as a sweet thing in a sweet place....sweet