Linux Service Won’t Start? 7 Ways to Diagnose and Fix It

A Linux service that refuses to start can take down a website, database, or background worker. The temptation is to run systemctl restart repeatedly, but a failed startup usually leaves clues you can inspect before changing anything.

This guide focuses on diagnosing a Linux service that won’t start, using systemd tools and practical examples. The commands apply to most modern distributions that use systemd, including Ubuntu, Debian, Fedora, and many VPS images.

1. Check the Service Status First

Start with the exact service name. For example, to investigate Nginx:

sudo systemctl status nginx.service --no-pager -l

Look for Active: failed, the exit status, recent error messages, and the ExecStart command. A status such as status=1/FAILURE confirms that a process exited unsuccessfully; it does not explain why.

If you’re unsure of the unit name, list failed units:

systemctl --failed

Avoid restarting a production service until you understand whether it is safe to interrupt existing requests or jobs.

2. Read the Logs for the Actual Error

Systemd’s journal often contains the most useful evidence:

sudo journalctl -u nginx.service -b -n 100 --no-pager

This displays recent entries for the service from the current boot. To examine logs around a particular incident, specify a time range:

sudo journalctl -u nginx.service --since "30 minutes ago" --no-pager

Search for messages such as permission denied, address already in use, no such file or directory, or a failed configuration test. Some applications also write their own logs, so check the application’s documented log location when the journal provides little detail.

Important: logs can contain secrets, access tokens, database URLs, or personal information. Redact them before sharing screenshots or asking for help.

3. Validate the Configuration Before Restarting

A single typo can prevent a service from starting. Many applications provide a safe configuration test. For Nginx:

sudo nginx -t

For SSH, the equivalent check is:

sudo sshd -t

The second command may use a distribution-specific executable path. These tests validate configuration syntax and some references, but they cannot guarantee the service will start successfully.

For a custom systemd unit, inspect its effective configuration:

systemctl cat myapp.service
systemctl show myapp.service -p ExecStart -p User -p WorkingDirectory

If you’ve edited a unit file or drop-in, run sudo systemctl daemon-reload so systemd reads the updated definition. This does not restart the service; you still need a deliberate start or restart after validating the change.

4. Check Whether Another Process Owns the Port

Web servers and application processes can fail when another program already listens on their configured port.

sudo ss -ltnp

To focus on port 80:

sudo ss -ltnp '( sport = :80 )'

Identify the process and confirm whether it is expected. For example, a second web server, a manually launched application, or an old instance may already own the port.

Do not kill the process just because it appears in the output. It may be serving another application. Resolve the conflict by correcting the service configuration, stopping the duplicate through its supervisor, or assigning an appropriate port.

For a more detailed introduction to graphical server administration, see Server Management GUI vs CLI.

5. Inspect Permissions, Paths, and Environment Files

Services frequently run under dedicated accounts rather than root. A command that works in your interactive shell may fail under systemd because the service user cannot read a file or enter a directory.

Check the configured account and paths:

systemctl show myapp.service -p User -p Group -p WorkingDirectory -p EnvironmentFiles
ls -ld /opt/myapp /opt/myapp/config

If the application reports a missing file, verify its absolute path. For permissions, check directory traversal as well as file access:

namei -l /opt/myapp/config/app.env

Only change ownership or permissions after confirming which account should have access. Avoid chmod 777 and broad recursive chown commands: they can expose secrets or break other services.

Also check EnvironmentFile= references in the unit. Missing required environment files, invalid variable values, or incorrect working directories can prevent startup. Be careful not to print secret values into shared logs.

6. Check Dependencies and System Resources

A service may be healthy on its own but unable to start because a dependency is unavailable. For instance, an application might require a database connection or a mounted data directory.

Inspect dependencies and recent failures:

systemctl list-dependencies myapp.service
systemctl --failed

Then check whether the server has sufficient resources:

free -h
df -h
df -i

A full filesystem, exhausted inodes, or memory pressure can interfere with startup. To check for processes killed by the kernel’s out-of-memory handler, inspect kernel logs:

sudo journalctl -k -b --no-pager | grep -i -E 'out of memory|oom-kill|killed process'

A lack of OOM messages does not rule out every memory-related problem. Use the service logs and application metrics together before drawing conclusions.

If storage is the issue, read our guide to managing a VPS without the command line for a broader view of server resources.

7. Apply One Fix, Then Start and Verify

Once you’ve identified a likely cause, make a targeted change and validate it. If the service is stopped, start it:

sudo systemctl start myapp.service

If it is running but needs to reload a supported configuration, a reload may be less disruptive than a restart:

sudo systemctl reload myapp.service

Not every service supports reload. Check its documentation and unit definition first. If a restart is necessary, plan for its impact:

sudo systemctl restart myapp.service
sudo systemctl status myapp.service --no-pager -l

A successful systemctl command is not the same as a healthy application. Confirm that the expected port is listening, inspect new log entries, and run an application-level health check where available. For a web service, that might mean requesting its health endpoint from an appropriate network location.

If systemd reports start-limit-hit after repeated failures, fix the underlying cause before considering sudo systemctl reset-failed myapp.service. Resetting the failed state does not repair a broken application.

Troubleshoot Linux Services Visually with Server Explorer

When you manage several VPS instances, switching between SSH sessions and memorizing commands can slow down routine investigation. Server Explorer provides a desktop interface for working with remote Linux servers over SSH.

Inspect Linux service status and manage systemd services directly from Server Explorer.

Its systemd service controls help you inspect and manage services, while the integrated terminal remains available for detailed systemctl and journalctl diagnostics. You can also use the process and port views to investigate potential conflicts and the server dashboard to check resource pressure.

The graphical interface makes common actions easier to access, but it does not replace application logs, systemd’s error messages, or Linux permissions. Use those sources to confirm the cause before making changes.

Investigate service startup failures using systemctl and journalctl in Server Explorer’s integrated terminal.

Quick Troubleshooting Checklist

SymptomFirst thing to check
status=1/FAILUREsystemctl status and journalctl -u
Address already in usess -ltnp and the configured port
Permission deniedService user, file ownership, and directory access
No such file or directoryExecStart, working directory, and referenced paths
Configuration parse errorApplication-specific config validation
Service exits under loadMemory, disk, inodes, and application logs
start-limit-hitRepeated failure cause before resetting state

Final Thoughts

When a Linux service won’t start, the fastest reliable approach is to read the failure, isolate the cause, and change one thing at a time. Begin with systemctl status and journalctl, then investigate configuration, port conflicts, permissions, dependencies, and resource limits.

Once the service starts, verify the application itself—not just its systemd status. That final check is what turns a successful restart into a confirmed recovery.

Server Explorer

Bring your servers into focus.

A desktop app for macOS and Windows. Connect over SSH.

Download

Leave a Reply

Your email address will not be published. Required fields are marked *