Chroot: 해당 파일이나 디렉터리가 없습니다.

Chroot: 해당 파일이나 디렉터리가 없습니다.

이 질문이 이전에 요청된 적이 있다는 것을 알고 있지만 내 문제가 해결되지 않았습니다.

나는 /dev및 를 바인딩하고 에 /proc복사했습니다 . 그러나 chroot는 어떤 명령도 실행할 수 없습니다.qemu-arm-static/usr/bin

전날 근무 중이었습니다. 그래서 지금은 무엇이 깨졌는지 알 수 없습니다.

그것이 무엇이든 가리키는 경우 strace 덤프

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 +++

답변1

나는 그것을 작동하고 있습니다. 제가 아주 어리석은 실수를 저질렀습니다.

qemu-arm-static내가 사용해야 할 것 대신에 뭔가를 사용하고 있어서 qemu-aarch64-static, 그냥 엉망이에요.

답변2

추적 출력에는 누락된 파일이 표시됩니다.

따라서 추적으로 식별된 누락된 파일을 모두 설치하고 다시 확인하십시오. 완료될 때까지 이 작업을 반복하십시오.

chroot()단지 그것을 생성하기 만 하면 됩니다 ENOENT.

관련 정보