File size: 4,006 Bytes
279efce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Analyze Journal Errors

You are helping the user parse systemd journal logs to identify recent errors and issues.

## Task

1. **Check recent errors from current boot:**
   ```bash
   # Errors from current boot
   journalctl -b -p err

   # Errors and warnings
   journalctl -b -p warning

   # Critical and alert level messages
   journalctl -b -p crit
   ```

2. **Show errors from specific time periods:**
   ```bash
   # Last hour
   journalctl --since "1 hour ago" -p err

   # Last 24 hours
   journalctl --since "24 hours ago" -p err

   # Specific date range
   journalctl --since "2025-10-25" --until "2025-10-26" -p err

   # Last 100 error entries
   journalctl -p err -n 100
   ```

3. **Group errors by service/unit:**
   ```bash
   # List units with failures
   systemctl --failed

   # Errors from specific service
   journalctl -u SERVICE_NAME -p err

   # Common problematic services
   journalctl -u NetworkManager -p err
   journalctl -u systemd-resolved -p err
   journalctl -u bluetooth -p err
   ```

4. **Analyze error frequency:**
   ```bash
   # Count errors by message
   journalctl -b -p err --no-pager | grep -oP '(?<=: ).*' | sort | uniq -c | sort -rn | head -20

   # Errors per unit
   journalctl -b -p err --no-pager | grep -oP '\w+\.service' | sort | uniq -c | sort -rn
   ```

5. **Check for kernel errors:**
   ```bash
   # Kernel errors
   journalctl -k -p err

   # Segfaults
   journalctl | grep -i "segfault"

   # OOM killer events
   journalctl | grep -i "killed process"
   ```

6. **Find patterns and recurring issues:**
   ```bash
   # I/O errors
   journalctl -b | grep -i "i/o error"

   # Disk errors
   journalctl -b | grep -i "ata.*error"

   # Network errors
   journalctl -b | grep -i "network.*error\|dhcp.*fail"

   # GPU/graphics errors
   journalctl -b | grep -i "amdgpu\|drm.*error"
   ```

7. **Export error summary:**
   ```bash
   # Save errors to file for analysis
   journalctl -b -p err --no-pager > /tmp/system-errors-$(date +%Y%m%d).log

   # Create error report
   cat > /tmp/error-report.txt << EOF
   System Error Report - $(date)
   ======================================

   Failed Services:
   $(systemctl --failed --no-pager)

   Recent Errors (last 24h):
   $(journalctl --since "24 hours ago" -p err --no-pager | tail -50)

   Error Summary by Service:
   $(journalctl -b -p err --no-pager | grep -oP '\w+\.service' | sort | uniq -c | sort -rn)
   EOF

   cat /tmp/error-report.txt
   ```

## Present Summary to User

Provide:
- Number of errors found in timeframe
- Most frequent error messages
- Services/units with errors
- Critical vs warning vs error breakdown
- Any patterns (disk, network, GPU issues)
- Recommended actions for common errors

## Common Error Patterns & Solutions

**NetworkManager errors:**
- DHCP timeout: Check network cable/WiFi
- DNS resolution: Check /etc/resolv.conf

**Bluetooth errors:**
- Adapter reset: `sudo systemctl restart bluetooth`
- Firmware missing: Check `dmesg | grep -i bluetooth`

**Disk errors:**
- I/O errors: Run SMART checks with `/check-disk-errors`
- Filesystem errors: May need `fsck`

**GPU errors:**
- AMDGPU: Check ROCm installation and kernel modules
- DRM errors: May indicate driver issues

**systemd-resolved errors:**
- DNSSEC validation failures: Common with some ISPs
- Fallback DNS: Configure in `/etc/systemd/resolved.conf`

## Additional Analysis

If requested:
- Compare error frequency over different boots: `journalctl --list-boots`
- Check correlation with specific events (updates, configuration changes)
- Identify error spikes: `journalctl -b -p err --output=short-monotonic`
- Export for external analysis: `journalctl -b -p err -o json`

## Notes

- Priority levels: 0=emerg, 1=alert, 2=crit, 3=err, 4=warning, 5=notice, 6=info, 7=debug
- Use `--no-pager` for scripting and piping
- Journal size can be checked with: `journalctl --disk-usage`
- Persistent journal: stored in `/var/log/journal/`
- Consider rotating old logs: `journalctl --vacuum-time=30d`