CentOS 9 - changing SELinux disabled to permissive

Issues related to applications and software problems and general support
Post Reply
kathyl1721
Posts: 6
Joined: 2023/11/21 14:05:26

CentOS 9 - changing SELinux disabled to permissive

Post by kathyl1721 » 2024/02/20 17:50:40

As the title says, we have a Centos 9 Stream device where SELinux is set to disabled. We want it to be permissive. In /etc/selinux/config I changed the line to permissive - SELINUX=permissive. Then I ran

Code: Select all

grubby --update-kernel ALL --remove-args selinux
and reboot. After reboot I issue a sestatus and it still says it is disabled. I also tried fixfiles -F onboot but that did not work. What am I doing incorrectly?

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 9 - changing SELinux disabled to permissive

Post by TrevorH » 2024/02/20 18:35:46

Is /etc/sysconfig/selinux a symlink to ../selinux/config ? It should be.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

kathyl1721
Posts: 6
Joined: 2023/11/21 14:05:26

Re: CentOS 9 - changing SELinux disabled to permissive

Post by kathyl1721 » 2024/02/20 19:16:23

Yes it is.

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: CentOS 9 - changing SELinux disabled to permissive

Post by lightman47 » 2024/02/20 20:16:02

Throwing this out here:

I use "sudo getenforce" to find out the current status, and "sudo setenforce (enforcing|permissive|disabled) to change the default.

kathyl1721
Posts: 6
Joined: 2023/11/21 14:05:26

Re: CentOS 9 - changing SELinux disabled to permissive

Post by kathyl1721 » 2024/02/21 17:54:12

I've done that also, but always get the response that SElinux is disabled.

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: CentOS 9 - changing SELinux disabled to permissive

Post by lightman47 » 2024/02/21 17:58:07

What's set in /etc/selinux/config?

User avatar
jlehtone
Posts: 4532
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 9 - changing SELinux disabled to permissive

Post by jlehtone » 2024/02/21 20:31:12

lightman47 wrote:
2024/02/20 20:16:02
... "sudo setenforce (enforcing|permissive|disabled)" to change the default.
AFAIK, the 'setenforce' does merely change current running status; not update config that is used on next boot.

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 9 - changing SELinux disabled to permissive

Post by TrevorH » 2024/02/21 23:40:13

Show the full contents of /etc/selinux/config and of /proc/cmdline, also the output from `uname -a`
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

kathyl1721
Posts: 6
Joined: 2023/11/21 14:05:26

Re: CentOS 9 - changing SELinux disabled to permissive

Post by kathyl1721 » 2024/02/28 12:17:49

Sorry for the delay. After I change selinux to permissive, /etc/selinux/config looks like this:

SELINUX=permissive
SELINUXTYPE=targeted


uname -a:

5.14.0-419.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 7 23:01:41 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

/proc/cmdline:

BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-419.el9.x86_64 root=/dev/mapper/hostname-root ro crashkernel=1G-4G:192M,4G-64G:265M,64G-:512 resume=/dev/mapper/hostname-swap rd.lvm.lv=hostname-root rd.lvm.lv=hostname/swap

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 9 - changing SELinux disabled to permissive

Post by TrevorH » 2024/02/28 12:33:00

How about the output from `rpm -Va \*selinux\*`

Otherwise I would suggest reading your logs, probably either /var/log/messages or /var/log/secure to see if there are any selinux related errors at boot time.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply