I repurposed a Windows laptop as a small home server and installed CachyOS with GNOME because it may still be used as a normal laptop later. My first service is a Foundry VTT server running through Node.js. Port forwarding, SSH key access, and a systemd service are already configured. The service is enabled and uses Restart=on-failure, but after reboot the machine stops at the graphical login screen and eventually goes to sleep. The service works once I log in locally. What is the proper way to make it start and remain available after reboot? Would automatic login be sufficient, or can I keep the graphical session locked while preventing sleep?
3 Answers
Login and sleep are separate problems. Configure GNOME's power settings so the machine never suspends while plugged in, and make sure the relevant sleep settings are disabled for the server's use case. You do not need to automatically log in just to run a correctly configured system service, and leaving the machine at the login screen is generally safer than starting an unlocked desktop session.
For a home machine that is normally left logged in, automatic login would probably make the setup work, but it is more of a convenience workaround than the ideal solution. If you use it, set the session to lock immediately or shortly after login and still disable automatic suspend. Another option is to run Foundry in a Docker or Podman container, which can be configured to restart automatically and keeps the application environment isolated.
First check whether the service is actually running after reboot by connecting over SSH and using systemctl status and journalctl -u your-service-name. A normal system-level systemd service does not need anyone logged into the graphical desktop. If it is a user-level service, though, it normally stops when that user has no session. You can either move it to /etc/systemd/system as a system service, or enable lingering for the account with loginctl enable-linger username so its user services can run without an interactive login.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures