ziesemer
November 6th, 2009, 10:52 PM
I've been having pretty good success creating a bootable USB flash drive with the Ubuntu "live" environment (casper). I'm using the official release of Karmic Koala (9.10), x86, and have followed the notes at https://wiki.ubuntu.com/LiveUsbPendrivePersistent (method 3) and https://help.ubuntu.com/community/LiveCD/Persistence .
The only real difference so far is that I plan on using Ext2 (or maybe even 3 or 4) instead of Fat16/32, and as such am using Grub2 (1.97) instead of SYSLINUX. I'm also testing everything using VirtualBox, and as such, am using a virtual hard disk instead of an actual USB drive, as VirtualBox currently doesn't support booting from USB.
I had everything working great, including persistence. However, the root of my boot drive seemed very messy, with 5+ folders created for the contents of the live CD (casper, preseed, etc.), another 5+ folders for persistence (etc, home, var, etc.), and everything else I was hoping to share the partition with. Ideally, all of the contents of the live CD would be copied into a "ubuntu-live" directory, and all of the persistence data would be kept in a "ubuntu-persistence" directory.
Here is the Grub2 entry that I had when everything was working as expected:
menuentry "Ubuntu 9.10 32-bit - Live" {
linux /casper/vmlinuz boot=casper persistent --
initrd /casper/initrd.lz
}
I then moved all of the live CD folders (casper, preseed, etc.) into /ubuntu-live, and updated the Grub2 entry with the "live-media-path" option as documented at http://manpages.ubuntu.com/manpages/karmic/man7/live-getty.7.html :
menuentry "Ubuntu 9.10 32-bit - Live" {
linux /ubuntu-live/casper/vmlinuz boot=casper live-media-path=/ubuntu-live/casper ignore_uuid persistent --
initrd /ubuntu-live/casper/initrd.lz
}
I had to add the "ignore_uuid" option to prevent the boot from hanging with infinite "stdin: error 0" outputs (after "Begin: Running /scripts/casper-premount ...", 2 "Done." lines, and a few EXT4-4s kernel debug outputs, apparently due to the hidden ".disk" directory missing from the root of the drive.
However, I'm stuck with the following output: (OCR'd from VirtualBox print-screen using tesseract with manual edits)
[ 5.780380] device-mapper: dm-raid45: initialized v0.2594b
Done.
Begin: Running /scripts/init-premount ...
Done.
Begin: Mounting root file system... ...
[ 6.937398] EXT4-fs (sda1): barriers enabled
Begin: Running /scripts/casper-premount ...
Done.
Done.
[ 6.939426] kjournald2 starting: pid 339, dev sda1:8, commit interval 5 seconds
[ 6.940156] EXT4-fs (sda1): delayed allocation enabled
[ 6.940575] EXT4-fs: file extents enabled
[ 6.941079] EXT4-fs: mballoc enabled
[ 6.941384] EXT4-fs (sda1): mounted filesystem with ordered data mode
[ 6.996176] aufs 2-standalone.tree-30-20090727
[ 7.167173] squashfs: version 4.0 (2009/01/31) Phillip Lougher
BusyBox u1.13.3 (Ubuntu 1:1.13.3-lubuntu?) built-in shell (ash)
Enter 'help’ for a list of built-in commands.
(initramfs) mount: mounting /dev/sdal on /cow failed: Device or resource busy
Can not mount /dev/sdal on /cow
Hitting enter gives a "(initramfs)" BusyBox prompt.
Removing the "persistent" option allows for a successful boot as a normal live CD, but without persistence.
What does "cow" stand for in this context?
After some digging, this appears to be coming from line 426 in /initrd/scripts/casper , shortly after calling the "find_cow_device" function that is defined in casper-helpers. Overall, it seems that something else already has /dev/sda1 locked, but I don't know what. Not knowing exactly what "/cow" is supposed to be or what it is used for doesn't help, either. I'm wondering if maybe this entire mount section is unnecessary, and if a symbolic link would suffice instead?
I considered trying to edit the casper script to make this work, or at least to add some additional debugging. Is there an easier way to do this short of rebuilding it into a new casper/initrd.lz every time? (https://wiki.ubuntu.com/CustomizeLiveInitrd)
Some additional references that I found:
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/406192
"[karmic] various pre-mount errors". Not sure this is even relevant.
http://brainstorm.ubuntu.com/idea/15173
"Idea #15173: Add live-media-path boot option or similar, to allow booting from folder in root" Seems to be the exact same thing as I'm trying to do, though with no reference to the "live-media-path" option.
http://www.mail-archive.com/debian-live@lists.debian.org/msg00580.html
"Re: "BOOT FAILED!" with a live-rw partition (ext2 and ext3 tested)" Same error that I'm getting, though reported at the Debian level. Mentions a fix, but not sure if it would already be in Karmic or not.
http://bromavilleherald.com/index.php/Casper_boot_process
"Casper boot process"
http://manpages.ubuntu.com/manpages/karmic/en/man7/casper.7.html
http://manpages.ubuntu.com/manpages/karmic/en/man8/initramfs-tools.8.html
Finally, I also found http://manpages.ubuntu.com/manpages/karmic/man7/live-getty.7.html . It mentions that it is a fork of Casper, and most significantly, includes a "persistent-path" option in addition to "live-media-path" and other potentially useful options. Should I consider trying to switch over to this, instead, if even possible?
Are there any other ideas or fixes to get this working as expected?
Thanks!
The only real difference so far is that I plan on using Ext2 (or maybe even 3 or 4) instead of Fat16/32, and as such am using Grub2 (1.97) instead of SYSLINUX. I'm also testing everything using VirtualBox, and as such, am using a virtual hard disk instead of an actual USB drive, as VirtualBox currently doesn't support booting from USB.
I had everything working great, including persistence. However, the root of my boot drive seemed very messy, with 5+ folders created for the contents of the live CD (casper, preseed, etc.), another 5+ folders for persistence (etc, home, var, etc.), and everything else I was hoping to share the partition with. Ideally, all of the contents of the live CD would be copied into a "ubuntu-live" directory, and all of the persistence data would be kept in a "ubuntu-persistence" directory.
Here is the Grub2 entry that I had when everything was working as expected:
menuentry "Ubuntu 9.10 32-bit - Live" {
linux /casper/vmlinuz boot=casper persistent --
initrd /casper/initrd.lz
}
I then moved all of the live CD folders (casper, preseed, etc.) into /ubuntu-live, and updated the Grub2 entry with the "live-media-path" option as documented at http://manpages.ubuntu.com/manpages/karmic/man7/live-getty.7.html :
menuentry "Ubuntu 9.10 32-bit - Live" {
linux /ubuntu-live/casper/vmlinuz boot=casper live-media-path=/ubuntu-live/casper ignore_uuid persistent --
initrd /ubuntu-live/casper/initrd.lz
}
I had to add the "ignore_uuid" option to prevent the boot from hanging with infinite "stdin: error 0" outputs (after "Begin: Running /scripts/casper-premount ...", 2 "Done." lines, and a few EXT4-4s kernel debug outputs, apparently due to the hidden ".disk" directory missing from the root of the drive.
However, I'm stuck with the following output: (OCR'd from VirtualBox print-screen using tesseract with manual edits)
[ 5.780380] device-mapper: dm-raid45: initialized v0.2594b
Done.
Begin: Running /scripts/init-premount ...
Done.
Begin: Mounting root file system... ...
[ 6.937398] EXT4-fs (sda1): barriers enabled
Begin: Running /scripts/casper-premount ...
Done.
Done.
[ 6.939426] kjournald2 starting: pid 339, dev sda1:8, commit interval 5 seconds
[ 6.940156] EXT4-fs (sda1): delayed allocation enabled
[ 6.940575] EXT4-fs: file extents enabled
[ 6.941079] EXT4-fs: mballoc enabled
[ 6.941384] EXT4-fs (sda1): mounted filesystem with ordered data mode
[ 6.996176] aufs 2-standalone.tree-30-20090727
[ 7.167173] squashfs: version 4.0 (2009/01/31) Phillip Lougher
BusyBox u1.13.3 (Ubuntu 1:1.13.3-lubuntu?) built-in shell (ash)
Enter 'help’ for a list of built-in commands.
(initramfs) mount: mounting /dev/sdal on /cow failed: Device or resource busy
Can not mount /dev/sdal on /cow
Hitting enter gives a "(initramfs)" BusyBox prompt.
Removing the "persistent" option allows for a successful boot as a normal live CD, but without persistence.
What does "cow" stand for in this context?
After some digging, this appears to be coming from line 426 in /initrd/scripts/casper , shortly after calling the "find_cow_device" function that is defined in casper-helpers. Overall, it seems that something else already has /dev/sda1 locked, but I don't know what. Not knowing exactly what "/cow" is supposed to be or what it is used for doesn't help, either. I'm wondering if maybe this entire mount section is unnecessary, and if a symbolic link would suffice instead?
I considered trying to edit the casper script to make this work, or at least to add some additional debugging. Is there an easier way to do this short of rebuilding it into a new casper/initrd.lz every time? (https://wiki.ubuntu.com/CustomizeLiveInitrd)
Some additional references that I found:
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/406192
"[karmic] various pre-mount errors". Not sure this is even relevant.
http://brainstorm.ubuntu.com/idea/15173
"Idea #15173: Add live-media-path boot option or similar, to allow booting from folder in root" Seems to be the exact same thing as I'm trying to do, though with no reference to the "live-media-path" option.
http://www.mail-archive.com/debian-live@lists.debian.org/msg00580.html
"Re: "BOOT FAILED!" with a live-rw partition (ext2 and ext3 tested)" Same error that I'm getting, though reported at the Debian level. Mentions a fix, but not sure if it would already be in Karmic or not.
http://bromavilleherald.com/index.php/Casper_boot_process
"Casper boot process"
http://manpages.ubuntu.com/manpages/karmic/en/man7/casper.7.html
http://manpages.ubuntu.com/manpages/karmic/en/man8/initramfs-tools.8.html
Finally, I also found http://manpages.ubuntu.com/manpages/karmic/man7/live-getty.7.html . It mentions that it is a fork of Casper, and most significantly, includes a "persistent-path" option in addition to "live-media-path" and other potentially useful options. Should I consider trying to switch over to this, instead, if even possible?
Are there any other ideas or fixes to get this working as expected?
Thanks!