Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 105417 - lvm2 fails to compile on hardened system.
Summary: lvm2 fails to compile on hardened system.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Eric Edgar (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-09 12:45 UTC by Paul de Vrieze (RETIRED)
Modified: 2006-04-24 14:18 UTC (History)
3 users (show)

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


Attachments
The build log of lvm2 (lvm2.log,265.47 KB, text/plain)
2005-09-09 12:46 UTC, Paul de Vrieze (RETIRED)
Details
catalyst spec that reproduces the bug (livecd-stage1.spec,3.37 KB, text/plain)
2006-03-15 16:33 UTC, Matthias Langer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul de Vrieze (RETIRED) gentoo-dev 2005-09-09 12:45:42 UTC
lvm2-2.01.13 fails to compile statically with sys-fs/device-mapper-1.01.04.
Compiling things dynamically goes right. It seems to break on selinux code so I
assigned it to hardened. I've attached the build log.
Comment 1 Paul de Vrieze (RETIRED) gentoo-dev 2005-09-09 12:46:18 UTC
Created attachment 68058 [details]
The build log of lvm2
Comment 2 solar (RETIRED) gentoo-dev 2005-10-27 12:51:20 UTC
Can anybody else test this? I'm not a selinux user but building a normal
currently stable lvm2 works fine for me.

[ebuild   R   ] sys-fs/device-mapper-1.01.03  0 kB 
[ebuild   R   ] sys-fs/lvm2-2.01.09  -nolvmstatic +readline 0 kB 

I do see errors with the version you mentioned but they are logical that it 
would be that way. If this is the same error I'm failing to see how it relates 
to selinux.

i686-pc-linux-gnu-gcc -o lvm.static dumpconfig.o formats.o lvchange.o
lvconvert.o lvcreate.o lvdisplay.o lvextend.o lvmchange.o lvmcmdline.o
lvmdiskscan.o lvreduce.o lvremove.o lvrename.o lvresize.o lvscan.o polldaemon.o
pvchange.o pvcreate.o pvdisplay.o pvmove.o pvremove.o pvscan.o reporter.o
segtypes.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 lvm-static.o -static
-Wl,--export-dynamic -L../lib -L/usr/lib -llvm -ldevmapper \
        -lreadline -ldl -lncurses  -rdynamic
../lib/liblvm.a(sharedlib.o)(.text+0xfd): In function `load_shared_library':
: warning: Using 'dlopen' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o)(.text+0x25bd): In function
`rl_username_completion_function':
: warning: Using 'getpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(tilde.o)(.text+0x64e): In function `tilde_expand_word':
: warning: Using 'getpwnam' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(shell.o)(.text+0x1b1): In function `sh_get_home_dir':
: warning: Using 'getpwuid' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o)(.text+0x25b4): In function
`rl_username_completion_function':
: warning: Using 'setpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o)(.text+0x267a): In function
`rl_username_completion_function':
: warning: Using 'endpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
make[1]: Leaving directory `/var/tmp/portage/lvm2-2.01.13/work/LVM2.2.01.13/tools'
Comment 3 solar (RETIRED) gentoo-dev 2005-10-27 12:59:15 UTC
Yeah just read your log. This looks totally unrelated to selinux. 
The build is just faulty. dlopen cant be used in static apps (oxymoronic)

static linking and +readline cant be used together. 
Also the dlopen() thing should be not be in lib.a
Comment 4 petre rodan (RETIRED) gentoo-dev 2005-12-03 02:14:47 UTC
not selinux related, so reassigning to ebuild maintainer
Comment 5 Douglas Paul 2005-12-10 20:21:12 UTC
(In reply to comment #3)
> Yeah just read your log. This looks totally unrelated to selinux. 

Actually these were the lines from the log that caused the errors. The dlopen
stuff were just warnings. This seems related to selinux, but the problem is
still in the package.

/usr/lib/libdevmapper.a(libdm-common.o): In function `set_selinux_context':
libdm-common.c:(.text+0x5e0): multiple definition of `set_selinux_context'
../lib/liblvm.a(selinux.o):selinux.c:(.text+0x0): first defined here
/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/bin/ld:
Warning: size of symbol `set_selinux_context' changed from 353 in
../lib/liblvm.a(selinux.o) to 354 in /usr/lib/libdevmapper.a(libdm-common.o)
Comment 6 Stephen Fromm 2006-03-09 10:39:32 UTC
This problem still exists for me.  I tried building:

 * sys-fs/lvm2-2.01.09
 * sys-fs/lvm2-2.01.14-r1
 * sys-fs/lvm2-2.02.01

All three fail.  The first two die with a similar error:

/usr/lib/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
load_policy.c:(.text+0x93): undefined reference to `sepol_policy_kern_vers_max'
load_policy.c:(.text+0xf7): undefined reference to `sepol_policy_kern_vers_min'
load_policy.c:(.text+0x1b2): undefined reference to `sepol_policy_file_create'
load_policy.c:(.text+0x1c8): undefined reference to `sepol_policydb_create'
load_policy.c:(.text+0x1f2): undefined reference to `sepol_policy_file_set_mem'
load_policy.c:(.text+0x20a): undefined reference to `sepol_policydb_read'
load_policy.c:(.text+0x22a): undefined reference to `sepol_policydb_set_vers'
load_policy.c:(.text+0x258): undefined reference to `sepol_policydb_to_image'
load_policy.c:(.text+0x26d): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x27b): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x2ae): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x2bc): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x35e): undefined reference to `sepol_genbools'
load_policy.c:(.text+0x3e1): undefined reference to `sepol_genbools_array'
load_policy.c:(.text+0x47d): undefined reference to `sepol_genusers'
load_policy.c:(.text+0x4ba): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x4c8): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x4db): undefined reference to `sepol_policy_file_free'
collect2: ld returned 1 exit status

Please let me know if additional information is needed.
Comment 7 Tim Adamec 2006-03-11 18:54:59 UTC
I was having the same problems on an athlon-xp system, non-selinux.

I got a successful build by adding the following to /etc/package.use:

sys-fs/lvm2 -readline nolvmstatic
Comment 8 lotso 2006-03-14 09:27:07 UTC
I'm having the same problem on a hardened system as well. My Laptop which runs a non-hardened (use=hardened) compiles fine with +readline -nolvmstatic.

Doing as per Tim (Comment #7) worked fine.
Comment 9 Matthias Langer 2006-03-15 16:33:07 UTC
Created attachment 82245 [details]
catalyst spec that reproduces the bug

I've got a similar error when trying to build a live-cd with catalyst:

i386-pc-linux-gnu-gcc -o lvm archiver.o dumpconfig.o formats.o lvchange.o lvcreate.o lvdisplay.o lvextend.o lvmchange.o lvmcmdline.o lvmdiskscan.o lvreduce.o lvremove.o lvrename.o lvresize.o lvscan.o polldaemon.o pvchange.o pvcreate.o pvdisplay.o pvmove.o pvremove.o pvscan.o reporter.o segtypes.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 lvm.o -Wl,--export-dynamic -L../lib -L/usr/lib -llvm -ldevmapper -lreadline -ldl -lncurses  -rdynamic
i386-pc-linux-gnu-gcc -o lvm.static archiver.o dumpconfig.o formats.o lvchange.o lvcreate.o lvdisplay.o lvextend.o lvmchange.o lvmcmdline.o lvmdiskscan.o lvreduce.o lvremove.o lvrename.o lvresize.o lvscan.o polldaemon.o pvchange.o pvcreate.o pvdisplay.o pvmove.o pvremove.o pvscan.o reporter.o segtypes.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 lvm-static.o -static -Wl,--export-dynamic -L../lib -L/usr/lib -llvm -ldevmapper \
        -lreadline -ldl -lncurses  -rdynamic
/usr/lib/libdevmapper.a(pool.o): In function `_align_chunk':
pool.c:(.text+0x110): multiple definition of `_align_chunk'
../lib/liblvm.a(pool.o):pool.c:(.text+0x100): first defined here
/usr/lib/libdevmapper.a(pool.o): In function `_new_chunk':
pool.c:(.text+0x130): multiple definition of `_new_chunk'
../lib/liblvm.a(pool.o):pool.c:(.text+0x120): first defined here
/usr/lib/gcc/i386-pc-linux-gnu/3.4.5/../../../../i386-pc-linux-gnu/bin/ld: Warning: size of symbol `_new_chunk' changed from 172 in ../lib/liblvm.a(pool.o) to 175 in /usr/lib/libdevmapper.a(pool.o)
../lib/liblvm.a(sharedlib.o): In function `load_shared_library':
sharedlib.c:(.text+0x114): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o): In function `rl_username_completion_function':
complete.c:(.text+0x1ff1): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(tilde.o): In function `tilde_expand_word':
tilde.c:(.text+0x1f3): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(shell.o): In function `sh_get_home_dir':
shell.c:(.text+0x142): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o): In function `rl_username_completion_function':
complete.c:(.text+0x1fe3): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
complete.c:(.text+0x209c): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: ld returned 1 exit status
make[1]: *** [lvm.static] Error 1
make[1]: Leaving directory `/var/tmp/portage/lvm2-2.01.09/work/LVM2.2.01.09/tools'
make: *** [tools] Error 2

!!! ERROR: sys-fs/lvm2-2.01.09 failed.
Comment 10 Jesper Saxtorph 2006-03-19 08:32:48 UTC
(In reply to comment #0)
(In reply to comment #9)

I got a the same error messages as #9 in a new install.
The only difference is I compile with i686 where Matthias uses i383, this gives some different addresses in the output, put with that changed, a diff showed it is the same.

It is not a se system, just a plain 'standard' 2006.0 and gentoo-sources
I installed it as a pretty minimal system.
It should be used as a storage server so it is without any fuzz.

I have:
sys-fs/device-mapper-1.02.02
sys-fs/lvm2-2.01.09 -nolvmstatic +readline

The interesting thing is that I have exactly the same versions and useflags on my workstation and it is working without any problems and has done so for long time.
Maybe that is actually the important difference, my workstation has properbly been compiling lvm2 against some older version of other things.
On my workstation genlop gives me:
     Sat May  7 22:05:59 2005 >>> sys-fs/lvm2-2.01.09
       merge time: 2 minutes and 52 seconds.
so it is some time ago.

If there is any info needed or anything I can try out, just let me know.
Comment 11 Jesper Saxtorph 2006-03-19 08:55:14 UTC
Ok, I think I found the problem.

This is a duplicate of bug #120511 and as stated there:

------- Comment #12 From Michael Hampton  2006-03-18 06:33 PST  [reply] -------
The problem here is that if you install a fresh 2006.0 system without ~x86,
then device-mapper 1.02.02 and lvm2-2.01.09 will try to install, and they
aren't compatible with each other, as the commenters above pointed out. I'd
suggest the new device-mapper go into ~x86 or the new lvm come out...one or the
other, otherwise new installs using LVM (like mine) are going to break
horribly.
-------------------------------

The 'hack' solution I went for was as follows.
I new it all worked on my workstation and I could see that there the current lvm2 version was installed before the update to the current deveice-mapper.
So I did:
emerge -va =device-mapper-1.01.03 (earlier version on my workstation)
emerge -va lvm2
emerge -va device-mapper

This workes. It also fits with the problem description, since the moved parts is not moved to device-mapper-1.01.03 so the lvm2 install can perform with no conflicts. lvm2 has poperbly made the moved symbols private, so that is why the device-mapper can install cleanly afterwards.

I am new to this stuff, so should I do something to change the status of this bug?

Comment 12 Stephen Fromm 2006-03-20 16:24:31 UTC
(In reply to comment #11)

> The 'hack' solution I went for was as follows.
> I new it all worked on my workstation and I could see that there the current
> lvm2 version was installed before the update to the current deveice-mapper.
> So I did:
> emerge -va =device-mapper-1.01.03 (earlier version on my workstation)
> emerge -va lvm2
> emerge -va device-mapper

(I assume you are building lvm-2.01.09)

This did not work for me.  I downgraded device-mapper from 1.02.02 to 1.01.03 and then rebuilt lvm2.  It failed with the same error as described in my previous comment.

I can successfully build lvm-2.01.09 with device-mapper-1.02.02 if I do:

# USE=nolvmstatic emerge lvm2
Comment 13 Paul de Vrieze (RETIRED) gentoo-dev 2006-03-21 07:39:45 UTC
Guys, the issues that are in current lvm2 static compilation are not related to this bug. The bug in issue is specific to the usage of selinux.
Comment 14 Eric Edgar (RETIRED) gentoo-dev 2006-04-19 20:26:32 UTC
can you try lvm2-2.02.03 
Comment 15 Stephen Fromm 2006-04-20 14:33:11 UTC
I get similar results when compiling lvm2-2.02.03:

../lib/liblvm.a(sharedlib.o): In function `load_shared_library':
sharedlib.c:(.text+0x135): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o): In function `rl_username_completion_function':
complete.c:(.text+0x1dec): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(tilde.o): In function `tilde_expand_word':
tilde.c:(.text+0x4ce): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(shell.o): In function `sh_get_home_dir':
shell.c:(.text+0x133): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libreadline.a(complete.o): In function `rl_username_completion_function':
complete.c:(.text+0x1de7): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
complete.c:(.text+0x1e8d): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
load_policy.c:(.text+0x93): undefined reference to `sepol_policy_kern_vers_max'
load_policy.c:(.text+0xf7): undefined reference to `sepol_policy_kern_vers_min'
load_policy.c:(.text+0x1b2): undefined reference to `sepol_policy_file_create'
load_policy.c:(.text+0x1c8): undefined reference to `sepol_policydb_create'
load_policy.c:(.text+0x1f2): undefined reference to `sepol_policy_file_set_mem'
load_policy.c:(.text+0x20a): undefined reference to `sepol_policydb_read'
load_policy.c:(.text+0x22a): undefined reference to `sepol_policydb_set_vers'
load_policy.c:(.text+0x258): undefined reference to `sepol_policydb_to_image'
load_policy.c:(.text+0x26d): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x27b): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x2ae): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x2bc): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x35e): undefined reference to `sepol_genbools'
load_policy.c:(.text+0x3e1): undefined reference to `sepol_genbools_array'
load_policy.c:(.text+0x47d): undefined reference to `sepol_genusers'
load_policy.c:(.text+0x4ba): undefined reference to `sepol_policy_file_free'
load_policy.c:(.text+0x4c8): undefined reference to `sepol_policydb_free'
load_policy.c:(.text+0x4db): undefined reference to `sepol_policy_file_free'
collect2: ld returned 1 exit status
make[1]: *** [lvm.static] Error 1
make[1]: Leaving directory `/var/tmp/portage/lvm2-2.02.03/work/LVM2.2.02.03/tools'
make: *** [tools] Error 2


Here is the output from emerge --info:

Portage 2.0.54 (selinux/2005.1/x86, gcc-3.3.6, glibc-2.3.5-r3, 2.6.15-gentoo-r1 i686)
=================================================================
System uname: 2.6.15-gentoo-r1 i686 Intel(R) Xeon(TM) CPU 3.40GHz
Gentoo Base System version 1.6.14
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg distlocks sandbox selinux sfperms strict"
GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://mirror.datapipe.net/gentoo ftp://pandemonium.tiscali.de/pub/gentoo/ ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="apache2 bash-completion berkdb bzip2 crypt curl dba expat gd gdbm gnutls gpm ipv6 java jpeg lcms ldap libwww mailwrapper milter mime mmx mng ncurses nls nptl pam pcre perl png posix python readline sasl selinux snmp sockets sse ssl tcpd threads truetype udev unicode usb vhosts x86 xml xml2 zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LDFLAGS, LINGUAS
Comment 16 Eric Edgar (RETIRED) gentoo-dev 2006-04-21 13:02:40 UTC
is this still an issue with 2.02.04-r1?
Comment 17 Robert F Stockdale IV 2006-04-23 02:40:04 UTC
> lvm2-2.01.13 fails to compile statically with sys-fs/device-mapper-1.01.04.
> Compiling things dynamically goes right. It seems to break on selinux code so I
> assigned it to hardened. I've attached the build log.

(In reply to comment #0)
> lvm2-2.01.13 fails to compile statically with sys-fs/device-mapper-1.01.04.
> Compiling things dynamically goes right. It seems to break on selinux code so I
> assigned it to hardened. I've attached the build log.

(In reply to comment #12)
> (In reply to comment #11)
> 
> > The 'hack' solution I went for was as follows.
> > I new it all worked on my workstation and I could see that there the current
> > lvm2 version was installed before the update to the current deveice-mapper.
> > So I did:
> > emerge -va =device-mapper-1.01.03 (earlier version on my workstation)
> > emerge -va lvm2
> > emerge -va device-mapper
> 
> (I assume you are building lvm-2.01.09)
> 
> This did not work for me.  I downgraded device-mapper from 1.02.02 to 1.01.03
> and then rebuilt lvm2.  It failed with the same error as described in my
> previous comment.
> 
> I can successfully build lvm-2.01.09 with device-mapper-1.02.02 if I do:
> 
> # USE=nolvmstatic emerge lvm2
> 

This worked for me. Nice job. I've been trying for quite some time to get this compiled. I didn't even know that device-mapper was installed let alone part of the problem. Thanks
Comment 18 Eric Edgar (RETIRED) gentoo-dev 2006-04-24 11:10:42 UTC
again the question stands is this still and issue with 2.02.04-r1 or 2.02.05?  If I dont recieve a response I will assume that it is fixed and close this bug.
Comment 19 Stephen Fromm 2006-04-24 13:20:40 UTC
I can successfully build both lvm2-2.02.04-r1 and lvm2-2.02.05 without having to specify USE=nolvmstatic.  Thank you.
Comment 20 Eric Edgar (RETIRED) gentoo-dev 2006-04-24 14:18:24 UTC
this is fixed as of lvm2-2.02.04-r1 and lvm2-2.02.05