Okay I haven't tried this, but it should work I think.
First boot from a live CD.
Next open a terminal and type
sudo fdisk -l
From this you want to determine the partition that your Ubuntu installation is on. If you have only one hard drive it will be
X is the partition number.
Next mount the Ubuntu installation's partition replacing
X with the correct partition number.
sudo mount /dev/sdaX /mnt
Next navigate to the directory where
dpkg_22.214.171.124ubuntu7_amd64.deb is and use this command:
sudo dpkg --root=/mnt -i dpkg_126.96.36.199ubuntu7_amd64.deb
Hopefully this will work, and you can reboot into your Ubuntu installation and find that
dpkg has been reinstalled. If there are any errors let me know and I will try to help you.
I've been reading through the
dpkg manpage and I think the command I suggested above might not work. Here are the relevant sections of the manpage for reference.
Change default administrative directory, which contains
many files that give information about status of
installed or uninstalled packages, etc. (Defaults to
Change default installation directory which refers to the
directory where packages are to be installed. instdir is
also the directory passed to chroot(2) before running
package's installation scripts, which means that the
scripts see instdir as a root directory. (Defaults to /)
Changing root changes instdir to dir and admindir to
--root=dir as I suggested would set the admin folder to
/mnt/var/lib/dpkg--the folder that you deleted.
Instead try this:
sudo dpkg --force-overwrite --instdir=/mnt -i dpkg_188.8.131.52ubuntu7_amd64.deb
This will use the liveCD's
/var/lib/dpkg folder, but the
--force-overwrite flag should make it install even though it thinks the package is already installed.
While this should work to reinstall
dpkg I don't think it will rebuild the package lists that are in
/var/lib/dpkg. Following the advice in izx's comment to copy the directories/file from a liveCD and go from their is probably your best bet.