Skip to main content

Common Linux VPS Issues

This guide helps you diagnose and resolve the most common issues on a Linux VPS.

Unable to Connect to VPS

Check if VPS is Online

From the YorkHost panel, verify that the VPS is started.

Test Connectivity

# Ping from your machine
ping YOUR_IP

# If ping fails, the VPS might be off or network is blocked

SSH Problem

# Test SSH connection with verbose
ssh -v root@YOUR_IP

# If custom port
ssh -v -p 2222 root@YOUR_IP

"Connection refused" error:

  • SSH service is not running
  • SSH port is different from 22
  • Firewall is blocking the port

"Connection timed out" error:

  • VPS is off
  • Firewall is blocking all traffic
  • Network issue

Recovery via VNC Console

If SSH doesn't work, use the VNC console from the panel:

# Check SSH status
systemctl status sshd

# Restart SSH
systemctl restart sshd

# Check firewall
ufw status

Slow or Unresponsive Server

Check System Load

# Overview
top

# Or more readable
htop

# Load average
uptime

The "load average" indicates the number of processes waiting:

  • < 1.0: OK
  • 1.0 - 2.0: High load
  • 2.0: Overload

Identify Resource-Heavy Processes

# Top 10 by CPU
ps aux --sort=-%cpu | head -10

# Top 10 by RAM
ps aux --sort=-%mem | head -10

Check RAM

free -h

Example:

              total        used        free      shared  buff/cache   available
Mem: 3.8Gi 2.1Gi 200Mi 100Mi 1.5Gi 1.4Gi
  • available: Actually available RAM (includes releasable cache)

If RAM is saturated:

# Identify the culprit
ps aux --sort=-%mem | head -5

# Kill a process (last resort)
kill -9 PID

Check Swap

swapon --show
free -h

If swap is heavily used, the system lacks RAM.

Disk Full

Check Disk Space

df -h

Example:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1 50G 48G 2.0G 96% /
Warning

A 100% full disk can prevent the system from booting and cause data corruption.

Find Large Files

# Largest directories
du -h --max-depth=1 / | sort -hr | head -20

# Files larger than 100MB
find / -type f -size +100M 2>/dev/null

# Large logs
du -h /var/log/ | sort -hr | head -10

Clean Up Space

# Clean unused apt packages
sudo apt autoremove -y
sudo apt clean

# Clean old kernels
sudo apt autoremove --purge

# Clean logs (carefully)
sudo journalctl --vacuum-time=7d
sudo find /var/log -name "*.gz" -delete
sudo find /var/log -name "*.1" -delete

# Clean Docker (if used)
docker system prune -af

See the Disk Space Management guide for more details.

Services Won't Start

Check Status

systemctl status service_name

Possible states:

  • active (running): OK
  • inactive (dead): Stopped
  • failed: Error at startup

View Error Logs

# Service logs
journalctl -u service_name -n 50

# Real-time logs
journalctl -u service_name -f

Common Issues

Port already in use:

# Find who's using a port
sudo ss -tlnp | grep :80
sudo lsof -i :80

Invalid configuration file:

# Test Nginx config
sudo nginx -t

# Test Apache config
sudo apachectl configtest

Incorrect permissions:

# Check owner
ls -la /path/to/file

# Fix permissions
sudo chown www-data:www-data /var/www/html -R
sudo chmod 755 /var/www/html -R

Network Issues

Check Network Configuration

# Network interfaces
ip addr

# Routing table
ip route

# DNS
cat /etc/resolv.conf

Test DNS Resolution

# Test DNS
nslookup google.com
dig google.com

If DNS doesn't work:

# Configure temporary DNS
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

Test Outgoing Connectivity

# Test HTTP
curl -I https://google.com

# Test with IP (no DNS)
curl -I http://142.250.179.110

Firewall Issues

Check UFW

sudo ufw status verbose

Commonly Forgotten Rules

# SSH (default or custom port)
sudo ufw allow 22/tcp
sudo ufw allow 2222/tcp

# Web
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# FiveM
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp

Reset Firewall

# Temporarily disable
sudo ufw disable

# Reset all rules
sudo ufw reset

# Reconfigure
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw enable

Database Inaccessible

MySQL/MariaDB

# Status
systemctl status mysql
systemctl status mariadb

# Logs
tail -50 /var/log/mysql/error.log

# Test connection
mysql -u root -p

"Too many connections" error:

SHOW PROCESSLIST;
-- Kill inactive connections
KILL CONNECTION_ID;

"Can't connect to MySQL server" error:

# Check MySQL is listening
ss -tlnp | grep 3306

# Restart
sudo systemctl restart mysql

Cron Not Executing

Check Cron Logs

grep CRON /var/log/syslog | tail -20

Common Issues

Missing absolute path:

# Bad
* * * * * script.sh

# Good
* * * * * /usr/local/bin/script.sh

Environment variables:

# Add at top of crontab
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Script permissions:

chmod +x /path/to/script.sh

Useful Diagnostic Commands

# System information
uname -a
lsb_release -a

# Processes
top / htop
ps aux

# Memory
free -h
vmstat 1 5

# Disk
df -h
du -h --max-depth=1 /

# Network
ss -tlnp
ip addr
ping / traceroute

# Logs
journalctl -xe
tail -f /var/log/syslog
dmesg | tail
Tip

In case of serious problems, restart the VPS from the YorkHost panel. If the issue persists, contact support with the diagnostic information.