(1):
今天原本的目標是在initramfs時,把root fs用aufs包起來(像live CD)
所以從 kernel cmdline開始:
linux vmlinuz break=mountroot ...
(initramfs) mkdir /root/ro /root/rw
(initramfs) mount -t ext4 -r /dev/sda1 /root/ro
(initramfs) insmod /root/ro/lib/modules/.../kernel/fs/aufs/aufs.ko
(initramfs) mount -t tmpfs /root/rw
(initramfs) mount -t aufs -o br:/root/rw:/root/ro /root
(initramfs) ls /root
/bin .....
這時writeable root看起來弄好了
(initramfs) >/root/root/test
(initramfs) ls /root/root
test
(Ctrl-D)
..........
login:
可是在登入後,/root底下沒有東西,也變成唯讀的了
(2)在平常的shell下
# chroot /bin/ /busybox
chroot: failed to run command `/busybox': No such file or directory
不知到為什麼會這樣,static linked binary也會有dependency?
strace看到的結果是:
chroot("/bin/") = 0
chdir("/") = 0
execve("/busybox", ["/busybox"], [/* 15 vars */]) =
-1 ENOENT (No such file or directory)
又是很怪的問題了,謝謝大家
--
今天原本的目標是在initramfs時,把root fs用aufs包起來(像live CD)
所以從 kernel cmdline開始:
linux vmlinuz break=mountroot ...
(initramfs) mkdir /root/ro /root/rw
(initramfs) mount -t ext4 -r /dev/sda1 /root/ro
(initramfs) insmod /root/ro/lib/modules/.../kernel/fs/aufs/aufs.ko
(initramfs) mount -t tmpfs /root/rw
(initramfs) mount -t aufs -o br:/root/rw:/root/ro /root
(initramfs) ls /root
/bin .....
這時writeable root看起來弄好了
(initramfs) >/root/root/test
(initramfs) ls /root/root
test
(Ctrl-D)
..........
login:
可是在登入後,/root底下沒有東西,也變成唯讀的了
(2)在平常的shell下
# chroot /bin/ /busybox
chroot: failed to run command `/busybox': No such file or directory
不知到為什麼會這樣,static linked binary也會有dependency?
strace看到的結果是:
chroot("/bin/") = 0
chdir("/") = 0
execve("/busybox", ["/busybox"], [/* 15 vars */]) =
-1 ENOENT (No such file or directory)
又是很怪的問題了,謝謝大家
--
All Comments