sys-apps/mkinitrd cannot cope with LVM, probably because if expects it to work like on RedHat. Reproducible: Always Steps to Reproduce: 1. mkinitrd initrd-mkinitrd-2.4.21-cube-2.gz 2.4.21-cube-2 Actual Results: root@cube:/boot# mkinitrd initrd-mkinitrd-2.4.21-cube-2.gz 2.4.21-cube-2 cp: cannot stat `/sbin/vgwrapper': No such file or directory ln: accessing `/tmp/initrd.xc0kET/bin/vgwrapper': No such file or directory ln: accessing `/tmp/initrd.xc0kET/bin/vgwrapper': No such file or directory root@cube:/boot# Expected Results: Build an initrd that can boot a root filesystem on an LVM logical volume. Portage 2.0.49-r3 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1, 2.4.21-cube-2) ================================================================= System uname: 2.4.21-cube-2 i686 AMD Athlon(tm) processor distcc 2.9 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-tbird -O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config /usr/vice/etc /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/config" CONFIG_PROTECT_MASK="/etc/afs/modload /etc/make.globals /etc/afs/C /etc/afs/afsws /etc/gconf /etc/env.d" CXXFLAGS="-O2 -mcpu=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="sandbox ccache autoaddcvs 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="x86 foomaticdb libg++ mad gtkhtml gdbm berkdb libwww gtk cdr -3dfx 3dnow -aalib acl afs -alsa apm -arts avi -bonobo crypt -cups dga -directfb doc dvd encode -esd -evo -fbcon -ggi gif -gnome -gnome-libs -gphoto2 -gpm guile hbci -icc -icc-pgo imap imlib ipv6 -java jpeg kde -kerberos krb4 lcms ldap -matrox maildir mbox mikmod mmx monitor -motif mozilla mpeg -mule mysql nas ncurses nls -odbc oggvorbis opengl oss pam -pcmcia -pda pdflib -perl png -pnp postgres python qt qtmt quicktime readline -ruby samba -sasl sdl skey slang -slp -snmp socks5 spell ssl -static -svga -tcltk -tcpd tetex tiff truetype -voodoo3 X xml xml2 -xmms xv -zeo zlib"
Created attachment 18369 [details, diff] install vgscan and vgchange themselves instead of vgwrapper The attached patch fixes the problem by copying vgscan and vgchange themselves into the initrd instead of copying vgwrapper and linking to it. In addition to this, sys-fs/lvm-user needs to be compiled with USE=static.
why not use lvmcreate_initrd to create the initrd? then if you need anything special done edit that one?
Because lvmcreate_initrd does not use pivot_root, so I cannot have an ext3 LVM root mounted with data=journal (rootflags get applied to the initrd, not the real root). Even the initrd created by mkinitrd had to be hand-edited because it only works for self-hosting, but I needed the initrd for a UML host. initrd-tools from Debian might be better, haven't tried that yet. UML=user mode linux, BTW.
I'm not sure if we can take this patch, since we cant ensure that lvm-user is compiled static. I've never used LVM, how does the Redhat behavior differ from ours? Did Redhat cook up vgwrapper as a lite, static program that incorporates the needed functionality of vgscan and vgchange, for use in initrds? If this is the case, we could ask the lvm-user people to see if we can get this wrapper, which would probably be a better solution.
On a RedCrap machine: [root@gcomm root]# ldd /sbin/vgwrapper not a dynamic executable I'm in favour of redirecting this to lvm-user and dropping the patch.
The vgwrapper that Red Hat has doesn't seem so nice. So I am going to put in a lvm-user patch that always causes a vgscan.static and vgchange.static to be built, and then use your patch so mkinitrd will install them into the initrd. However, I ran into this warning when building them static (near the end of the build): gcc -static vgscan.o -L/var/tmp/portage/lvm-user-1.0.7/work/LVM/1.0.7/tools/lib -llvm-10 -o vgscan /var/tmp/portage/lvm-user-1.0.7/work/LVM/1.0.7/tools/lib/liblvm-10.a(lv_create_node.o)(.text+0x82): In function `lv_create_node': : warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking Did you receive this warning when you built lvm-user with USE="static"? (its near the end of the build, and it doesnt fail the ebuild). If so does it still work ok? I just want to be sure, since I don't use LVM myself.
I committed lvm-user-1.0.7-r1 and mkinitrd-3.5.7-r2. Together they should fix this.
Works fine. Thanks!