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

NoOp glgxg at sbcglobal.net
Fri Jun 17 00:56:28 UTC 2011


On 06/16/2011 04:18 PM, Jordon Bedwell wrote:
> On 6/16/2011 1:52 PM, NoOp wrote:
>> $ 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]
> 
> 
> I literally deleted /var/lib/dpkg on one of my computers and then
> proceeded to figure out how to recover it and this is what I came up
> with and this is how I got the system restored (it's a bit rough but it
> works):

The:
# tar xzfv data.tar.gz
will rebuild the /var/lib/dpkg/ folders. So the 'mkdir /var/lib/dpkg/...
isn't necessary.

> 
> #~: sudo -i
> #~: rm -rf /var/cache/apt/archives
> #~: mkdir /var/lib/dpkg
> #~: mkdir /var/lib/dpkg/info
> #~: mkdir /var/lib/dpkg/parts
> #~: mkdir /var/lib/dpkg/alternatives
> #~: mkdir /var/lib/dpkg/methods
> #~: mkdir /var/lib/dpkg/updates
> #~: mkdir /var/cache/apt/archives
> #~: mkdir /var/cache/apt/archives/partial
> 
> #~: cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
> #~: cd /var/cache/apt/archives
> #~: dpkg --clear-avail
> #~: apt-get clean
> 
> #~: apt-get --reinstall -dy install $(dpkg --get-selections | grep
> 'install' | cut -f1)
> 
> #~: dpkg --force-depends -i ucf_*.deb
> #~: dpkg --force-depends -i *.deb
> 






More information about the ubuntu-users mailing list