2

I'm customizing a Raspbian installation using qemu, i.e.:

systemd-nspawn -q --bind /usr/bin/qemu-arm-static -D $MOUNTPATH /bin/bash << EOF
DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND
apt-get install -y samba
EOF

My host machine runs Debian 9.9 and the target is Raspbian Buster. When I run such a command I get a lot of these errors:

ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

It seems it cannot expand the ${PLATFORM} variable. I'm not sure if this error comes from the host machine or the emulated target. Anyway I tried to:

export PLATFORM=v7l

in both host terminal and nspawn script, but nothing has changed. I also read the output of system-nspawn --help but I didn't find anything related to the platform.

What should I need to do?

1

The ${PLATFORM} pseudo-variable is actually a linker token that is embedded into the binaries and libraries to refer to other libraries, in order to permit them to find the right library for their platform when there are more than one possibility.

See man ld.so for more details, more specifically section "Rpath Token Expansion".

In the specific case of ${PLATFORM}, it's taken from the auxv vector. You can have ld.so dump that vector by running a command (basically, any command) with the LD_SHOW_AUXV=1 environment variable exported. You can also inspect the /proc/$pid/auxv file to find the auxv for a running process.

This will likely match the output of uname -m, but it's possible it will be uname -p or one of the other fields in the uname output.

I don't think you can control that from nspawn, since it's only really doing Linux namespaces, and perhaps you'll need actual virtualization to change what the platform looks like. If you can run this inside QEMU (for your Raspbian architecture) instead of nspawn, I'd bet that should solve the problem. Since QEMU would be booting a Linux kernel for the right platform, you should get the right settings to make this all work.

  • I'm not sure to understand all correctly. I don't want to boot the target system in a virtual environment, but I just want to run commands, like my example. Is it possible to do the same with QEMU? – Mark Aug 18 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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