Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 596540 - sys-kernel/genkernel - Integrated LVM needs UDEV support
Summary: sys-kernel/genkernel - Integrated LVM needs UDEV support
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
Depends on:
Reported: 2016-10-08 11:39 UTC by Thomas Deutschmann
Modified: 2017-09-03 06:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann gentoo-dev Security 2016-10-08 11:39:28 UTC
On my typical system I have at least 3 partitions:

- sda1 (EF00)
- sda2 (8300; ext4 for /boot)
- sda3 (8E00; LVM PV)

In my LVM PV I have logical volumes for "/", "/usr/portage", "/var/log" and SWAP.

Well, in my case sda3 is often full encrypted using LUKS before I add LVM on top but this shouldn't have an effect on the problem I am reporting.

Sometimes I have multiple disks (i.e. sdb, sdc) which will have one large LVM partition. But these partition/volumes are getting mounted by the system using localmount service, not by genkernel.

The problem:
Sometimes (I don't know what's triggering this), after running the system for a while, LVM will become unable to see my logical volumes. They are still mounted and accessible but I will notice when I want to create LVM snapshots to backup the system when LVM reports it can't create the snapshot because the LVs/PVs are missing (`pvs` and `lvs` don't list them anymore).

Howver that's only the case for sda, the LVM PV/LV genkernel mounts/activate. The PVs/LVs from my additional disks the local system mounts/activate are still present and show up.

I tried to

 - restart udev (`/etc/init.d/udev restart`)

 - Re-run the `udevadm trigger` (with "--verbose" I see the dm-* in the list)

 - restart lvmetad (`/etc/init.d/lvmetad restart`)

 - restart lvm (`/etc/init.d/lvm restart`)

but nothing helps.

SO I went into "/dev/mapper" and noticed that the PVs/LVs the local system mounts/activates are shown up as symlinks but the PVs/LVs genkernel's initramfs mounts/activate aren't symlinks:

> # ls -lv /dev/mapper/
> total 0
> crw------- 1 root root  10, 236 Oct  8 12:55 control
> brw------- 1 root root 250,   6 Oct  8 12:55 dataVault
> brw------- 1 root root 250,   0 Oct  8 12:55 root
> lrwxrwxrwx 1 root root        7 Oct  8 12:55 dataStorage-volBackup -> ../dm-8
> lrwxrwxrwx 1 root root        7 Oct  8 13:05 dataStorage-volSrv -> ../dm-7
> brw------- 1 root root 250,   3 Oct  8 12:55 systemStorage-volLog
> brw------- 1 root root 250,   2 Oct  8 12:55 systemStorage-volPortage
> brw------- 1 root root 250,   5 Oct  8 12:55 systemStorage-volRoot
> brw------- 1 root root 250,   1 Oct  8 12:55 systemStorage-volSwap

I run `rm /dev/mapper/systemStorage-volPortage && /etc/init.d/udev restart` and voilà, udev re-created the device node as symlink. And _now_ the systemStorage PV shows up again with _all_ its logical volumes (although the other still not symlinked).

Again, I don't now why/when this will happen. After a fresh boot I don't have symlinks for the systemStoarge group however the group and its volumes appear in `pvs` and `lvs` and I can create snapshots. So it doesn't seem to be a general problem. Only after a while...

However that sounds like

My system's LVM is build against UDEV (i.e. I am using sys-fs/lvm2[udev]) and I have set 'obtain_device_list_from_udev = 1' and 'external_device_info_source = "udev"' in /etc/lvm/lvm.conf.

So I guess the root cause is, that LVM from genkernel doesn't support UDEV and therefore don't create symlinked device nodes.

Tested with =sys-apps/genkernel- which is using LVM at v2.02.88. My system's LVM is at v2.02.145-r2.

# emerge --info
Portage 2.3.1 (python 3.4.5-final-0, default/linux/amd64/13.0, gcc-5.4.0, glibc-2.23-r2, 4.4.23-gentoo x86_64)
System uname: Linux-4.4.23-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1275_V2_@_3.50GHz-with-gentoo-2.3
KiB Mem:    32844824 total,  23276240 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Fri, 07 Oct 2016 21:30:36 +0000
sh bash 4.4
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:          4.4::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.6.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22.2::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.69-r2::gentoo
sys-devel/automake:       1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo
sys-devel/gcc:            5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Comment 1 Thomas Deutschmann gentoo-dev Security 2016-10-08 18:16:07 UTC
OK, I got my static lvm2 with UDEV support into the initramfs (see bug 442078).

However when set 'external_device_info_source = "udev"' in /etc/lvm/lvm.conf (which get copied into the initramfs) the lvm part will fail with many

> Udev database has incomplete information about device <device>


That's because lvm with UDEV supports expect /run/udev/ to be populated which isn't in the initramfs.

I think

> In other words, if udev is not running before you activate lvm, you may have problems.


describes the problem best :/

Sounds like I have to use LVM2 without UDEV support, i.e. with

> obtain_device_list_from_udev=0
> external_device_info_source="none"

But I still don't understand why it suddenly stop working. I.e. why LVM works after boot for a while (i.e. all volumes show up, I can create snapshots...) and suddenly LVM no longer sees its volumes.
Comment 2 Larry the Git Cow gentoo-dev 2017-09-03 06:44:22 UTC
Bug has been closed via the following commit:

    commit ed4c4b10e62a57129bb7da924f850e65bdf47b71
Author:     Robin H. Johnson <>
AuthorDate: 2017-09-03 06:34:32 +0000
Commit:     Robin H. Johnson <>
CommitDate: 2017-09-03 06:44:08 +0000

    sys-kernel/genkernel: bump, lots of improvements
    - Improvements to the bincache system.
    - Updates initramfs tools to ensure they compile on ~arch glibc.
    -- busybox 1.27.2
    -- mdadm 4.0
    -- lvm 2.02.173
    -- gpg 1.4.22
    The following not well tested with new glibc at this time:
    - dmraid
    - fuse
    - iscsi
    - unionfs-fuse
    Package-Manager: Portage-2.3.6, Repoman-2.3.3

 sys-kernel/genkernel/Manifest                 |   5 +
 sys-kernel/genkernel/genkernel- | 165 ++++++++++++++++++++++++++
 sys-kernel/genkernel/genkernel-9999.ebuild    |  17 +--
 3 files changed, 179 insertions(+), 8 deletions(-)