Wrong symlink check for /dev/mapper in cryptroot?

Asked by Robert on 2008-11-30

I am having trouble with update-initramfs and an encrypted root partition on Ubuntu. I want an LUKS-encrypted root with the key on a USB stick. After encrypting the partitions and installing Kubuntu, I kept using the live CD to modify crypttab and rebuild the initramfs. At this point I have mounted the new system and chroot'ed into it.

root@ubuntu:/usr/share/initramfs-tools# aptitude show initramfs-tools | grep Version
Version: 0.92bubuntu16

root@ubuntu:/# update-initramfs -u ALL
update-initramfs: Generating /boot/initrd.img-2.6.27-9-generic
cryptsetup: NOTE: using /dev/mapper/ubuntu instead of /dev/disk/by-uuid/3c9a63f0-89df-4cce-8a68-7e9a1e4b0ae6 for ubuntu

This seems a little strange -- it tries to use the encrypted mapping but when the initramfs becomes active on booting the device is not yet mapped.

root@ubuntu:/# ls -l /dev/disk/by-uuid | grep ubuntu
lrwxrwxrwx 1 root root 19 2008-11-30 14:42 3c9a63f0-89df-4cce-8a68-7e9a1e4b0ae6 -> ../../mapper/ubuntu

root@ubuntu:/# cat /etc/crypttab
# target name, source device, key file, options
swap /dev/disk/by-uuid/8ac4b8a7-d222-41a9-bbe1-492a73c5b470 /dev/random swap
ubuntu /dev/disk/by-uuid/3c9a63f0-89df-4cce-8a68-7e9a1e4b0ae6 /dev/disk/by-uuid/baca2aed-3fd7-4fa0-85ad-bbf3ae0a03d4/mykey luks,keyscript=/usr/local/sbin/keyscript

root@ubuntu:/# cat /etc/fstab
# /dev/mapper/ubuntu UUID=3c9a63f0-89df-4cce-8a68-7e9a1e4b0ae6 / ext3 relatime,errors=remount-ro 0 1
/dev/mapper/ubuntu / ext3 relatime,errors=remount-ro 0 1
/dev/sda2 /boot ext3 relatime 0 2

The warning above comes from /usr/share/initramfs-tools/hooks/cryptroot line 183:

                if [ "$link" != "${link#/dev/mapper/}" ]; then
                        echo "cryptsetup: NOTE: using $link instead of $source for $target" >&2

Seems like the script wants to use a target of a symlink if the symlink does not point to a mapped device.
Shouldn't the check be
                if [ ! "${link#/dev/mapper/}" ]; then


Question information

English Edit question
Ubuntu initramfs-tools Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Robert (robert-wenner) said : #1

Ok, copy & paste error; everything's fine.