CodexBloom - Programming Q&A Platform

Arch Linux - Systemd Service scenarios to Start with 'scenarios to start service: Connection refused' scenarios

👀 Views: 73 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-08
linux systemd node.js JavaScript

I've encountered a strange issue with I'm relatively new to this, so bear with me. I'm stuck on something that should probably be simple. I'm currently setting up a custom systemd service on Arch Linux to run a Node.js application, but I'm running into issues where the service won't start. The service file located at `/etc/systemd/system/my-node-app.service` is as follows: ```ini [Unit] Description=My Node.js App After=network.target [Service] ExecStart=/usr/bin/node /home/user/my-node-app/app.js WorkingDirectory=/home/user/my-node-app Restart=always User=user Environment=NODE_ENV=production [Install] WantedBy=multi-user.target ``` When I run `sudo systemctl start my-node-app`, I receive the following behavior: ``` Failed to start my-node-app.service: Connection refused ``` I have tried enabling the service with `sudo systemctl enable my-node-app` and checking the status with `sudo systemctl status my-node-app`, but it doesn't provide much detail other than showing the same behavior. I've also looked at the logs using `journalctl -u my-node-app` and it shows: ``` -- Logs begin at Mon 2023-10-16 10:00:00 UTC, end at Mon 2023-10-16 10:30:00 UTC. -- Oct 16 10:15:00 hostname systemd[1]: my-node-app.service: Service hold-off time over, scheduling restart. Oct 16 10:15:00 hostname systemd[1]: my-node-app.service: Start request repeated too quickly. Oct 16 10:15:00 hostname systemd[1]: Failed to start My Node.js App. ``` I've confirmed that Node.js is installed and accessible, and the path in `ExecStart` is correct. I also verified that my Node.js application runs without issues using `node /home/user/my-node-app/app.js` directly from the terminal. Any insights on what could be causing this "Connection refused" behavior would be greatly appreciated. This is for a microservice running on Ubuntu 22.04. Thanks for taking the time to read this! This issue appeared after updating to Javascript latest.