dpkg: error: reading package info file ‘/var/lib/dpkg/updates/0000’: Is a directory

I’ve recently got a Banana Pi 3 that’s got Linux version 3.4.39-BPI-M3-Kernel on it.

I’ve tried installing apache2 and php on it, just like I did on a Raspberry Pi 0.

I’ve managed to install apache2 using this sudo apt-get install apache2 -y But I couldn’t install php. I used

sudo apt-get install php7.0 sudo apt-get install php7.1 sudo apt-get install php libapache2-mod-php -y  

I kept getting:

Unable to locate package php7.0 Unable to locate package php7.1 E: Unable to locate package php 

Then I’ve used sudo apt-get update and the command worked. Then I’ve used sudo apt-get upgrade and hell broke loose. It unpacked some things then I got this:

Preparing to unpack .../libgd3_2.1.0-5+deb8u13_armhf.deb ... Unpacking libgd3:armhf (2.1.0-5+deb8u13) over (2.1.0-5+deb8u12) ... packet_write_wait: Connection to port 22: Broken pipe 

Then I’ve tried again sudo apt-get upgrade and I got E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

Now I typed: sudo dpkg --configure -a and I got dpkg: error: reading package info file '/var/lib/dpkg/updates/0000': Is a directory

I went on google to find some answers and I found this And I did the following:

sudo rm /var/lib/dpkg/updates/0000 sudo apt-get clean sudo apt-get update 

It did some things and it broke a this line:

Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

Then I typed sudo dpkg --configure -a and I got a lot of things :

Setting up libgd3:armhf (2.1.0-5+deb8u13) ... Setting up libavutil54:armhf (6:11.12-1~deb8u7+rpi1) ... Setting up libavutil-dev (6:11.12-1~deb8u7+rpi1) ... Setting up libswscale3:armhf (6:11.12-1~deb8u7+rpi1) ... /var/lib/dpkg/info/libswscale3:armhf.postinst: 1: /var/lib/dpkg/info/libswscale3:armhf.postinst: Package:: not found /var/lib/dpkg/info/libswscale3:armhf.postinst: 2: /var/lib/dpkg/info/libswscale3:armhf.postinst: Status:: not found /var/lib/dpkg/info/libswscale3:armhf.postinst: 3: /var/lib/dpkg/info/libswscale3:armhf.postinst: Priority:: not found /var/lib/dpkg/info/libswscale3:armhf.postinst: 4: /var/lib/dpkg/info/libswscale3:armhf.postinst: Section:: not found /var/lib/dpkg/info/libswscale3:armhf.postinst: 5: /var/lib/dpkg/info/libswscale3:armhf.postinst: Installed-Size:: not found /var/lib/dpkg/info/libswscale3:armhf.postinst: 7: /var/lib/dpkg/info/libswscale3:armhf.postinst: Syntax error: newline unexpected dpkg: error processing package libswscale3:armhf (--configure):  subprocess installed post-installation script returned error exit status 2 Setting up libavresample2:armhf (6:11.12-1~deb8u7+rpi1) ... Setting up libavcodec56:armhf (6:11.12-1~deb8u7+rpi1) ... Setting up libavformat56:armhf (6:11.12-1~deb8u7+rpi1) ... Setting up libavresample-dev (6:11.12-1~deb8u7+rpi1) ... dpkg: dependency problems prevent configuration of libswscale-dev:  libswscale-dev depends on libswscale3 (= 6:11.12-1~deb8u7+rpi1); however:   Package libswscale3:armhf is not configured yet.  dpkg: error processing package libswscale-dev (--configure):  dependency problems - leaving unconfigured Setting up libavcodec-dev (6:11.12-1~deb8u7+rpi1) ... Setting up libavformat-dev (6:11.12-1~deb8u7+rpi1) ... Processing triggers for libc-bin (2.19-18+deb8u9) ... /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so.54 is not an ELF file - it has the wrong magic bytes at the start.  /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so is not an ELF file - it has the wrong magic bytes at the start.  Aborted /sbin/ldconfig.real: Can't stat /usr/local/XSGX/lib: No such file or directory /sbin/ldconfig.real: Can't stat /usr/lib/mali: No such file or directory /sbin/ldconfig.real: Path `/lib/arm-linux-gnueabihf' given more than once /sbin/ldconfig.real: Path `/usr/lib/arm-linux-gnueabihf' given more than once /sbin/ldconfig.real: Path `/usr/lib' given more than once /usr/lib:     libpord_seq-4.10.0.so -> libpord_seq-4.10.0.so     libmpiseq_seq-4.10.0.so -> libmpiseq_seq-4.10.0.so     libcedrus.so.1 -> libcedrus.so.1     libBLT.2.5.so.8.6 -> libBLT.2.5.so.8.6     libgnome-menu-3.so.0 -> libgnome-menu-3.so.0.0.1     libRTIMULib.so.7 -> libRTIMULib.so.7.2.1     libgettextsrc-0.19.3.so -> libgettextsrc-0.19.3.so     libblas.so.3 -> libblas.so.3gf     libjsoncpp.so.0 -> libjsoncpp.so.0.6.0     libportmidi.so.0 -> libportmidi.so.0.0.0     libopenblas.so.0 -> libopenblas_armv6p-r0.2.19.so     libgksu2.so.0 -> libgksu2.so.0.0.2     librevenge-stream-0.0.so.0 -> librevenge-stream-0.0.so.0.0.1     libgnome-desktop-3.so.10 -> libgnome-desktop-3.so.10.0.0     libcdio_paranoia.so.1 -> libcdio_paranoia.so.1.0.0     liblapack.so.3 -> liblapack.so.3gf     libexttextcat-2.0.so.0 -> libexttextcat-2.0.so.0.0.0     libodfgen-0.1.so.1 -> libodfgen-0.1.so.1.0.1     libgettextlib-0.19.3.so -> libgettextlib-0.19.3.so     libcmis-0.4.so.4 -> libcmis-0.4.so.4.0.1     libbind9.so.90 -> libbind9.so.90.0.9     libwps-0.3.so.3 -> libwps-0.3.so.3.0.0     libgsl.so.0 -> libgsl.so.0.17.0     libzmumps_seq-4.10.0.so -> libzmumps_seq-4.10.0.so     libgtkglext-x11-1.0.so.0 -> libgtkglext-x11-1.0.so.0.0.0     libcdio_cdda.so.1 -> libcdio_cdda.so.1.0.0     libopcodes-2.25-system.so -> libopcodes-2.25-system.so     libBLTlite.2.5.so.8.6 -> libBLTlite.2.5.so.8.6     libisc.so.95 -> libisc.so.95.5.0     libiso9660.so.8 -> libiso9660.so.8.0.0     libid3tag.so.0 -> libid3tag.so.0.3.0     libdmumps_seq-4.10.0.so -> libdmumps_seq-4.10.0.so     libbfd-2.25-system.so -> libbfd-2.25-system.so     libgltf-0.0.so.0 -> libgltf-0.0.so.0.0.2     libzbar.so.0 -> libzbar.so.0.2.0     liborcus-parser-0.8.so.0 -> liborcus-parser-0.8.so.0.0.0     libgme.so.0 -> libgme.so.0.5.3     libneon-gnutls.so.27 -> libneon-gnutls.so.27.3.1     libkate.so.1 -> libkate.so.1.3.0     libpigpioultrasonic.so -> libpigpioultrasonic.so.1     libboost_iostreams.so.1.53.0 -> libboost_iostreams.so.1.53.0     liblirc_client.so.0 -> liblirc_client.so.0.2.1     libpigpiod_if.so -> libpigpiod_if.so     libwpg-0.3.so.3 -> libwpg-0.3.so.3.0.0     libisccfg.so.90 -> libisccfg.so.90.1.0     libporttime.so.0 -> libporttime.so.0.0.0     libvcdinfo.so.0 -> libvcdinfo.so.0.2.0     librarian.so.0 -> librarian.so.0.0.0     libgviewrender-1.1.so.1 -> libgviewrender.so     libpigpiod_if2.so -> libpigpiod_if2.so     libetonyek-0.1.so.1 -> libetonyek-0.1.so.1.0.1     libcdr-0.1.so.1 -> libcdr-0.1.so.1.0.0     libsqlite.so.0 -> libsqlite.so.0.8.6     libcmumps_seq-4.10.0.so -> libcmumps_seq-4.10.0.so     libhyphen.so.0 -> libhyphen.so.0.3.0     libofa.so.0 -> libofa.so.0.0.0     libpigpio.so -> libpigpio.so     libboost_iostreams.so.1.50.0 -> libboost_iostreams.so.1.50.0     libsigc-1.2.so.5 -> libsigc-1.2.so.5.0.7     libgviewv4l2core-1.1.so.1 -> libgviewv4l2core.so     libvlccore.so.8 -> libvlccore.so.8.0.0     libsrtp.so.0 -> libsrtp.so.0.0     libwnck-1.so.22 -> libwnck-1.so.22.3.31     libv8.so.3.14.5 -> libv8.so.3.14.5     librevenge-0.0.so.0 -> librevenge-0.0.so.0.0.1     libdns.so.100 -> libdns.so.100.2.2     liborcus-mso-0.8.so.0 -> liborcus-mso-0.8.so.0.0.0     libresid-builder.so.0 -> libresid-builder.so.0.0.1     libmspub-0.1.so.1 -> libmspub-0.1.so.1.0.1     libmythes-1.2.so.0 -> libmythes-1.2.so.0.0.0     libhardsid-builder.so.0 -> libhardsid-builder.so.0.0.1     libmozjs185.so.1.0 -> libmozjs185.so.1.0.0     libpyglib-2.0-python2.7.so.0 -> libpyglib-2.0-python2.7.so.0.0.0     libabw-0.1.so.1 -> libabw-0.1.so.1.0.0     libvisio-0.1.so.1 -> libvisio-0.1.so.1.0.0     libpostproc.so.52 -> libpostproc.so.52.0.100     libsmumps_seq-4.10.0.so -> libsmumps_seq-4.10.0.so     librevenge-generators-0.0.so.0 -> librevenge-generators-0.0.so.0.0.1     libisccc.so.90 -> libisccc.so.90.0.6     libmodplug.so.1 -> libmodplug.so.1.0.0     libipopt.so.1 -> libipopt.so.1.9.9     libsidplay2.so.1 -> libsidplay2.so.1.0.1     libxklavier.so.16 -> libxklavier.so.16.2.0     libpisock.so.9 -> libpisock.so.9.0.2     libmwaw-0.3.so.3 -> libmwaw-0.3.so.3.0.1     liblwres.so.90 -> liblwres.so.90.0.7     liblangtag.so.1 -> liblangtag.so.1.2.0     libe-book-0.1.so.1 -> libe-book-0.1.so.1.0.1     libcompface.so.1 -> libcompface.so.1.0.0     libmumps_common_seq-4.10.0.so -> libmumps_common_seq-4.10.0.so     libgtop-2.0.so.7 -> libgtop-2.0.so.7.2.0     libgslcblas.so.0 -> libgslcblas.so.0.0.0     libxapian.so.22 -> libxapian.so.22.6.6     libeot.so.0 -> libeot.so.0.0.0     libboost_iostreams.so.1.49.0 -> libboost_iostreams.so.1.49.0     libcmis-c-0.4.so.4 -> libcmis-c-0.4.so.4.0.1     libvte2_90.so.9 -> libvte2_90.so.9.3600.3     libgviewencoder-1.1.so.1 -> libgviewencoder.so     libwebcam.so.0 -> libwebcam.so.0.2.4     libgviewaudio-1.1.so.1 -> libgviewaudio.so     libvlc.so.5 -> libvlc.so.5.5.0     libwpd-0.10.so.10 -> libwpd-0.10.so.10.0.0     libmimic.so.0 -> libmimic.so.0.0.1     libpulsecore-5.0.so -> libpulsecore-5.0.so     libfreehand-0.1.so.1 -> libfreehand-0.1.so.1.0.0     libident.so.0 -> libident.so.0.22     libgdkglext-x11-1.0.so.0 -> libgdkglext-x11-1.0.so.0.0.0     libtwolame.so.0 -> libtwolame.so.0.0.0     libcdio.so.13 -> libcdio.so.13.0.0     libvte.so.9 -> libvte.so.9.2800.2     liborcus-0.8.so.0 -> liborcus-0.8.so.0.0.0 /opt/vc/lib:     libOpenVG.so -> libOpenVG.so     libmmal_util.so -> libmmal_util.so     libbrcmWFC.so -> libbrcmWFC.so     libopenmaxil.so -> libopenmaxil.so     libbrcmGLESv2.so -> libbrcmGLESv2.so     libbrcmOpenVG.so -> libbrcmOpenVG.so     libdebug_sym.so -> libdebug_sym.so     libelftoolchain.so -> libelftoolchain.so     libcontainers.so -> libcontainers.so     libmmal_components.so -> libmmal_components.so     libmmal.so -> libmmal.so     libvchiq_arm.so -> libvchiq_arm.so     libmmal_vc_client.so -> libmmal_vc_client.so     libWFC.so -> libWFC.so     libEGL.so -> libEGL.so     libbrcmEGL.so -> libbrcmEGL.so     libbcm_host.so -> libbcm_host.so     libdtovl.so -> libdtovl.so     libvcsm.so -> libvcsm.so     libmmal_core.so -> libmmal_core.so     libGLESv2.so -> libGLESv2.so     libvcos.so -> libvcos.so /lib/arm-linux-gnueabihf:     libselinux.so.1 -> libselinux.so.1     libkmod.so.2 -> libkmod.so.2.2.8     libisc-export.so.95 -> libisc-export.so.95.5.0     libply.so.4 -> libply.so.4.0.0     libSegFault.so -> libSegFault.so     libsmartcols.so.1 -> libsmartcols.so.1.1.0     libext2fs.so.2 -> libext2fs.so.2.4     libirs-export.so.91 -> libirs-export.so.91.0.0     libexpat.so.1 -> libexpat.so.1.6.0     libmemusage.so -> libmemusage.so     libdbus-1.so.3 -> libdbus-1.so.3.8.14     libglib-2.0.so.0 -> libglib-2.0.so.0.4200.1     libwrap.so.0 -> libwrap.so.0.7.6     libgcrypt.so.20 -> libgcrypt.so.20.0.3     libslang.so.2 -> libslang.so.2.3.0     liblzo2.so.2 -> liblzo2.so.2.0.0     librt.so.1 -> librt-2.19.so     libnss_mdns.so.2 -> libnss_mdns.so.2     libdl.so.2 -> libdl-2.19.so     libcap.so.2 -> libcap.so.2.24     libacl.so.1 -> libacl.so.1.1.0     libreadline.so.6 -> libreadline.so.6.3     libattr.so.1 -> libattr.so.1.1.0     libnss_mdns4_minimal.so.2 -> libnss_mdns4_minimal.so.2     libpcprofile.so -> libpcprofile.so     libbsd.so.0 -> libbsd.so.0.7.0     libcryptsetup.so.4 -> libcryptsetup.so.4.6.0     libnss_nis.so.2 -> libnss_nis-2.19.so     libtirpc.so.1 -> libtirpc.so.1.0.10     libaudit.so.1 -> libaudit.so.1.0.0     libfuse.so.2 -> libfuse.so.2.9.3     libmnl.so.0 -> libmnl.so.0.1.0     libhistory.so.6 -> libhistory.so.6.3     libthread_db.so.1 -> libthread_db-1.0.so     libusb-1.0.so.0 -> libusb-1.0.so.0.1.0     libnl-3.so.200 -> libnl-3.so.200.19.0     libcidn.so.1 -> libcidn-2.19.so     libgcc_s.so.1 -> libgcc_s.so.1     libnsl.so.1 -> libnsl-2.19.so     libuuid.so.1 -> libuuid.so.1.3.0     libe2p.so.2 -> libe2p.so.2.3     libply-splash-graphics.so.4 -> libply-splash-graphics.so.4.0.0     libsepol.so.1 -> libsepol.so.1     libpcre.so.3 -> libpcre.so.3.13.1     libblkid.so.1 -> libblkid.so.1.1.0     libnss_nisplus.so.2 -> libnss_nisplus-2.19.so     libiw.so.30 -> libiw.so.30     libc.so.6 -> libc-2.19.so     libpamc.so.0 -> libpamc.so.0.82.1     libpam_misc.so.0 -> libpam_misc.so.0.82.0     libulockmgr.so.1 -> libulockmgr.so.1.0.1     libsysfs.so.2 -> libsysfs.so.2.0.1     libparted.so.2 -> libparted.so.2.0.1     libdevmapper.so.1.02.1 -> libdevmapper.so.1.02.1     libudev.so.1 -> libudev.so.1.5.0     libisccfg-export.so.90 -> libisccfg-export.so.90.1.0     libnss_mdns6.so.2 -> libnss_mdns6.so.2     libply-splash-core.so.4 -> libply-splash-core.so.4.0.0     libBrokenLocale.so.1 -> libBrokenLocale-2.19.so     libnss_files.so.2 -> libnss_files-2.19.so     libatasmart.so.4 -> libatasmart.so.4.0.5     libnss_hesiod.so.2 -> libnss_hesiod-2.19.so     liblzma.so.5 -> liblzma.so.5.0.0     libdns-export.so.100 -> libdns-export.so.100.2.2     libss.so.2 -> libss.so.2.0     libpthread.so.0 -> libpthread-2.19.so     libutil.so.1 -> libutil-2.19.so     libnss_mdns6_minimal.so.2 -> libnss_mdns6_minimal.so.2     libjson-c.so.2 -> libjson-c.so.2.0.0     libcom_err.so.2 -> libcom_err.so.2.1     libm.so.6 -> libm-2.19.so     libncursesw.so.5 -> libncursesw.so.5.9     libsystemd.so.0 -> libsystemd.so.0.3.1     libnss_mdns4.so.2 -> libnss_mdns4.so.2     libresolv.so.2 -> libresolv-2.19.so     libnss_dns.so.2 -> libnss_dns-2.19.so     libanl.so.1 -> libanl-2.19.so     libudev.so.0 -> libudev.so.0.13.0     libkeyutils.so.1 -> libkeyutils.so.1.5     libpng12.so.0 -> libpng12.so.0.50.0     libnfsidmap.so.0 -> libnfsidmap.so.0.3.0     libusb-0.1.so.4 -> libusb-0.1.so.4.4.4     libncurses.so.5 -> libncurses.so.5.9     libmount.so.1 -> libmount.so.1.1.0     libply-boot-client.so.4 -> libply-boot-client.so.4.0.0     libpam.so.0 -> libpam.so.0.83.1     libtinfo.so.5 -> libtinfo.so.5.9     libz.so.1 -> libz.so.1.2.8     libcrypt.so.1 -> libcrypt-2.19.so     libbz2.so.1.0 -> libbz2.so.1.0.4     libnl-genl-3.so.200 -> libnl-genl-3.so.200.19.0     libpopt.so.0 -> libpopt.so.0.0.0     libnss_mdns_minimal.so.2 -> libnss_mdns_minimal.so.2     libprocps.so.3 -> libprocps.so.3.0.0     libnss_compat.so.2 -> libnss_compat-2.19.so     libgpg-error.so.0 -> libgpg-error.so.0.13.0 /sbin/ldconfig.real: /lib/arm-linux-gnueabihf/ld-2.19.so is the dynamic linker, ignoring      ld-linux-armhf.so.3 -> ld-2.19.so /usr/lib/arm-linux-gnueabihf: /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so.54 is not an ELF file - it has the wrong magic bytes at the start.  /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so is not an ELF file - it has the wrong magic bytes at the start.  Aborted dpkg: error processing package libc-bin (--configure):  subprocess installed post-installation script returned error exit status 134 Errors were encountered while processing:  libswscale3:armhf  libswscale-dev  libc-bin 

Then I went again online and found this

And I typed: sudo rm /var/cache/ldconfig/aux-cache and /sbin/ldconfig.

And this is what it returned:

/sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so.54 is not an ELF file - it has the wrong magic bytes at the start.  /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libavutil.so is not an ELF file - it has the wrong magic bytes at the start.  Aborted 

Then on the same thread I found sudo apt-get --reinstall install libc-bin and I hit it.

And it returned an error:

Reading package lists... Done Building dependency tree        Reading state information... Done The following packages were automatically installed and are no longer required:   libmng1 libqtgui4 Use 'apt-get autoremove' to remove them. The following packages will be upgraded:   libc-bin 1 upgraded, 0 newly installed, 0 to remove and 321 not upgraded. 3 not fully installed or removed. Need to get 1206 kB of archives. After this operation, 1024 B of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libc-bin armhf 2.19-18+deb8u10 [1206 kB] Fetched 1206 kB in 0s (1762 kB/s) Can't set locale; make sure $  LC_* and $  LANG are correct! Reading changelogs... Done perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:     LANGUAGE = (unset),     LC_ALL = (unset),     LC_MONETARY = "ro_RO.UTF-8",     LC_ADDRESS = "ro_RO.UTF-8",     LC_TELEPHONE = "ro_RO.UTF-8",     LC_NAME = "ro_RO.UTF-8",     LC_MEASUREMENT = "ro_RO.UTF-8",     LC_IDENTIFICATION = "ro_RO.UTF-8",     LC_NUMERIC = "ro_RO.UTF-8",     LC_PAPER = "ro_RO.UTF-8",     LANG = "en_US.UTF-8"     are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory dpkg: warning: files list file for package 'qtchooser' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'qdbus' missing; assuming package has no files currently installed dpkg: unrecoverable fatal error, aborting:  unable to open files list file for package `libswscale-dev': Input/output error E: Sub-process /usr/bin/dpkg returned an error code (2) 

And know I’m posting here because I have no idea what is happening, what I did or how to fix it. So, as you can see I am not a Linux user. If this happened on Windows I would’ve reinstalled it. But this, I have no idea what to do and I don’t want to break it even further.