When managing a virtual machine (VM) in Linux, you may encounter various types of errors that necessitate checking the logs in the /var/log
directory, particularly the syslog
file and other relevant logs. Here are common types of errors you might face and where to find them:
1. System Errors
Kernel Errors
- Log File:
/var/log/kern.log
(Debian/Ubuntu),dmesg
- Common Errors:
- Kernel panics
- Hardware failures
- Device errors
Boot Errors
- Log File:
/var/log/boot.log
- Common Errors:
- Boot failures
- Missing dependencies
- Service startup failures
2. Authentication and Authorization Errors
Authentication Errors
- Log File:
/var/log/auth.log
(Debian/Ubuntu),/var/log/secure
(CentOS/RHEL) - Common Errors:
- Failed login attempts
- SSH login issues
- PAM (Pluggable Authentication Modules) errors
Authorization Errors
- Log File:
/var/log/auth.log
,/var/log/secure
- Common Errors:
- Sudo command failures
- Insufficient permissions
3. Application Errors
Web Server Errors
- Log File:
/var/log/apache2/error.log
(Apache),/var/log/nginx/error.log
(Nginx) - Common Errors:
- 404 Not Found
- 500 Internal Server Error
- Misconfigured virtual hosts
- SSL/TLS errors
Database Errors
- Log File:
/var/log/mysql/error.log
(MySQL),/var/log/postgresql/postgresql-<version>-main.log
(PostgreSQL) - Common Errors:
- Connection failures
- Query errors
- Permission issues
4. Network Errors
Network Connectivity Errors
- Log File:
/var/log/syslog
,/var/log/messages
- Common Errors:
- Network interface failures
- DNS resolution issues
- Firewall blocking
5. Disk and Filesystem Errors
Disk Errors
- Log File:
/var/log/syslog
,/var/log/messages
- Common Errors:
- Disk I/O errors
- Disk full errors
- Filesystem corruption
6. Service and Daemon Errors
Service Failures
- Log File:
/var/log/syslog
,/var/log/messages
- Common Errors:
- Service startup failures
- Service crashes
- Configuration errors
7. Security and Access Errors
Security Breaches
- Log File:
/var/log/auth.log
,/var/log/secure
- Common Errors:
- Unauthorized access attempts
- Intrusion detection alerts
8. Performance Issues
Performance Degradation
- Log File:
/var/log/syslog
,/var/log/messages
- Common Errors:
- High CPU usage
- High memory usage
- Slow disk I/O
9. Cron Job Errors
Cron Job Failures
- Log File:
/var/log/syslog
,/var/log/cron.log
(if configured) - Common Errors:
- Job execution failures
- Permission issues
10. Hardware Errors
Hardware Failures
- Log File:
/var/log/kern.log
,dmesg
- Common Errors:
- CPU errors
- Memory errors
- Device failures
Checking the Logs
Using less
- View the log file:
less /var/log/syslog
Using grep
- Search for specific errors:
grep "error" /var/log/syslog
Using tail
- Follow the log file in real-time:
tail -f /var/log/syslog
Examples of Log Entries for Common Errors
Kernel Error Example
- Log File:
/var/log/kern.log
Jan 8 12:34:56 hostname kernel: [123456.789012] EXT4-fs error (device sda1): ext4_find_entry:1309: inode #524289: comm apache2: reading directory lblock 0
Authentication Error Example
- Log File:
/var/log/auth.log
Jan 8 12:34:56 hostname sshd[1234]: Failed password for invalid user root from 192.168.1.100 port 22 ssh2
Web Server Error Example
- Log File:
/var/log/apache2/error.log
[Tue Jan 08 12:34:56.789012 2022] [core:error] [pid 1234] [client 192.168.1.100:12345] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
Disk Error Example
- Log File:
/var/log/syslog
Jan 8 12:34:56 hostname kernel: [123456.789012] Buffer I/O error on dev sda1, logical block 0, async page read