Monday, October 22, 2012

ubuntu dpkg no lock and status file

Problem:

Upgrade Ubuntu from 12.04 to 12.10 needs a long time, so I just keep the laptop to upgrade unplugged, when getting up, found the dpkg locked for the unusual shutdown, the stupid thing I did is:

Delete the lock, and the dpkg folder

The errors I got is:
       1) Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)
       2) Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Solution:

1) sudo mkdir /var/lib/dpkg/
    error 1) and 2) would disappear, however when apt-get update, a new error comes out:

    Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
2) sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

Now it works fine. 

Thanks the following references:

2 comments: