Tuesday, August 22, 2023

SELinux and Custom Systemd .service Files



I had a custom systemd .service file I was trying to add and have it run at boot time. Unfortuniately it kept bitching at me about "Failed to start readpartition.service: Unit readpartition.service not found.". After looking around the Interwebs I found the below page by Craig Earley. The girth of it was to run this command so SELinux will allow it as a service.

sudo chcon system_u:object_r:systemd_unit_file_t:s0 <name of service>.service

This command is useless if you aren't running a SELinux enabled Linux Distro. But it works like magic if you are.

For a more in depth look at the problem and it's solutions visit Craig's page:
https://craigearley.com/2020/05/15/how-to-enable-a-systemctl-service-unit-without-disabling-selinux/

Thank You, Craig Earley!