-2

I know it has been asked before but they do not solve my problem.

I have already binded the /dev and /proc, copied the qemu-arm-static to /usr/bin. But chroot fails at executing any command.

It was working the day before. So I dont know what is broken now.

strace dump if it points to anything

execve("/usr/sbin/chroot", ["chroot", "target-rootfs", "bash"], [/* 27 vars */]) = 0
brk(NULL)                               = 0x2513000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=127309, ...}) = 0
mmap(NULL, 127309, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4c601e3000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4c601e2000
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4c5fc14000
mprotect(0x7f4c5fdd4000, 2097152, PROT_NONE) = 0
mmap(0x7f4c5ffd4000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f4c5ffd4000
mmap(0x7f4c5ffda000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4c5ffda000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4c601e1000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4c601e0000
arch_prctl(ARCH_SET_FS, 0x7f4c601e1700) = 0
mprotect(0x7f4c5ffd4000, 16384, PROT_READ) = 0
mprotect(0x608000, 4096, PROT_READ)     = 0
mprotect(0x7f4c60203000, 4096, PROT_READ) = 0
munmap(0x7f4c601e3000, 127309)          = 0
brk(NULL)                               = 0x2513000
brk(0x2534000)                          = 0x2534000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2981280, ...}) = 0
mmap(NULL, 2981280, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4c5f93c000
close(3)                                = 0
getcwd("/home/YashB/mini_deb", 4096)    = 21
lstat("/home/YashB/mini_deb/target-rootfs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chroot("target-rootfs")                 = 0
chdir("/")                              = 0
execve("/usr/local/sbin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/bin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/sbin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/bin/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/games/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/games/bash", ["bash"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2492, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2492
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "chroot: ", 8chroot: )                 = 8
write(2, "failed to run command \342\200\230bash\342\200\231", 32failed to run command ‘bash’) = 32
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(127)                         = ?
+++ exited with 127 +++

closed as off-topic by slm Jul 13 '18 at 11:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – slm
If this question can be reworded to fit the rules in the help center, please edit the question.

1

I have got it to work. I was making a very stupid mistake.

I was using qemu-arm-static instead of qemu-aarch64-static as I should have and so that was all the mess.

  • When you can (in two days), mark this with a ✓. – ctrl-alt-delor Jul 13 '18 at 11:10
0

Your trace output shows you which files are missing.

So just install all the missing files identified by the trace and check again...repeat this until you are done.

You just need to check all the syscalls after chroot() that create an ENOENT.

  • which files ? I have bash at rootfs/bin/bash were it is supposed to be. – yashC Jul 13 '18 at 9:17
  • 1
    The files that create an ENOENT error. – schily Jul 13 '18 at 9:46

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