1

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?

DumperJumper
  • 11
  • 1
  • 2

2 Answers2

1

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 :-)

Ingo
  • 42,107
  • 20
  • 85
  • 197
0

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.

joan
  • 71,024
  • 5
  • 73
  • 106
  • Thats what I have learned today. But how do I fix my problem? I would want to avoid to reinstall the whole system. – DumperJumper Jan 21 '20 at 09: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 Jan 21 '20 at 09:10