Skip to content

Ubuntu 10.04 i686, Badly broken dpkg

Recently had to fix a really badly broken dpkg database. I think this could also be useful for if you have gotten to a state where you just want to reinstall every single package currently on the machine…

I guess the instructions are not just for 10.04, but you will need to find the appropriate pacakges

To start, download the following packages from the Ubuntu Package Search:

  • dpkg
  • debconf
  • apt
  • apt-utils
cp -rf /var/lib/dpkg/info /var/lib/dpkg/info.back
rm -rf /var/lib/dpkg/info
dpkg --force-depends -i [[DPKG]]
dpkg --force-depends -i [[DEBCONF]]
dpkg --force-depends -i [[APT]]
dpkg --force-depends -i [[APT-UTILS]]

apt-get update
apt-get --reinstall install ucf
dpkg -l | grep ii | awk '{print "apt-get --reinstsall -y install", "$2"}' > /tmp/inst
chmod +x /tmp/inst

Posted in Linux. Tagged with , , , , .