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.
Asked
Active
Viewed 7.8k times
5

muffin
- 151
2 Answers
3
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:

Manuel Jordan
- 1,768
- 7
- 30
- 50
-
1
-
1"The package dpkg needs to be reinstalled, but I can't find an archive for it." >> exact error listed – muffin Feb 03 '17 at 01:19
-
for the command
cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
, I am getting error,cp: cannot stat '/var/backups/dpkg.status.0': No such file or directory
– Varsh Feb 09 '21 at 05:54
1
I found a solution that worked for a user with a related problem...
sudo -i
mkdir /tmp/dpkg
cd /tmp/dpkg
#i386 version
wget https://launchpad.net/ubuntu/+archive/primary/+files/dpkg_1.18.4ubuntu1.1_i386.deb
or
#amd64 version
wget https://launchpad.net/ubuntu/+archive/primary/+files/dpkg_1.18.4ubuntu1.1_amd64.deb
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:

Manuel Jordan
- 1,768
- 7
- 30
- 50
-
1the dpkg package is no longer valid i guess? the wget returns a not found – muffin Feb 02 '17 at 04:46
-
1What does
w/
mean to a learner, please use full english words and not short hands! – George Udosen Feb 02 '17 at 05:10 -
1since you use wget to download the package to reinstall it, then you don't need to navigate to tmp where its stored temporary after installing it – Pavlos Theodorou Feb 02 '17 at 05:48
-
1
-
2sudo apt-get install --reinstall dpkg >> gives me the same error because apt-get requires dpkg but then dpkg is the one i need to reinstall.. – muffin Feb 02 '17 at 06:41
-
2This answer seems to be outright plagiarised from this one, but actively modified so that it doesn't actually work. – Michael Homer Jan 15 '19 at 21:15
-
@Michael Homer; I added the source to the bottom of my post. Also what do you recommend I do to fix this answer? – David your friend Jan 15 '19 at 21:59
-
I have re-proposed the edit; I don't have any other recommendation other than that honesty is the best policy. – Michael Homer Jan 15 '19 at 22:07
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
– David your friend Feb 02 '17 at 07:00cat /etc/apt/sources.list
Have you tried usingSynaptic
/Aptitude
to reinstall packages. – David your friend Feb 09 '17 at 04:01