Bug 1243168 - Entire system mislabelled on fresh Rawhide install
Summary: Entire system mislabelled on fresh Rawhide install
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: lorax
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: AcceptedBlocker
Depends On:
Blocks: F23AlphaBlocker
TreeView+ depends on / blocked
 
Reported: 2015-07-14 23:08 UTC by Adam Williamson
Modified: 2016-05-03 07:52 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-07-31 20:21:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1219045 0 unspecified CLOSED changes to is_selinux_enabled() renders machines unbootable which never had selinux installed or active 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1332147 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 1219045 1332147

Description Adam Williamson 2015-07-14 23:08:15 UTC
On recent install tests I've noticed that I couldn't log in to the installed system as root without booting with 'enforcing=0'.

It seems like, post-install, large swathes of the system are mislabelled. Running "restorecon -nvr / | wc -l" after a minimal install reports 25675 - i.e. 25675 files are mislabelled.

Proposing as an Alpha blocker: this is a violation of "A system installed without a graphical package set must boot to a state where it is possible to log in through at least one of the default virtual consoles." - https://fedoraproject.org/wiki/Fedora_23_Alpha_Release_Criteria#Expected_installed_system_boot_behavior - as you can't log in to a minimal install without setting SELinux to permissive.

Comment 1 Adam Williamson 2015-07-14 23:08:44 UTC
Sorry, I should specify, this is after a boot.iso install.

Comment 2 Adam Williamson 2015-07-14 23:17:11 UTC
bcl says anaconda didn't change anything, so CCing mgrepl and dwalsh.

Comment 3 Adam Williamson 2015-07-15 00:36:59 UTC
So, this is another consequence of the change in libselinux 2.3-10:

"- is_selinux_enabled: Add /etc/selinux/config test (#1219045)"

That is, in response to https://bugzilla.redhat.com/show_bug.cgi?id=1219045 , is_selinux_enabled() was changed to only succeed if /etc/selinux/config existed. It does not exist in the anaconda environment, so in the anaconda environment is_selinux_enabled() fails.

This (I don't know precisely how and I'm not digging into the dnf/rpm/libselinux interactions to find out :>) results in default contexts not being set for anything, it seems.

I built a libselinux with that change reverted and applied it as an updates.img, and the installed system was no longer completely mislabelled (a few files still are mislabelled - some kernel files in /boot and /usr/lib/modules , and some stuff in /tmp and /sys that would get recreated on boot anyway).

So to fix this either libselinux needs to change is_selinux_enabled() yet again somehow, or we need to add a /etc/selinux/config to the anaconda environment.

Comment 4 Adam Williamson 2015-07-15 00:42:40 UTC
/etc/selinux/config is part of the selinux-policy package and lorax dumps that in runtime-cleanup.tmpl:

removepkg checkpolicy selinux-policy libselinux-utils

so to keep /etc/selinux/config in the anaconda env we'd have to tweak that. re-assigning to lorax for now, if we decide it's libselinux that should change we can re-assign again.

Comment 5 Jan Kurik 2015-07-15 13:16:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 6 Petr Lautrbach 2015-07-16 11:50:15 UTC
From the point of view of libselinux, SELinux is enabled when a system runs with SELinux enabled kernel. There used to be a check if a policy is loaded but it was considered as a hack and it caused some deadlocks in X.org.

There's another bug [1] assigned to anaconda where it's suggested to copy /etc/selinux/config file from a ramdisk to a filesystem as soon as possible. 

The check of existence of /etc/selinux/config is just a fix to suppress regressions on misconfigured systems with SELinux enabled kernel but without any SELinux policy.


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1229788

Comment 7 Adam Williamson 2015-07-16 14:56:01 UTC
The bug report you mention is basically irrelevant in this case because the issue here is not /etc/selinux/config missing in the *installed system root*, but it mssing from the *installer environment*. That's why the result in F23 is much worse than in F22.

Comment 8 Petr Schindler 2015-07-20 17:06:41 UTC
Discussed at today's blocker review meeting [1].

This bug was accepted as Alpha blocker - This bug is a clear violation of the following criteria: "A system installed without a graphical package set must boot to a state where it is possible to log in through at least one of the default virtual consoles."

[1] http://meetbot.fedoraproject.org/fedora-blocker-review/2015-07-20/

Comment 9 Miroslav Grepl 2015-07-21 06:38:49 UTC
(In reply to Adam Williamson from comment #7)
> The bug report you mention is basically irrelevant in this case because the
> issue here is not /etc/selinux/config missing in the *installed system
> root*, but it mssing from the *installer environment*. That's why the result
> in F23 is much worse than in F22.

Not sure if I understand correctly. 

The problem is with

removepkg checkpolicy selinux-policy libselinux-utils

which means /ect/selinuc/config is missing.

Comment 10 Adam Williamson 2015-07-21 06:47:38 UTC
Yes, that's what's happening in F23.

The other bug you refer to is for F22, and what happens there is different. The F22 installer environment doesn't have /etc/selinux/config either - but it also doesn't have the updated libselinux, so for processes running in the context of the installer environment, SELinux is considered 'active'. The installed system root, however, *does* get the updated libselinux (if the update repos are available). It seems like some or all scriptlets run in the context of the installed system, so it's files created by scriptlets that get mislabelled, for those packages installed after libselinux but before selinux-policy. That's how I read it, anyway.

There's already a fix posted for this: https://lists.fedorahosted.org/pipermail/anaconda-patches/2015-July/021371.html

Comment 11 Adam Williamson 2015-07-31 20:21:11 UTC
This was fixed by lorax-23.14-1.fc23 .


Note You need to log in before you can comment on or make changes to this bug.