E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

NoOp glgxg at sbcglobal.net
Thu Jun 16 18:52:46 UTC 2011


On 06/16/2011 09:38 AM, amritpal pathak wrote:
> On Wed, Jun 15, 2011 at 1:06 PM, NoOp <glgxg at sbcglobal.net> wrote:
> 
>> On 06/15/2011 02:07 AM, amritpal pathak wrote:
>> > when i try to install any software by terminal ,it says:
>> >  E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file
>> or
>> > directory)
>> >  E: Unable to lock the administration directory (/var/lib/dpkg/), are you
>> > root?
>> >
>> >  Tried to unlock as: sudo rm /var/lib/dpkg/lock .
>> >  It asked for password and then says:
>> >        rm: cannot remove `/var/lib/dpkg/lock': No such file or
>> >        directory i.e there is no suck a file/directory..but the  error
>> shows
>> > it.
>> >    i am admin of my system(of cource) then why it  is asking for "are you
>> > root" and m unable to open synaptic package manager too..
>>
>> What is the output of:
>> $ ls -al /var/lib/dpkg/
>>
>> ls: cannot access /var/lib/dpkg/: No such file or directory

I have *no* ideal if this will work or not, but I think it's worth a try:

$ sudo apt-get install --reinstall dpkg

If that doesn't work, then here is other possible solution:

Download the appropriate dpkg for your system (what version is it BTW?):
http://packages.ubuntu.com/search?searchon=names&keywords=dpkg

Example for maverick:
http://packages.ubuntu.com/maverick/dpkg
[Download dpkg]
Pick your version for 64 or 32bit.

Then go to where you downloaded the .deb file and change it to a .gz.
I'll use the maverick 32bit .deb file in the example, change to whatever
you require:

$ sudo -i
(enter your normal user password at the password prompt)
# ar x dpkg_1.15.8.4ubuntu3.1_i386.deb
# mv data.tar.gz /data.tar.gz
# cd /
# tar xzfv data.tar.gz
# exit
$ sudo apt-get update && sudo apt-get upgrade
$ sudo dpkg --configure -a
$ sudo apt-get install -f

Reference for the above:
http://www.debianhelp.co.uk/debianproblem.htm
[ What to do if the dpkg command is broken]





More information about the ubuntu-users mailing list