1

I bought a new Raspberry Pi 2 with ARM processor architecture. Tonight I did an update via sudo apt-get update && sudo apt-get upgrade. I noticed, that it did update the dpkg package itself.

Now I wanted to install apache2 on the Raspbian system, but the dpkg binaries seem to be broken:

...
/usr/bin/dpkg-deb: 1: /usr/bin/dpkg-deb: Syntax error: word unexpected (expecting ")")
dpkg: Fehler beim Bearbeiten des Archivs /var/cache/apt/archives/apache2-data_2.4.10-10+deb8u3_all.deb (--unpack):
 Unterprozess dpkg-deb --control gab den Fehlerwert 2 zurück
...

For all none german speakers

"Fehler beim Bearbeiten des Archivs" means "An error occurred while processing the archive" and means "Unterprozess dpkg-deb --control gab den Fehlerwert 2 zurück" the "Subprocess dpkg-deb --control returned error code 2"

This happens to all packages I'm trying to install.

What can I do now?

  • It's a raspberry pi 2 running Raspbian (Debian) Jessy – chris.ribal Dec 16 '15 at 12:44
3

To restore the binaries without using dpkg, here's the "simple" approach, assuming your Raspberry Pi has binutils installed:

  • retrieve the dpkg package (the .deb file); it's probably still in /var/cache/apt/archives, otherwise you'll need to download it (from the pool; pick whichever version matches what you have installed)
  • extract the data.tar.gz file from the archive, somewhere safe: ar x dpkg_....deb data.tar.gz
  • extract dpkg-deb: tar xf data.tar.gz ./usr/bin/dpkg-deb
  • move dpkg-deb into place: sudo mv usr/bin/dpkg-deb /usr/bin

If you don't have binutils installed, you'll need to extract data.tar.gz on another computer (after installing binutils there if necessary).

  • Yes, i found it too. For everyone with the same problem (Raspberry PI 2, Raspbian Jessy), use the file: archive.raspbian.org/raspbian/pool/main/d/dpkg/…. I followed your instructions and it's working. THANKS! – chris.ribal Dec 16 '15 at 13:07
  • 2
    Be aware there are too many reports about corrupted and failed MicroSD cards. This time you managed to salvage your work. Keep several MicroSD cards at hand, and have always a recent backup. – Rui F Ribeiro Dec 16 '15 at 15:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.