= 2008-09-25 = * [課程] DRBL/Clonezilla 進階課程 * [小問題] 顯示卡自動偵測到解析度是 1280x768 但是接到 4:3 的螢幕 {{{ 00:02.0 VGA compatible controller: Intel Corporation 82Q963/Q965 Integrated Graphics Controller (rev 02) }}} * Ubuntu 8.04 常見 DRBL 安裝問題 * [[Image(linux-image-2.6.24_not_found.png)]] * 修改 patch {{{ #!diff --- /opt/drbl/sbin/drblsrv.org 2008-09-25 10:32:04.000000000 +0800 +++ /opt/drbl/sbin/drblsrv 2008-09-25 10:53:21.000000000 +0800 @@ -3440,7 +3440,7 @@ if [ $rc_get_kernel -gt 0 ]; then [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE echo "$latest_drbl_kernel_in_rep can NOT be downloaded!!! Something went wrong!" - echo "Maybe you should check /etc/sources.list or remove the unnecessary kernel block in /var/lib/dpkg/status so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." + echo "Maybe you should check /etc/apt/sources.list or remove the unnecessary kernel block in /var/lib/dpkg/status so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." echo "Program terminated!!!" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL exit 1 @@ -4014,7 +4014,7 @@ if [ $RC -gt 0 ]; then [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE echo "$latest_drbl_kernel_in_rep can NOT be downloaded!!! Something went wrong!" - echo "Maybe you should check /etc/sources.list so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." + echo "Maybe you should check /etc/apt/sources.list so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." echo "Program terminated!!!" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL exit 1 }}} * [備忘] Ubuntu 沒有 root 預設密碼,雖然有 sudo ,但 sudo 有兩個的困擾: * (1) 時間問題(sudo timeout): NTP更新或手動改時間的時候會造成 * (2) hostname 問題: 如果有改 hostname, sudo 也會失效 * [小問題] Windows XP 是 FAT32 格式必須轉換到 NTFS 格式 {{{ convert d: /FS:NTFS convert c: /FS:NTFS }}} * [備忘] 本機加完使用者之後,必須手動跑 YP 的帳號更新程序 {{{ drbladm@drbl-server:~$ sudo make -C /var/yp/ }}} * [備忘] 可以用 mknic-nbi 指令來更新 /tftpboot/nbi_img/ 目錄中的 Netboot Image {{{ # /opt/drbl/sbin/mknic-nbi }}} * [密技] 如果想要自己加東西到 pxe-initrd 的 initial RAMDisk 的話,可以改 /usr/lib/mkpxeinitrd-net/initrd-skel 的內容,例如想要加 NFSv4 或者把 Lustre、AoE、iSCSI 的網路硬碟,可以改 /usr/lib/mkpxeinitrd-net/initrd-skel/sbin/udhcpc-post 這些程序。 * [備忘] 為什麼 DRBL Client 的 /root 與 DRBL Server 的 /root 是各自獨立的呢? * DRBL Client 的 /root : /tftpboot/nodes/$IP/root * [備忘] dcs re-deploy 就是跑 drblpush -c /etc/drbl/drblpush.conf * [備忘] DRBL 的更新原則: 如果是 df 顯示出來的目錄讀寫權限是 RW,請重新跑 drblpush (re-deploy) 或用 drbl-cp-host 強制複製到每一台 DRBL Client。drblpush 更新方法包含 rsync 跟直接覆蓋兩種。 * [備忘] 在 Linux 底下查 BIOS 裡面的 UUID 可以用 [http://packages.debian.org/etch/dmidecode dmidecode] 套件的 dmidecode 指令,這個 UUID 就可以給 /tftpboot/nbi_img/pxelinux.cfg/ 指定特定機器的 pxelinux 設定用 * [參考] [http://www.cyberciti.biz/tips/querying-dumping-bios-from-linux-command-prompt.html Get Information About Your BIOS / Server Hardware From a Shell Without Opening Chassis ( BIOS Decoder )] * [參考] [http://www.linux.com/articles/40412 dmidecode: What's it good for?] {{{ root@drbl-xen-srv:~# dmidecode | grep UUID UUID: 564DA03C-37F5-D7DE-386D-CEF0191D96DC }}} * [小技巧] 要查 TFTP Server 的互動要求,可以把 /etc/default/tftpd-hpa 裡的 OPTIONS 加上 -v 參數 {{{ #!diff --- /etc/default/tftpd-hpa +++ /etc/default/tftpd-hpa @@ -2,1 +2,1 @@ - OPTIONS="-l -s /tftpboot/nbi_img" + OPTIONS="-l -v -v -v -s /tftpboot/nbi_img" }}} * 打開 logging verbosity 之後,重新啟動 {{{ # /etc/init.d/tftpd-hpa restart }}} * 從/var/log/daemon.log 可以看到 DRBL Client 送過來的 UUID * [小技巧] 把 /etc/dhcp3/dhcpd.conf 裡的 log 設定前的 mark 拿掉 {{{ #!diff --- /etc/dhcp3/dhcpd.conf +++ /etc/dhcp3/dhcpd.conf @@ -37,9 +37,9 @@ - #log(info, concat("Client ", - # binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)), - # " requests ", - # binary-to-ascii(16, 8, ":", option dhcp-parameter-request-list), - # " - ", - # pick-first-value(option vendor-class-identifier, "no vendor-id"), - # " - ", - # pick-first-value(option dhcp-client-identifier, "no dhcp-client-id")) - # ); + log(info, concat("Client ", + binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)), + " requests ", + binary-to-ascii(16, 8, ":", option dhcp-parameter-request-list), + " - ", + pick-first-value(option vendor-class-identifier, "no vendor-id"), + " - ", + pick-first-value(option dhcp-client-identifier, "no dhcp-client-id")) + ); }}} * 打開 dhcpd log 之後,重新啟動 dhcpd {{{ # /etc/init.d/dhcp3-server restart }}} * 就可以在 /var/log/daemon.log 裡看到 DHCP Server 與 DHCP Client 互動的過程 {{{ Sep 25 13:04:51 drbl-server dhcpd: DHCPDISCOVER from 00:0f:fe:5e:4b:f8 via eth1 Sep 25 13:04:52 drbl-server dhcpd: DHCPOFFER on 192.168.100.3 to 00:0f:fe:5e:4b:f8 via eth1 Sep 25 13:04:53 drbl-server dhcpd: DHCPREQUEST for 192.168.100.3 (192.168.100.254) from 00:0f:fe:5e:4b:f8 via eth1 Sep 25 13:04:53 drbl-server dhcpd: DHCPACK on 192.168.100.3 to 00:0f:fe:5e:4b:f8 via eth1 Sep 25 13:04:53 drbl-server in.tftpd[19982]: RRQ from 192.168.100.3 filename pxelinux.0 Sep 25 13:04:53 drbl-server in.tftpd[19982]: tftp: client does not accept options Sep 25 13:04:53 drbl-server in.tftpd[19983]: RRQ from 192.168.100.3 filename pxelinux.0 Sep 25 13:04:53 drbl-server in.tftpd[19984]: RRQ from 192.168.100.3 filename pxelinux.cfg/de568b5e-d92a-dc11-bbda-fe5e4bf8000f Sep 25 13:04:53 drbl-server in.tftpd[19984]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19985]: RRQ from 192.168.100.3 filename pxelinux.cfg/01-00-0f-fe-5e-4b-f8 Sep 25 13:04:53 drbl-server in.tftpd[19985]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19986]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A86403 Sep 25 13:04:53 drbl-server in.tftpd[19986]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19987]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A8640 Sep 25 13:04:53 drbl-server in.tftpd[19987]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19988]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A864 Sep 25 13:04:53 drbl-server in.tftpd[19988]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19989]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A86 Sep 25 13:04:53 drbl-server in.tftpd[19989]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19990]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A8 Sep 25 13:04:53 drbl-server in.tftpd[19990]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19991]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0A Sep 25 13:04:53 drbl-server in.tftpd[19991]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19992]: RRQ from 192.168.100.3 filename pxelinux.cfg/C0 Sep 25 13:04:53 drbl-server in.tftpd[19992]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19993]: RRQ from 192.168.100.3 filename pxelinux.cfg/C Sep 25 13:04:53 drbl-server in.tftpd[19993]: sending NAK (1, File not found) to 192.168.100.3 Sep 25 13:04:53 drbl-server in.tftpd[19994]: RRQ from 192.168.100.3 filename pxelinux.cfg/default Sep 25 13:04:53 drbl-server in.tftpd[19995]: RRQ from 192.168.100.3 filename menu.c32 Sep 25 13:04:53 drbl-server in.tftpd[19996]: RRQ from 192.168.100.3 filename pxelinux.cfg/default Sep 25 13:05:12 drbl-server in.tftpd[20001]: RRQ from 192.168.100.3 filename vmlinuz-pxe Sep 25 13:05:12 drbl-server in.tftpd[20002]: RRQ from 192.168.100.3 filename initrd-pxe.img }}} * [備忘] DRBL 群組的作法: 寫 /etc/drbl/IP-grp-* 或 /etc/drbl/IP-mac-* {{{ root@drbl-server:~# cat /etc/drbl/IP-grp-1 192.168.100.1 192.168.100.2 192.168.100.3 }}} * 如果 {{{ root@drbl-server:/tftpboot/nbi_img/pxelinux.cfg# ls -al 總計 28 drwxr-xr-x 2 root root 4096 2008-09-25 14:39 . drwxr-xr-x 3 root root 4096 2008-09-25 10:31 .. -rw-r--r-- 1 root root 3829 2008-09-25 14:39 C0A86401 -rw-r--r-- 1 root root 3829 2008-09-25 14:39 C0A86402 -rw-r--r-- 1 root root 3829 2008-09-25 14:39 C0A86403 -rw-r--r-- 1 root root 3831 2008-09-25 14:34 default -rw-r--r-- 1 root root 3829 2008-09-25 14:39 default_skeleton }}} * [備忘] 用 DRBL 來製作 GNU/Linux 網路安裝 USB 隨身碟 * 首先檢查 USB 隨身碟代號,可以從 dmesg , /proc/partitions 得知,在 Ubuntu 8.04 會自動 mount 到 /media/USB {{{ root@drbl-server:~# cat /proc/partitions major minor #blocks name 8 16 253440 sdb 8 17 248976 sdb1 root@drbl-server:~# mount /dev/sdb1 on /media/USB type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush) }}} * 執行 drbl-syslinux-netinstall 以後跑 syslinux 更新 MBR 的部分理論上就可以用這個 USB 拇指碟開機了 {{{ root@drbl-server:~# /opt/drbl/sbin/drbl-syslinux-netinstall root@drbl-server:~# unzip linux-netinstall-20080925.zip -d /media/USB/ root@drbl-server:~# which syslinux /usr/bin/syslinux root@drbl-server:~# umount /media/USB/ root@drbl-server:~# syslinux -s /dev/sdb1 root@drbl-server:~# cat /usr/lib/syslinux/mbr.bin > /dev/sdb }}} * [備忘] Ubuntu 8.04 安裝 VirtualBox 的程序(安裝 gcin 跟 VirtualBox,並設定 TUN 內部網路) {{{ drbladm@drbl-server:~$ sudo apt-get update; sudo apt-get install gcin virtualbox-ose virtualbox-ose-modules-`uname -r` drbladm@drbl-server:~$ im-switch -s gcin drbladm@drbl-server:~$ sudo /etc/init.d/vboxdrv restart drbladm@drbl-server:~$ sudo adduser `whoami` vboxusers drbladm@drbl-server:~$ wget http://drbl.nchc.org.tw/advanced/01_DRBL/utils/config-tun.sh drbladm@drbl-server:~$ sudo apt-get install uml-utilities; sudo chmod +x config-tun.sh; sudo ./config-tun.sh start }}} * [無聊亂測] 產生 GRUB Bootable CD Iso 檔案 * 參考: [http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD-ROM.html GRUB 官方文件] {{{ root@drbl-xen-srv:~# mkdir iso root@drbl-xen-srv:~# mkdir -p iso/boot/grub root@drbl-xen-srv:~# cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub/ root@drbl-xen-srv:~# }}}