0

When I keep my Myservice.service file in /etc/systemd/system/Myservice.service. I get not-found error.

systemctl status Myservice
● Myservice.service
   Loaded: not-found (Reason: Unit Myservice.service not found.)
   Active: failed (Result: exit-code) since Thu 2020-08-27 11:04:58 EDT; 22min ago
 Main PID: 3539430 (code=exited, status=125)

But when I keep the same service file in /lib/systemd/system/Myservice.service. It works fine.

But why doesn't it work in the first scenario? why systemd not able to find file in first case. How can I debug this scenario with systemd.

red5pider
  • 351
  • 1
  • 9
  • 24

1 Answers1

2

I figured it out, In RHEL 8, My Myservice.service default selinux context is unconfined_u:object_r:admin_home_t:s0 under /etc/systemd/system/, I changed it to system_u:object_r:systemd_unit_file_t:s0. and That's it!

red5pider
  • 351
  • 1
  • 9
  • 24
  • For noobs like me: The command to do this is chcon system_u:object_r:systemd_unit_file_t:s0 [your-file] – Jan Aug 19 '22 at 06:09