Service Won't Start
01
Check service status
bash
systemctl status service-name
The output shows if the service is active (running), failed, or inactive.
02
Read the service logs
bash
# Last 50 logs
journalctl -u service-name -n 50
# Real-time logs (useful to see what happens on restart)
journalctl -u service-name -f
# Logs from last system boot
journalctl -u service-name -b
03
Basic systemd commands
bash
# Start
systemctl start service-name
# Stop
systemctl stop service-name
# Restart
systemctl restart service-name
# Reload configuration without downtime
systemctl reload service-name
# Enable on automatic startup
systemctl enable service-name
# Disable automatic startup
systemctl disable service-name
04
Diagnosis for specific service
Nginx won't start
bash
# Test configuration
nginx -t
# See the specific error
journalctl -u nginx -n 20
Common causes:
Apache won't start
bash
apache2ctl configtest
journalctl -u apache2 -n 20
MySQL / MariaDB won't start
bash
journalctl -u mariadb -n 30
# or
cat /var/log/mysql/error.log | tail -30
Common causes:
To repair corrupted tables:
bash
mysqlcheck --all-databases --auto-repair -u root -p
PHP-FPM won't start
bash
journalctl -u php8.2-fpm -n 20
php-fpm8.2 --test
- Syntax error in configuration file
- Port 80 or 443 already used by another process
- SSL certificate file missing or expired
- Disk full (MySQL can't write)
- Database corruption (after a crash)
- Wrong configuration in /etc/mysql/
05
Port already in use
Often a service won't start because its port is already in use:
bash
# Who uses port 80?
ss -tlnp | grep :80
# or
lsof -i :80
bash
# Kill the process using the port
kill -9 PID
06
Service crashes in loop
If a service keeps crashing, systemd puts it in "failed" state after a while:
bash
# Reset failure counter
systemctl reset-failed service-name
# Then restart
systemctl start service-name
07
Services in failed state
bash
# List all services in error
systemctl --failed
08
Permission problem
Sometimes a service won't start because it doesn't have permissions on its files:
bash
# Check file owner (example for nginx)
ls -la /var/www/example.com/
ls -la /etc/nginx/
# Fix permissions
chown -R www-data:www-data /var/www/example.com/
chmod -R 755 /var/www/example.com/
Gerelateerde artikelen
Common Issues
Locked Out of VPS
Complete guide to recover server access when locked out, with step-by-step instructions from VNC Console
5 min lezen
Common Issues
Server Unreachable
What to do when server is not responding or you can't connect via SSH
3 min lezen
Common Issues
Website Not Reachable
What to do when website is not responding, shows errors, or is unreachable
3 min lezen
