2014-06-22

[筆記] 解決Ubuntu 14.04 使用SoftRAID或LVM開機出現diskfilter writes are not supported

Ubuntu Server出了新版14.04,剛好最近公司Mail Server掛點,乾脆就重灌成這版吧,比起不熟悉的OpenSUSE,我還是更習慣Ubuntu

使用SoftRAID安裝好後,重開機,但這時畫面卻出現這個:


雖然不理她,五秒鐘之後也會繼續開機,功能也都正常,但心裡總是不舒坦,覺得哪裡怪怪的....

搜尋了一下,這個的確是14.04的Bug。還好,在Bug回報討論串有人提出已經解決了。
底下就是解法:
Fix from #28 extended to support LVM (so, I think, it is universal clean fix of this bug). Change recordfail section in /etc/grub.d/00_header to:
if [ "$quick_boot" = 1 ]; then
    cat <<EOF
function recordfail {
  set recordfail=1
EOF
    GRUBMDDEVICE="$(grub-probe --target=disk "${grubdir}")"
    GRUBLVMDEVICE="$(grub-probe --target=disk "${grubdir}")"
    if echo "$GRUBMDDEVICE" | grep "/dev/md" > /dev/null; then
        cat <<EOF
  # GRUB lacks write support for $GRUBMDDEVICE, so recordfail support is disabled.
EOF
    elif echo "$GRUBLVMDEVICE" | grep "/dev/mapper" > /dev/null; then
        cat <<EOF
  # GRUB lacks write support for $GRUBLVMDEVICE, so recordfail support is disabled.
EOF
    else
        FS="$(grub-probe --target=fs "${grubdir}")"
        case "$FS" in
          btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)
            cat <<EOF
  # GRUB lacks write support for $FS, so recordfail support is disabled.
EOF
          ;;
          *)
            cat <<EOF
  if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
EOF
        esac
    fi
    cat <<EOF
}

接著執行update-grub,然後重新開機即可。