Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionWelterlen Benoit
2023-01-30 10:06:43 UTC
Description of problem:
When trying to use the option AUTORELABEL=0 in /etc/selinux/config to enter a shell a manually fix labels, it fails with
---
Jan 27 15:35:30 localhost selinux-autorelabel[765]: *** Warning -- SELinux mls policy relabel is required.
Jan 27 15:35:30 localhost selinux-autorelabel[765]: *** /etc/selinux/config indicates you want to manually fix labeling
Jan 27 15:35:30 localhost selinux-autorelabel[765]: *** problems. Dropping you to a shell; the system will reboot
Jan 27 15:35:30 localhost selinux-autorelabel[765]: *** when you leave the shell.
Jan 27 15:35:30 localhost selinux-autorelabel[770]: sulogin: tcgetattr failed: Inappropriate ioctl for device
---
Version-Release number of selected component (if applicable):
RHEL9
selinux-policy-mls-34.1.29-1.el9_0.2.noarch
policycoreutils-3.3-6.el9_0.x86_64
# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: mls
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: denied
Memory protection checking: actual (secure)
Max kernel policy version: 33
How reproducible:
always
Steps to Reproduce:
1. put AUTORELABEL=0 in /etc/selinux/config
2. reboot
3.
Actual results:
sulogin: tcgetattr failed: Inappropriate ioctl for device
Expected results:
access to shell without error
Additional info:
selinux-autorelabel.service needs StandardInput=tty for this particular case. tty was dropped from the service back in 2019 as part of the fix for https://bugzilla.redhat.com/show_bug.cgi?id=1634661 so we can't simply bring it back. But it's possible to use tty conditionally based on AUTORELABEL variable:
~~~
diff --git a/selinux-autorelabel-generator.sh b/selinux-autorelabel-generator.sh
index be6048766dcc..d9380b8be75b 100644
--- a/selinux-autorelabel-generator.sh
+++ b/selinux-autorelabel-generator.sh
@@ -18,6 +18,15 @@ fi
set_target ()
{
ln -sf "$unitdir/selinux-autorelabel.target" "$earlydir/default.target"
+ AUTORELABEL="1"
+ source /etc/selinux/config
+ if [ "$AUTORELABEL" = "0" ]; then
+ mkdir -p "$earlydir/selinux-autorelabel.service.d"
+ cat > "$earlydir/selinux-autorelabel.service.d/tty.conf" <<EOF
+[Service]
+StandardInput=tty
+EOF
+ fi
}
if selinuxenabled; then
~~~
Rawhide and centosstream 9 testing builds are available at https://copr.fedorainfracloud.org/coprs/plautrba/autorelabel0/
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (policycoreutils bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2023:2561