casper-rw file not detected due to improper use of fstype

Bug #365853 reported by whitis
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Invalid
Undecided
Tormod Volden

Bug Description

Binary package hint: casper

ubuntu-9.04-rc-desktop-i386.iso

Casper is unable to find the file casper-rw in the root directory of a FAT filesystem located on partition 1 of a USB drive (/dev/sdb1 on target system). Kernel booted with the "persistence" option.

Inside initrd.gz, the file scripts/casper has the persistence. It looks for casper-rw for whole system persistence and home-rw for home directory persistence. It uses a function find_cow_device() in scripts/casper-helpers. This in turn makes use of /usr/lib/klibc/bin/fstype to report the filesystem type for each partition it finds. Unfortunately, this program is returning UNKNOWN for the usb drive partition, among others. find_cow_device expects this program to return "vfat". This is impossible since fstype has no test for FAT filesystems, as verified by looking at the source for klibc-1.5 and by running strings on it.

This bug may have been introduced in a hurried attempt to prevent casper from mounting, and therefore replaying the journal file, on journaling filesystems on a system in hibernation. Or perhaps a modified version of fstype.c was used which was then reverted.

I am, incidentally, using a manually constructed USB image due to a failure of usb-creator to put the files on the filesystem in a sensible order that can be booted on systems with a BIOS 512MB (no LBA) limit on usb devices presented as floppies. It has been carefully checked using diff and cmp to be identical to the image created by usb-creator except for a sensible file order, syslinux.cfg is in /syslinux/ where it belongs, and isolinux.cfg is still there. The differences are not relevant to this bug. The initrd.gz file on the original ISO image was checked to contain this bug. /usr/lib/klibc/bin/fstype (on running system) and /casper/initrd.gz/bin/fstype (from ISO image) where both checked with "strings $filename | fgrep -i fat". Neither is capable of detecting FAT filesystems and returning the string "vfat".
  http://www.freelabs.com/~whitis/linux/usb_ubuntu_9.04RC/index.xhtml

The usb partition was formated using mkfs.msdos (on a debian system). But, again, not relevent since the bit pattern present is irrelevant to detection failure when there is no code to check for FAT in the first place.

Revision history for this message
whitis (whitis) wrote :

Actually, double checking, the get_fstype() function tries a second method if fstype returns "unknown": it uses "/lib/udev/vol_id -t /dev/sdb1". And, in fact /lib/udev/vol_id, when run from within the (initframfs) prompt, does display "vfat" and get_fstype is actually returning "vfat". So, the title of the bug is wrong.

I have found that if I type "persistent" on the kernel command line, I drop out to (initramfs) prompt, which I am exploiting to look around in the (initramfs) environment.

/casper-rw-backing has been created but isn't mounted.
Running try_mount "/dev/sdb1" "/casper-rw-backing" "rw"
gives
/bin/sh: head: not found
/bin/sh: head: not found
/bin/sh: head: not found
mount: cannot read /etc/fstab: No such file or directory
/bin/sh: panic: not found
which I fixed using PATH=$PATH:/filesystem.squashfs/usr/bin
now try_mount succeeds in mounting.
and
   if [ -e "/casper-rw-backing/casper-rw" ]; then echo yes; fi
says yes.

(initramfs) find_cow_device casper-rw
stdin: error 0
/dev/loop1
but running ". /scripts/casper" still doesn't mount anything on /cow (nor does it report any errors), even though I export PERSISTENT="Yes"
(initramfs) mount -t vfat -o rw,noatime /dev/loop1 /cow
mount: mounting /dev/loop1 on /cow failed: Invalid argument
  (my fault, it is ext3, not vfat)
(initramfs) setup_loop "/casper-rw-backing/casper-rw" "loop" "/sys/block/loop*"
/dev/loop2
(initramfs) losetup -a
/dev/loop0: [0811]:30 (/cdrom/casper/filesystem.squashfs)
/dev/loop1: [0811]:35 (/casper-rw-backing/casper-rw)
/dev/loop2: [0811]:35 (/casper-rw-backking/casper-rw)
(initrams) mount -t ext3 -o rw,noatimer /dev/looop1 /cow
  Works
Can now see /cow/lost\+found

exit 1 leaves (inirtramfs) mode

sleep now

Revision history for this message
whitis (whitis) wrote :

