Ubuntu
Chroot : 沒有這樣的文件或目錄
我知道以前有人問過,但他們沒有解決我的問題。
我已經綁定了
/dev
and/proc
,複製了qemu-arm-static
to/usr/bin
。但是 chroot 無法執行任何命令。前一天還在工作。所以我不知道現在壞了什麼。
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 +++
我已經讓它工作了。我犯了一個非常愚蠢的錯誤。
我正在使用
qemu-arm-static
而不是qemu-aarch64-static
我應該使用的,所以這就是所有的混亂。
您的跟踪輸出會顯示哪些文件失去了。
因此,只需安裝跟踪標識的所有失去文件並再次檢查…重複此操作直到完成。
您只需要在
chroot()
創建一個ENOENT
.