1

I recently changed my hostname, and after rebooting with the new hostname, /etc/issue stopped getting displayed on the login screen. I disabled selinux temporarily, and /etc/issue was displayed again. After re-enabling selinux, /etc/issue once again stopped displaying. Can anyone tell me what's going on and how to fix it?

Thanks.

1 Answer 1

2

Well, the easiest way is disabling SELinux, which I don't recommend, though:

setenforce 0

Or you can create a rule to allow it to write, run or whatever it needs to do and is being blocked so far. To do so, check your system log file and copy the line that is "denied", it should be something like this:

audit(...): avc:  denied  { write } for  pid=27984 comm="hostname" name="hostname" dev=sda6 ino=307469 scontext=root:system_r:system_r:s0 tcontext=system_u:object_r:usr_t:s0 tclass=...

Copy it and run the following command:

audit2allow -M local << _EOF_
(paste the content)
_EOF_

Then, run:

semodule -i local.pp

That will create a permanent rule for it so you shouldn't need to disable SELinux. Even if you have more than one denied line, you can paste all of them at once and audit2allow will generate as many rules as you need in your local.pp file.

2
  • This way actually prevents from having the AVC denied, however, it doesn't answer the question "why did the file get a bad context?". First : ls -lZ /etc/issue and check in audit log for exact AVC message. Then change the file context using restorecon or chcon to match the expected SELinux context.
    – tonioc
    Nov 3, 2015 at 13:45
  • I like your answer, but I know very little about SELinux. What is -lZ?
    – the_rover
    Nov 3, 2015 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .