libc 및 기타 여러 도구로 업그레이드한 후 독점 커널 빌드 및 운영 체제를 시작하려고 합니다. 저는 3.2.0 커널의 initramfs와 일부 유틸리티(busybox 등)를 사용하여 부팅합니다. 그러나 udev 172 및 systemd 43 업데이트로 인해 systemd
구조가 크게 변경된 것으로 보입니다. 예전에는 boot를 사용했는데 init=/bin/systemd
지금은 그런 것 같습니다 /usr/lib/systemd/systemd
. 하지만 init
이 오류와 커널 패닉이 발생하므로 값을 변경하는 것만으로는 작동하지 않습니다.
# exec /bin/busybox switch_root /mnt/rootfs /usr/lib/systemd/systemd ro rootwait
BusyBox v1.20.2 (2014-05-28 13:23:51 IST) multi-call binary.
Usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]
Unmounting /proc
Executing switch_root and spawning init
switch_root: can't execute '/usr/lib/systemd/systemd': Too many levels of symbolic links
[49290.074730] Kernel panic - not syncing: Attempted to kill init!
[49290.093029] Backtrace:
[49290.100574] Function entered at [<c0017160>] from [<c0410744>]
[49290.118584] r6:4024473c r5:cf01bc00 r4:c0cdbb08 r3:60000013
[49290.136081] Function entered at [<c041072c>] from [<c04109c0>]
[49290.154074] Function entered at [<c0410950>] from [<c003e240>]
[49290.172069] r3:c0cac4a4 r2:0000001c r1:00000001 r0:c0457748
[49290.189560] r7:000000f8
[49290.197366] Function entered at [<c003dbdc>] from [<c003e348>]
[49290.215360] r7:000000f8
[49290.223152] Function entered at [<c003e2f4>] from [<c003e3b8>]
[49290.241147] r4:00000001 r3:00000001
[49290.252176] Function entered at [<c003e3a0>] from [<c0013a80>]
busybox의 switch_root 또는 시작 /usr/lib/systemd/systemd
프로세스에서 심볼릭 링크 오류가 발생하는지 아는 사람이 있습니까?
나는 switch_root가 무언가를 해석하는 데 문제가 있다고 가정하고 있지만 systemd를 올바르게 구성하지 않았을 수도 있습니다.
나는 이것을 디버깅하는 방법을 알 수 없습니다.
ls -ld
출력은 다음과 같습니다 (아래에 혼란스러운 설명이 있어서 죄송합니다).
# ls -ld /mnt/rootfs/usr/lib/systemd/
drwxrwxr-x 7 0 0 4096 Jan 8 01:21 /mnt/rootfs/usr/lib/systemd/
#
# ls -ld /mnt/rootfs/usr/lib/systemd/systemd
-rwxr-xr-x 1 0 0 674468 Apr 12 2016 /mnt/rootfs/usr/lib/systemd/systemd
strace
출력 은 다음 과 같습니다 .
# exec strace -f /bin/busybox switch_root /mnt/rootfs /usr/lib/systemd/systemd r
o rootwait
execve("/bin/busybox", ["/bin/busybox", "switch_root", "/mnt/rootfs", "/usr/lib/systemd/systemd", "ro", "rootwait"], [/* 6 vars */]) = 0
brk(0) = 0x1a45000
uname({sys="Linux", node="(none)", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400ac000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/v7l/neon/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/v7l/neon", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/v7l/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/v7l", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/neon/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/neon", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/v7l/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/v7l/neon/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/v7l/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/v7l/neon", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/v7l/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/v7l/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/v7l/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/v7l", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/neon/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/neon/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/neon/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/neon", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/vfp/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/lib/vfp", 0xbe9d3540) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250g\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1242860, ...}) = 0
mmap2(NULL, 1312160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x400d3000
mprotect(0x401fe000, 65536, PROT_NONE) = 0
mmap2(0x4020e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12b) = 0x4020e000
mmap2(0x40211000, 9632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40211000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40214000
set_tls(0x402144c0, 0x40214ba8, 0x4004b000, 0x402144c0, 0x4004b000) = 0
mprotect(0x4020e000, 8192, PROT_READ) = 0
mprotect(0x4004a000, 4096, PROT_READ) = 0
getuid32() = 0
chdir("/mnt/rootfs") = 0
stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
getpid() = 771
mmap2(NULL, 45056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x402ba000
mmap2(NULL, 401408, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40307000
brk(0) = 0x1a45000
brk(0x1a67000) = 0x1a67000
munmap(0x40307000, 401408) = 0
munmap(0x402ba000, 45056) = 0
write(2, "BusyBox v1.20.2 (2016-04-12 15:5"..., 41BusyBox v1.20.2 (2016-04-12 15:51:37 IST)) = 41
write(2, " multi-call binary.\n", 20 multi-call binary.
) = 20
write(2, "\nUsage: ", 8
Usage: ) = 8
write(2, "switch_root", 11switch_root) = 11
write(2, " ", 1 ) = 1
write(2, "[-c /dev/console] NEW_ROOT NEW_I"..., 42[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]) = 42
write(2, "\n\n", 2
) = 2
exit_group(1) = ?
+++ exited with 1 +++
Unmounting /proc
Executing switch_root and spawning init
switch_root: can't execute '/usr/lib/systemd/systemd': Too many levels of symbolic links
[ 52.064978] Kernel panic - not syncing: Attempted to kill init!
[ 52.083278] Backtrace:
[ 52.090828] Function entered at [<c0017160>] from [<c0410764>]
[ 52.108828] r6:40259730 r5:cf01bc00 r4:c09c1b08 r3:600b0013
[ 52.126328] Function entered at [<c041074c>] from [<c04109e0>]
[ 52.144324] Function entered at [<c0410970>] from [<c003e240>]
[ 52.162319] r3:c09924a4 r2:00000020 r1:00000001 r0:c0457750
[ 52.179817] r7:000000f8
[ 52.187621] Function entered at [<c003dbdc>] from [<c003e348>]
[ 52.205616] r7:000000f8
[ 52.213410] Function entered at [<c003e2f4>] from [<c003e3b8>]
[ 52.231416] r4:000a0138 r3:ffffffff
[ 52.242451] Function entered at [<c003e3a0>] from [<c0013a80>]
안타깝게도 그 안에서 유용한 정보를 찾을 수 없었습니다. 비지박스 코드를 보면 작업을 수행하고 chroot
이전 설치 디렉터리를 정리한 다음 execv
내 명령을 사용하여 init
작업을 실행합니다 .