Tommy 碎碎念

Tommy Wu's blog

Debian 的 dkms_autoinstaller 當同一個模組有多個版本時的處理
post by tommy @ 26 四月, 2012 10:23

最近發現在安裝新的 kernel 時, Debian 在安裝之後, 會去處理 dkms 的模組, 但是當同一個模組有多個版本存在時, /usr/lib/dkms/dkms_autoinstaller 這個 script 就會回報這個錯誤:

Apr 25 17:09:33 mail dkms_autoinstaller: e1000e: Multiple versions in DKMS. Unsure what to do. Resolve manually.
Apr 25 17:09:33 mail dkms_autoinstaller: igb: Multiple versions in DKMS. Unsure what to do. Resolve manually.

由於舊的版本通常是在目前或舊的 kernel 仍在使用, 所以也無法馬上就移除. 所以每次有新的版本時, 就有這個問題. (有其他的解決方法嗎?)

使用這個 patch, 可以直接選擇最大的版本來用, 這樣就可以允許多個版本存在 (這應該是多數情況下的選擇):

--- dkms_autoinstaller.orig     2012-04-26 10:03:51.235070429 +0800
+++ dkms_autoinstaller 2012-04-26 10:03:50.691733326 +0800
@@ -79,7 +79,10 @@
version_count=0
already_installed=""
already_installed_version=""
- for versioned_path in $(find "$modulepath" -maxdepth 1 -mindepth 1 -type d -a -not -name original_module); do
+ for versioned_path in $(find "$modulepath" -maxdepth 1 -mindepth 1 -type d -a -not -name original_module | sort -r); do
+ if [ "$version_count" -gt 0 ]; then
+ continue
+ fi
version_count=$(($version_count + 1))
version_in_tree="${versioned_path##*/}"

這樣以後更換新的版本時, 就應該會自動處理了.

Del.icio.us Furl HEMiDEMi Technorati MyShare
initamfs 使用 xz 來壓縮
post by tommy @ 18 四月, 2012 17:47

昨天把 kernel 裡頭關於 xz 的支援打開後, 就把 kernel 改用 xz 來壓縮, 解壓縮的速度比 bzip2 快, 壓起來又比 bzip2 小. 所以就想把 initramfs 也改用 xz 來壓縮.

由於 Debian Squeeze 的 initramfs-tools 並沒有支援 xz, 不過... 看那個 script, 並沒有要求 /etc/initramfs-tools/initramfs.conf 這個檔案內的 COMPRESS 設定只能設它所列的那一個, 而是把這個設定當成指令來執行壓縮的動作, 所以... 我原本以為就直接改成 xz, 這樣就可以了.

執行 mkinitramfs 或 update-initramfs 之後, 雖然是產生了一個 xz 壓縮的檔案, 不過.... 重開機後, 發現 kernel 沒辦法正確載入那個檔案....

後來看到這篇,  提到要用這樣的參數才可以:

find . | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > /usr/src/initram.igz

所以... 還是要去改 /usr/sbin/mkinitramfs 這個 script 的內容, 對 xz 特別去處理才可以.

後來看到 Debian 有這個 patch 可以用:

diff -uNr initramfs-tools-0.98.8/conf/initramfs.conf initramfs-tools-0.98.8.new/conf/initramfs.conf
--- initramfs-tools-0.98.8/conf/initramfs.conf 2010-08-26 03:32:27.000000000 +0800
+++ initramfs-tools-0.98.8.new/conf/initramfs.conf 2011-05-12 09:49:57.000000000 +0800
@@ -36,7 +36,7 @@
KEYMAP=n
 
#
-# COMPRESS: [ gzip | bzip2 | lzma | lzop ]
+# COMPRESS: [ gzip | bzip2 | lzma | lzop | xz ]
#
 
COMPRESS=gzip
diff -uNr initramfs-tools-0.98.8/mkinitramfs initramfs-tools-0.98.8.new/mkinitramfs
--- initramfs-tools-0.98.8/mkinitramfs 2011-01-28 22:09:09.000000000 +0800
+++ initramfs-tools-0.98.8.new/mkinitramfs 2011-05-12 09:49:27.000000000 +0800
@@ -149,6 +149,8 @@
 
[ "${compress}" = lzop ] && compress="lzop -9"
 
+[ "${compress}" = xz ] && compress="xz -9 --check=crc32"
+
if [ -d "${outfile}" ]; then
echo "${outfile} is a directory" >&2
exit 1

加上 --check=crc32 就可以了.

這樣子處理後的檔案, 果然可以正常開機了.

Del.icio.us Furl HEMiDEMi Technorati MyShare
LVM 無法正常移除 snapshot?
post by tommy @ 16 四月, 2012 11:20

最近發現每天使用 LVM snapshot 備份的時候, 總會有些 snapshot 無法被移除, 找了一下, 應該是 LVM 與 udisks 搭配時發生的問題.

解決方法也很簡單, 就是一直試到可以移除為止. (上頭連結有人說用 lvchange 先改狀態再移除就可以, 不過我試的結果, 也是有無法移除的時候, 所以.... 弄個 loop 來移除, 試到可以移除為止, 這是目前比較可行的方法)

我把原本移除的動作改用 for loop 處理, 目前看起來多試在試了兩三次後就會被移除了.

Del.icio.us Furl HEMiDEMi Technorati MyShare
btrfs
post by tommy @ 16 四月, 2012 09:13

btrfs Oracle linux 所做的一個 open source filesystem, 其主要目標應該是 ZFS (因為授權的關係, 無法直接納入 linux kernel 中) 吧. (閱讀全文)

Del.icio.us Furl HEMiDEMi Technorati MyShare
Bad Behavior 已經阻擋了 52 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS