Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sys-fs/lvm2-2.02.108 fails on static libs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Sun Aug 17, 2014 6:08 am    Post subject: sys-fs/lvm2-2.02.108 fails on static libs Reply with quote

This seems to be a common issue with lvm2, but it's only recently popped up for me. I get the following:

Code:
entd -o liblvm2cmd.so \
        -Wl,-whole-archive liblvm2cmd.a -Wl,-no-whole-archive \
        -llvm-internal -ldaemonclient -ludev  -ldl -lblkid  -ldevmapper-event -ldevmapper
ln -s -f liblvm2cmd.so liblvm2cmd.so.2.02
../lib/liblvm-internal.a(sharedlib.o): In function `load_shared_library':
sharedlib.c:(.text+0x165): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libblkid.a(libcommon_la-fileutils.o): In function `mkdir_p':
(.text+0x110): multiple definition of `mkdir_p'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-mkdir.o):(.text.mkdir_p+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-util.o): In function `gid_to_name':
(.text.gid_to_name+0x31): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-util.o): In function `get_group_creds':
(.text.get_group_creds+0xca): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o): In function `util_lookup_group':
(.text.util_lookup_group+0xd7): warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-util.o): In function `get_user_creds':
(.text.get_user_creds+0x163): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-util.o): In function `get_user_creds':
(.text.get_user_creds+0xe7): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o): In function `util_lookup_user':
(.text.util_lookup_user+0xcc): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/libudev.a(libsystemd_shared_la-util.o): In function `lookup_uid':
(.text.lookup_uid+0x82): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
Makefile:151: recipe for target 'lvm.static' failed
make[1]: *** [lvm.static] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-fs/lvm2-2.02.108/work/LVM2.2.02.108/tools'
make.tmpl:277: recipe for target 'tools' failed
make: *** [tools] Error 2


In another post on the topic, NeddySeagoon suggested compiling lvm2 with '-static', but static is required after udev-182 for systems with /usr on an lvm partition (such as mine). Is there some other solution?

Cheers,

EE
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Sun Aug 17, 2014 4:14 pm    Post subject: Reply with quote

As I understand it, udev upstream so thoroughly broke support for separate /usr that you likely already use an initrd to mount /usr (or are affected by other problems related to udev assuming /usr is available early). If you use a initrd, and that initrd mounts /usr, then you do not need USE=-static on lvm2 if you also place the necessary C library shared objects in the initrd. Are you using static lvm2 because you did not place glibc shared objects in the initrd?
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Sun Aug 17, 2014 4:20 pm    Post subject: Reply with quote

I followed the instructions in this guide, which instruct to build lvm with static. However, this appears to be for the purpose of building a busybox shell to check /usr and /var before mounting, and does not indicate whether that flag is needed after the initramfs/initrd has been built.

Is that not the case? ie, now that I've built an initramfs using this guide, can I then drop the static flags from those packages? Also, how often should I update that initramfs? Neddy suggested it should be quite rare, but I haven#t updated it since the guide came out (and that was over two years ago at this point).

Cheers,

EE
Back to top
View user's profile Send private message
saellaven
l33t
l33t


Joined: 23 Jul 2006
Posts: 646

PostPosted: Sun Aug 17, 2014 5:15 pm    Post subject: Reply with quote

Check out this thread if you're interested in a separate /usr and don't want the headaches or potential breakages that come with an initramfs/initrd (it's possible for certain packages to get updated which will break your system if your initramfs isn't rebuilt also, which has already happened in the past for some people. If you don't regularly rebuild your initramfs, eventually, your luck IS going to run out even if things have been fine so far).

I've been using it for quite a while and it is stable, but WilliamH refuses to accept the patches for all I can assume are petty, personal reasons.

I'm using it with sys-fs/lvm2-2.02.103 and sys-fs/eudev-1.9-r2 (I don't trust udev and don't want systemd anywhere near my systems) without problem.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Sun Aug 17, 2014 5:56 pm    Post subject: Reply with quote

You need USE=static if you want to run the resulting binary without having a copy of the glibc shared objects available. I prefer to take the size hit of building an initrd that has glibc shared objects included, so that I can then place nearly arbitrary non-static commands in my initrd without special handling. If you do this, then you do not need static lvm. If you rebuild the initramfs to try this, save your old one aside until you know the new one works. It is easy to make a mistake with this conversion and the result will be an initrd that fails to mount any LVM-managed volumes. Depending on your filesystem locations, that could be an inconvenience or it could be a showstopper.
Back to top
View user's profile Send private message
blu3bird
Retired Dev
Retired Dev


Joined: 04 Oct 2003
Posts: 614
Location: Munich, Germany

PostPosted: Sun Aug 17, 2014 10:23 pm    Post subject: Reply with quote

sys-apps/util-linux and sys-fs/udev both include the function mkdir_p. If two different libraries include the same functions, gcc(ld) errors just like this.

As a workaround you can compile lvm with LDFLAGS="-Wl,-zmuldefs" which will give you a working lvm but please open a bug for this.
_________________
Black Holes are created when God divides by zero!
Back to top
View user's profile Send private message
gagern
n00b
n00b


Joined: 26 Nov 2003
Posts: 54

PostPosted: Fri Aug 22, 2014 7:33 am    Post subject: Reply with quote

I encountered the same, and filed bug 520450 for this.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Fri Aug 22, 2014 8:07 am    Post subject: Reply with quote

thanks for filing. I got distracted and neglected to do this :(

Cheers,

EE
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Wed Aug 27, 2014 7:47 pm    Post subject: Reply with quote

so it seems now that lvm2 has the following USE:

Code:
 static? ( !udev )


This, again, seems to contradict the instructions for building an initramfs to boot with /usr on an lvm partition. It also seems a bit of overkill, since apparently the overlapping functions are build-time only.

Any suggestions?

Cheers,

EE
Back to top
View user's profile Send private message
saellaven
l33t
l33t


Joined: 23 Jul 2006
Posts: 646

PostPosted: Wed Aug 27, 2014 8:07 pm    Post subject: Reply with quote

ExecutorElassus wrote:
so it seems now that lvm2 has the following USE:

Code:
 static? ( !udev )


This, again, seems to contradict the instructions for building an initramfs to boot with /usr on an lvm partition. It also seems a bit of overkill, since apparently the overlapping functions are build-time only.

Any suggestions?

Cheers,

EE


If all you need an initramfs for is a separate /usr, check out the link I posted earlier. You can ditch the initramfs entirely.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Wed Aug 27, 2014 9:02 pm    Post subject: Reply with quote

I saw that, and it's complicated :(

I have a bunch of questions about it. My partitions are identified by UUID in fstab; will this make a difference? FWIW, I get error messages about not finding /dev/vg volumes during boot.

I'm interested in that HOWTO, but haven't had the head for it since you first posted. How do you patch the files in question? To I add the patch files to a local patch repository to patch them into the ebuilds? How do I keep things like /etc/init.d/udev from reverting to their unpatched state after every update?

Your Howto needs a Howto :(

EE
Back to top
View user's profile Send private message
saellaven
l33t
l33t


Joined: 23 Jul 2006
Posts: 646

PostPosted: Thu Aug 28, 2014 12:00 am    Post subject: Reply with quote

ExecutorElassus wrote:
I saw that, and it's complicated :(

I have a bunch of questions about it. My partitions are identified by UUID in fstab; will this make a difference? FWIW, I get error messages about not finding /dev/vg volumes during boot.

I'm interested in that HOWTO, but haven't had the head for it since you first posted. How do you patch the files in question? To I add the patch files to a local patch repository to patch them into the ebuilds? How do I keep things like /etc/init.d/udev from reverting to their unpatched state after every update?

Your Howto needs a Howto :(

EE


I understand the frustration and reticence, I went through it at first too... you can put them in a patch repository or you can just patch them the once by hand, then when you run etc-update or whatever after installing new versions either do a merge of the files or repatch the new ones.

Once those 3 files have been patched, I've done near 0 maintenance on them.

you'll want to edit your lvm.conf accordingly, as well running "rc-update del udev sysinit" to make sure udev isn't started too early in the boot process.

That's really all there is to it... it's ridiculous that it hasn't been accepted upstream (which is a Gentoo dev) so it requires no additional work, but it's purely for political reasons that it hasn't been accepted.

You should be ok with your partitions identified by UUID, though I use /dev/mapper/* nodes for better reliability. The kernel doesn't understand UUID on its own and is reliant on user space for that and the /dev/vg nodes are created by udev, so if someone wanted to be malicious upstream (and the Council has already okayed this potential behavior, as requested by the same Gentoo dev that won't accept the patches) and move the required libraries required out of / and into /usr, you'd have a problem to fix.

As I posted on page 4 of that thread:
Quote:

I didn't keep detailed notes but...
1) remove udev and install eudev (this step is optional, but I wanted off the udev treadmill since I don't trust the systemd developers) and reboot to make sure it works
2) edit the files as shown in the first post of the thread and reboot to make sure nothing has broken
3) make sure your fstab is setup to mount the partitions by their device nodes or LABELs and not by UUID and reboot to make sure nothing has broken
4) change udev from sysinit to boot (rc-update del udev sysinit && rc-update add udev boot)
5) set initramfs="NO" in /etc/rc.conf and reboot to make sure everything is working


Step 1 is optional. You'll want confirm that your UUIDs are still okay at step #3
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Thu Aug 28, 2014 10:32 am    Post subject: Reply with quote

actually, the UUIDs were only there to get the initramfs to work; I'm fine with listing partitions by /dev/mapper nodes instead.

Sigh. I'll set to work on this over the weekend. I'm not in any shape to do real work on the system during the week. It's not frustration with the instructions per se. I'm just not much for up during the week besides tea and cake and binge-watching whatever :(

Thanks for your advice on this. On the side, how different is eudev? Is it in a mature state? Does it work better? Is there a guide somewhere? If I'm going to be reconfiguring the system, I might as well look into that as well.

Cheers,

EE
Back to top
View user's profile Send private message
saellaven
l33t
l33t


Joined: 23 Jul 2006
Posts: 646

PostPosted: Thu Aug 28, 2014 1:26 pm    Post subject: Reply with quote

ExecutorElassus wrote:

Thanks for your advice on this. On the side, how different is eudev? Is it in a mature state? Does it work better? Is there a guide somewhere? If I'm going to be reconfiguring the system, I might as well look into that as well.


eudev is pretty mature... essentially, it is the latest udev, only with carefully selected patches that keeps out the systemd gang's insanity.

For me, the process of switching was
emerge -Ca udev
emerge -1 eudev

but that was before the virtual was created... now, you can probably just add the following to your /etc/portage/package.mask and then update as normal
sys-fs/udev
sys-apps/systemd

the one thing you might have to be careful about, is if you use the not so "persistent and predictable naming" of udev, in which case you'll want to add the rule-generator flag to eudev or change your network configuration back to the eth0 type setup (optionally, you can write a couple rules to name the devices whatever you want).

Glad I could help
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Thu Aug 28, 2014 3:57 pm    Post subject: Reply with quote

trying that resulted in emerge attempting to downgrade util-linux to 2.24.x (I'm at 2.25), which failed on the following:

Code:
checking for udev_new in -ludev... checking for TINFO... no
no
configure: error: udev selected but libudev not found
checking for tgetent in -ltinfo... no
checking for syscall fallocate...
!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/sys-apps/util-linux-2.24.2/work/util-linux-2.24.2-abi_x86_64.amd64/config.log
 * ERROR: sys-apps/util-linux-2.24.2::gentoo failed (configure phase):
 *   econf failed
 *
 * Call stack:
 *          ebuild.sh, line   93:  Called src_configure
SYS_fallocate
checking for valid fallocate() function...  *        environment, line 4029:  Called multilib-minimal_src_configure
 *        environment, line 2616:  Called multilib_parallel_foreach_abi 'multilib-minimal_abi_src_configure'
 *        environment, line 2922:  Called multibuild_parallel_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_a                                          bi_src_configure'
 *        environment, line 2509:  Called multibuild_foreach_variant '_multibuild_parallel' '_multilib_multibuild_wrapper' 'mult                                          ilib-minimal_abi_src_configure'
 *        environment, line 2452:  Called _multibuild_run '_multibuild_parallel' '_multilib_multibuild_wrapper' 'multilib-minima                                          l_abi_src_configure'
 *        environment, line 2450:  Called _multibuild_parallel '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configur                                          e'
 *        environment, line 2500:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *        environment, line  558:  Called multilib-minimal_abi_src_configure
yes
 *        environment, line 2610:  Called multilib_src_configure
checking for syscall unshare...  *        environment, line 3048:  Called econf '--docdir=/usr/share/doc/util-linux-2.24.2' '--e                                          nable-fs-paths-extra=/usr/sbin:/bin:/usr/bin' '--libdir=${prefix}/lib64' '--enable-nls' '--enable-agetty' '--with-bashcompletion                                          dir=/usr/share/bash-completion/completions' '--enable-bash-completion' '--disable-setpriv' '--enable-cramfs' '--disable-cytune'                                           '--disable-fdformat' '--with-ncurses=auto' '--disable-kill' '--disable-login' '--disable-mesg' '--disable-nologin' '--enable-par                                          tx' '--with-python' '--enable-raw' '--enable-rename' '--disable-reset' '--enable-schedutils' '--disable-su' '--disable-wall' '--                                          disable-write' '--enable-makeinstall-chown' '--enable-makeinstall-setuid' '--without-selinux' '--without-slang' '--enable-static                                          ' '--with-udev'
 *   phase-helpers.sh, line  584:  Called die
 * The specific snippet of code:
 *                      die "econf failed"
 *
SYS_unshare
checking for unshare...  * If you need support, post the output of `emerge --info '=sys-apps/util-linux-2.24.2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/util-linux-2.24.2::gentoo'`.
/usr/lib64/portage/bin/isolated-functions.sh: line 195: wait: `econf failed': not a pid or valid job spec
 * The complete build log is located at '/var/tmp/portage/sys-apps/util-linux-2.24.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-apps/util-linux-2.24.2/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-apps/util-linux-2.24.2/work/util-linux-2.24.2-abi_x86_64.amd64'
 * S: '/var/tmp/portage/sys-apps/util-linux-2.24.2/work/util-linux-2.24.2'
Any tips?

Thanks,

EE
ADDENDUM: oh, util-linux-2.25 got masked in the repository because of a nasty bug. Anyway, your instructions aren't quite accurate: util-linux requires udev to be installed beforehand to compile, and actually just the command "emerge eudev" takes care of unmerging udev after eudev is already in place. So, that guide can be simplified somewhat. I'm emerging eudev now. I'll report back.
ADDENDUM2: emerging eudev seems to have worked fine, but lvm2 still needs -static or -udev to emerge, which means I'll have to go through with your guide this weekend. Wish me luck!
Back to top
View user's profile Send private message
saellaven
l33t
l33t


Joined: 23 Jul 2006
Posts: 646

PostPosted: Thu Aug 28, 2014 7:55 pm    Post subject: Reply with quote

ExecutorElassus wrote:

ADDENDUM2: emerging eudev seems to have worked fine, but lvm2 still needs -static or -udev to emerge, which means I'll have to go through with your guide this weekend. Wish me luck!


I'm not on unstable (though I selectively have a couple dozen unstable packages), so I'm not sure if what you're seeing is due to that

[ebuild R ] sys-fs/lvm2-2.02.109 USE="readline static static-libs thin udev (-clvm) (-cman) -device-mapper-only -lvm1 -lvm2create_initrd (-selinux) -systemd"

plus eudev-1.10

app-shells/bash: 4.2_p45
dev-java/java-config: 2.2.0
dev-lang/python: 2.7.7, 3.3.5-r1
dev-util/ccache: 3.1.9-r3
dev-util/cmake: 2.8.12.2-r1
dev-util/pkgconfig: 0.28-r1
sys-apps/baselayout: 2.2
sys-apps/openrc: 0.12.4
sys-apps/sandbox: 2.6-r1
sys-devel/autoconf: 2.13, 2.69
sys-devel/automake: 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils: 2.24-r3
sys-devel/gcc: 4.3.6-r1, 4.6.4, 4.8.2-r1, 4.9.1
sys-devel/gcc-config: 1.7.3
sys-devel/libtool: 2.4.2-r1
sys-devel/make: 3.82-r4
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc: 2.19-r1
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Fri Aug 29, 2014 9:57 am    Post subject: Reply with quote

actually, that USE requirement was added afaik to all lvm2 ebuilds due to changes in udev (see the bug report above). You may find that even stable packages now disallow static lvm with udev.

Anyway, more news in a couple days.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Sun Sep 14, 2014 12:08 pm    Post subject: Reply with quote

It seems there's a slight wrinkle in the initramfs-free setup you linked: I also have / on a partition managed by lvm (so far as I can tell; it's on RAID1, listed as /dev/md126 by 'mount'). According to your guide, that doesn't work, correct?

Am I incorrect? Or do I need to re-compile lvm2 with -static? If the latter, will the initramfs I have still work?

Thanks,

EE
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Sun Sep 14, 2014 1:46 pm    Post subject: Reply with quote

ExecutorElassus,

With root on a LVM volume you need an initrd containing lvm, since you need to start lvm from userspace before you can mount root to get at userspace.

It doesn't matter if lvm is built with USE=static or not as long as all the bits are in the initrd, it will still work.
Until recently, USE=static was preferred, but run lddtree on the binary will tell you the libs it needs. Add these to the initrd and you are good.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1435
Location: Berlin, Germany

PostPosted: Sun Sep 14, 2014 1:49 pm    Post subject: Reply with quote

Neddy! So good to hear from you! I always feel better seeing you in a thread, you're legit.

Cheers, mate. I'll just drop the static flag from lvm and proceed.

Thanks.

EE
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum