site  contact  subhomenews

Cannot execute usrmerged binaries on non-usrmerged OS

September 09, 2023 — BarryK

Building what is intended to be EasyOS 5.5 in woofQ, host OS is Easy 5.4.10. Building with packages compiled in OE with the "usrmerge" flag set in DISTRO_FEATURES, reported earlier:

https://bkhome.org/news/202309/openembedded-version-4012-release-r4-compiled.html

Have run '3buildeasydistro' and got a surprise failure. The script creates the drive-image file 'easy-5.5-amd64.img' and performs this operation:

# SKELETON_NAME=easy-5.5-amd64
# LOOP3="$(losetup -f)"
# echo $LOOP3
/dev/loop2
# losetup ${LOOP3} ${SKELETON_NAME}.img
# rootfs-complete/usr/bin/limine-deploy ${LOOP3} --force-mbr
bash: rootfs-complete/usr/bin/limine-deploy: No such file or directory

Hmmm, this has always worked, until now. From previous experience, that very misleading "No such file or directory" error can occur if the OS is unable to find 'ld-linux-x86-64.so.2'. OK, some tests:

# file rootfs-complete/usr/bin/limine-deploy
rootfs-complete/usr/bin/limine-deploy: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld-linux-x86-64.so.2, BuildID[sha1]=b17135abe549bbff3c1d71f448c703879c3954d3, for GNU/Linux 3.2.0, stripped

# ls -l rootfs-complete/usr/bin/limine-deploy
-rwxr-xr-x 1 root root 43048 Sep 9 10:39 rootfs-complete/usr/bin/limine-deploy

# ldd rootfs-complete/usr/bin/limine-deploy
linux-vdso.so.1 (0x00007ffeab7af000)
libc.so.6 => /lib/libc.so.6 (0x00007f516e8aa000)
/usr/lib/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f516eabf000)

The same version of 'limine-deploy' compiled in OE, "r3", without "usrmerge" flag, works. Comparing the two:

# cmp /usr/bin/limine-deploy rootfs-complete/usr/bin/limine-deploy
/usr/bin/limine-deploy rootfs-complete/usr/bin/limine-deploy differ: byte 153, line 1

It is not just 'limine-deploy', none of the binary executables in rootfs-complete/usr/bin work, they all give "No such file or directory". For example:

# rootfs-complete/usr/bin/limine-version
bash: rootfs-complete/usr/bin/limine-version: No such file or directory

However, if chroot:

# chroot rootfs-complete /usr/bin/limine-version
4.20230503.0

Binary executables from Void Linux do work in Easy 5.4.10.

What I am concluding from this is that the "usrmerge" flag in OE is bad news. It really does not have to be set. All of the /lib etc symlinks will assure that shared libraries are found.  So, looks like will do another recompile in OE without that flag. That will take about 1 day (24 hours) plus 15 hours.

EDIT:
As mentioned above, the error occurs because 'ld-linux-x86-64.so.2' cannot be found. So the binaries compiled in a non-usr-merged OS will not work as-is, but they will work after creating a symlink. Before:

# rootfs-complete/usr/bin/limine-version
bash: rootfs-complete/usr/bin/limine-version: No such file or directory

Create the symlink:

# ln -s /lib/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2

Now:

# rootfs-complete/usr/bin/limine-version
4.20230503.0

So perhaps I won't recompile in OE.  

Tags: easy