Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 44091 - sys-fs/lvm2: cannot be used within initrd
Summary: sys-fs/lvm2: cannot be used within initrd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 46167
  Show dependency tree
 
Reported: 2004-03-08 18:16 UTC by Sascha Silbe
Modified: 2004-10-15 23:43 UTC (History)
4 users (show)

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


Attachments
Patch (lvm2-static.patch,1.12 KB, patch)
2004-03-12 14:59 UTC, Tim Yamin (RETIRED)
Details | Diff
Patch for 2.00.15 (lvm2-2.00.15.ebuild.static.patch,1.07 KB, patch)
2004-05-15 09:38 UTC, Philipp Kirchner
Details | Diff
patch for LVM2.2.00.15 to cope with *.static command names (bug44091-LVM2.2.00.15-static.patch,591 bytes, patch)
2004-05-22 05:41 UTC, Sascha Silbe
Details | Diff
Updated patch for lvm2.2.00.15.ebuild (bug44091-lvm2.2.00.15-static.ebuild.patch,1.05 KB, patch)
2004-05-22 05:55 UTC, Sascha Silbe
Details | Diff
suggested (untested) patch for genkernel against current cvs (genkernel-lvm.diff,649 bytes, patch)
2004-09-09 17:00 UTC, rob holland (RETIRED)
Details | Diff
fix previous borked patch (sorry) (genkernel-lvm.diff,1.02 KB, patch)
2004-09-09 17:06 UTC, rob holland (RETIRED)
Details | Diff
changes as requested (genkernel.patch,769 bytes, patch)
2004-09-19 14:04 UTC, rob holland (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Silbe 2004-03-08 18:16:26 UTC
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"
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2004-03-12 14:59:27 UTC
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.
Comment 2 Sascha Silbe 2004-03-16 09:47:11 UTC
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# 

Comment 3 Sascha Silbe 2004-03-16 10:04:58 UTC
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.

Comment 4 Jason Cox (RETIRED) gentoo-dev 2004-04-16 17:52:50 UTC
Did recompiling device-manager statically fix this?
Comment 5 Philipp Kirchner 2004-05-15 09:38:08 UTC
Created attachment 31484 [details, diff]
Patch for 2.00.15

Applied the previous posted patch to lvm2-2.00.15.ebuild
Comment 6 Sascha Silbe 2004-05-22 04:11:55 UTC
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.
Comment 7 Sascha Silbe 2004-05-22 05:41:52 UTC
Created attachment 31832 [details, diff]
patch for LVM2.2.00.15 to cope with *.static command names
Comment 8 Sascha Silbe 2004-05-22 05:55:59 UTC
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.
Comment 9 Chris Gianelloni (RETIRED) gentoo-dev 2004-05-27 16:16:20 UTC
Adding myself, since I will be looking into implementing this on the LiveCD's soon.
Comment 10 Greg Kroah-Hartman (RETIRED) gentoo-dev 2004-06-21 13:24:57 UTC
Not a kernel bug, so I'm giving it to you :)

If someone else should own it, please reassign it.
Comment 11 Chris Gianelloni (RETIRED) gentoo-dev 2004-06-22 05:32:12 UTC
Does genkernel have support for this now?
Comment 12 Tim Yamin (RETIRED) gentoo-dev 2004-06-22 07:59:30 UTC
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...
Comment 13 Chris Gianelloni (RETIRED) gentoo-dev 2004-08-18 15:06:22 UTC
Max: could you implement the static USE flag on lvm2, then reassign this back to livecd@gentoo.org when you're done?

Thanks
Comment 14 rob holland (RETIRED) gentoo-dev 2004-09-09 16:46:26 UTC
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.
Comment 15 rob holland (RETIRED) gentoo-dev 2004-09-09 17:00:53 UTC
Created attachment 39278 [details, diff]
suggested (untested) patch for genkernel against current cvs
Comment 16 rob holland (RETIRED) gentoo-dev 2004-09-09 17:02:19 UTC
sorry, didn't roll the patch properly, its against gen_initrd.sh
Comment 17 rob holland (RETIRED) gentoo-dev 2004-09-09 17:06:00 UTC
Created attachment 39279 [details, diff]
fix previous borked patch (sorry)
Comment 18 Scott Taylor (RETIRED) gentoo-dev 2004-09-09 22:54:05 UTC
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" )
Comment 19 rob holland (RETIRED) gentoo-dev 2004-09-10 01:33:31 UTC
fixed and commited. sorry about that
Comment 20 Tim Yamin (RETIRED) gentoo-dev 2004-09-19 02:40:07 UTC
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!
Comment 21 rob holland (RETIRED) gentoo-dev 2004-09-19 14:04:58 UTC
Created attachment 39951 [details, diff]
changes as requested
Comment 22 Chris Gianelloni (RETIRED) gentoo-dev 2004-10-09 12:19:37 UTC
So Tim... what's the verdict on this?  Will genkernel pull in the proper files into the initrd?  If so, which version?
Comment 23 Chris Gianelloni (RETIRED) gentoo-dev 2004-10-15 23:43:34 UTC
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.