Red Hat Bugzilla – Bug 189489
Can't install kernels in a chroot with Selinux enabled
Last modified: 2007-11-30 17:07:24 EST
1. Boot a RHEL4 U3 CD in rescue mode
2. chroot to the real system:
3. Try to install a newer kernel:
error: %pre(kernel-2.6.9-34.EL.i686) scriptlet failed, exit status 255
error: install: %pre scriptlet failed (2), skipping kernel-2.6.9-34.EL
The stack trace shows that it can't access the /selinux files:
452 getppid() = 451
452 open("/proc/self/attr/current", O_RDONLY) = 22
452 read(22, "user_u:system_r:unconfined_t\0", 4095) = 29
452 close(22) = 0
452 getxattr("/bin/sh", "security.selinux", "system_u:object_r:shell_exec_t",
255) = 31
452 open("/selinux/create", O_RDWR) = -1 ENOENT (No such file or directory)
452 exit_group(-1) = ?
451 <... futex resumed> ) = -1 EINTR (Interrupted system call)
451 --- SIGCHLD (Child exited) @ 0 (0) ---
Created attachment 128039 [details]
You'll need to mount /selinux inside the chroot manually, or add it to some script.
How do you mount /selinux? rc.sysinit doesn't do it, the mkinitrd doesn't seem
to either, and /selinux doesn't appear in the mount output.
Also, the rescue disk gives some instructions on how to access the full system
after starting up. From anaconda:
_("Your system has been mounted under %s.\n\n"
"Press <return> to get a shell. If you would like to "
"make your system the root environment, run the command:\n\n"
"\tchroot %s\n\nThe system will reboot "
"automatically when you exit from the shell.") %
Maybe anaconda should mount /selinux under both the real root, and the "would
The mount is done by init with the call
#define SELINUXMNT "/selinux/"
mount("none", SELINUXMNT, "selinuxfs", 0, 0)
In resuce mode outside chroot can you make sure /selinux is mounted? Then
inside the chroot is there any way you could mount by hand or run a simple
program with that line?
Created attachment 130869 [details]
anaconda patch to bind mount /selinux into /mnt/sysimage
Untested, but I think this will do it. I'm going to go try by hand to
recreate this. I don't have the slightest clue how to test this patch
By hand in rescue running /mnt/sysimage/sbin/mount --bind /selinux
/mnt/sysimage/selinux and then chrooting seemed to be happy. Jeremy, does this
seem like something you are willing to take into anaconda?
reassigning to jeremy.
Seems to make sense, although probably just doing a regular mount of /selinux
instead of a bind mount (no need to bind mount it really)
Chris -- can you get this into HEAD and give the cvs revs and then ensure it
gets pulled in for 4.5?
HEAD already has:
# and /selinux too
if flags.selinux and os.path.isdir("%s/selinux" %(anaconda.rootPath,)):
isys.mount("/selinux", "%s/selinux" %(anaconda.rootPath,),
except Exception, e:
log.error("error mounting selinuxfs: %s" %(e,))
This was committed to revision 1.63 of rescue.py. I'll track this for the next
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Can you drop to a shell, umount /mnt/sysimage/selinux, and then mount -o bind -t
selinuxfs /mnt/sysimage/selinux. Does that show things in /selinux when you chroot?
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.