Skip to contentSkip to conversation

2.6.0-test6 boot process failures

DISCUSSION Tom 4 participants 11 messages Oct 7, 2003 – Oct 8, 2003 SELinux security module

lore
Share & tools
lore

Tom

author
#0 lore raw

I have a few weird dynamic linker "libselinux.so not found" errors during bootup, even though libselinux.so is on the initrd image, the policy loads correctly and everything seems to work fine.

The only thing I can think about is that libselinux.so is in /usr/lib and that is on a seperate partition, (/usr is).

Is it possible - I'm not familiar with the details of the boot process
- that somewhere inbetween it loses access to the initrd /usr/lib but before it has mounted all the other partitions?

If so - how do I work around this?

Btw: Russel, I tried to mail you directly, but your mailserver doesn't like my dialup-IP: Collin already made a script and that works just fine. I tried replacing it with yours and that broke my initrd, but that may as well have been my mistake. Well, at least it's not drop-in-be-happy - should I do more testing? Tell me what to do, boot details are beyond me.

Signature · 8 lines
http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 10 lines · Tom

I have a few weird dynamic linker "libselinux.so not found" errors during bootup, even though libselinux.so is on the initrd image, the policy loads correctly and everything seems to work fine.

The only thing I can think about is that libselinux.so is in /usr/lib and that is on a seperate partition, (/usr is).

Is it possible - I'm not familiar with the details of the boot process
- that somewhere inbetween it loses access to the initrd /usr/lib but before it has mounted all the other partitions?

Actually a Gentoo user reported this to me a couple days ago. Yeah, its because /usr/ is a separate partition. I'm not familiar with the debian initrd-tools, but I would assume that it pivot_root's at the end of the initrd script, and then it does an exec /sbin/init. After the pivot_root, /usr/lib doesnt point to the initrd, since root is not the real root, not the initrd root. And since your /usr is a separate partition, if something thats linked against libselinux.so is used before /usr is mounted, you get that error.

BTW, You don't need the libraries on the initrd, because load_policy is a static executable.

For Gentoo, I used the attached patch on libselinux to make it install to /lib.

On a side note, I noticed that all of the coreutils programs were mysteriously linked against libselinux for some reason (as reported by ldd). I don't know yet why this is happening. Is this happening to other people's systems?

Signature · 7 lines
Chris PeBenito
<[email protected]>
Developer, SELinux
Hardened Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243
src/Makefile +1 -1
diff -urN libselinux-1.2.orig/src/Makefile libselinux-1.2/src/Makefile
@@ -1,5 +1,5 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
+PREFIX ?= $(DESTDIR)/
 LIBDIR ?= $(PREFIX)/lib
 
 LIBVERSION = 1
#2 lore raw
Quoted 8 lines · Chris PeBenito
Quoted 3 lines

Is it possible - I'm not familiar with the details of the boot process
- that somewhere inbetween it loses access to the initrd /usr/lib but before it has mounted all the other partitions?

Actually a Gentoo user reported this to me a couple days ago. Yeah, its because /usr/ is a separate partition. I'm not familiar with the debian initrd-tools, but I would assume that it pivot_root's at the end of the initrd script, and then it does an exec /sbin/init. After the

Yes, this is a bug, and your analysis is correct.

Programs in /sbin or /bin must NEVER be linked against shared objects in /usr/lib . As /bin/ps, /bin/ls, and /lib/security/pam_selinux.so are linked against libselinux.so, libselinux.so should go into /lib.

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#3 lore raw
Quoted 5 lines · Russell Coker

Yes, this is a bug, and your analysis is correct.

Programs in /sbin or /bin must NEVER be linked against shared objects in /usr/lib . As /bin/ps, /bin/ls, and /lib/security/pam_selinux.so are linked against libselinux.so, libselinux.so should go into /lib.

I moved libselinux.so to /lib and all my boot problems have gone poof.

Therefore, I second that libselinux.so should go into /lib

Signature · 8 lines
http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#4 lore raw
In reply to Russell Coker
Quoted 5 lines · Russell Coker

Yes, this is a bug, and your analysis is correct.

Programs in /sbin or /bin must NEVER be linked against shared objects in /usr/lib . As /bin/ps, /bin/ls, and /lib/security/pam_selinux.so are linked against libselinux.so, libselinux.so should go into /lib.

Ok, I'll adjust the upstream Makefile accordingly, but Dan will need to update the RPM spec file.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito

On a side note, I noticed that all of the coreutils programs were mysteriously linked against libselinux for some reason (as reported by ldd). I don't know yet why this is happening. Is this happening to other people's systems?

Sorry, why is this surprising given the coreutils selinux patch? Or do you mean that even coreutils programs that aren't patched for SELinux are also showing up with dependencies on libselinux? The coreutil-selinux.patch does add -lselinux to the LDADD line in the Makefile.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#6 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Chris PeBenito

On a side note, I noticed that all of the coreutils programs were mysteriously linked against libselinux for some reason (as reported by ldd). I don't know yet why this is happening. Is this happening to other people's systems?

Sorry, why is this surprising given the coreutils selinux patch? Or do you mean that even coreutils programs that aren't patched for SELinux are also showing up with dependencies on libselinux? The coreutil-selinux.patch does add -lselinux to the LDADD line in the Makefile.

Every single binary. Even the ones that aren't patched, such as uname and yes. See the attached ldd outputs. This happens on both my x86 and PPC.

Signature · 12 lines
Chris PeBenito
<[email protected]>
Developer, SELinux
Hardened Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#7 lore raw
Quoted 2 lines · Chris PeBenito

and yes. See the attached ldd outputs. This happens on both my x86 and PPC.

Hmm, it would help if I actually attached it.

Signature · 7 lines
Chris PeBenito
<[email protected]>
Developer, SELinux
Hardened Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243
#8 lore raw
In reply to Tom
Quoted 5 lines · Tom

Collin already made a script and that works just
fine. I tried replacing it with yours and that broke my initrd, but that may as well have been my mistake. Well, at least it's not drop-in-be-happy - should I do more testing? Tell me what to do, boot details are beyond me.

I'm not really surprised that my script didn't work - I had never tested it and you don't expect untested code to work.

Where's Colin's script?

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#9 lore raw
Quoted 4 lines · Russell Coker

I'm not really surprised that my script didn't work - I had never tested it and you don't expect untested code to work.

Where's Colin's script?

It's in his selinux-policy-default package. Here's the script:

#!/bin/sh -e
# Install binary policy file and load_policy utility for loading it. test -n "$INITRDDIR"
mkdir -p "$INITRDDIR"/selinux
mkdir -p "$INITRDDIR"/etc/security/selinux
mkdir -p "$INITRDDIR"/scripts
cp -a /etc/security/selinux/policy.15 "$INITRDDIR/etc/security/selinux/policy.15" cp -a /usr/sbin/load_policy "$INITRDDIR/bin/load_policy"
cp -a /usr/share/selinux/initrd-script "$INITRDDIR/scripts/selinux"

Signature · 8 lines
http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#10 lore raw
Quoted 3 lines · Tom
Quoted 1 line

Where's Colin's script?

It's in his selinux-policy-default package. Here's the script:

OK, I've just released a new version of my selinux-policy-default package with this. I have made a few changes, the noteworthy change is that I check for the policy version, so the same script will work for the old SE Linux (apart from trying to mount /selinux which I forgot), the new SE Linux, and future releases.

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.