Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 473502 - <sys-libs/libselinux-2.1.13-r4: Building SELinux policy fails with missing file_contexts.local
Summary: <sys-libs/libselinux-2.1.13-r4: Building SELinux policy fails with missing fi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL:
Whiteboard: selinux-utils
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-16 15:36 UTC by Sven Vermeulen (RETIRED)
Modified: 2013-08-22 16:29 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Vermeulen (RETIRED) gentoo-dev 2013-06-16 15:36:58 UTC
After a fresh installation, a policy rebuild failed. When trying to load a new policy, the following error occurred:

"""
>>> Completed installing selinux-base-policy-2.20130424-r1 into /var/tmp/portage/sec-policy/selinux-base-policy-2.20130424-r1/image/

 [32;01m*[0m Inserting the following modules, with base, into the strict module store: application authlogin bootloader clock consoletype cron dmesg fstools getty hostname hotplug init iptables libraries locallogin logging lvm miscfiles modutils mount mta netutils nscd portage raid rsync selinuxutil ssh staff storage su sysadm sysnetwork udev userdomain usermanage unprivuser xdg
Error opening /etc/selinux/strict/contexts/files/file_contexts.local: No such file or directory
libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/strict/contexts/files/file_contexts.local
libsemanage.semanage_install_active: Could not copy /etc/selinux/strict/modules/active/policy.kern to /etc/selinux/strict/policy/policy.26. (No such file or directory).
semodule:  Failed!
"""

A "touch /etc/selinux/strict/contexts/files/file_contexts.local" seemed to resolve the issue.
Comment 1 Lari Korpi 2013-06-18 10:50:11 UTC
I get the same effect.

Portage 2.1.12.2 (hardened/linux/amd64/selinux, gcc-4.6.3, glibc-2.15-r3, 3.8.6-hardened x86_64)
=================================================================
System uname: Linux-3.8.6-hardened-x86_64-AMD_A8-5600K_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
KiB Mem:    16323684 total,   3867076 free
KiB Swap:   83886072 total,  83886072 free
Timestamp of tree: Tue, 18 Jun 2013 05:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="..."
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="..."
USE="aio alsa amd64 berkdb bzip2 caps cli cracklib crypt cxx dri gdbm gpm hardened iconv ipv6 justify logrotate lvm mmx modules mudflap multilib ncurses nls nptl open_perms opengl openmp pam parted pax_kernel pcre pdo peer_perms qemu readline selinux session sse sse2 ssl tcpd threads tor-hardening ubac unicode urandom vhost-net virt-network xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Lari Korpi 2013-06-18 10:51:34 UTC
I also see the following:
libsepol.print_missing_requirements: apache's global requirements were not met: type/attribute gds_db_port_t (No such file or directory).
libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).
Comment 3 Sven Vermeulen (RETIRED) gentoo-dev 2013-07-28 11:24:30 UTC
Fix now in tree with libselinux-2.1.13-r4, also moved ebuild to python-r1.

The gds_db_port_t one is a different bug, not related to the file_contexts.local.
Comment 4 Amadeusz Sławiński 2013-08-10 17:57:45 UTC
Doesn't seem fixed for me

 * Inserting the following modules, with base, into the strict module store: application authlogin bootloader clock consoletype cron dmesg fstools getty hostname hotplug init iptables libraries locallogin logging lvm miscfiles modutils mount mta netutils nscd portage raid rsync selinuxutil setrans ssh staff storage su sysadm sysnetwork udev userdomain usermanage unprivuser xdg
Error opening /etc/selinux/strict/contexts/files/file_contexts.local: No such file or directory
libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/strict/contexts/files/file_contexts.local
libsemanage.semanage_install_active: Could not copy /etc/selinux/strict/modules/active/policy.kern to /etc/selinux/strict/policy/policy.28. (No such file or directory).
semodule:  Failed!

[ebuild   R    ] sys-libs/libselinux-2.1.13-r4  USE="(python) static-libs -ruby" PYTHON_TARGETS="python2_7 python3_2 (-python3_1)" RUBY_TARGETS="ruby18 ruby19" 0 kB
Comment 5 Amadeusz Sławiński 2013-08-10 18:07:59 UTC
ok, this is weird, I reemerged libselinux and this time selinux-base-policy installed without problem
Comment 6 Amadeusz Sławiński 2013-08-10 18:17:42 UTC
sorry for the noise, anyway I think the directory doesn't exist so file can't be created on fresh installs

ie libselinux is merged by "emerge -1 checkpolicy policycoreutils"
it tries to create file but it can't because there s no such place

then "FEATURES="-selinux" emerge selinux-base-policy" merges selinux-base which creates needed directories

# equery b /etc/selinux/strict/contexts/files/
 * Searching for /etc/selinux/strict/contexts/files/ ... 
sec-policy/selinux-base-9999 (/etc/selinux/strict/contexts/files)

that's why it fails on fresh install
Comment 7 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-10 19:35:09 UTC
Okay, I added in an mkdir -p in libselinux.

This is however stupid. A better fix would be to not mess with all this compilation stuff - really, for the 0.3sec improvement it gives, it gives me a lot of work :-P
Comment 8 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 16:29:55 UTC
Now stable in tree