All of lore.kernel.org
 help / color / mirror / Atom feed
* Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
@ 2007-01-31 10:47 Loïc Minier
  2007-01-31 11:00 ` Loïc Minier
  2007-01-31 15:06 ` Alasdair G Kergon
  0 siblings, 2 replies; 7+ messages in thread
From: Loïc Minier @ 2007-01-31 10:47 UTC (permalink / raw)
  To: dm-devel

        Hi,

 When issuing the same dmsetup commands on two device nodes with the
 same major/minor, the results are puzzling:
 bee:~# file /dev/dm-1
 /dev/dm-1: block special (254/1)
 bee:~# file /dev/mapper/bee--sata-refuge
 /dev/mapper/bee--sata-refuge: block special (254/1)
 bee:~# dmsetup table /dev/mapper/bee--sata-refuge
 0 131072 linear 8:2 117440896
 bee:~# dmsetup table /dev/dm-1
 dm_task_set_name: Device /dev/dm-1 not found
 Command failed

 (Same problem with short names:)
 bee:~# dmsetup table bee--sata-refuge
 0 131072 linear 8:2 117440896
 bee:~# dmsetup table dm-1
 device-mapper: table ioctl failed: No such device or address
 Command failed


 This is a problem hitting lilo relatively hard as it has logic to
 ignore devices with the same major/minor; that is, if lilo sees "dm-1"
 first and then the corresponding /dev/mapper device, it will drop any
 reference to the mapper device.  As having /boot on RAID 1 for lilo
 requires calling "dmsetup table" on the root device, this breaks lilo
 for a lot of people.

 Of course, it would be possible to patch lilo to explicitely skip
 /dev/dm-* devices, but it seems this would be a workaround instead of
 the real fix.


 This is under 2.6.18 and libdevmapper 1.02.12-1.


 You can find more details in Debian bug
 <http://bugs.debian.org/401393>, the bug was triggered by the addition
 of the /dev/dm-* device in udev (see <http://bugs.debian.org/392623>),
 and affects other distributions as well,
 <https://launchpad.net/distros/ubuntu/+source/lilo-installer/+bug/23835>.


 (RAID 1 support in lilo comes from a third-party patch added in the
 Debian packaging.)

   Bye,
-- 
Loïc Minier <lool@dooz.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 10:47 Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo Loïc Minier
@ 2007-01-31 11:00 ` Loïc Minier
  2007-01-31 15:10   ` Alasdair G Kergon
  2007-01-31 15:06 ` Alasdair G Kergon
  1 sibling, 1 reply; 7+ messages in thread
From: Loïc Minier @ 2007-01-31 11:00 UTC (permalink / raw)
  To: dm-devel

On Wed, Jan 31, 2007, Loïc Minier wrote:
>  bee:~# dmsetup table dm-1
>  device-mapper: table ioctl failed: No such device or address
>  Command failed

 (responding to self)

 Is lilo supposed to call something like "dmsetup info" on the
 major/minor of dm-1 to translate this into a device mapper
 "device_name"?  E.g.:
 bee:~# file /dev/dm-1
 /dev/dm-1: block special (253/1)
 bee:~# dmsetup info -c --noheadings -j 253 -m 1
bee--sata-refuge:253:1:L--w:1:1:0:LVM-beM0G1UiiCSaWGi1RkcyX3EhGET9D7GbyLPU0wXiCs
OswbyC2LoECortBYa3prWw
 bee:~# dmsetup table bee--sata-refuge
 0 131072 linear 8:2 117440896

 Or is the device-mapper code supposed to accept device names from /dev
 as parameters?

-- 
Loïc Minier <lool@dooz.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 10:47 Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo Loïc Minier
  2007-01-31 11:00 ` Loïc Minier
@ 2007-01-31 15:06 ` Alasdair G Kergon
  2007-01-31 15:54   ` Loïc Minier
  1 sibling, 1 reply; 7+ messages in thread
From: Alasdair G Kergon @ 2007-01-31 15:06 UTC (permalink / raw)
  To: dm-devel

On Wed, Jan 31, 2007 at 11:47:37AM +0100, Loïc Minier wrote:
>  When issuing the same dmsetup commands on two device nodes with the
>  same major/minor, the results are puzzling:

The device-mapper ioctls allow mapped devices to be referenced in three ways:
  name
  uuid
  major+minor

The uuid is optional.

dmsetup provides a command line wrapper around the ioctls.  It also
maintains the /dev/mapper directory, creating inodes there called 'name'.
It understands the above three ways of referencing devices: it does not
depend on the existing contents of '/dev'.

Some distributions chose to configure udev to create /dev/dm-N inodes where
N is the minor number.  (I have always discouraged that as a recipe for
confusion: I believe that using configurable names is a better approach.)

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 11:00 ` Loïc Minier
@ 2007-01-31 15:10   ` Alasdair G Kergon
  2007-01-31 15:47     ` Loïc Minier
  0 siblings, 1 reply; 7+ messages in thread
From: Alasdair G Kergon @ 2007-01-31 15:10 UTC (permalink / raw)
  To: dm-devel

On Wed, Jan 31, 2007 at 12:00:10PM +0100, Loïc Minier wrote:
>  supposed to call something like "dmsetup info" on the
>  major/minor of dm-1 to translate this into a device mapper
>  "device_name"?  E.g.:

That would work.

>  Or is the device-mapper code supposed to accept device names from /dev
>  as parameters?
 
It does not do that at the moment.  Perhaps there's a case for adding
inode->device number conversions to dmsetup: You're the first person to suggest
this.

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 15:10   ` Alasdair G Kergon
@ 2007-01-31 15:47     ` Loïc Minier
  0 siblings, 0 replies; 7+ messages in thread
From: Loïc Minier @ 2007-01-31 15:47 UTC (permalink / raw)
  To: dm-devel

On Wed, Jan 31, 2007, Alasdair G Kergon wrote:
> >  Or is the device-mapper code supposed to accept device names from /dev
> >  as parameters?
> It does not do that at the moment.  Perhaps there's a case for adding
> inode->device number conversions to dmsetup: You're the first person
> to suggest this.

 Ok; lilo isn't calling the dmsetup command, but uses libdevmapper
 directly, so even if you add support for any /dev device name in
 dmsetup, it wont help lilo.  Hence, I've changed the problematic dm
 task call to use major/minor instead of the name (see attached patch)
 and will wait for feedback from users as I don't have such a setup.

 So, thanks for clarifying this!  I'm not sure it would be a good idea
 to accept device mapper names as well as /dev names in dmsetup as I
 think this would confuse things.  I personally like it that dmsetup
 reflects what the ioctl accepts, nothing more, nothing less.


PS: I was wrong when saying that the code is in a Debian specific patch,
the patch is only historic and the problematic code is in the lilo
mainline
-- 
Loïc Minier <lool@dooz.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 15:06 ` Alasdair G Kergon
@ 2007-01-31 15:54   ` Loïc Minier
  2007-01-31 20:10     ` Luca Berra
  0 siblings, 1 reply; 7+ messages in thread
From: Loïc Minier @ 2007-01-31 15:54 UTC (permalink / raw)
  To: dm-devel

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

On Wed, Jan 31, 2007, Alasdair G Kergon wrote:
> Some distributions chose to configure udev to create /dev/dm-N inodes where
> N is the minor number.  (I have always discouraged that as a recipe for
> confusion: I believe that using configurable names is a better approach.)

 I seem to recall even RedHat or Fedora attempted to add these devices,
 but I suppose you know best.  The reasons why these were added in udev
 in Debian and Ubuntu are mentionned in http://bugs.debian.org/392623,
 but in short gnome-mount required this to work; perhaps this should be
 fixed in gnome-mount.  The details are in a comment of #401393 though:
  <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401393;msg=37>

 (attaching the patch I mentionned in the preceding mail but forgot,
 sorry)

-- 
Loïc Minier <lool@dooz.org>

[-- Attachment #2: lilo_22.7.3-1.4.diff --]
[-- Type: text/x-diff, Size: 1631 bytes --]

--- lilo-22.7.3/debian/patches/00list
+++ lilo-22.7.3/debian/patches/00list
@@ -31,0 +32 @@
+20_devmapper-use-major-minor
--- lilo-22.7.3/debian/changelog
+++ lilo-22.7.3/debian/changelog
@@ -1,3 +1,11 @@
+lilo (1:22.7.3-1.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * New dpatch, 20_devmapper-use-major-minor, to address device-mapper devices
+    via major/minor instead of name for DM_DEVICE_TABLE; closes: #401393.
+
+ -- Loic Minier <lool@dooz.org>  Wed, 31 Jan 2007 15:21:06 +0100
+
 lilo (1:22.7.3-1.3) unstable; urgency=low
 
   * Non-maintainer upload to fix a few more l10n issues.
--- lilo-22.7.3.orig/debian/patches/20_devmapper-use-major-minor.dpatch
+++ lilo-22.7.3/debian/patches/20_devmapper-use-major-minor.dpatch
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_devmapper-use-major-minor.patch.dpatch by Loic Minier <lool@dooz.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad lilo-22.7.3~/geometry.c lilo-22.7.3/geometry.c
+--- lilo-22.7.3~/geometry.c	2007-01-31 15:20:37.000000000 +0100
++++ lilo-22.7.3/geometry.c	2007-01-31 15:20:43.000000000 +0100
+@@ -930,8 +930,9 @@
+ 	    slash++;
+ 		else
+ 	    slash = dmdev;
+-	    if (!dm_task_set_name(dmt, slash))
+-		die("device-mapper: dm_task_set_name(\"%s\") failed",dmdev);
++	    if (!dm_task_set_major(dmt, MAJOR(device)) ||
++	        !dm_task_set_minor(dmt, MINOR(device)))
++		die("device-mapper: dm_task_set_major() or dm_task_set_minor() failed");
+ 	    if (!dm_task_run(dmt))
+ 		die("device-mapper: dm_task_run(DM_DEVICE_TABLE) failed");
+ 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo
  2007-01-31 15:54   ` Loïc Minier
@ 2007-01-31 20:10     ` Luca Berra
  0 siblings, 0 replies; 7+ messages in thread
From: Luca Berra @ 2007-01-31 20:10 UTC (permalink / raw)
  To: dm-devel

On Wed, Jan 31, 2007 at 04:54:29PM +0100, Loïc Minier wrote:
>On Wed, Jan 31, 2007, Alasdair G Kergon wrote:
>> Some distributions chose to configure udev to create /dev/dm-N inodes where
>> N is the minor number.  (I have always discouraged that as a recipe for
>> confusion: I believe that using configurable names is a better approach.)

i tend to agree with Alasdair on the above point

> I seem to recall even RedHat or Fedora attempted to add these devices,
> but I suppose you know best.  The reasons why these were added in udev
> in Debian and Ubuntu are mentionned in http://bugs.debian.org/392623,
> but in short gnome-mount required this to work; perhaps this should be
> fixed in gnome-mount.  The details are in a comment of #401393 though:
>  <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401393;msg=37>

I also looked at the patch to support LUKS into hal and i tought it was
badly written (forgot the gory details)

> (attaching the patch I mentionned in the preceding mail but forgot,
> sorry)

in any case i lost the argument, so i think that i will use your patch,
at least until grub2 gets support for the eye-candy gfxboot, then i hope
to toss lilo into oblivion.

Thanks for providing the patch,
L.

-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-01-31 20:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-31 10:47 Weird discrepancy between /dev/mapper/* and /dev/dm-* devices breaks lilo Loïc Minier
2007-01-31 11:00 ` Loïc Minier
2007-01-31 15:10   ` Alasdair G Kergon
2007-01-31 15:47     ` Loïc Minier
2007-01-31 15:06 ` Alasdair G Kergon
2007-01-31 15:54   ` Loïc Minier
2007-01-31 20:10     ` Luca Berra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.