Problems when booting an encrypted lvm containing btrfs

Bug #551055 reported by Vincent
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cryptsetup (Ubuntu)
Confirmed
Undecided
Unassigned
Nominated for Karmic by KOCMOHABT
Nominated for Lucid by KOCMOHABT

Bug Description

Binary package hint: initramfs-tools

SYSTEM information:
Ubuntu Lucid Lynx (newest, dist-upgrade 20 mins ago :))
Package: initramfs-tools v. 0.92bubuntu71
------------------------------------------------------------------------------

I installed Ubuntu Lucid Lynx from scratch via the LiveCD installation.

The setup looks like this:

/dev/sda1: /boot (ext3)
/dev/sda2: cryptsetup/lvm containing / (ext4), /var (ext4), /home (ext4)

When the system boots up, it has to unlock the crypted partition, detect the lvm and then mount the partitions.

This works well with the ext4 file system, but ...

Then I booted back into the LiveCD, tared up the contents of the / fs, created a btrfs and untared back the contents. I changed the /etc/fstab file and the /etc/initramfs-tools/modules file so that it contains all necessary modules to mount the btrfs.

When I rebooted the machine, the password prompt appeared. I entered the password, but the password prompt throw an error ("cryptsetup: unknown fs type, bad password or options", kind of that) and I had to retype my password twice. So in the end, I entered my password three times. Then it mounted all partitions and went on booting. I figured out, that the lvm was detected when I entered my password the first time, so it may be the btrfs.

Althrough btrfs is not supported yet, I think this is a bug. Few people use btrfs and if this bug gets fixed to the next release, it would be very nice.

Thanks.

Revision history for this message
gutschke (markus+launchpad) wrote :

Try the attached patch for cryptsetup. It will probably take care of the issue.

Revision history for this message
Vincent (v-wochnik-yahoo) wrote : Re: [Bug 551055] Re: Problems when booting an encrypted lvm containing btrfs

Stupid question, but what commands do I have to enter to make this patch
work?

Thank you, I really don't know what that cryptsetup crap is about. :D

2010/4/15 gutschke
<<email address hidden><markus%<email address hidden>>
>

> Try the attached patch for cryptsetup. It will probably take care of the
> issue.
>
> ** Patch added: "cryptsetup.diff"
> http://launchpadlibrarian.net/44205307/cryptsetup.diff
>
> --
> Problems when booting an encrypted lvm containing btrfs
> https://bugs.launchpad.net/bugs/551055
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “initramfs-tools” package in Ubuntu: New
>
> Bug description:
> Binary package hint: initramfs-tools
>
> SYSTEM information:
> Ubuntu Lucid Lynx (newest, dist-upgrade 20 mins ago :))
> Package: initramfs-tools v. 0.92bubuntu71
>
> ------------------------------------------------------------------------------
>
> I installed Ubuntu Lucid Lynx from scratch via the LiveCD installation.
>
> The setup looks like this:
>
> /dev/sda1: /boot (ext3)
> /dev/sda2: cryptsetup/lvm containing / (ext4), /var (ext4), /home (ext4)
>
> When the system boots up, it has to unlock the crypted partition, detect
> the lvm and then mount the partitions.
>
> This works well with the ext4 file system, but ...
>
> Then I booted back into the LiveCD, tared up the contents of the / fs,
> created a btrfs and untared back the contents. I changed the /etc/fstab file
> and the /etc/initramfs-tools/modules file so that it contains all necessary
> modules to mount the btrfs.
>
> When I rebooted the machine, the password prompt appeared. I entered the
> password, but the password prompt throw an error ("cryptsetup: unknown fs
> type, bad password or options", kind of that) and I had to retype my
> password twice. So in the end, I entered my password three times. Then it
> mounted all partitions and went on booting. I figured out, that the lvm was
> detected when I entered my password the first time, so it may be the btrfs.
>
> Althrough btrfs is not supported yet, I think this is a bug. Few people use
> btrfs and if this bug gets fixed to the next release, it would be very nice.
>
> Thanks.
>
> To unsubscribe from this bug, go to:
>
> https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/551055/+subscribe
>

--
E-Mail:
   <email address hidden>
ICQ:
   427102527

Revision history for this message
KOCMOHABT (kocmo) wrote :

Vincent, here's the gutschke's patch adapted for Ubuntu Karmic. Normally you'd install it by saving it to /tmp and running the following from the shell:

cd /usr/share/initramfs-tools/scripts/local-top
sudo patch -p1 < /tmp/cryptsetup.ubuntu_karmic.diff
sudo update-initramfs -c -k all

However, it likely won't be enough on its own, because of bug #450260. Till that one is fixed, you'll need to apply this patch, and still assemble initrd manually (to make sure it contains correct conf/conf.d/cryptroot, and btrfs.ko with libcrc32c.ko and libcrc32c.ko dependencies, and all needed crypto modules), and edit grub.cfg or menu.lst by hand. And may have to do the GRUB_DEVICE trick mentioned in #450260 discussion.

Revision history for this message
KOCMOHABT (kocmo) wrote :

Alright, I worked through the odds and ends, and got the automagic for initrd and grub working. I have a btrfs root partition on top of lvm, itself on top of dm-crypt device, itself on top of raid. If your config similarly involves btrfs root partition on top of crypto, this is what you need to do to boot it:

1) Download patch from comment 3 above, save it to /tmp. Apply it:
cd /usr/share/initramfs-tools/scripts/local-top
sudo patch -p1 < /tmp/cryptsetup.ubuntu_karmic.diff

2) Add btrfs, crc32c, libcrc32c, and zlib_deflate to /etc/initrams-tools/modules, one per line.

3) Regenerate initrd images for all kernels (if you have any manually assembled initrd images which work, you might want to back them up before running this):
sudo update-initramfs -c -k all

4) Edit grub-mkconfig and /etc/default/grub, as described in comment 4 of bug #450260. Regenerate grub configuration (not sure if it'll work with grub-legacy, I tested with grub-pc):
sudo update-grub

After this procedure things will work correctly even when installing future kernel updates (if any) for Karmic, and bootable configuration will be auto-generated.

Revision history for this message
KOCMOHABT (kocmo) wrote :

Applies to Lucid, too. Here's the patch for Lucid, apply as described in comment #3. In Lucid bug #450260 no longer affects us, so don't worry about update-grub stuff in comment #4.

tags: added: patch
affects: initramfs-tools (Ubuntu) → cryptsetup (Ubuntu)
Revision history for this message
Chow Loong Jin (hyperair) wrote :

The attached patch appears to be still incomplete. There's something about passdev or other that also apparently loops through a whole set of filesystems (see debian/passdev.c in the source package).Tagging patch-needswork.

tags: added: patch-needswork
Changed in cryptsetup (Ubuntu):
status: New → Confirmed
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.