Ok, so Oleg and I were looking at a solution, and figured we'd give the "maybe it just works" path a try.
I installed a system, it installed onto /dev/sda (as this bug shows).
I then 'apt-get install multipath-tools-boot'
I rebooted, with the 'root=LABEL=cloudimg-rootfs' on the cmdline (as normal). It died in initramfs unable to find root. The full bootlog at http://paste.ubuntu.com/11547135/ .
The multipath-tools-boot package puts some code into the initramfs (/usr/share/initramfs-tools/scripts/local-top/multipath) that does this:
| if [ -x /sbin/kpartx -a -x /sbin/dmsetup ]; then
| /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p -part" >/dev/null
| fi
That looks all well and good.
In the initramfs I did some debugging:
(initramfs) /sbin/dmsetup ls --target multipath
1IBM IPR-0 5EC2A900000000A0 (252, 1)
1IBM IPR-0 5EC2A90000000020 (252, 2)
1IBM IPR-0 5EC2A90000000080 (252, 5)
1IBM IPR-0 5EC2A90000000060 (252, 3)
1IBM IPR-0 5EC2A900000000C0 (252, 4)
1IBM IPR-0 5EC2A90000000040 (252, 0)
And then further debug, I find that dmsetup is calling kpartx seemingly correctly, but kpartx is I think messing up.
I was able to fix this by booting with:
root=UUID=f7c3b31d-3411-420e-a57d-9318e43248ba ro console=hvc0 break=post-multipath
Then ... after that, I have the devices I needed:
(initramfs) blkid
/dev/sda2: LABEL="cloudimg-rootfs" UUID="f7c3b31d-3411-420e-a57d-9318e43248ba" TYPE="ext4"
/dev/sdg2: LABEL="cloudimg-rootfs" UUID="f7c3b31d-3411-420e-a57d-9318e43248ba" TYPE="ext4"
/dev/mapper/1IBM\x20\x20\x20\x20\x20IPR-0\x20\x20\x205EC2A90000000080-part2: LABEL="cloudimg-rootfs" UUID="f7c3b31d-3411-420e-a57d-9318e43248ba" TYPE="ext4"
I exited from there, the remaining boot took over, and mounted the device mapper device as /.
All happy.
So, if there weren't a bug in kpartx we'd have a very easy solution in just installing the multipath-tools-boot package.
That said, it looks like user_friendly_names in /etc/multipath.conf might be relevant.
Ok, so Oleg and I were looking at a solution, and figured we'd give the "maybe it just works" path a try. tools-boot'
I installed a system, it installed onto /dev/sda (as this bug shows).
I then 'apt-get install multipath-
I rebooted, with the 'root=LABEL= cloudimg- rootfs' on the cmdline (as normal). It died in initramfs unable to find root. The full bootlog at http:// paste.ubuntu. com/11547135/ .
The multipath- tools-boot package puts some code into the initramfs (/usr/share/ initramfs- tools/scripts/ local-top/ multipath) that does this:
| if [ -x /sbin/kpartx -a -x /sbin/dmsetup ]; then
| /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p -part" >/dev/null
| fi
That looks all well and good.
In the initramfs I did some debugging:
(initramfs) /sbin/dmsetup ls --target multipath
1IBM IPR-0 5EC2A900000000A0 (252, 1)
1IBM IPR-0 5EC2A90000000020 (252, 2)
1IBM IPR-0 5EC2A90000000080 (252, 5)
1IBM IPR-0 5EC2A90000000060 (252, 3)
1IBM IPR-0 5EC2A900000000C0 (252, 4)
1IBM IPR-0 5EC2A90000000040 (252, 0)
And then further debug, I find that dmsetup is calling kpartx seemingly correctly, but kpartx is I think messing up.
I was able to fix this by booting with: UUID=f7c3b31d- 3411-420e- a57d-9318e43248 ba ro console=hvc0 break=post- multipath
root=
Then doing:
(initramfs) cat /tmp/myprog
#!/bin/sh
tgt="$1"
fixed=$(echo "$tgt" | sed 's, ,\\x20,g')
{
echo "input: '$tgt'"
echo "fixed: '$fixed'"
echo /sbin/kpartx -a -v -p -part "$fixed"
/sbin/kpartx -a -v -p -part "$fixed"
ret=$?
echo $ret
} >> /tmp/log 2>&1
exit $ret
(initramfs) rm /tmp/log 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 00A0' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 00A0 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0020' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0020 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0080' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0080 0-part1 (252:6): 0 16384 linear /dev/mapper/ 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0080 2048 0-part2 (252:7): 0 554268639 linear /dev/mapper/ 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0080 18432 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0060' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0060 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 00C0' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 00C0 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0040' 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0040
(initramfs) /sbin/dmsetup ls --target multipath --exec "/bin/myprog"
(initramfs) cat /tmp/log
input: '/dev/mapper/1IBM IPR-0 5EC2A900000000A0'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
0
input: '/dev/mapper/1IBM IPR-0 5EC2A90000000020'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
0
input: '/dev/mapper/1IBM IPR-0 5EC2A90000000080'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
add map 1IBM IPR-0 5EC2A9000000008
add map 1IBM IPR-0 5EC2A9000000008
0
input: '/dev/mapper/1IBM IPR-0 5EC2A90000000060'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
0
input: '/dev/mapper/1IBM IPR-0 5EC2A900000000C0'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
0
input: '/dev/mapper/1IBM IPR-0 5EC2A90000000040'
fixed: '/dev/mapper/
/sbin/kpartx -a -v -p -part /dev/mapper/
Then ... after that, I have the devices I needed: cloudimg- rootfs" UUID="f7c3b31d- 3411-420e- a57d-9318e43248 ba" TYPE="ext4" cloudimg- rootfs" UUID="f7c3b31d- 3411-420e- a57d-9318e43248 ba" TYPE="ext4" 1IBM\x20\ x20\x20\ x20\x20IPR- 0\x20\x20\ x205EC2A9000000 0080-part2: LABEL=" cloudimg- rootfs" UUID="f7c3b31d- 3411-420e- a57d-9318e43248 ba" TYPE="ext4"
(initramfs) blkid
/dev/sda2: LABEL="
/dev/sdg2: LABEL="
/dev/mapper/
I exited from there, the remaining boot took over, and mounted the device mapper device as /.
All happy.
So, if there weren't a bug in kpartx we'd have a very easy solution in just installing the multipath- tools-boot package.
That said, it looks like user_friendly_names in /etc/multipath.conf might be relevant.