Fixing Live CD boot error: Ext3fs unsupported optional features: (240)

Scenario:
Live CD boot without problem in qemu, but boot failed in a real machine with ext4 filesystem in local hard drive. The boot failed because of the following error:
Ext3fs: sdaX: unsupported optional features: (240)
root filesystem is not mounted and the boot sequence either fell into an infinite loop displaying the error or into busybox.

Explaination
I first encountered this error years ago in clonezilla Live CD, as I choose a new version of the Live CD image, the problem was gone. This time, I encountered this error again with BackTrack 4 Live CD Image. However, BackTrack Linux doesn't have a release roadmap and even if it does, the problem is not likely to be fixed since there is a workaround for it. As I insists in keeping my live usb layout neat, I decided to fix it myself.

After tracing the code of 'Casper' and doing some experiments, I finally get to the bottom of it. Let's first see the grub4dos entry:

title BackTrack Linux
root (hd0,1)
kernel /BackTrack/vmlinuz BOOT=casper boot=casper iso-scan/filename=/BackTrack/bt4-mod.iso nopersistent textonly rw
initrd /BackTrack/initrd.gz

As you can see, I use the option 'iso-scan/filename' to tell Casper where the rootfs is(If you want to know how to use this option, check out this post for instructions).

The option is saved in /proc/cmdline, and Casper access it through /proc/cmdline as well. In order for Casper to find the device that contains the image, Casper will try to mount the device in the list
$(echo /sys/block/* | tr ' ' '\n' | grep -v /ram | grep -v /loop | grep -v /fd)
and see if the device contains the ISO image.

To mount the device, Casper use the program 'fstype' to determine the filesystem type, which is part of the package 'klibc-utils'. The problem lies in the program 'fstype'.

From the error message:
Ext3fs: sdaX: unsupported optional features: (240)
Because ext4 is an upgraded version of ext3, the 'unsupported optional features' actually means the features of ext4. This means that Casper is mounting sdaX with ext3 format, but sdaX is in fact an ext4 formatted disk. So we can guess that there is some problem in the detection of filesystem type. Since I had updated the live CD kernel to 2.6.34, which definitly supports ext4, there is no reason that the kernel can't recognize ext4 format.

As I mentioned, the problem lies in the program 'fstype'. Since BackTrack Linux is based on ubuntu 8.10, which in that time, does not support ext4 format. The klibc-utils package in the ubuntu repository is outdated and does not recognize ext4. That is why 'fstype' recognizes an ext4 disk as an ext3 one and thus leads to an error. Casper either dies or falls into an infinite loop when this error occurs.

Solution
Since the problem occurred because that the package 'klibc-utils' is outdated, we simply upgrade the package and rebuild the ramfs. If you have an machine with ubuntu(version >= 9.04) installed, simply cd to the chroot directory and execute the following command:

cd ~/bt4/edit/root
sudo aptitude download libklibc klibc-utils

In chroot environment:

cd
dpkg -i *.deb
rm *.deb
update-initramfs -u

After this, copy the initrd.gz to your usb. In my case /media/BOOT/BackTrack.
Note: You don't have to rebuild the ISO again since the boot process is took care by 'vmlinuz' and 'initrd.gz' located in the root directory(along with the ISO image).

That's it.

Have fun :)

留言

匿名表示…
what do you mean by cd to the chroot directory and execute the following command? do i have to extract my bt4 iso?
AZ Huang寫道…
yes, you have to unpack the rootfs. See http://www.offensive-security.com/backtrack/customising-backtrack-live-cd-the-easy-way/ for instructions.

這個網誌中的熱門文章

決定了!!!

P.S. I Love You

Tips: PPTP client on Openwrt