Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocation type "0x2a" error running bash. Unable to run bash in nixOS #968

Open
Yeshey opened this issue Jun 10, 2024 · 1 comment
Open

Comments

@Yeshey
Copy link

Yeshey commented Jun 10, 2024

Trying to test the box86 package for nixOS.

I have a aarch64 machine and a x86_64 PC. I'm using my x86_64 PC to build binaries and sending them to the aarch64 server
Using the debug commands from this issue I'm getting the following:

# in the x86_64 PC
> nix-build "<nixpkgs>" --argstr system "i686-linux" -A bash
/nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26
> /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash --version
GNU bash, version 5.2.26(1)-release (i686-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
> ll
lrwxrwxrwx - root 10 jun 17:19  result -> /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26
> nix copy --to ssh://[email protected] /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26

# in aarch64 machine
> export LD_LIBRARY_PATH="$(for lib in ncurses glibc; do nix-build '<nixpkgs>' -A pkgsCross.armv7l-hf-multiplatform.${lib} --no-out-link; done | xargs -I {} echo -n {}/lib: | sed 's/:$//')"
> echo $LD_LIBRARY_PATH                                                                                                       18:26:24
/nix/store/74gp2wabmv0cqwhpsjmglpzlwvyvd2r5-ncurses-armv7l-unknown-linux-gnueabihf-6.4/lib:/nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib
> box86 /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash                                                      18:25:45
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
Error: PltResolver: Symbol __isoc23_strtoimax(ver 10: __isoc23_strtoimax@GLIBC_2.38) not found, cannot apply R_386_JMP_SLOT 0x813ec88 (0x805d2e6) in /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash
> BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_PREFER_EMULATED=1 BOX86_EMULATED_LIBS=libc.so.6 BOX86_DYNAREC=0 BOX86_SHOWSEGV=1 BOX86_SHOWBT=1 box86 /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash
Debug level is 1
Dynarec is off
Shows details of dlopen / dlsym /dlclose : Yes
Show Segfault signal even if a signal handler is present
Show Backtrace for signals
Running on Neoverse-N1 with 4 Cores
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
BOX86 will force the used of emulated libs for libc.so.6 
Using default BOX86_PATH: ./:bin/
BOX86: Prefer Emulated libs
Counted 107 Env var
Looking for /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash
bash detected, disabling banner
Rename process to "bash"
Using native(wrapped) libdl.so.2
Using emulated /nix/store/756q2acnjgi6ym709gw1f3jp0ciqwib1-glibc-2.39-52/lib/libc.so.6
Redirecting overridden malloc function for /nix/store/756q2acnjgi6ym709gw1f3jp0ciqwib1-glibc-2.39-52/lib/libc.so.6
Using emulated /nix/store/756q2acnjgi6ym709gw1f3jp0ciqwib1-glibc-2.39-52/lib/ld-linux.so.2
Warning, don't know of to handle rel #2 type: 0x2a (unknown) (0x60432b00) for 
Warning, don't know of to handle rel #91 type: 0x2a (unknown) (0x60227c74) for 
Warning, don't know of to handle rel #19 type: 0x2a (unknown) (0x60227e74) for 
Warning, don't know of to handle rel #20 type: 0x2a (unknown) (0x60227e6c) for 
Warning, don't know of to handle rel #21 type: 0x2a (unknown) (0x60227e64) for 
Warning, don't know of to handle rel #22 type: 0x2a (unknown) (0x60227e58) for 
Warning, don't know of to handle rel #23 type: 0x2a (unknown) (0x60227e34) for 
Warning, don't know of to handle rel #24 type: 0x2a (unknown) (0x60227e30) for 
Warning, don't know of to handle rel #25 type: 0x2a (unknown) (0x60227e24) for 
1690244|SIGSEGV @0x62aace58 (???(/nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash/0x62aace58)) (x86pc=0x24ab0/???:"???", esp=0x41a601fc, stack=0x41269000:0x41a69000 own=(nil) fp=(nil)), for accessing 0x24ab0 (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0)
ESP-0x10:0x00000000 ESP-0x0c:0x00000000 ESP-0x08:0x00000000 ESP-0x04:0x00000000
ESP+0x00:0x40a70010 ESP+0x04:0x00000001 ESP+0x08:0x41a60210 ESP+0x0c:0x41a60218
Native bactrace:
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x628fb2a4]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(__default_rt_sa_restorer+0) [0x40866cb0]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x62aace58]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x629057f8]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x629059c8]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x6282eed0]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x628d1ce8]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x628d1eb0]
        /nix/store/3c54hwp1zji0h8yl66860cp8zp2vsrzv-bash-5.2p26/bin/bash() [0x6281c5dc]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(+0x238cc) [0x4084f8cc]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(__libc_start_main+0x98) [0x4084f9c0]
1690244|Double SIGSEGV (code=1, pc=0x62aace58, addr=0x24ab0)!

I verified that the version of bash included in the box86 repo is

GNU bash, version 5.1.16(1)-release (i686-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

With the help of this site to view nix package versions, I tried to run with that bash version as well, but the result seems to be comparable:

# in the x86_64 PC
> nix-build "<nixpkgs>" --argstr system "i686-linux" -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz -A bash
/nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16
> nix copy --to ssh://[email protected] /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16 

# in aarch64 machine
> export LD_LIBRARY_PATH="$(for lib in ncurses glibc; do nix-build '<nixpkgs>' -A pkgsCross.armv7l-hf-multiplatform.${lib} --no-out-link; done | xargs -I {} echo -n {}/lib: | sed 's/:$//')"
> echo $LD_LIBRARY_PATH                                                                                                       18:26:24
/nix/store/74gp2wabmv0cqwhpsjmglpzlwvyvd2r5-ncurses-armv7l-unknown-linux-gnueabihf-6.4/lib:/nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib
> box86 /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash                                                                        18:33:59
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
# (exits with bash error code 255)
> BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_PREFER_EMULATED=1 BOX86_EMULATED_LIBS=libc.so.6 BOX86_DYNAREC=0 BOX86_SHOWSEGV=1 BOX86_SHOWBT=1 box86 /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash
Debug level is 1
Dynarec is off
Shows details of dlopen / dlsym /dlclose : Yes
Show Segfault signal even if a signal handler is present
Show Backtrace for signals
Running on Neoverse-N1 with 4 Cores
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
BOX86 will force the used of emulated libs for libc.so.6 
Using default BOX86_PATH: ./:bin/
BOX86: Prefer Emulated libs
Counted 107 Env var
Looking for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash
bash detected, disabling banner
Rename process to "bash"
Redirecting overridden malloc function for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash
Using native(wrapped) libdl.so.2
Using emulated /nix/store/0wr8hawrkjxp9bygcdisdg4kj2irqqyb-glibc-2.35-163/lib/libc.so.6
Redirecting overridden malloc function for /nix/store/0wr8hawrkjxp9bygcdisdg4kj2irqqyb-glibc-2.35-163/lib/libc.so.6
Using emulated /nix/store/0wr8hawrkjxp9bygcdisdg4kj2irqqyb-glibc-2.35-163/lib/ld-linux.so.2
Warning, don't know of to handle rel #145 type: 0x2a (unknown) (0x60436b18) for 
Warning, don't know of to handle rel #1356 type: 0x2a (unknown) (0x60221cb4) for 
Warning, don't know of to handle rel #17 type: 0x2a (unknown) (0x60221e8c) for 
Warning, don't know of to handle rel #18 type: 0x2a (unknown) (0x60221e64) for 
Warning, don't know of to handle rel #19 type: 0x2a (unknown) (0x60221e5c) for 
Warning, don't know of to handle rel #20 type: 0x2a (unknown) (0x60221e4c) for 
1708800|SIGSEGV @0x62aae070 (???(/nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash/0x62aae070)) (x86pc=0x600213dc//nix/store/0wr8hawrkjxp9bygcdisdg4kj2irqqyb-glibc-2.35-163/lib/libc.so.6:"???", esp=0x41a601c0, stack=0x41269000:0x41a69000 own=(nil) fp=(nil)), for accessing 0x50 (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0)
ESP-0x10:0x40a70010 ESP-0x0c:0x00000000 ESP-0x08:0x00000000 ESP-0x04:0x00000000
ESP+0x00:0x00000000 ESP+0x04:0x00000000 ESP+0x08:0x00000000 ESP+0x0c:0x00000000
Native bactrace:
        /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash() [0x628fb2a4]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(__default_rt_sa_restorer+0) [0x40866cb0]
        /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash() [0x62aae070]
        /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash() [0x629057f8]
        /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash() [0x6281c68c]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(+0x238cc) [0x4084f8cc]
        /nix/store/176g0h9j5vmkil0k8zb5h4a8iac06qcb-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/libc.so.6(__libc_start_main+0x98) [0x4084f9c0]
1708800|Double SIGSEGV (code=1, pc=0x62aae070, addr=0x50)!

also tried different versions of the bash required libraries ncurses and glibc, using a glibc version older than 2.39-5 gives me segmentation fault, and older than 2.38 tells me `GLIBC_2.38' is missing, it might be that I'm missing some library for bash as well..? As I'm in a aarch64 system and am not using a chroot

@Yeshey Yeshey changed the title Relocation type "0x2a" error in newer bash. Unable to run bash in nixOS Relocation type "0x2a" error running bash. Unable to run bash in nixOS Jun 10, 2024
@Yeshey
Copy link
Author

Yeshey commented Jul 31, 2024

> BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_PREFER_EMULATED=1 BOX86_DYNAREC=0 BOX86_SHOWSEGV=1 BOX86_SHOWBT=1 box86 /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/sh /nix/store/p2fman5q3b9xdy13yy829p5pmggdiflg-steam/bin/steam
Debug level is 1
Dynarec is off
Shows details of dlopen / dlsym /dlclose : Yes
Show Segfault signal even if a signal handler is present
Show Backtrace for signals
Running on Neoverse-N1 with 4 Cores
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
Using default BOX86_PATH: ./:bin/
BOX86: Prefer Emulated libs
Counted 108 Env var
Looking for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/sh
argv[1]="/nix/store/p2fman5q3b9xdy13yy829p5pmggdiflg-steam/bin/steam"
Rename process to "bash"
Redirecting overridden malloc function for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using emulated /nix/store/0wr8hawrkjxp9bygcdisdg4kj2irqqyb-glibc-2.35-163/lib/ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Warning, don't know of to handle rel #145 type: 0x2a (unknown) (0x60036b18) for 

malloc: subst.c:4744: assertion botched
free: called with unallocated block argument
Aborting...[1]    3350035 abort (core dumped)  BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_PREFER_EMULATED=1 BOX86_DYNAREC=0 =1 =1

without BOX86_PREFER_EMULATED=1

BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_DYNAREC=0 BOX86_SHOWSEGV=1 BOX86_SHOWBT=1 box86 /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/sh /nix/store/p2fman5q3b9xdy13yy829p5pmggdiflg-steam/bin/steam
Debug level is 1
Dynarec is off
Shows details of dlopen / dlsym /dlclose : Yes
Show Segfault signal even if a signal handler is present
Show Backtrace for signals
Running on Neoverse-N1 with 4 Cores
Box86 with Dynarec v0.3.6 nogit built on Jan  1 1980 00:00:00
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
Using default BOX86_PATH: ./:bin/
Counted 108 Env var
Looking for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/sh
argv[1]="/nix/store/p2fman5q3b9xdy13yy829p5pmggdiflg-steam/bin/steam"
Rename process to "bash"
Redirecting overridden malloc function for /nix/store/9cf3kcqal0v4sj78kmfkdkplpifs1piv-bash-5.1-p16/bin/bash
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0

malloc: subst.c:4744: assertion botched
free: called with unallocated block argument
Aborting...[1]    3350342 abort (core dumped)  BOX86_DLSYM_ERROR=1 BOX86_LOG=1 BOX86_DYNAREC=0 BOX86_SHOWSEGV=1 BOX86_SHOWBT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant