On 8/30/21 09:28, Guillaume Gardet wrote:
> Hi, > >> -----Original Message----- From: Frans de Boer <frans@fransdb.nl> >> Sent: 26 August 2021 15:22 To: opensuse-factory@opensuse.org >> Subject: qemu-aarch64-static >> >> LS, >> >> I can't find the qemu-aarch64-static with the available qemu >> version. Where can I get it? > > If you need 'qemu-aarch64', it is in 'qemu-linux-user' package. > > Guillaume I just found out that qemu-aarch64 is indeed statically linked. The ´qemu-aarch64-binfmt' is a soft link to qemu-binfm, which itself is also statically linked. So, I guessed that I needed qemu-binfmt within the chroot jail to deal with the different magic file numbers for aarch64 executables.

Not so, that did not worked either. The final bash shell is never started. What am I doing wrong?

Prior to the chroot command,  qemu-aarch64-binfmt (actually qemy-binfmt) is copied to /newroot/usr/bin.
To start chroot is:
/usr/bin/qemu-aarch64 -strace -cpu cortex-a53 -L /newroot  /newroot/usr/sbin/chroot  "/newroot" \
  /usr/bin/env -i \
    HOME=/root \
    TERM="$TERM" \
    PS1='(lfs chroot) \u:\w\$ ' \
    PS4='(${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]} - [${SHLVL},${BASH_SUBSHELL}, $?] ' \
    PATH=/usr/bin:/usr/sbin \
    bldNAME='FdB' \
    /usr/bin/bash --login +h

The output of the -strace is now:
+ /usr/bin/qemu-aarch64 -strace -cpu cortex-a53 -L /mnt/lfs /mnt/lfs/usr/sbin/chroot /mnt/lfs /usr/bin/env -i HOME=/root T
ERM=xterm-256color 'PS1=(lfs chroot) \u:\w\$ ' 'PS4=(${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]} - [${SHLVL},${BASH_SUBSHELL}
, $?] ' PATH=/usr/bin:/usr/sbin bldNAME=FdB /usr/bin/bash --login +h
11237 brk(NULL) = 0x000000000041b000
11237 uname(0x55007ff598) = 0
11237 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,AT_EACCESS|0x34cc8) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007feb70,0x1000) = 0
11237 mmap(NULL,78492,PROT_READ,MAP_PRIVATE,3,0) = 0x0000005500839000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/tls/aarch64/libc.so.6",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 newfstatat(AT_FDCWD,"/usr/lib/tls/aarch64",0x00000055007feba0,0) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/tls/libc.so.6",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 newfstatat(AT_FDCWD,"/usr/lib/tls",0x00000055007feba0,0) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/aarch64/libc.so.6",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 newfstatat(AT_FDCWD,"/usr/lib/aarch64",0x00000055007feba0,0) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/libc.so.6",O_RDONLY|O_CLOEXEC) = 3
11237 read(3,0x7fed00,832) = 832
11237 newfstatat(3,"",0x00000055007feba0,0x1000) = 0
11237 mmap(NULL,1691192,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x000000550084d000
11237 mprotect(0x00000055009c9000,61440,PROT_NONE) = 0
11237 mmap(0x00000055009d8000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x17b000) = 0x00000055009d8
000
11237 mmap(0x00000055009de000,48696,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x00000055009de000
11237 close(3) = 0
11237 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x00000055009ea000
11237 set_tid_address(365082617648,365082619376,365082617440,365080834112,365082617632,365080838368) = 11237
11237 set_robust_list(365082617664,24,365082617440,365082617712,365082617664,1) = -1 errno=38 (Function not implemented)
11237 mprotect(0x00000055009d8000,16384,PROT_READ) = 0
11237 mprotect(0x0000000000419000,4096,PROT_READ) = 0
11237 mprotect(0x0000005500835000,8192,PROT_READ) = 0
11237 prlimit64(0,3,0,365080606480,365082143416,40) = 0
11237 munmap(0x0000005500839000,78492) = 0
11237 getrandom(365082585408,8,1,365082617440,0,365080611497) = 8
11237 brk(NULL) = 0x000000000041b000
11237 brk(0x000000000043c000) = 0x000000000043c000
11237 openat(AT_FDCWD,"/usr/lib/locale/locale-archive",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/share/locale/locale.alias",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff310,0x1000) = 0
11237 read(3,0x41b4a0,4096) = 2998
11237 read(3,0x41b4a0,4096) = 0
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or di
rectory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,369,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009ec000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/gconv/gconv-modules.cache",O_RDONLY) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/gconv/gconv-modules",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff350,0x1000) = 0
11237 read(3,0x41d310,4096) = 3808
11237 read(3,0x41d310,4096) = 0
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/gconv/gconv-modules.d",O_RDONLY|O_DIRECTORY|O_NONBLOCK|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff4b0,0x1000) = 0
11237 getdents64(3,4321280,32768,2147483647,4,3) = 96
11237 openat(AT_FDCWD,"/usr/lib/gconv/gconv-modules.d/gconv-modules-extra.conf",O_RDONLY|O_CLOEXEC) = 4
11237 newfstatat(4,"",0x00000055007ff350,0x1000) = 0
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 brk(0x000000000045d000) = 0x000000000045d000
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 4096
11237 read(4,0x427010,4096) = 726
11237 read(4,0x427010,4096) = 0
11237 close(4) = 0
11237 getdents64(3,4321280,32768,2147483647,4,7) = 0
11237 close(3) = 0
11237 futex(0x00000055009dd874,FUTEX_PRIVATE_FLAG|FUTEX_WAKE,2147483647,NULL,0x0000000000000026,38) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/nl_NL.UTF-8/LC_MEASUREMENT",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or direc
tory)
11237 openat(AT_FDCWD,"/usr/lib/locale/nl_NL.utf8/LC_MEASUREMENT",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,23,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009ed000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_TELEPHONE",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directo
ry)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_TELEPHONE",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,59,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009ee000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_ADDRESS",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory
)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_ADDRESS",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,167,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009ef000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_NAME",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_NAME",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,77,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009f0000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_PAPER",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_PAPER",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,34,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009f1000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.UTF-8/LC_MESSAGES",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or director
y)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_MESSAGES",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES",O_RDONLY|O_CLOEXEC) = 3
11237 newfstatat(3,"",0x00000055007ff6d0,0x1000) = 0
11237 mmap(NULL,57,PROT_READ,MAP_PRIVATE,3,0) = 0x00000055009f2000
11237 close(3) = 0
11237 openat(AT_FDCWD,"/usr/lib/locale/en_NL.UTF-8/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or director
y)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_NL.utf8/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory
)
11237 openat(AT_FDCWD,"/usr/lib/locale/en_NL/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en.UTF-8/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en.utf8/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 openat(AT_FDCWD,"/usr/lib/locale/en/LC_MONETARY",O_RDONLY|O_CLOEXEC) = -1 errno=2 (No such file or directory)
11237 readlinkat(AT_FDCWD,"/mnt",0x00000055007ff140,1023) = -1 errno=22 (Invalid argument)
11237 readlinkat(AT_FDCWD,"/mnt/lfs",0x00000055007ff140,1023) = -1 errno=22 (Invalid argument)
11237 chroot("/mnt/lfs") = 0
11237 chdir("/") = 0

PS: read /mnt/lfs as /newroot.

That is it, it just exit the script file.

Using my own compiled 'qemu-aarch64-binfmt' (using -target=...) shows after the last line the expected bash prompt. So that works up to that point.
And then I am back to my latest issue: within the chroot jail, the configure script with gcc, gettext and a lot of other packages, can't find the version of the bash script - complaining that is its too old or not existing, while it is just version 5.1.8. Other aarch64 programs like tar, bash, patch etc. just run.

--- Frans.