I got tired of trying to debug the file loading and went ahead and created a ext3 casper-rw partition. A script to build a flash image can be found here:
http://www.freelabs.com/~whitis/linux/usb_ubuntu_9.04RC/index.xhtml

However, the original problems with loading the file should be solved.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

The error seen above due to the use of "head" in the initrd has been fixed. Can you please try a Karmic live CD to see if it now works?

Changed in casper (Ubuntu):
assignee: nobody → Tormod Volden (tormodvolden)
status: New → Incomplete
Revision history for this message
Tormod Volden (tormodvolden) wrote :

And please attach casper.log (see also https://wiki.ubuntu.com/DebuggingCasper)

Revision history for this message
febrile (febrile) wrote :

Just to flag up that this issue may also apply to UNR 9.10 beta:

I make a bootable SD card of ubuntu-9.10-beta-netbook-remix.iso with usb-creator
- with persistence I have the same (initramfs) error: mounting /dev/loop1 on /cow failed
- with no persistence it boots fine

I'm afraid I didn't investigate much at the time (just went ahead without persistence) and only subsequently spotted this bug report. When I have spare media I'll try to recreate this and see if PATH=$PATH:/filesystem.squashfs/usr/bin gets around it as above.

Revision history for this message
lio (liolikliolik) wrote :

i'm absolutely new to ubuntu, just wanted to install it on asus eee pc 900a (the asus pre-installed software is not comfortable :-)

So i created the bootable USB drive with ubuntu 9.10 netbook remix, started the installation, but it gives an error:
Can not mount /dev/loop1 on /cow
and asks (initramfs)...
Please advise if there is any easy way to continue the installation
thanks

Revision history for this message
Tormod Volden (tormodvolden) wrote :

We'd like to figure out what's causing this bug for you, but we haven't heard back from you in a while. Could you please provide the requested information? Thanks!

Revision history for this message
NetLife (juice-keys) wrote :

I would just like to say I am having the exact same issue Febrile is describing. Boots OK without persistence and does not boot with persistence.

I can also confirm that this occurs with knoppix 6 as well. When I create a persitent img file it no longer booted. I booted from the CD then deleted the file, and bam, the usb drive booted again.

If there is any workaround please let me know.

Revision history for this message
NetLife (juice-keys) wrote :

nevermind, I should have read the whole thread.

In any case, I tried the script. I had to take out the "p" option on all the cp commands to get it to work. It booted, but only once. On the second boot it said it couldn't mount /dev/sda2

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Unless one of you is willing to provide the information we have asked for, there is nothing we can do about it. Please reopen the bug if you have exact same description as in the original report and attach the casper.log.

Changed in casper (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
NetLife (juice-keys) wrote :

My apologies, Tormod. To be honest, I don't know how much related to the original post this is. However, I am almost 100% sure this is the same problem febrile is having (post #5). Furthermore, it may have something to do with agp since I can boot with persistence if I yank out my geforce fx5200 agp card and put in a pci one.

So if you want to leave this closed or reopen based on what I posted, it's your call.

attached is the casper.log.

thanks

NetLife (juice-keys)
Changed in casper (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
fester88 (fester-warpedculture) wrote :

I am also having the same problem as febrile. I have downloaded the latest Ubuntu Netbook Remix 9.10, followed the instructions for building a USB boot disk and get the error "Can not mount /dev/loop1 on /cow" on my Asus Eee PC 4G.

I followed the instructions for getting the casper.log, have attached it to this comment and hope that it can help shed some light on this issue.

Revision history for this message
fester88 (fester-warpedculture) wrote :

Actually, I just solved this problem by using the method explained at:
http://ubuntuforums.org/archive/index.php/t-1306277.html

On creation of the USB boot disk using usb-creator, selecting "discarded on shutdown" resolves the problem for me.

Revision history for this message
dach (dacherx) wrote :

I'm also new user to unbuntu UNR. That's the wrong solution. You no longer have a persistent storage by running usb-creator with "discarded on shutdown". This problem is caused usb-creator.exe not creating a proper casper-rw containting a valid ext3/ext2 filesystem.

Fixes are to create a working casper_rw using http://www.pendrivelinux.com/casper-rw-creator-make-a-persistent-file-from-windows/ or cygwin tools (which is what I did)

Changed in casper (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.