Issue with algod daemon not starting after reboot

Hi everyone, getting the following error after reboot. Any help in solving this issue will be good.

Thanks in advance.

Oct 3 14:44:01 ip-172-31-85-21 algod[1979]: unexpected failure in establishing algod.lock: open /var/lib/algorand/algod.lock: permission denied
Oct 3 14:44:01 ip-172-31-85-21 systemd[1]: algorand.service: Main process exited, code=exited, status=1/FAILURE

Oct 3 14:44:01 ip-172-31-85-21 systemd[1]: algorand.service: Failed with result ‘exit-code’.
Oct 3 14:44:06 ip-172-31-85-21 systemd[1]: algorand.service: Service hold-off time over, scheduling restart.
Oct 3 14:44:06 ip-172-31-85-21 systemd[1]: algorand.service: Scheduled restart job, restart counter is at 30.
Oct 3 14:44:06 ip-172-31-85-21 systemd[1]: Stopped Algorand daemon.
Oct 3 14:44:06 ip-172-31-85-21 systemd[1]: Started Algorand daemon.

Who owns /var/lib/algorand? is there a algod.lock owned by someone else in the way?
ls -ld /var/lib/algorand /var/lib/algorand/algod.lock

Right. I changed it to ubuntu user so that I can access the files inside. How do I change the daemon to run with ubuntu user instead of algorand user?

Check out /lib/systemd/system/algorand@.service.

if you’ll edit the file, you should be able to modify the account with which the algod is invoked.

Note that if you do that, you’ll need to follow up with
sudo systemctl daemon-reload
as well as restarting the service.

alternatively, just restore the owner of the above directories.