Bug#402410: debian-installer: LVM setup broken if hostname/VG contains a "-" character
On Mon, December 11, 2006 21:44, Frans Pop said:
> reassign 402410 partman-auto-lvm
> tags 402410 + patch pending
> thanks
>
> On Monday 11 December 2006 20:36, Mike Hommey wrote:
>> the hyphen is a valid character, but it is doubled in the /dev/mapper
>> device name (because the hyphen separates VG and LV names). Note that
>> the /dev/$VG/$LV mapping doesn't double the hyphens.
>
> OK. In that case I think the patch below fixes things. There already seems
> to be support for "undoubling" hyphens when parsing VG/LV names
> from /dev/mapper devices.
>
> I cannot quickly find how exactly this is handled in manual partitioning
> using LVM, but as it seems to work correctly there I'm not going to worry
> too much about it now.
>
>
> Index: perform_recipe_by_lvm
> ==================================================================---
> perform_recipe_by_lvm (revision 43277)
> +++ perform_recipe_by_lvm (working copy)
> @@ -78,7 +78,10 @@
> lv_create $VG_name "$lvname" $(($1/1024)) ||
> autopartitioning_failed
> fi
>
> - device=/dev/mapper/"$VG_name"-"$lvname"
> + # Hyphens in VG or LV names are doubled under /dev/mapper
> + VG_dev="$(echo "$VG_name" | sed 's/-/--/g')"
> + LV_dev="$(echo "$lvname" | sed 's/-/--/g')"
> + device=/dev/mapper/"$VG_dev"-"$LV_dev"
>
> dirname=$(echo "$device" | sed "s:/:=:g")
> dev=$DEVICES/$dirname
>
Yes, that's the right idea. I don't know whether more changes are necessary.
If needed, I can verify that this patch is sufficient during this weekend
at the latest.
Also note that the /dev/$VG/$LV solution will not work since neither
cryptsetup, nor initramfs support that syntax (it's impossible to tell
that it's a lvm device during early boot)
--
David Härdeman
Reply to: