multipath-tools-boot: support booting without user_friendly_names on devices with spaces in identifiers
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | multipath-tools (Ubuntu) |
Medium
|
Mathieu Trudel-Lapierre | ||
| | Trusty |
Medium
|
Mathieu Trudel-Lapierre | ||
Bug Description
[Impact]
If a system is not installed w/ multipath support (i.e., no disk-detect/
If an user later installs multipath-
Those rules don't handle disk devices w/ spaces on their names/uuids/models very well..
That's because of udev's SYMLINK command using spaces to separate multiple links, and the kernel sysfs/dm informing \x20 instead, which is not correctly interpreted by some commands, resulting in file not found errors, for example.
Thus, the system fails to boot.
[Test case]
Requires installing on a system where there are spaces in the name of the device make/model data; for instance, on POWER8 with IPR disks, or with QEMU.
1) Install system with multipath support ('disk-
2) Boot the system.
3) Edit /etc/multipath.
4) Update the initramfs: sudo update-initramfs -u
5) Reboot.
[Regression potential]
Minimal. Systems with names in the disk make/model data would not boot without user_friendly_names enabled. This patch will allow multipath-tools to correctly handle these devices in the case where friendly names are not enabled by using the devices major/minor numbers rather that its path.
----
There's no problem, however, if user_friendly_names is enabled in multipath.conf (which is enabled in the default multipath.conf from the installer, if it has multipath enabled).
Notice it's an acceptable case to install w/out multipath support, and enable it later for booting.
Disk devices w/ spaces in naming is not common over SAN/storage systems, but that happens often for conventional disks; for example:
- IBM IPR ( IBM IPR-0 5DB6F40000000080 )
- IBM VDASD ( AIX VDASD 00c96f0700004c0
- QEMU HARDDISK ( QEMU QEMU HARDDISK <serial> )
So, please, is it possible to ship the default multipath.conf (e.g., from installer) w/ multipath-
For users not to their systems failing to boot after installing multipath-
Related bugs:
* bug 1371634: block devices appear twice
* bug 1551937: lvm and multipath and xenial not happy together
* bug 1429327: Boot from a unique, stable, multipath-dependent symlink
Hi Mauricio, I'd be very interested in looking at the patches you propose, we can consider those alongside shipping multipath.conf with user_friendly_names enabled.
| Changed in multipath-tools (Ubuntu): | |
| status: | New → Triaged |
| importance: | Undecided → Medium |
| assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
Hi Mathieu,
> Hi Mauricio, I'd be very interested in looking at the patches [...]
Sorry for the delay. I missed this w/ some issue w/ email servers.
I'll attach them soon.. just cleaning up 2 minor points.
Hi Mathieu,
I belive the actual fix is better than the requirement of user_friendly_
The patch is attached (sorry for the delay, things turned a bit :)
Test scenario:
Boot without 'splash quiet' and with 'debug break=top,
On break #1 you can change udev rules/modify user_friendly_
On break #2 you can read the udev debug output more clearly.
1) The change to kpartx.udev (replace dmsetup_env with equivalent udev rules)
fixes this call to kpartx_id, which ends up mis-detecting multipath as raid.
Before:
------
[ 0.755972] systemd-udevd[94]: IMPORT 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one' /lib/udev/
[ 0.756185] systemd-udevd[180]: starting 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one'
[ 0.757407] systemd-udevd[94]: 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one'(err) 'device-mapper: deps ioctl on failed: No such device or address'
[ 0.757526] systemd-udevd[94]: 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one'(err) ''
[ 0.757602] systemd-udevd[94]: 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one'(err) 'Command failed'
[ 0.757850] systemd-udevd[94]: 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one'(out) 'DM_TYPE=raid'
[ 0.757927] systemd-udevd[94]: 'kpartx_id 252 0 mpath-0QEMU QEMU HARDDISK serial_one' [180] exit with return code 0
[ 0.758017] systemd-udevd[94]: LINK 'disk/by-
(initramfs) ls -l /dev/disk/by-id/ | sort
...
lrwxrwxrwx 1 10 raid-mpath0 -> ../../dm-0
lrwxrwxrwx 1 10 raid-mpath0-
lrwxrwxrwx 1 10 raid-mpath0-
lrwxrwxrwx 1 10 raid-mpath0-
...
After:
-----
[ 16.020662] systemd-udevd[112]: IMPORT '/sbin/dmsetup info -j 252 -m 0 -c --nameprefixes --noheadings --rows -o attr' /lib/udev/
...
[ 16.021746] systemd-udevd[205]: starting '/sbin/dmsetup info -j 252 -m 0 -c --nameprefixes --noheadings --rows -o attr'
[ 16.023274] systemd-udevd[112]: '/sbin/dmsetup info -j 252 -m 0 -c --nameprefixes --noheadings --rows -o attr'(out) 'DM_ATTR='L--w''
[ 16.023554] systemd-udevd[112]: '/sbin/dmsetup info -j 252 -m 0 -c --nameprefixes --noheadings --rows -o attr' [205] exit with return code 0
...
[ 16.035336] systemd-udevd[210]: starting 'kpartx_id 252 0 mpath-0QEMU\
[ 16.037665] systemd-udevd[111]: 'kpartx_id 252 0 mpath-0QEMU\
[ 16.037764] systemd-udevd[111]: 'kpartx_id 252 0 mpath-0QEMU\
[ 16.037872] systemd-udevd[111]: LINK 'disk/by-
(initramfs) ls -l /dev/disk/by-id/ | sort
...
lrwxrwxrwx 1 10 scsi-mpath0 -> ../../dm-0
lrwxrwxrwx 1 10 scsi-mpath0-part1 -> ../../dm-1
lrwxrwxrwx 1 10 scsi-mpath0-part2 -> ../../dm-2
lrwxrwxrwx 1 10 scsi-mpath0-part3 -> ../../dm-3
...
2) The chan...
| summary: |
- Ship the default /etc/multipath.conf on multipath-tools-boot (for - user_friendly_names) + multipath-tools-boot: support booting without user_friendly_names on + devices with spaces in identifiers |
| tags: | added: patch |
The attachment "multipath-
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]
Re-attaching, as it seems the previous attachment link is now HTTP 404.
| description: | updated |
| Scott Moser (smoser) wrote : | #7 |
Hi,
Attached to bug 1371634 i added a script that shows a general issue with kpartx being called on files with spaces in them.
Does that seem like a bug that should also be fixed?
it shows itself with:
$ img="/tmp/my.img"; spacename="/dev/my space name";
$ truncate --size=1G "$img"
$ echo "2048," | sfdisk --force "$img" --unit S
$ lodev=$(sudo losetup --find --show "$img")
$ echo $lodev
/dev/loop0
$ sudo ln -sf "$lodev" "$spacename"
$ ls -l $lodev "$spacename"
brw-rw---- 1 root disk 7, 0 Jun 4 09:25 /dev/loop0
lrwxrwxrwx 1 root root 10 Jun 4 09:25 /dev/my space name -> /dev/loop0
$ sudo kpartx -a -v "$spacename"
device-mapper: reload ioctl on my\x20space\
create/reload failed on my space name1
add map my space name1 (0:0): 0 2095104 linear /dev/my space name 2048
## then clean up
$ sudo losetup -d "$lodev"
$ sudo rm "$spacename" "$img"
Sorry, messed on the wrong bug :)
| Changed in multipath-tools (Ubuntu): | |
| status: | Triaged → Fix Committed |
| status: | Fix Committed → Confirmed |
| tags: | added: targetmilestone-inin1404 targetmilestone-inin1504 |
Hi @mathieu-tl @smoser
Back to this one. Good news.
Scott, thanks for the pointer to the error/limitation in kpartx.
With that fixed, I could successfully boot Ubuntu 14.04.3 on QEMU disks (w/ spaces) w/out user_friendly_
I'm attaching a debdiff with the patch submitted to dm-devel here.
Is it still on the window for 14.04.4?
Boot messages:
<...>
[ 84.995873] Adding 5492672k swap on /dev/mapper/
[ 85.004033] EXT4-fs (dm-3): re-mounted. Opts: errors=remount-ro
<...>
$ sudo multipath -l
0QEMU QEMU HARDDISK helloworld dm-0 QEMU ,QEMU HARDDISK
size=128G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=-1 status=active
`- 0:0:0:0 sda 8:0 active undef running
$ mount | grep ' / '
/dev/mapper/
$ cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/
$ ls -l /dev/mapper
total 0
brw-rw---- 1 root disk 252, 0 Jan 7 13:50 0QEMU QEMU HARDDISK helloworld
brw-rw---- 1 root disk 252, 1 Jan 7 13:50 0QEMU QEMU HARDDISK test
lrwxrwxrwx 1 root root 7 Jan 7 13:50 0QEMU\x20\
brw-rw---- 1 root disk 252, 2 Jan 7 13:50 0QEMU\x20\
brw-rw---- 1 root disk 252, 3 Jan 7 13:50 0QEMU\x20\
brw-rw---- 1 root disk 252, 4 Jan 7 13:50 0QEMU\x20\
lrwxrwxrwx 1 root root 7 Jan 7 13:50 0QEMU\x20\
brw-rw---- 1 root disk 252, 5 Jan 7 13:50 0QEMU\x20\
crw------- 1 root root 10, 236 Jan 7 13:50 control
Notice there are 2 devices for each wholedisk (with mangled and unmangled names); I suspect that's some inconsistency between multipath call to libdevmapper and udev (multipath not waiting for udev to create the nodes, and/or creating the nodes by itself / not using udev -- udev should use the DM NAME, which indeed is mangled). I tried but could not find the root cause for that, but it's not a regression from this patch (it existed previously).
Test with multipath device:
=======
# multipath
create: 0QEMU QEMU HARDDISK test undef QEMU ,QEMU HARDDISK
size=2.0G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
`- 0:0:1:0 sdb 8:16 undef ready running
# ls -l /dev/mapper/
total 0
brw-rw---- 1 root disk 252, 1 Jan 7 10:31 0QEMU QEMU HARDDISK test
lrwxrwxrwx 1 root root 7 Jan 7 10:31 0QEMU\x20\
crw------- 1 root root 10, 236 Jan 7 09:00 control
Without patch:
-------------
# kpartx -av '/dev/mapper/0QEMU QEMU HARDDISK test'
device-mapper: reload ioctl on 0QEMU\x20\
create/reload failed on 0QEMU QEMU HARDDISK test1
add map 0QEMU QEMU HARDDISK test1 (0:0): 0 4194242 linear /dev/mapper/0QEMU QEMU HARDDISK test 62
# ls -l /dev/mapper
total 0
brw-rw---- 1 root disk 252, 1 Jan 7 10:31 0QEMU QEMU HARDDISK test
lrwxrwxrwx 1 root root 7 Jan 7 10:31 0QEMU\x20\
crw------- 1 root root 10, 236 Jan 7 09:00 control
With patch:
----------
# kpartx -av '/dev/mapper/
add map 0QEMU QEMU HARDDISK test1 (252:5): 0 4194242 linear /dev/mapper/
# ls -l /dev/mapper/
total 0
brw-rw---- 1 root disk 252, 1 Jan 7 10:31 0QEMU QEMU HARDDISK test
lrwxrwxrwx 1 root root 7 Jan 7 10:31 0QEMU\x20\
brw-rw---- 1 root disk 252, 5 Jan 7 10:32 0QEMU\x20\
crw------- 1 root root 10, 236 Jan 7 09:00 control
# kpartx -dv '/dev/mapper/
del devmap : 0QEMU QEMU HARDDISK test1
# ls -l /dev/mapper/
total 0
brw-rw---- 1 root disk 252, 1 Jan 7 10:31 0QEMU QEMU HARDDISK test
lrwxrwxrwx 1 root root 7 Jan 7 10:31 0QEMU\x20\
crw------- 1 root root 10, 236 Jan 7 09:00 control
The patch has been applied upstream [1] in a slight different form -- the debdiff attached here is the backport for Trusty.
The difference is just MAJOR()/MINOR() vs. major()/minor().
| Launchpad Janitor (janitor) wrote : | #13 |
This bug was fixed in the package multipath-tools - 0.5.0-7ubuntu10
---------------
multipath-tools (0.5.0-7ubuntu10) xenial; urgency=medium
* debian/
debian/
allow multipathd to handle cases where the bindings file is read-only.
(LP: #1526984)
* debian/
* debian/
initramfs.
* debian/
indeed loaded and ready before we end premount.
* debian/
multipath so that new paths can be correctly added as detected while we're
still in the initramfs.
* debian/
* debian/
with spaces in device names in kpartx too (LP: #1432062)
-- Mathieu Trudel-Lapierre <email address hidden> Wed, 27 Jan 2016 10:42:51 -0500
| Changed in multipath-tools (Ubuntu): | |
| status: | Confirmed → Fix Released |
| Changed in multipath-tools (Ubuntu Trusty): | |
| status: | New → In Progress |
| importance: | Undecided → Medium |
| assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
| description: | updated |
Hello Mauricio, or anyone else affected,
Accepted multipath-tools into trusty-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in multipath-tools (Ubuntu Trusty): | |
| status: | In Progress → Fix Committed |
| tags: | added: verification-needed |
Marking as verification-done.
Details:
-------
qemu-kvm guest w/ rootfs on multipath
# mount | grep ' / '
/dev/mapper/
# lvm pvdisplay | grep Name
PV Name /dev/mapper/
VG Name mauricfo4-vg
the disk WWID contains spaces
# multipath -l
mpath0 (0QEMU QEMU HARDDISK trustyroot) dm-0 QEMU ,QEMU HARDDISK
size=32G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=-1 status=active
| `- 0:0:0:0 sda 8:0 active undef running
`-+- policy='round-robin 0' prio=-1 status=enabled
`- 0:0:1:0 sdb 8:16 active undef running
install new version
# apt-get install multipath-
# dpkg -s kpartx | grep Version
Version: 0.4.9-3ubuntu7.8
remove multipath configuration (user_friendly_
from rootfs and initramfs
# rm -rf /etc/multipath*
# mount /boot
# update-initramfs -u
update-initramfs: Generating /boot/initrd.
verify
# reboot
...
Loading, please wait...
[ 0.482143] systemd-udevd[92]: starting version 204
Begin: Loading essential drivers ... done.
Begin: Running /scripts/
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... Begin: Loading multipath modules ...
[ 0.546011] device-mapper: multipath: version 1.9.0 loaded
Success: loaded module dm-multipath.
Failure: failed to load module dm-emc.
done.
Begin: Starting multipathd ... [ 0.558504] multipathd (125): /proc/125/oom_adj is deprecated, please use /proc/125/
[ 0.571510] device-mapper: multipath round-robin: version 1.0.0 loaded
[ 0.661820] random: lvm urandom read with 60 bits of entropy available
[ 0.910243] random: nonblocking pool is initialized
done.
Begin: Running /scripts/
done.
[ 1.122520] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: (null)
Begin: Running /scripts/
done.
done.
Begin: Running /scripts/
[ 1.211793] init: plymouth-
[ 1.211889] init: plymouth-
[ 1.230100] init: plymouth-
[ 1.230199] init: plymouth-
[ 1.415024] Adding 1417152k swap on /dev/mapper/
[ 1.417519] EXT4-fs (dm-4): re-mounted. Opts: errors=remount-ro
Great, the rootfs is found and mounted.
Notice this setup (LVM on multipath) hits LP #1540401,
but non-LVM on multipath doesn't, as originally reported.
The disk drive for /boot is not ready yet or not present.
keys:Continue to wait, or Press S to skip mounting or M for manual recovery
keys: S
And the system boots successfully:
# mount | grep ' / '
/dev/mapper/
# pvdisplay | grep Name
PV Name /dev/HARDDISK
VG Name ...
| tags: |
added: verification-done removed: verification-needed |
Testing w/ pure multipath setup (non-LVM).
Boots successfully, w/ no prompts.
# mount | grep ' / '
/dev/mapper/
# multipath -l
mpath0 (0QEMU QEMU HARDDISK trustyroot) dm-0 QEMU ,QEMU HARDDISK
size=32G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=-1 status=active
| `- 0:0:0:0 sda 8:0 active undef running
`-+- policy='round-robin 0' prio=-1 status=enabled
`- 0:0:1:0 sdb 8:16 active undef running
Remove multipath conf/bindings/
# rm -rf /etc/multipath*
# update-initramfs -u
# reboot
Boots successfully:
# mount | grep ' / '
/dev/mapper/
# multipath -l
0QEMU QEMU HARDDISK trustyroot dm-0 QEMU ,QEMU HARDDISK
size=32G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=-1 status=active
| `- 0:0:0:0 sda 8:0 active undef running
`-+- policy='round-robin 0' prio=-1 status=enabled
`- 0:0:1:0 sdb 8:16 active undef running
| Brian Murray (brian-murray) wrote : | #17 |
Hello Mauricio, or anyone else affected,
Accepted multipath-tools into trusty-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| tags: | removed: verification-done |
| tags: | added: verification-needed |
This was already verified successfully before; the additional update does not need reverification, only checking the regression in bug 1543430.
| tags: |
added: verification-done removed: verification-needed |
| Launchpad Janitor (janitor) wrote : | #19 |
This bug was fixed in the package multipath-tools - 0.4.9-3ubuntu7.9
---------------
multipath-tools (0.4.9-3ubuntu7.9) trusty; urgency=medium
* debian/
files unmapping. (LP: #1543430)
multipath-tools (0.4.9-3ubuntu7.8) trusty; urgency=medium
* debian/
spaces in device names in kpartx too (LP: #1432062)
* debian/
so the by-uuid/ symlinks have a chance to be updated by udev rules.
(LP: #1503286)
* Allow device detection all through the initramfs: run multipathd instead
of only scanning once for devices, so those that come up slower can still
be used as a root device (LP: #1526984):
- debian/
debian/
debian/
debian/
to allow multipathd to handle cases where the bindings file is read-only.
- debian/
- debian/
they're ready before we mount.
- debian/
multipath so that new paths can be correctly added as detected while
we're still in the initramfs.
- debian/
- debian/
initramfs.
* debian/
config values) for the IBM 2810XIV storage system. (LP: #1496210)
* debian/
kpartx -a, so as to remove old partition entries if the partition table
has changed. (LP: #1473903)
* debian/
debian/
udev, device-mapper and multipath, and let udev deal with creating device
nodes and symlinks. (LP: #1486370)
* debian/
longer available. (LP: #1538775)
-- Mathieu Trudel-Lapierre <email address hidden> Tue, 09 Feb 2016 16:03:10 -0500
| Changed in multipath-tools (Ubuntu Trusty): | |
| status: | Fix Committed → Fix Released |
| Adam Conrad (adconrad) wrote : Update Released | #20 |
The verification of the Stable Release Update for multipath-tools has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.
| description: | updated |


BTW, I have prototype patches to fix the spacing issue in udev rules
(pathes for kpartx.rules, multipath.rules, and kpartx_id IIRC)
But I guess that at this point of the schedule it'd be safer to go w/ shipping a default thing which could have been installed, rather than changing stuff at the udev rules level.
The problem seems to emerge from the general dm.rules, which on recent kernels will set DM_NAME as the mangled name which is obtained from sysfs/.../dm/name, but some Debian-specific thing related to dmsetup not exporting variables correctly will re-set DM_NAME to a non-mangled name.. this is leading to problem in the rest of that rules file.. Also, kpartx_id IIRC-2 gets a non-mangled name, in variable dmname IIRC-3.)
I can provide those patches if you're interested in taking a look.