How to reinstall dpkg

I always get this error when I attempt to install a package using apt-get. I would appreciate help. This seems a common problem with every other package, but I've never encountered a problem with the dpkg itself.

enter image description here

4

2 Answers

Ubuntu dpkg recovery

Recover dpkg status file

cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

Reinstall - dpkg

cd /var/cache/apt/archives/
dpkg --force-depends -i dpkg_*.deb

Reinstall - apt

cd /var/cache/apt/archives/
dpkg --force-depends -i apt_*.deb
dpkg --force-depends -i apt-utils_*.deb
apt-get update

Missing files in /var/lib/dpkg/info?

Use dpkg to list installed packages..

dpkg -l | grep ii

Reinstall from output using apt...

dpkg -l | grep ii | awk '{print "apt-get --reinstall -y install", $2}' > /tmp/reinstall

Now, install ucf which may be of importance to installation of kernel or others...

apt-get --reinstall install ucf

Source:

3

I found a solution that worked for a user with a related problem...

sudo -i
mkdir /tmp/dpkg
cd /tmp/dpkg
#i386 version
wget
or
#amd64 version
wget
ar x dpkg*.deb data.tar.gz
tar xfvz data.tar.gz ./usr/bin/dpkg
sudo cp ./usr/bin/dpkg /usr/bin/
sudo apt-get update
sudo apt-get install --reinstall dpkg

Source:

8

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like