Unset LD_LIBRARY_PATH and LD_PRELOAD to avoid invalid ELF header

The error

    /data/data/com.termux/files/nix/bin/sh: error while loading shared libraries: /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so: invalid ELF header

it seems to happen  because of

    LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so

which doesn't support the .so file being a linker script

    .../files/nix $ cat ./nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so
    /* GNU ld script
       Use the shared library, but some functions are only in
       the static library, so try that secondarily.  */
    OUTPUT_FORMAT(elf64-littleaarch64)
    GROUP ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so.6 /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc_nonshared.a  AS_NEEDED ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/ld-linux-aarch64.so.1 ) )
This commit is contained in:
Kovacsics Robert 2023-03-12 22:54:31 +00:00
parent f6ecf3b932
commit 55cc8f0210

View file

@ -46,6 +46,11 @@ writeScript "login" ''
BIND_PROC_UPTIME="" BIND_PROC_UPTIME=""
fi fi
# See https://github.com/CypherpunkArmory/UserLAnd/issues/1333
unset LD_LIBRARY_PATH
unset LD_PRELOAD
exec ${installationDir}/bin/proot-static \ exec ${installationDir}/bin/proot-static \
-b ${installationDir}/nix:/nix \ -b ${installationDir}/nix:/nix \
-b ${installationDir}/bin:/bin! \ -b ${installationDir}/bin:/bin! \