
我剛剛安裝了一個這樣的系統:
ubuntu@ubuntu:~$ ls -l /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 2012-01-22 18:49 Boot -> ../../sda1
lrwxrwxrwx 1 root root 10 2012-01-22 18:49 ubuntu32 -> ../../sda2
lrwxrwxrwx 1 root root 10 2012-01-22 18:28 ubuntu64 -> ../../sda3
lrwxrwxrwx 1 root root 10 2012-01-22 18:49 Home -> ../../sda5
ubuntu@ubuntu:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2012-01-22 20:55 3582d70f-f4a5-484c-b14c-45cd740346b9 -> ../../sda1
lrwxrwxrwx 1 root root 10 2012-01-22 20:55 741182a8-3f15-4dfd-994d-654c8a57a9e4 -> ../../sda2
lrwxrwxrwx 1 root root 10 2012-01-22 20:55 1c415472-a770-4d76-be9f-27b8c1408e2a -> ../../sda3
lrwxrwxrwx 1 root root 10 2012-01-22 20:55 3515d523-72a2-4e04-b7da-cb6a1fd572ef -> ../../sda5
lrwxrwxrwx 1 root root 10 2012-01-22 20:55 f1f1cd7e-30cb-44e7-9ef6-986a589e0045 -> ../../sda6
我需要 32 位元和 64 位元分開,這樣我就可以測試每個版本的驅動程式效能,主目錄是共用的,每個版本的 ubuntu 在其他版本下安裝為 /ubuntuXX。 /boot 也都指向 /dev/sda1。
當我sudo update-grub
從 ubuntu32 運行時,它運行良好,但啟動 ubuntu64 時出現錯誤。init
失敗,我假設這是因為錯誤的位元類型。 grub 的作業系統探針不應該是位元感知的嗎?我怎麼能讓這兩個正常啟動。
我從活動磁碟執行 grub-customizer,選擇 /dev/sda3 作為 root,在第二步驟中選擇所有分割區,然後刪除除 OS-Prober 和 memtest 之外的所有分割區。結果是附加的 grub.cfg。它現在將 /dev/sda2 列為唯一的作業系統選項。 grub.cfg 將每個條目的根 UUID 設為 /boot。
grub.cfg:http://pastebin.com/Dkdxian4
fstab(兩者):http://pastebin.com/3sUabYRY
我知道 grub2 都是自動生成的,菜單和爵士樂,但我如何刪除所有這些並手動添加整體(我不會長時間保留此安裝,因此不必擔心內核更新)
我嘗試了盲目地複製該/dev/sda2
條目,但進行了調整,/dev/sda3
但進展並不順利。然而,我確實遇到了與第一次嘗試相同的錯誤(這是內核恐慌之前的那一行,run-init
)
grub.cfg 的更新部分:http://pastebin.com/DvfBhrBF
(null)
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom: ... done.
[ 3.402989] request_module: runaway loop modprobe binfmt-464c
run-init: /sbin/init: Exec format error
[ 3.406303] Kernel panic - not syncing: Attempted to kill init!
[ 3.406394] Pid: 1, comm: run-init Not tainted 3.0.0-15-generic #25-Ubuntu
[ 3.408290] [<c151a922>] ? printk+0x2d/0x2f
[ 3.408338] [<c151a800>] panic+0x5c/0x151
[ 3.408388] [<c104b564>] forget_original_parent+0x1e4/0x1f0
[ 3.408440] [<c10d3a48>] ? perf_cgroup_attach_task+0x20/0x20
[ 3.408489] [<c104b583>] exit_notify+0x13/0x140
[ 3.408536] [<c104bd8d>] do_exit+0x1ad/0x3a8
[ 3.408585] [<c1313850>] ? tty_write+0x228/0x228
[ 3.408632] [<c104c098>] sys_exit+0x18/0x28
[ 3.408680] [<c152e424>] syscall_call+0x7/0xb
我開始認為這與 /boot 目錄中的核心映像有關。
好的,現在我確定這是因為一個分割區是 32 位,一個分割區是 64 位。
圖1:來自/boot/grub/grub.cfg的發揮:
linux /vmlinuz-3.0.0-12-generic root=/dev/sda2
initrd /initrd.img-3.0.0-12-generic
圖 2:/ubuntu64/vm* 和 /ubuntu32/vm* 的列表
me@GAMMA:~$ ls -l /vm*
lrwxrwxrwx 1 root root 29 2012-01-23 20:41 /vmlinuz -> boot/vmlinuz-3.0.0-15-generic
lrwxrwxrwx 1 root root 29 2012-01-22 13:05 /vmlinuz.old -> boot/vmlinuz-3.0.0-12-generic
me@GAMMA:~$ ls -l /ubuntu32/vm*
lrwxrwxrwx 1 root root 29 2012-01-22 12:41 /ubuntu32/vmlinuz -> boot/vmlinuz-3.0.0-15-generic
lrwxrwxrwx 1 root root 29 2012-01-22 12:22 /ubuntu32/vmlinuz.old -> boot/vmlinuz-3.0.0-12-generic
圖 3:/boot/vmlinuz-3.0.0-12-generic 的魔術檔案類型
/boot/vmlinuz-3.0.0-12-generic: Linux kernel x86 boot executable bzImage, version 3.0.0-12-generic (buildd@creste, RO-rootFS, root_dev 0x801, swap_dev 0x4, Normal VGA
/boot/vmlinuz-3.0.0-15-generic: Linux kernel x86 boot executable bzImage, version 3.0.0-15-generic (buildd@creste, RO-rootFS, root_dev 0x801, swap_dev 0x4, Normal VGA
現在這是真實的踢球者:
me@GAMMA:~$ sudo find / -name "vmlinuz*"
/boot/vmlinuz-3.0.0-12-generic
/boot/vmlinuz-3.0.0-15-generic
/vmlinuz.old
/vmlinuz
/ubuntu32/vmlinuz.old
/ubuntu32/vmlinuz
這是我係統上唯一的核心!這怎麼可能?我現在正在運行 64 位(並且報告/dev/sda3
是64 位)!/
uname
我檢查了packages.ubuntu.com上的套件內容和am64版本的linux-image-3.0.0.15-generic清單/boot/vmlinuz-3.0.0-15-generic
作為文件,所以我執行了以下命令:
me@GAMMA:~$ sudo openssl dgst -md5 /boot/vmlinuz-3.0.0-15-generic > ~/3.0.0.15x86
me@GAMMA:~$ sudo apt-get install --reinstall linux-image-3.0.0-15-generic
(Output Omitted)
me@GAMMA:~$ sudo openssl dgst -md5 /boot/vmlinuz-3.0.0-15-generic
MD5(/boot/vmlinuz-3.0.0-15-generic)= f56839a4642eb97e06e5efb0bc74f4dc
me@GAMMA:~$ cat ~/3.0.0.15x86
MD5(/boot/vmlinuz-3.0.0-15-generic)= f56839a4642eb97e06e5efb0bc74f4dc
me@GAMMA:~$ sudo openssl dgst -md5 /boot/vmlinuz-3.0.0-15-generic > ~/3.0.0.15x86
因此,Linux 內核的行為非常類似於 OSX 中的 Mach 內核,因為它是一個 32 位元可執行文件,可以在需要時切換到 64 位元模式。那麼問題是為什麼我會收到有關“Exec format error”的錯誤?
這個帖子然而,似乎表明runaway loop modprobe
內核恐慌表明這確實是一個 32/64 位元問題。 Grub 必須有某種方式告訴內核位元長,也許它位於 /boot 中的關聯檔案中,明天再研究一下。
快速更新:
32 位元和 64 位元核心的雜湊值不同,但檔案報告它們都是 x86。
< MD5(/boot/vmlinuz-3.0.0-15-generic)= f56839a4642eb97e06e5efb0bc74f4dc
---
> MD5(/boot/vmlinuz-3.0.0-15-generic)= cee6cd7db9016ee8531be92504ac802b
所以我需要確定如何將核心安裝到 /boot 以外的位置,以便兩個核心不會互相干擾...
答案1
(未經測試)解決方案:
僅將一個分割區的 /dev/sda1 掛載到 /boot 上,另一個分割區的 /boot 保留在適當的位置。核心不會互相干擾,這樣 grub 就不會因為為什麼有兩個作業系統而只有一個核心而感到困惑。