[問題] 開機時根目錄用aufs, move mount

看板Linux作者 (我抓得到什麼呢?)時間11年前 (2012/10/18 21:50), 編輯推噓0(008)
留言8則, 2人參與, 最新討論串1/2 (看更多)
(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) 又是很怪的問題了,謝謝大家 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.32

10/19 02:44, , 1F
我學長改完initrd的script是mount aufs後直接pivot chroot
10/19 02:44, 1F

10/19 02:45, , 2F
我的作法更暴力,進去系統時在mountall前先做aufs mount
10/19 02:45, 2F

10/19 02:47, , 3F
在修掉kernel中squashfs對mount會強制加上ro flag,這樣就
10/19 02:47, 3F

10/19 02:48, , 4F
可以不經initrd直接掛起squashfs後進系統,apt-get也不會因
10/19 02:48, 4F

10/19 02:49, , 5F
/是ro就不給我"暫時"的安裝package在aufs的系統下。
10/19 02:49, 5F

10/19 06:49, , 6F
你的意思是:改掉ro flag就可以讓kernel把東西暫時放到buffer?
10/19 06:49, 6F

10/19 09:00, , 7F
如果kernel不做patch,掛squashfs當/的話,/一定是ro
10/19 09:00, 7F

10/19 09:00, , 8F
apt-get跟dpkg在安裝的時候如果看到/是ro就直接出錯了
10/19 09:00, 8F
文章代碼(AID): #1GW0alKW (Linux)
文章代碼(AID): #1GW0alKW (Linux)