Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 442078

Summary: sys-kernel/genkernel-3.4.45 - wrong lvm.static usage
Product: Gentoo Hosted Projects Reporter: Alexey Sychev <taviscaron>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: RESOLVED FIXED    
Severity: normal CC: bas, itumaykin+gentoo, whissi
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: genkernel.conf

Description Alexey Sychev 2012-11-06 18:31:57 UTC
sys-kernel/genkernel (all latest versions) don't use lvm.static available on system and still compile 2.02.88 for adding to initramfs:

gentoo boot # genkernel initramfs
* Gentoo Linux Genkernel; Version 3.4.45
* Running with options: initramfs

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86/modules_load ..

* Clearing cache dir contents from /var/cache/genkernel
* Linux Kernel 3.6.6-gentoo for x86...
* .. with config file /etc/kernels/kernel-config-x86-3.6.6-gentoo
* busybox: >> Applying patches...
*           - 1.18.1-openvt.diff
*           - busybox-1.20.1-mdstart.patch
*           - busybox-1.20.2-glibc-sys-resource.patch
*           - busybox-1.7.4-signal-hack.patch
* busybox: >> Configuring...
* busybox: >> Compiling...
* busybox: >> Copying to cache...
* initramfs: >> Initializing...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Appending busybox cpio data...
*         >> Appending lvm cpio data...
*           LVM: Adding support (compiling binaries)...
* lvm: >> Applying patches...
*           - lvm2-2.02.72-no-export-dynamic.patch
* lvm: >> Configuring...
* lvm: >> Compiling...
*       >> Copying to bincache...
*         >> Appending mdadm cpio data...
* 		MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)...
*         >> Appending modules cpio data...
*         >> Appending blkid cpio data...
*         >> Appending modprobed cpio data...
*         >> Compressing cpio data (.xz)...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* add "dolvm" for lvm support
* add "domdadm" for RAID support
* With support for several ext* filesystems available, it may be needed to
* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
* 
* Make sure you have the latest ~arch genkernel before reporting bugs.

* RUNNING FINAL CACHE/TMP CLEANUP
* CACHE_DIR: /var/cache/genkernel
* Clearing cache dir contents from /var/cache/genkernel
* 	 >> removing /var/cache/genkernel/LVM2.2.02.88-x86.tar.bz2
* 	 >> removing /var/cache/genkernel/busybox-1.20.2-x86.tar.bz2

* TMPDIR: /var/tmp/genkernel
* Removing tmp dir contents
* 	 >> removing initramfs-3.6.6-gentoo
gentoo boot #

gentoo boot # eix lvm2
[I] sys-fs/lvm2
     Installed versions:  2.02.97(15:27:10 11/02/12)(readline static static-libs udev -clvm -cman -lvm1 -selinux -thin)
     Homepage:            http://sources.redhat.com/lvm2/
     Description:         User-land utilities for LVM2 (device-mapper) software.

gentoo boot # which lvm.static
/sbin/lvm.static
gentoo boot # ls -la /sbin/lvm.static
-r-xr-xr-x 1 root root 2127832 Nov  2 15:27 /sbin/lvm.static
gentoo boot # ldd /sbin/lvm.static
	not a dynamic executable
Comment 1 Alexey Sychev 2012-11-06 18:36:13 UTC
Created attachment 328574 [details]
genkernel.conf
Comment 2 Alexey Sychev 2012-11-06 18:38:14 UTC
work ( LVM: Adding support (using local static binary /sbin/lvm.static)...) only if i change this:

--- /usr/share/genkernel/gen_initramfs.sh	2012-11-06 22:33:38.458143086 +0400
+++ /usr/share/genkernel/gen_initramfs.sh.original	2012-11-06 22:33:18.338111572 +0400
@@ -302,7 +302,7 @@
 	cd ${TEMP}
 	mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
 	mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
-	if [ -e '/sbin/lvm.static' ]
+	if false && [ -e '/sbin/lvm.static' ]
 	then
 		print_info 1 '          LVM: Adding support (using local static binary /sbin/lvm.static)...'
 		cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
