10

Original Problem

I have aarch64/arm64 version of Debian on a Raspberry Pi 3 B+ (2017) or Pi 4 (using an image from here). Now I want to run 32-bit (armhf/armv7) versions of some applications/libraries but they don't seem to work. Particular raspistill from the Raspbery Pi userland apps.

Question: If at all possible, how do I get raspistill (and other 32-bit arm binaries) to run on a 64-bit OS?

What I have tried:

Additional steps taken

Attempting to install libc6:armh

Using raspbian source

I tried installing libc6:armh with sudo apt-get install libc6:armhf, and I get the following message:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: libc6:armhf : Depends: libgcc1:armhf but it is not going to be installed E: Unable to correct problems, you have held broken packages.

If I then try sudo apt-get install libc6:armhf libgcc1:armhf, I get a long list of additional or new packages to be installed, suggested packages, and packages that will be removed. The last part of the message indicates this:

WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt adduser (due to apt) gpgv (due to apt) libapt-pkg5.0 (due to apt) libc6 (due to apt) libgcc1 (due to apt) libgnutls30 (due to apt) libseccomp2 (due to apt) libstdc++6 (due to apt) base-files base-passwd libdebconfclient0 (due to base-passwd) bash
  libtinfo6 (due to bash) debianutils (due to bash) bsdutils libsystemd0 (due to bsdutils) coreutils libacl1 (due to coreutils) libattr1 (due to coreutils) libselinux1 (due to coreutils) dash dpkg (due to dash) debconf (due to dash) diffutils libbz2-1.0 (due to dpkg)
  liblzma5 (due to dpkg) zlib1g (due to dpkg) tar (due to dpkg) e2fsprogs libblkid1 (due to e2fsprogs) libcom-err2 (due to e2fsprogs) libext2fs2 (due to e2fsprogs) libss2 (due to e2fsprogs) libuuid1 (due to e2fsprogs) fdisk libfdisk1 (due to fdisk)
  libmount1 (due to fdisk) libncursesw6 (due to fdisk) libsmartcols1 (due to fdisk) findutils grep libpcre3 (due to grep) gzip hostname init systemd-sysv (due to init) init-system-helpers (due to init) perl-base (due to init-system-helpers) libc-bin login
  libaudit1 (due to login) libpam0g (due to login) libpam-runtime (due to login) libpam-modules (due to login) mount util-linux (due to mount) ncurses-bin sed sysvinit-utils libcap-ng0 (due to util-linux) libudev1 (due to util-linux)
0 upgraded, 3 newly installed, 272 to remove and 1 not upgraded.
Need to get 2534 kB of archives.
After this operation, 718 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'

Using default debian source

I thought that I would temporarily remove the raspbian source from /etc/apt/sources.list and just use the default debian sources, but with the armhf architecture enables. Example from sources.list: deb [arch=arm64,armhf] http://deb.debian.org/debian buster main contrib non-free.

Now when I run sudo apt-get install libc6:armhf, I get an error stating: package architecture (armhf) does not match system (arm64). I get this error even after running sudo apt-get update, upgrade, dist-upgrade, clean and autoclean.

Get:2 http://deb.debian.org/debian buster/main armhf libgcc1 armhf 1:8.3.0-6 [37.2 kB]
Get:3 http://deb.debian.org/debian buster/main armhf libc6 armhf 2.28-10 [2390 kB]
Get:4 http://deb.debian.org/debian buster/main armhf libunistring2 armhf 0.9.10-1 [368 kB]
Get:5 http://deb.debian.org/debian buster/main armhf libidn2-0 armhf 2.0.5-1+deb10u1 [74.3 kB]
Fetched 3060 kB in 2s (1430 kB/s)
Preconfiguring packages ...
dpkg: error processing archive /var/cache/apt/archives/gcc-8-base_8.3.0-6_armhf.deb (--unpack):
 package architecture (armhf) does not match system (arm64)
dpkg: error processing archive /var/cache/apt/archives/libgcc1_1%3a8.3.0-6_armhf.deb (--unpack):
 package architecture (armhf) does not match system (arm64)
dpkg: error processing archive /var/cache/apt/archives/libc6_2.28-10_armhf.deb (--unpack):
 package architecture (armhf) does not match system (arm64)
dpkg: error processing archive /var/cache/apt/archives/libunistring2_0.9.10-1_armhf.deb (--unpack):
 package architecture (armhf) does not match system (arm64)
dpkg: error processing archive /var/cache/apt/archives/libidn2-0_2.0.5-1+deb10u1_armhf.deb (--unpack):
 package architecture (armhf) does not match system (arm64)
Errors were encountered while processing:
 /var/cache/apt/archives/gcc-8-base_8.3.0-6_armhf.deb
 /var/cache/apt/archives/libgcc1_1%3a8.3.0-6_armhf.deb
 /var/cache/apt/archives/libc6_2.28-10_armhf.deb
 /var/cache/apt/archives/libunistring2_0.9.10-1_armhf.deb
 /var/cache/apt/archives/libidn2-0_2.0.5-1+deb10u1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Running apt policy libc6:arm{hf,64} libgcc1:arm{hf,64} outputs:

libc6:armhf:
  Installed: (none)
  Candidate: 2.28-10
  Version table:
     2.28-10 990
        990 http://deb.debian.org/debian buster/main armhf Packages
libc6:
  Installed: 2.28-10
  Candidate: 2.28-10
  Version table:
 *** 2.28-10 990
        990 http://deb.debian.org/debian buster/main arm64 Packages
        100 /var/lib/dpkg/status
libgcc1:armhf:
  Installed: (none)
  Candidate: 1:8.3.0-6
  Version table:
     1:8.3.0-6 990
        990 http://deb.debian.org/debian buster/main armhf Packages
libgcc1:
  Installed: 1:8.3.0-6
  Candidate: 1:8.3.0-6
  Version table:
 *** 1:8.3.0-6 990
        990 http://deb.debian.org/debian buster/main arm64 Packages
        100 /var/lib/dpkg/status
zmike
  • 203
  • Do you have libc6:armhf installed? – Stephen Kitt Dec 21 '20 at 21:39
  • I tried installing libc6:armhf (on a test image) using apt-get along with a few dependencies, but it didn't work. apt did warn me that it was a dangerous alternative, and, unsurprisingly, this did lead to a kernel panic on reboot. – zmike Dec 22 '20 at 00:39
  • @StephenKitt any alternatives? – zmike Dec 22 '20 at 00:46
  • If you want to use multiarch to get 32-bit binaries running, you need libc6:armhf installed alongside libc6:arm64. Could you [edit] your question to include the information from your comment above, and add the exact messages shown by apt (informing you that it was a “dangerous alternative”)? – Stephen Kitt Dec 22 '20 at 08:09
  • @StephenKitt Updated the question – zmike Dec 22 '20 at 18:56
  • Is your system fully up-to-date? You need to run apt upgrade before attempting to install multiarch packages. – Stephen Kitt Dec 22 '20 at 19:09
  • @StephenKitt Yes it is, I ran sudo apt-get update, then upgrade and then dist-upgrade (to upgrade linux-image-arm64). – zmike Dec 22 '20 at 19:40
  • Could you show the output of apt policy libc6:arm{hf,64} libgcc1:arm{hf,64}? – Stephen Kitt Dec 22 '20 at 21:59
  • @StephenKitt I added the output to the question. – zmike Dec 23 '20 at 00:07
  • @francis No, haven't figured it out yet. We used 32-bit Raspbian for the time being – zmike Mar 02 '21 at 17:54

2 Answers2

6

I had the same issue (multiple package architecture (armhf) does not match system (arm64) when doing apt install libc6:armhf). For me executing dpkg --add-architecture armhf solved this problem.

FPK
  • 161
2

I had the exact same problem on the Raspi release of Ubuntu Mate Desktop 20.04. I tried installing Raspi Ubuntu Server 20.04 (no desktop) and then adding the armhf architecture and the :armhf libraries worked. I then installed the Mate desktop on this server installation and installed the 32 bit application (which required me to copy a custom 32 bit library to /usr/lib) and it worked. If your application needs Raspbian specific libraries, I'm not sure it will work doing the same but you can try.

Stephen Kitt
  • 434,908
francis
  • 21