緣起
2010-05-17
xPUD
- 測試環境:Debian GNU/Linux 5.0.4 (lenny)
jazz@Wdebian:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 5.0.4 (lenny)
Release: 5.0.4
Codename: lenny
- 取得 xPUD mkxpud 原始碼 - (1) 先安裝 git (注意套件名稱是 git-core 不是 git 喔!!) (2) 從 github 下載原始碼
jazz@Wdebian:~$ sudo apt-get install git-core
jazz@Wdebian:~$ git clone git://github.com/penk/mkxpud.git
- 由於會使用到 mksqushfs 跟 mkiofs 指令,因此就必須安裝 squashfs-tools 與 mkisofs 兩個套件。另外,因為會用到 ttf-droid 套件,只有 Ubuntu 有包,Debian 沒有,所以就只好從 Ubuntu 借了。
jazz@Wdebian:~$ http://mirrors.kernel.org/ubuntu/pool/universe/t/ttf-droid/ttf-droid_1.00~b112+dfsg+1-0ubuntu1_all.deb
jazz@Wdebian:~$ dpkg -i ttf-droid_1.00~b112+dfsg+1-0ubuntu1_all.deb
jazz@Wdebian:~$ sudo apt-get install squashfs-tools mkisofs
jazz@Wdebian:~$ cd mkxpud/
jazz@Wdebian:~/mkxpud$ sudo ./tools/mkxpud all
- [結果] 失敗!!! 看樣子 xPUD 的 mkxpud 一定得在 Ubuntu 系列執行才可以 :( - 沒仔細看文件的下場 ....
To generate a xPUD image, you will need:
1. a working Ubuntu 9.10 installation <---------------- ㄜ!!!! 2.6.28.cookbook jaunty.cookbook xpud089.cookbook default.cookbook lucid.cookbook 都是 ubuntu 系列
2. sudo permission to install packages on the host and testing
3. Internet access to download packages (if required)
4. at least 500MB of hard disk free space
- 改到 Ubuntu 9.04 試試看~因為從 xpud.org 下載 xpud-2.6.31.2-mod.tgz 很慢,所以嘗試從 mirror site下載,並解開至 /lib/modules/2.6.31.2 這樣 mkxpud 的 script 才不會又下載一次。安裝 squshfs-tools 跟 genisoimage (mkisofs) 供產生 Live CD ROOTFS 與 ISO 檔用,安裝 qemu 供 mkxpud test 用,安裝 nsis 好像是為了產生 windows exe 安裝執行檔。
jazz@jazzbook:~/mkxpud$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty
jazz@jazzbook:~/mkxpud$ sudo apt-get install qemu squashfs-tools genisoimage nsis
jazz@jazzbook:~/mkxpud$ sudo wget http://mesrss.free.fr/xpud/archive/xpud-2.6.31.2-mod.tgz -P skeleton/archive/
jazz@jazzbook:~/mkxpud$ sudo tar xzf skeleton/archive/xpud-2.6.31.2-mod.tgz -C /
jazz@jazzbook:~/mkxpud$ sudo ./tools/mkxpud all
DRBL-Live
2010-05-18
2010-05-19
- 修正作法, 再試一次:
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 5.0.4 (lenny)
Release: 5.0.4
Codename: lenny
~$ echo "deb http://free.nchc.org.tw/drbl-core drbl stable" > drbl.list
~$ sudo mv drbl.list /etc/apt/sources.list.d/
~$ wget http://drbl.nchc.org.tw/GPG-KEY-DRBL
~$ sudo apt-key add GPG-KEY-DRBL
~$ sudo apt-get update
~$ sudo apt-get -y install drbl
~$ sudo /opt/drbl/sbin/drblsrv -i -c n -n n -m n -g n -k 2 -o 1
~$ echo "deb http://free.nchc.org.tw/drbl-core drbl live-unstable" > drbl-live.list
~$ sudo mv drbl-live.list /etc/apt/sources.list.d/
~$ sudo apt-get update
~$ sudo apt-get -y install live-helper cdebootstrap zip
~$ sudo /opt/drbl/sbin/create-drbl-live-by-pkg -m http://free.nchc.org.tw/debian -s http://free.nchc.org.tw/debian-security -e unstable
- Yeah!! 成功了!!
jazz@lenny:~$ ls
drbl-live-xfce-20100519.iso drbl-live-xfce-stage1-20100519.iso
drbl-live-xfce-20100519.zip GPG-KEY-DRBL
2010-05-21
- 基於 create-drbl-live-by-pkg 開始嘗試加入 jdk, hadoop, xen hypervisor 套件....[失敗]
- [原因] sun-java6-jdk 等套件必須選擇同意授權才能繼續安裝。(2010-05-30 解決)
2010-05-23
- [文件] drbl-live 是用 live-helper 做的,所以相關語法可以參考 Debian Live Manual
- 研究 live-helper 跟 create-drbl-live
- lh_build 指令會執行三個 Stage,依序為 lh_bootstrap、lh_chroot 與 lh_binary
lh_bootstrap - create the first stage by bootstrapping a basic debian system
lh_chroot - create the second stage by customizing the chroot
lh_binary - create the third stage by generating a binary image
- 如果要用 live-helper 產生 live cd 並且用更多 apt 來源,可在 config/chroot_sources/ 加入 live.chroot 、 live.binary 跟對應的 gpg key 在 live.chroot.gpg 、live.binary.gpg
- 要額外裝的套件,可以參考 /usr/share/live-helper/lists/ 底下的檔案。然後用 lh config --bootstrap-config FILE 來指定。預設是使用 /usr/share/live-helper/lists/standard
LH_PACKAGES_LISTS="standard"
- 要額外拷貝進 Live CD 的檔案,可放在 config/chroot_local-includes
- 必須注意的是若跑過 lh_build 之後才更動 config/chroot_local-includes 的內容,必須下 lh_clean --chroot 把 chroot 目錄清除才能成功地更新檔案內容。當然最乾淨的做法是 lh_clean --purge 會全部清掉(除了 config 目錄外)
- 撰寫 drbl-hadoop-live 測試程式 test-live-helper.sh [147][148]
2010-05-30
- 解決 2010-05-21 的問題 - Debian / Ubuntu 如何在 shell script 裡面安裝 sun-java6-jdk 又不用選 yes 呢?!
- [參考] Installing java non-interactively
- 這裡提到用 debconf-set-selections 來設定一些參數,讓 sun-java*-* 不問授權的 yes,方法包括有寫檔跟沒寫檔的做法,個人覺得留言裡面的那個做法最帥了!!
cat << EOF | /usr/bin/debconf-set-selections
sun-java6-bin shared/accepted-sun-dlj-v1-1 select true
sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true
sun-java6-jre shared/accepted-sun-dlj-v1-1 select true
EOF
- 那麼如果以後遇到別的套件也有類似的問題該怎麼找參數呢?? 答案是用 debconf-get-selections 這個指令,首先必須安裝 debconf-utils 套件,然後執行 debconf-get-selections 再用 grep 用套件名稱找出可以改的參數。
~$ sudo debconf-get-selections | grep sun-java6
sun-java6-jre sun-java6-jre/stopthread boolean true
sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre sun-java6-jre/jcepolicy note
sun-java6-bin shared/error-sun-dlj-v1-1 error
sun-java6-jre shared/error-sun-dlj-v1-1 error
sun-java6-bin shared/present-sun-dlj-v1-1 note
sun-java6-jre shared/present-sun-dlj-v1-1 note
- 須注意的是原本參數是 boolean 格式,若要下給 debconf-set-selections 必須置換成 select 關鍵字喔!!
~$ sudo debconf-get-selections | grep sun-java6 | grep boolean | sed 's#boolean#select#g'
sun-java6-bin shared/accepted-sun-dlj-v1-1 select true
sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true
sun-java6-jre shared/accepted-sun-dlj-v1-1 select true
sun-java6-jre sun-java6-jre/stopthread select true
2010-06-25
- 更新 drbl-hadoop-live 測試程式 test-live-helper.sh [149]
- [備忘] lh config 的 --categories 參數只有在 1.0.3-2 有,2.0~a11-1drbl1 反而沒有
jazz@lenny:~/drbl-hadoop-live$ dpkg -l live-helper
要求=U:未知/I:安裝/R:刪除/P:清除/H:保留
| 狀態=N:尚未/I:已安裝/C:設定檔/U:已解開/F:設定失敗/H:半安裝/W:待處理/T:未處理
|/ 錯誤?=(無)/H:保留/R:須重新安裝/X:兩者兼有(狀態,錯誤:大寫=有問題)
||/ 名稱 版本 簡介
+++-================-================-================================================
ii live-helper 1.0.3-2 Debian Live build scripts
jazz@lenny:~/drbl-hadoop-live$ sudo lh config --help | grep "cat"
[--iso-application NAME]
[--categories CATEGORY|"CATEGORIES"]
jazz@Wdebian:~$ dpkg -l live-helper
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ 名稱 版本 簡介
+++-================-================-================================================
ii live-helper 2.0~a11-1drbl1 Debian Live build scripts
jazz@Wdebian:~$ sudo lh config --help | grep "cat"
[sudo] password for jazz:
[--iso-application NAME]
- 由於 live-helper 會產生 .stage 的檔案,所以可以用時間戳記來了解 live-helper 的大致工作流程(workflow)
jazz@lenny:~/drbl-hadoop-live/.stage$ ls --full-time * | sort -n
-rw-r--r-- 1 root root 0 2010-06-26 09:40:34.000000000 +0800 config
-rw-r--r-- 1 root root 0 2010-06-26 09:42:44.000000000 +0800 bootstrap
-rw-r--r-- 1 root root 0 2010-06-26 09:42:45.000000000 +0800 bootstrap_cache.save
-rw-r--r-- 1 root root 0 2010-06-26 09:43:05.000000000 +0800 chroot_packageslists
-rw-r--r-- 1 root root 0 2010-06-26 09:43:06.000000000 +0800 chroot_packages
-rw-r--r-- 1 root root 0 2010-06-26 09:45:58.000000000 +0800 chroot_install-packages
-rw-r--r-- 1 root root 0 2010-06-26 09:46:02.000000000 +0800 chroot_localization
-rw-r--r-- 1 root root 0 2010-06-26 09:46:05.000000000 +0800 chroot_hacks
-rw-r--r-- 1 root root 0 2010-06-26 09:46:30.000000000 +0800 binary_chroot
-rw-r--r-- 1 root root 0 2010-06-26 09:46:41.000000000 +0800 chroot_apt
-rw-r--r-- 1 root root 0 2010-06-26 09:48:51.000000000 +0800 binary_rootfs
-rw-r--r-- 1 root root 0 2010-06-26 09:48:52.000000000 +0800 binary_manifest
-rw-r--r-- 1 root root 0 2010-06-26 09:48:53.000000000 +0800 binary_linux-image
-rw-r--r-- 1 root root 0 2010-06-26 09:49:00.000000000 +0800 binary_memtest
-rw-r--r-- 1 root root 0 2010-06-26 09:49:07.000000000 +0800 binary_syslinux
-rw-r--r-- 1 root root 0 2010-06-26 09:49:08.000000000 +0800 binary_disk
-rw-r--r-- 1 root root 0 2010-06-26 09:49:08.000000000 +0800 binary_win32-loader
-rw-r--r-- 1 root root 0 2010-06-26 09:49:09.000000000 +0800 binary_includes
-rw-r--r-- 1 root root 0 2010-06-26 09:49:11.000000000 +0800 binary_md5sum
-rw-r--r-- 1 root root 0 2010-06-26 09:49:17.000000000 +0800 binary_iso

struct1:f4->"chroot_packageslists"->"chroot_packages"->"chroot_install-packages"->"chroot_localization"->"chroot_hacks"->"binary_chroot"->"chroot_apt";
"lh_binary"->"binary_rootfs"->"binary_manifest"->"binary_linux-image"->"binary_memtest"->"binary_syslinux"->"binary_disk"->"binary_win32-loader"->"binary_includes"->"binary_md5sum"->"binary_iso";
}
}}