Comment 3 Alexey Sychev 2012-11-27 17:40:57 UTC
Anybody here?
Comment 4 Alexey Sychev 2012-12-25 06:18:43 UTC
2 months...
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2013-01-04 02:18:24 UTC
Hi,

I can confirm this.

While fixing another bug in genkernel 3.4.45, I also fixed this. Would be nice if you could test my patch from #448156.

Thanks.
Comment 6 Xake 2013-01-04 14:10:06 UTC
I guess this is a WONTFIX as this is by design.
From the Changelog (http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;f=gen_initramfs.sh;h=265363f79df5a545dc47547dbee76972b387e9b7):

Fix dmraid building with LVM/device-mapper

dmraid is entirely broken if you try to use the system static
LVM/device-mapper. Instead, always build our own LVM2 for the initramfs,
using DESTDIR for cleaner install. Dead code paths for old LVM2 build
not removed yet until more users have tested.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

---

Does this actually break anything for any of you or do any of you have another approach you would prefer?
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2013-01-04 14:39:04 UTC
Well, most docs/tutorials explaining how to use LVM with genkernel I read also recommend to compile lvm2 with static USE flag, so it can be used by genkernel.

But because this is broken since the commit you linked, we now experience unbootable systems like described in #448156, because current LVM versions will store the binaries in /sbin instead of /bin and the gen_initramfs script wasn't aware of this change.

=> This bug uncovered another bug :)

With my patch both bugs are fixed for me. genkernel will use any existing LVM2 static binary it will find on the system (which is working fine on all my systems) and if genkernel needs to compile LVM2, this will also work now.

I am wondering what was wrong with the system's lvm, why they deactivated it.

So to your question:
When it is the recommended way that genkernel should build and use its own lvm2, that would be ok for me (but genkernel's lvm2 must be working, see #448156!).
But we should know the reason why we don't use any existing static lvm... that sounds like a dirty workaround.
Comment 8 Xake 2013-01-04 17:15:11 UTC
(In reply to comment #7)

As the commit said, we do experience problems with dmraid (i.e. many hardware RAID configurations) when using lvm2/dmsetup/dmraid from userspace. So we have disabled it for now.
So probably did users using dmraid (which uses device-manager/dmetup from the lvm2 package) meet unbootable systems. And those problems takes priority (I had honestly forgotten about this bug until I read the one you linked).


For the bug about the symlinks, please keep that discussion to that bug, as I am following that too.
Comment 9 Richard Yao (RETIRED) gentoo-dev 2013-06-06 06:49:48 UTC
(In reply to Alexey Sychev from comment #3)
> Anybody here?

People are here, but we are stretched fairly thin. The consequence is that we are not as responsive as we would like to be (understatement of the year). If you want to get people's attention, I suggest talking to them directly in IRC or sending emails to them. robbat2 maintains LVM in Gentoo, so it would be best for him to look at this.
Comment 10 Bas Nedermeijer 2015-06-07 21:30:44 UTC
This seems still to be an issue with genkernel 3.4.51.2.

I tried to boot from a root partition in combination with dm_cache partition. The LVM version used wasn't recent enough to recognize the cache type. Building LVM static didn't help.
Comment 11 Larry the Git Cow gentoo-dev 2017-09-03 06:44:16 UTC
Bug has been closed via the following commit:
    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed4c4b10e62a57129bb7da924f850e65bdf47b71

    commit ed4c4b10e62a57129bb7da924f850e65bdf47b71
Author:     Robin H. Johnson <robbat2@gentoo.org>
AuthorDate: 2017-09-03 06:34:32 +0000
Commit:     Robin H. Johnson <robbat2@gentoo.org>
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
    
    Closes: https://bugs.gentoo.org/442078
    Closes: https://bugs.gentoo.org/524346
    Closes: https://bugs.gentoo.org/596540
    Closes: https://bugs.gentoo.org/627398
    Closes: https://bugs.gentoo.org/628020
    Closes: https://bugs.gentoo.org/609342
    Package-Manager: Portage-2.3.6, Repoman-2.3.3

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