sys-fs/lvm2 is linked dynamically, so it cannot be used within an initrd. Reproducible: Always Steps to Reproduce: 1. emerge sys-fs/lvm2 2. ls /sbin/vgscan.static 3. ldd /sbin/vgscan Actual Results: root@cube:/boot# ls /sbin/vgscan.static ls: /sbin/vgscan.static: No such file or directory root@cube:/boot# ldd /sbin/vgscan libdevmapper.so.1.00 => /lib/libdevmapper.so.1.00 (0x40031000) libdl.so.2 => /lib/libdl.so.2 (0x40038000) libc.so.6 => /lib/libc.so.6 (0x4003b000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) Expected Results: Either provide statically linked /sbin/vgscan.static and /sbin/vgchange.static or link /sbin/lvm statically. Gentoo Base System version 1.4.3.13 Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.4.23-cube-2) ================================================================= System uname: 2.4.23-cube-2 i686 AMD Athlon(tm) processor distcc 2.12.1 i586-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.7.7 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=pentium -mcpu=athlon-tbird -O3 -pipe" CHOST="i586-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /usr/vice/etc /var/qmail/alias /var/qmail/control" CONFIG_PROTECT_MASK="/etc/afs/C /etc/afs/afsws /etc/afs/modload /etc/gconf /etc/make.globals /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -mcpu=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox strict userpriv usersandbox" GENTOO_MIRRORS="ftp://ftp.easynet.nl/mirror/gentoo/ http://gentoo.inode.at/ ftp://gentoo.inode.at/source/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://hybrid.sascha.silbe.org/gentoo-portage" USE="3dnow X acl afs apm avi berkdb cdr crypt dga doc dvd encode foomaticdb gdbm gif gtk gtk2 gtkhtml guile hbci imap imlib ipv6 j-noaim j-nomsn j-noyahoo jpeg krb4 lcms libg++ libwww linguas_de linguas_de_DE linguas_en linguas_en_GB linguas_en_US mad maildir mbox mikmod mmx monitor mpeg mysql nas ncurses nls oggvorbis opengl oss pam pdflib png postgres python qt qtmt quicktime readline samba sdl skey spell ssl tetex tiff truetype unicode x86 xml xml2 xv zlib"
Created attachment 27266 [details, diff] Patch Try this patch on /usr/portage/sys-apps/lvm2/lvm2-2.00.08.ebuild; and make sure that the "static" USE flag is set when you compile it.
root@cube:/usr/local/portage/sys-fs/lvm2# patch --dry-run < x.patch patching file lvm2-2.00.08.ebuild Hunk #1 FAILED at 14. 1 out of 1 hunk FAILED -- saving rejects to file lvm2-2.00.08.ebuild.rej root@cube:/usr/local/portage/sys-fs/lvm2#
After applying your patch manually, I get: [...] gcc -o lvm archive.o dumpconfig.o lvchange.o lvcreate.o lvdisplay.o lvextend.o lvm.o lvmchange.o lvmdiskscan.o lvreduce.o lvremove.o lvrename.o lvresize.o lvscan.o pvchange.o pvcreate.o pvdisplay.o pvmove.o pvremove.o pvscan.o report.o toollib.o vgcfgbackup.o vgcfgrestore.o vgchange.o vgck.o vgcreate.o vgconvert.o vgdisplay.o vgexport.o vgextend.o vgimport.o vgmerge.o vgmknodes.o vgreduce.o vgremove.o vgrename.o vgscan.o vgsplit.o -L../lib \ -L/lib -llvm -ldevmapper -ldl make[1]: Leaving directory `/tmp/portage/lvm2-2.00.08/work/LVM2.2.00.08/tools' /usr/lib/gcc-lib/i586-pc-linux-gnu/3.3.2/../../../../i586-pc-linux-gnu/bin/ld: cannot find -ldevmapper collect2: ld returned 1 exit status !!! ERROR: sys-fs/lvm2-2.00.08 failed. !!! Function src_compile, Line 28, Exitcode 1 !!! Static linking failed! So we need to compile device-mapper statically first.
Did recompiling device-manager statically fix this?
Created attachment 31484 [details, diff] Patch for 2.00.15 Applied the previous posted patch to lvm2-2.00.15.ebuild
Using sys-libs/device-mapper-1.00.08, lvm2 compiles fine with USE=static, but it does not work: root@cube:/usr/local/portage/sys-libs# vgdisplay.static No such command. Try 'help'. It's probably confused by the .static suffix.
Created attachment 31832 [details, diff] patch for LVM2.2.00.15 to cope with *.static command names
Created attachment 31834 [details, diff] Updated patch for lvm2.2.00.15.ebuild This patch against vanilla lvm2-2.00.15.ebuild applies the command name patch and provides static binaries if USE=static is set. BTW: Is there a reason to provide static binaries only if USE=static is set? The dynamically linked ones are always included.
Adding myself, since I will be looking into implementing this on the LiveCD's soon.
Not a kernel bug, so I'm giving it to you :) If someone else should own it, please reassign it.
Does genkernel have support for this now?
3.0.2b should, yes. It just needs the static binaries to be in place - if it doesn't complain that they're not there they should work...
Max: could you implement the static USE flag on lvm2, then reassign this back to livecd@gentoo.org when you're done? Thanks
I've commited 15-r1 which has USE="static" support. note: it installs the static binaries instead of the dynamic ones, not as well as. Same name, same symlinks. Genkernel will need to be fixed to not check for binary.static names but make sure /sbin/lvm is static then cp it + create two symlinks to it.
Created attachment 39278 [details, diff] suggested (untested) patch for genkernel against current cvs
sorry, didn't roll the patch properly, its against gen_initrd.sh
Created attachment 39279 [details, diff] fix previous borked patch (sorry)
lvm2 without USE=static dies in sed: >>> Unpacking LVM2.2.00.15.tgz to /data/tmp/portage/lvm2-2.00.15-r1/work !!! ERROR: sys-fs/lvm2-2.00.15-r1 failed. !!! Function src_unpack, Line 26, Exitcode 1 !!! sed failed Please wrap the sed logic in parentheses as so, for the sake of those without +static: use static && ( sed -i -e 's/TARGETS += lvm.static/TARGETS = .commands lvm-static/' \ -e 's/^install_tools_static:/install_tools_unused:/' \ -e 's/^install_tools_dynamic: lvm/install_tools_static: lvm.static/' \ -e 's/lvm \\$/lvm.static \\/' tools/Makefile.in || die "sed failed" )
fixed and commited. sorry about that
Rob: Can you get your patch to use ldd (part of glibc) instead of file (which is an external application) and also use grep -q instead of grep ... > /dev/null? Thanks!
Created attachment 39951 [details, diff] changes as requested
So Tim... what's the verdict on this? Will genkernel pull in the proper files into the initrd? If so, which version?
I'm going to mark this as fixed, since the newest version of genkernel has support for lvm in the initrd provided lvm is compiled with USE=static before genkernel runs. If there is a problem, be sure to REOPEN this bug.