When I run apt update, or any other apt, Im getting an error saying "illegal instruction", just like this:

pi@raspberrypi:~ $ sudo apt update
Illegal instruction

no other errormessages given. I followed this guide but that did not help.

I have previously been trying to install Debian (armhf) packages by dpkg -i. Might that have destroyed something?

2 Answers 2


It seems that apt or one of the shared library it uses is broken. apt depends on apt-get so you can try:

rpi ~$ sudo apt-get update

If it doesn't work then you can try to download the apt package and install it again with dpkg in the hope it will repair the broken programs. But first make a backup from your SD Card and check if you can restore it!

# download for stretch
rpi ~$ wget http://raspbian.raspberrypi.org/raspbian/pool/main/a/apt/apt_1.4.9_armhf.deb

# download for buster
rpi ~$ wget http://raspbian.raspberrypi.org/raspbian/pool/main/a/apt/apt_1.8.2_armhf.deb

But before installing apt, first deinstall all packages from debian:

rpi ~$ sudo dpkg --purge debian-package1-armhf   # and others
# ...
rpi ~$ sudo dpkg --install apt_1.4.9_armhf.deb   # for stretch
# or
rpi ~$ sudo dpkg --install apt_1.8.2_armhf.deb   # for buster

Good luck :-)


Unless you are absolutely sure of what you are doing don't mix Raspbian and Debian packages (or use any other repository other than Raspbian).

Debian for ARM uses a different ARM architecture (or it used to). It is targeted at more modern variants of the processor comapared to the rather old chips used in the Pi.

  • Thats what I have learned today. But how do I fix my problem? I would want to avoid to reinstall the whole system. Commented Jan 21, 2020 at 9:07
  • 3
    I suppose you would have to reinstall from Raspbian all those packages you installed from Debian. Possible simplest, certainly safest, to do a complete reinstall.
    – joan
    Commented Jan 21, 2020 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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