Bug#841423: LVM: raid1 kernel module not loaded

2016-10-20 Thread Ben Hutchings
On Fri, 2016-10-21 at 00:17 +0200, Cesare Leonardi wrote:
> Here i've talked about raid1 because it is what i've tested myself, but 
> since LVM can handle raid0/1/4/5/6/10, perhaps the same arguments apply 
> also to the other raid types.
> 
> For example i've noticed that the initramfs' hook from mdadm takes care 
> of loading all the raid modules:
> ---
> for module in linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do
>   force_load $module
> done

It should really use manual_add_modules to ensure the modules are
included in the initramfs.  It should not force them to be loaded.

> ---
> Maybe should also lvm2's hook load those modules?

Either dmsetup or lvm2 (I'm not quite sure what the division of
responsibilities is there) should ensure they are included.

Ben.

> And in fact if both lvm2 and mdadm are installed, what i'm reporting 
> here doesn't happen: raid modules are loaded by mdadm's hook.
> 
> Moreover, if i understand correctly, the grub2 package uploaded to 
> unstable 4 days ago (2.02-beta3) is the first that supports booting from 
> an LVM raid1: it would be wonderful if that setup could be supported out 
> of the box in Debian.
> 
> 
-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.



signature.asc
Description: This is a digitally signed message part


Bug#841423: LVM: raid1 kernel module not loaded

2016-10-20 Thread Cesare Leonardi
Here i've talked about raid1 because it is what i've tested myself, but 
since LVM can handle raid0/1/4/5/6/10, perhaps the same arguments apply 
also to the other raid types.


For example i've noticed that the initramfs' hook from mdadm takes care 
of loading all the raid modules:

---
for module in linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do
force_load $module
done
---
Maybe should also lvm2's hook load those modules?

And in fact if both lvm2 and mdadm are installed, what i'm reporting 
here doesn't happen: raid modules are loaded by mdadm's hook.


Moreover, if i understand correctly, the grub2 package uploaded to 
unstable 4 days ago (2.02-beta3) is the first that supports booting from 
an LVM raid1: it would be wonderful if that setup could be supported out 
of the box in Debian.




Bug#841423: LVM: raid1 kernel module not loaded

2016-10-20 Thread Ben Hutchings
Control: reassign -1 dmsetup 2:1.02.133-1

On Thu, 2016-10-20 at 14:27 +0200, Cesare Leonardi wrote:
> Package: initramfs-tools
> Version: 0.125
> Severity: normal
> 
> Initially i thought to file this bug to lvm2 package but now i suspect
> it's more related with kernel modules dependencies and the
> manual_add_modules() hook of initramfs-tools.
> 
> Suppose your system has lvm2 installed but not mdadm.
> Now search for the raid modules installed in the initramfs image:
> lsinitramfs IMG | grep raid
> You will notice that there are various raid modules loaded but not
> raid1.
> 
> LVM is a very flexible system that let's you convert your volume setup
> from linear to raidN and viceversa, with mounted filesystem.
>
> So if you, for example, try to you convert your single disk volume to
> a two disks raid1 volume, you will have an unbootable system, due to
> failure of volume activation caused by the missing raid1 module.
> 
> The workaround it to add "raidi1" to /etc/initramfs-tools/modules and
> update the initramfs before rebooting.
[...]

OK, so there is a hidden module dependency: dm-raid depends on md-mod,
which will request other md-RAID modules as needed.  We can't discover
that through static inspection of the modules or looking at sysfs.

I think this ought to be handled in dmsetup's initramfs hook.

Ben.

-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.


signature.asc
Description: This is a digitally signed message part


Bug#841423: LVM: raid1 kernel module not loaded

2016-10-20 Thread Cesare Leonardi
Package: initramfs-tools
Version: 0.125
Severity: normal

Initially i thought to file this bug to lvm2 package but now i suspect
it's more related with kernel modules dependencies and the
manual_add_modules() hook of initramfs-tools.

Suppose your system has lvm2 installed but not mdadm.
Now search for the raid modules installed in the initramfs image:
lsinitramfs IMG | grep raid
You will notice that there are various raid modules loaded but not
raid1.

LVM is a very flexible system that let's you convert your volume setup
from linear to raidN and viceversa, with mounted filesystem.
So if you, for example, try to you convert your single disk volume to
a two disks raid1 volume, you will have an unbootable system, due to
failure of volume activation caused by the missing raid1 module.

The workaround it to add "raidi1" to /etc/initramfs-tools/modules and
update the initramfs before rebooting.
The issue is also described here:
https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/1509717

Indeed it can be asked to the lvm2 maintainer to add "raid1" module to
the initramfs hook. Currently /usr/share/initramfs-tools/hooks/lvm2 load
these modules:
dm_mod
dm_snapshot
dm_mirror
dm_raid

But since with the above modules, various raid modules get loaded as
dependencies, i wonder why raid1 is not.



-- Package-specific info:
-- initramfs sizes
-rw-r--r-- 1 root root 19M Oct 20 13:26 /boot/initrd.img-4.6.0-1-amd64
-rw-r--r-- 1 root root 19M Oct 20 13:25 /boot/initrd.img-4.7.0-1-amd64
-- /proc/cmdline
BOOT_IMAGE=/vmlinuz-4.7.0-1-amd64 root=/dev/mapper/vg0-debian--root ro 
systemd.show_status=1 quiet

-- resume
RESUME=UUID=165d521e-0cc9-4bf4-bc12-a995e826a649
-- /proc/filesystems
ext3
ext2
ext4
vfat

-- lsmod
Module  Size  Used by
cpuid  16384  0
nls_ascii  16384  1
nls_cp437  20480  1
snd_hda_codec_realtek86016  1
snd_hda_codec_hdmi 45056  1
snd_hda_codec_generic69632  1 snd_hda_codec_realtek
vfat   20480  1
fat69632  1 vfat
amdkfd126976  1
efi_pstore 16384  0
kvm_amd73728  0
kvm   573440  1 kvm_amd
irqbypass  16384  1 kvm
efivars20480  1 efi_pstore
snd_hda_intel  36864  0
radeon   1490944  1
snd_hda_codec 135168  4 
snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel
serio_raw  16384  0
pcspkr 16384  0
snd_hda_core   81920  5 
snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
evdev  24576  2
k10temp16384  0
ttm98304  1 radeon
snd_hwdep  16384  1 snd_hda_codec
nuvoton_cir24576  0
drm_kms_helper147456  1 radeon
snd_pcm   110592  4 
snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_core
snd_timer  32768  1 snd_pcm
drm   364544  4 ttm,drm_kms_helper,radeon
sp5100_tco 16384  0
snd81920  8 
snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
sg 32768  0
soundcore  16384  1 snd
i2c_piix4  24576  0
shpchp 36864  0
rc_core28672  1 nuvoton_cir
i2c_algo_bit   16384  1 radeon
button 16384  0
acpi_cpufreq   20480  0
tpm_tis20480  0
tpm45056  1 tpm_tis
xt_tcpudp  16384  1
nf_conntrack_ipv4  20480  5
nf_defrag_ipv4 16384  1 nf_conntrack_ipv4
xt_conntrack   16384  5
nf_conntrack  114688  2 xt_conntrack,nf_conntrack_ipv4
iptable_filter 16384  1
sch_fq_codel   20480  3
efivarfs   16384  1
ip_tables  24576  1 iptable_filter
x_tables   36864  4 ip_tables,xt_tcpudp,xt_conntrack,iptable_filter
autofs440960  2
ext4  589824  2
ecb16384  0
glue_helper16384  0
lrw16384  0
gf128mul   16384  1 lrw
ablk_helper16384  0
cryptd 20480  1 ablk_helper
aes_x86_64 20480  0
crc16  16384  1 ext4
jbd2  106496  1 ext4
mbcache16384  3 ext4
sr_mod 24576  0
cdrom  57344  1 sr_mod
hid_generic16384  0
raid1  36864  2
usbhid 49152  0
hid   118784  2 hid_generic,usbhid
dm_raid28672  2
raid456   106496  1 dm_raid
async_raid6_recov  20480  1 raid456
async_memcpy   16384  2 raid456,async_raid6_recov
async_pq   16384  2 raid456,async_raid6_recov
async_xor  16384  3 async_pq,raid456,async_raid6_recov
async_tx   16384  5