First, make sure acpid.service
is actually being started during boot. After the host has rebooted, use this command to verify that:
# systemctl status acpid.service
It should say started
and enabled
. If it doesn't, then systemctl enable acpid.service
might solve the problem for you, by actually starting the service on reboot.
Second, if the service is actually starting during boot, then check the logs to see if there is something wrong with it. You should already see some lines from the logs in the systemctl status
output, then you can get more logs from that service using:
# journalctl -u acpid.service
You can also look at all the logs since the last reboot, with:
# journalctl -b
This might show other issues that can be related to the issue you're experiencing.
If it turns out acpid.service
is actually starting during boot and screen rotation is not working before it's restarted, it's quite possible that it's being started too early in the boot process and that's what's causing it to misbehave until it gets restarted. Hopefully, if that's the case, the logs might provide you more details to allow you to fix that.
(Please post updates if you find something through this suggested troubleshooting, I'd be happy to give more pointers if you can be more specific about the symptoms you see.)
Finally, using cron to manage systemd services will most likely not really work as expected.
If you do want to force the service to restart sometime after booting, using a systemd timer unit is a better approach. You can either disable the service on boot and use a timer unit to actually start it once the system has been up for a while, or you can keep it enabled on boot and use a timer unit to trigger a separate service unit (restart-acpid.service
, perhaps?) which uses Type=oneshot
and executes the /usr/bin/systemctl restart acpid.service
command (or the wrapper script which does essentially the same.)
However, that is pretty hacky. So I'd recommend you actually try to address the real problem by finding the root cause, rather than investing into such a clunky workaround for it.