2

When trying to deal with an error I accidentally deleted the /usr/bin/dpkg file and now I can't install packages anymore.

I'm still pretty new to linux so I'm not sure what I'm doing. Please help.

I use 20.04.2 LTS

1 Answers1

4

You have to manually download its package and get executable from it by

cd ~/Download
wget http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg/dpkg_1.19.7ubuntu3_amd64.deb
ar x dpkg_1.19.7ubuntu3_amd64.deb
tar -xf data.tar.xz
sudo cp usr/bin/dpkg /usr/bin/dpkg

And then reinstall it for sure by sudo apt-get install --reinstall dpkg .

N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • It might be worth noting that the downloaded `dpkg` version should match with your current Ubuntu release ... So probably try using `apt download dpkg` instead to automatically download the correct version given you have the correct repositories list. – Raffa Jun 29 '23 at 15:11