開機時根目錄用aufs, move mount - Linux

Zanna avatar
By Zanna
at 2012-10-18T21:50

Table of Contents

(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)

又是很怪的問題了,謝謝大家

--
Tags: Linux

All Comments

Franklin avatar
By Franklin
at 2012-10-23T16:36
我學長改完initrd的script是mount aufs後直接pivot chroot
Zanna avatar
By Zanna
at 2012-10-24T13:45
我的作法更暴力,進去系統時在mountall前先做aufs mount
James avatar
By James
at 2012-10-28T08:44
在修掉kernel中squashfs對mount會強制加上ro flag,這樣就
Lucy avatar
By Lucy
at 2012-10-29T11:48
可以不經initrd直接掛起squashfs後進系統,apt-get也不會因
Lauren avatar
By Lauren
at 2012-10-30T20:51
/是ro就不給我"暫時"的安裝package在aufs的系統下。
Mason avatar
By Mason
at 2012-11-02T15:14
你的意思是:改掉ro flag就可以讓kernel把東西暫時放到buffer?
Catherine avatar
By Catherine
at 2012-11-06T06:43
如果kernel不做patch,掛squashfs當/的話,/一定是ro
apt-get跟dpkg在安裝的時候如果看到/是ro就直接出錯了

libreoffice 的亂碼

Sandy avatar
By Sandy
at 2012-10-16T22:55
我又出現了 這次還是Java的問題 之前參考網路上的資料修好了Java的中文亂碼 但換libreoffice出現方格子 目前的解決方法是換系統預設字型 但… 我沒有好看的中文字型 所以… 現在電腦畫面好醜 有什麼辦法可以治本的嗎 或推薦我中文字型也行(X - ...

VM傳輸過濾封包資料(by python or c++)

Mary avatar
By Mary
at 2012-10-16T13:48
我們想要寫一個類似filter(用python 寫在libvirt上) 在VM傳輸時過濾封包資料(UDP type的先行) 就是可以控制單一或各個封包的priority 請問有類似的網站可以幫助我們嗎,找得有點久 如:http://goo.gl/ucjnE - ...

$4 的 Ubuntu 12.04 自動化安裝

Rae avatar
By Rae
at 2012-10-16T10:51
在先前的文章有提到 $4 的 Debian 6.0 自動化安裝 [1] Ubuntu 也是有同樣的安裝方法,詳細的過程另外放在 GitHub 上面方便日後的維護 http://fourdollars.github.com/d-i/ 類似於前文章提到的方式,只要下載 mini.iso 回來製作成 USB 隨 ...

fortran read

Daniel avatar
By Daniel
at 2012-10-16T09:47
想問一點fortran 的問題 在shell script裡面 主程式(command) 後面接的字串 內定就叫$1 $2 ...etc 所以 可以用這樣的方式給shell script 的程式當作input 那請問fortran可以嗎? 也就是 $./a.out cmd 以cmd作為 a.out的輸 ...

uClinux Scheduling

Gary avatar
By Gary
at 2012-10-15T23:03
※ 引述《HigherKuo (我需要好運)》之銘言: : 各位好 : 在開發uClinux的user space程式當中遇到了一個問題 : 就是有些操作必須要在interrupt發生之後很短的時間內完成 : 有什麼方式可以改變uClinux的scheduling嗎?讓我的程式可以分配到更多CPU time ...