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