A week of livecd-tools hacking

In addition to spending a bit of time on my presentation for the Red Hat Summit on the state of the livecd tools and some of the surround stuff, I've also taken the time to go through and take care of some outstanding bugs and feature requests. Some of them were boring things for corner cases, but there are a couple of them that are a bit more interesting

The first is an addition to the persistence support which we added in Fedora 9. Instead of just keeping a snapshot (via dm-snapshot) of the changes to your filesystem in an overlay, you can now also set up something to be used as /home. By default, this will be a file on the same USB key that you put the Live OS on, but you can also specify to use a partition by uuid, label or device name. So you could potentially even have the /home located on a hard drive in your system and just always boot the OS off of USB. Also, due to a lot of the concerns around security and losing laptops or hard drives, etc, I've made it so that the default for the persistent /home is that it be encrypted with dm-crypt. This way, if you lose your USB key, your data at least won't be compromised. Watch for this as we start to do Fedora 10 images

The second is more targeted at a specific class of hardware. As you might have noticed, there are a growing number of Linux users who are choosing to run Linux on top of the current Intel-based Apple hardware. One of the features in Fedora 9 is native support for booting these machines directly from EFI rather than going through the “legacy” BIOS mode. (Side note — this is often referred to as Boot Camp, but while the BIOS mode was added at the same time as Boot Camp's release, the BIOS mode was purely made possible by firmware changes and Boot Camp is the OS X app used for resizing your OS X install partition). The second piece is that these Intel based Macs do actually have support in their firmware for booting off of USB… the trick is that they can only do so via EFI and not via the legacy BIOS. So, I decided to make the changes necessary so that you can create a Live USB stick which boots on the Intel Macs. Unfortunately, it has a couple of limitations that aren't present in the general case.

  1. If you have one of the newer 64-bit capable Macs, you must use the 64-bit OS. We don't currently support booting the 32-bit OS from the 64-bit EFI
  2. Creating the USB key is currently a destructive process. One of the things about EFI is that it mandates the use of GPT for your partition table. And your USB key certainly came with an msdos partition table. I want to try to see if there's anything clever I can do, but I suspect this is just the way it rolls.
  3. Right now, you'll have to use a livecd created with git livecd-tools and it won't work with the Fedora 9 live images. But I should be able to put something into the livecd-iso-to-disk script to at least make this okay, I just haven't had the time today

8 thoughts on “A week of livecd-tools hacking”

  1. What would be awesome for live persistence is more robustness… currently if you get a hard freeze (it happens, I had it a few times), use the power button to reboot and very likely your live install is dead, you have to wipe the drive and write it again.
    So I am very reluctant about having personal data on a live USB drive with write persistence.

  2. Probably the biggest thing you can do to help on the robustness front is to not use vfat on the USB drive. Using ext2 is likely to give you significantly better failure characteristics there — it does also mean reformatting the stick, though.

    Also, I expect that using a partition for persistent home (rather than a loopback file) will give some better failure modes also, but that’s purely a hunch.

    Sadly, though, I bet that some of the problems come down to the flash in the USB disk doing silly nutters on a power “surge” during the reboot. But again, that’s just a hunch.

  3. 1. If you have one of the newer 64-bit capable Macs, you must use the 64-bit OS. We don’t currently support booting the 32-bit OS from the 64-bit EFI.

    The other direction might actually be easier, but they’re both a nasty chunk of work.

    2. Creating the USB key is currently a destructive process. One of the things about EFI is that it mandates the use of GPT for your partition table. And your USB key certainly came with an msdos partition table. I want to try to see if there’s anything clever I can do, but I suspect this is just the way it rolls.

    Pretty sure we’re just plain stuck with this. That being said, we could probably still do the gptsync trick…

  4. Creating the USB key is currently a destructive process. One of the things about EFI is that it mandates the use of GPT for your partition table. And your USB key certainly came with an msdos partition table.

    Or is formatted as a “superfloppy” with no partition table, but the same point still applies. 🙂

  5. That’s actually pretty uncommon with current keys. I haven’t actually gotten one without a partition table in any of my recent “ooh, I’ll just buy that one” sprees

  6. A bit more information for Apple please

    Aloha Jeremy,

    first, thank you for all of your hard work. I have an Apple MacBook Pro and I’m trying to make a USB memory stick bootable with Fedora 9. I wonder if you could write up a bit more on how this can be done. I tried to follow your blue print by fetching the latest version of livecd via “git clone git://git.fedorahosted.org/livecd && cd livecd && make install” Then I grabbed a copy of Fedora-9-x86_64-Live.iso from a mirror. I used Apple’s Disk Utility to partition the USB memory stick with no partitions, but having a GUID. I used parted to create a new partition of type ext3 and set it to bootable.

    Things deviated at this point from what I expected. I ran livecd-iso-to-disk ./Fedora-9-x86_64-Live.iso /dev/sdc1 only to have an error return stating that the device wasn’t bootable and that I should ‘toogle 1 boot’. I did that already. I mucked about a bit longer, created an ext3 filesystem across the entire device, e.g. mkfs.ext3 /dev/sdc, and reran the livecd-iso-to-disk. Things looked promising because I was asked about my MBR and I proceeded. As far as I know everything transferred properly, but I was never returned to the command-prompt. My memory is fading, but I recall a line returning to the console which said something about usb and syslinux with a rather long string of hex. No error messages struck me.

    Anyway, I gave it my best shot. I would love to boot my Apple MacBook Pro from a Fedora 9 LiveUSB. Can you help?

    Thanks,
    John

  7. Re: A bit more information for Apple please

    I only just saw this comment and I don’t have one of the machines sitting in front of me, so this is from memory, but it should be pretty close.

    First as you did, you’ll have to grab the latest version via git and get the live image. And then the big key is that you have to explicitly specify that you’re using livecd-iso-to-disk in the GPT mode by running
    ./livecd-iso-to-disk –mactel –reset-mbr /path/to/iso /my/partition

    –mactel tells it that we’re setting up for the EFI based booting and –reset-mbr makes it so that the key will be completely set up. So this should work with any key that you have.

    And just as the added caveat: this *WILL* remove all data currently on the key

Comments are closed.