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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
UBUNTU LINUX ADVANCED TROUBLESHOOTING SCENARIOS
|
| 2 |
+
Generated: Thu Feb 26 06:10:09 MST 2026
|
| 3 |
+
Total scenarios: 30000
|
| 4 |
+
Features: Dynamic difficulty, system state tracking, progressive degradation
|
| 5 |
+
<h>
|
| 6 |
+
π PROBLEM:
|
| 7 |
+
System is running slowly and needs investigation. Users report intermittent failures.
|
| 8 |
+
|
| 9 |
+
π» SYSTEM CONTEXT:
|
| 10 |
+
β’ OS: Ubuntu 22.04.1 LTS (Jammy Jellyfish)
|
| 11 |
+
β’ Kernel: 5.15.0-56-generic
|
| 12 |
+
β’ Hostname: staging-139-169-41prod
|
| 13 |
+
β’ User: deploy
|
| 14 |
+
β’ Uptime: 9 days, 13:00
|
| 15 |
+
β’ Load average: 0.64, 2.98, 0.60
|
| 16 |
+
β οΈ ERROR MESSAGE:
|
| 17 |
+
High load average and application timeouts
|
| 18 |
+
|
| 19 |
+
π AVAILABLE COMMANDS:
|
| 20 |
+
|
| 21 |
+
1. kill -9 1
|
| 22 |
+
β Kill init/systemd process
|
| 23 |
+
|
| 24 |
+
2. top -b -n 1
|
| 25 |
+
β Check running processes and resource usage
|
| 26 |
+
|
| 27 |
+
3. echo 3 > /proc/sys/vm/drop_caches
|
| 28 |
+
β Drop filesystem caches
|
| 29 |
+
|
| 30 |
+
4. reboot
|
| 31 |
+
β Restart the system (drastic)
|
| 32 |
+
|
| 33 |
+
β Which command would you run to troubleshoot this issue?
|
| 34 |
+
<eot>
|
| 35 |
+
<b>deploy@staging-139-169-41prod:~$ top -b -n 1
|
| 36 |
+
|
| 37 |
+
<eot><h>π€ COMMAND OUTPUT:
|
| 38 |
+
|
| 39 |
+
top - 06:10:09 up 9 day, 5 users, load average: 0.64, 2.98, 0.60
|
| 40 |
+
Tasks: 20 total, 2 running, 18 sleeping, 0 stopped, 0 zombie
|
| 41 |
+
%Cpu(s): 6.4 us, 14.9 sy, 0.0 ni, 73.7 id, 3.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
| 42 |
+
MiB Mem : 5 total, 2 free, 2 used, 1 buff/cache
|
| 43 |
+
MiB Swap: 3 total, 3 free, 0 used. 2 avail Mem
|
| 44 |
+
|
| 45 |
+
PID USER PR NI VIRT RES SHR S %%CPU %%MEM TIME+ COMMAND
|
| 46 |
+
1006 root 20 0 634 88 88 S 9.9 2.8 937:28 /usr/sbin/postgresql
|
| 47 |
+
1013 root 20 0 218 90 90 S 8.4 0.6 478:53 /usr/sbin/php8.2-fpm
|
| 48 |
+
1001 root 20 0 144 79 79 S 8.2 2.3 1065:54 /usr/sbin/ufw
|
| 49 |
+
1002 root 20 0 412 63 63 S 8.1 3.2 820:56 /usr/sbin/ssh
|
| 50 |
+
1008 mysql 20 0 113 83 83 S 7.5 3.8 425:04 /usr/sbin/mysql
|
| 51 |
+
1003 root 20 0 216 70 70 S 7.3 3.1 1304:37 /usr/sbin/php8.1-fpm
|
| 52 |
+
1010 root 20 0 434 86 86 S 7.3 0.4 1132:19 /usr/sbin/samba
|
| 53 |
+
678 root 20 0 551 78 78 S 7.0 0.4 986:15 /lib/systemd/systemd-udevd
|
| 54 |
+
1005 root 20 0 644 42 42 S 6.9 4.6 1430:15 /usr/sbin/snapd
|
| 55 |
+
892 systemd+ 20 0 268 78 78 S 6.5 2.7 8:21 /lib/systemd/systemd-timesyncd
|
| 56 |
+
<eot><b>π Root cause: Multiple factors could cause slow performance: high CPU, memory pressure, I/O wait, or network issues.
|
| 57 |
+
π§ Resolution: Use standard Linux troubleshooting tools to identify the bottleneck: top, iostat, vmstat, netstat.
|
| 58 |
+
β
Verification: Identify the root cause and resolve accordingly.
|
| 59 |
+
|
| 60 |
+
π System state evolving...
|
| 61 |
+
<eot>
|
| 62 |
+
<h>
|
| 63 |
+
π PROBLEM:
|
| 64 |
+
Nginx fails to start with error 'Address already in use' on port 80. Apache was previously installed but should have been removed.
|
| 65 |
+
|
| 66 |
+
π» SYSTEM CONTEXT:
|
| 67 |
+
β’ OS: Ubuntu 20.04.5 LTS (Focal Fossa)
|
| 68 |
+
β’ Kernel: 5.4.0-135-generic
|
| 69 |
+
β’ Hostname: ip-237-151-2prod
|
| 70 |
+
β’ User: dev1
|
| 71 |
+
β’ Uptime: 7 days, 21:00
|
| 72 |
+
β’ Load average: 2.85, 0.62, 0.53
|
| 73 |
+
β οΈ ERROR MESSAGE:
|
| 74 |
+
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
|
| 75 |
+
|
| 76 |
+
π AVAILABLE COMMANDS:
|
| 77 |
+
|
| 78 |
+
1. ss -tulpn | grep :80
|
| 79 |
+
β Find which process is using port 80
|
| 80 |
+
|
| 81 |
+
2. systemctl status nginx
|
| 82 |
+
β Check nginx status
|
| 83 |
+
|
| 84 |
+
3. journalctl -u nginx
|
| 85 |
+
β Check nginx logs
|
| 86 |
+
|
| 87 |
+
4. systemctl restart nginx
|
| 88 |
+
β Restart nginx (will likely fail again)
|
| 89 |
+
|
| 90 |
+
β Which command would you run to troubleshoot this issue?
|
| 91 |
+
<eot>
|
| 92 |
+
<b>dev1@ip-237-151-2prod:~$ ss -tulpn | grep :80
|
| 93 |
+
|
| 94 |
+
<eot><h>π€ COMMAND OUTPUT:
|
| 95 |
+
|
| 96 |
+
tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("apache2",pid=1234,fd=4))
|
| 97 |
+
<eot><b>π Root cause: Another process (likely Apache) is still listening on port 80, preventing nginx from binding.
|
| 98 |
+
π§ Resolution: Find the process using port 80: sudo ss -tulpn | grep :80. Stop the conflicting service: sudo systemctl stop apache2. Then start nginx.
|
| 99 |
+
β
Verification: Start nginx and verify it's listening on port 80 with 'ss -tulpn | grep :80'.
|
| 100 |
+
|
| 101 |
+
π Recommended next steps:
|
| 102 |
+
β’ systemctl stop apache2
|
| 103 |
+
β’ systemctl start nginx
|
| 104 |
+
|
| 105 |
+
π System state evolving...
|
| 106 |
+
<eot>
|
| 107 |
+
<h>
|
| 108 |
+
π PROBLEM:
|
| 109 |
+
Server load average is 1.6, 3.2, 2.3 and CPU temperature is unusually high at 51.2Β°C. Users report extreme sluggishness.
|
| 110 |
+
|
| 111 |
+
π» SYSTEM CONTEXT:
|
| 112 |
+
β’ OS: Ubuntu 23.10 (Mantic Minotaur)
|
| 113 |
+
β’ Kernel: 6.5.0-14-generic
|
| 114 |
+
β’ Hostname: db-94-5-224dev
|
| 115 |
+
β’ User: admin
|
| 116 |
+
β’ Uptime: 20 days, 22:00
|
| 117 |
+
β’ Load average: 1.60, 3.15, 2.25
|
| 118 |
+
β οΈ ERROR MESSAGE:
|
| 119 |
+
High CPU usage alert from monitoring (99% CPU)
|
| 120 |
+
|
| 121 |
+
π AVAILABLE COMMANDS:
|
| 122 |
+
|
| 123 |
+
1. renice -n 19 -p 9217
|
| 124 |
+
β Lower process priority
|
| 125 |
+
|
| 126 |
+
2. killall -9 crypto-miner
|
| 127 |
+
β Force kill processes by name
|
| 128 |
+
|
| 129 |
+
3. ps aux --sort=-%cpu | head -5
|
| 130 |
+
β Find the most CPU-intensive process
|
| 131 |
+
|
| 132 |
+
4. systemctl isolate multi-user.target
|
| 133 |
+
β Change runlevel
|
| 134 |
+
|
| 135 |
+
β Which command would you run to troubleshoot this issue?
|
| 136 |
+
<eot>
|
| 137 |
+
<b>admin@db-94-5-224dev:~$ ps aux --sort=-%cpu | head -5
|
| 138 |
+
|
| 139 |
+
<eot><h>π€ COMMAND OUTPUT:
|
| 140 |
+
|
| 141 |
+
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
|
| 142 |
+
ubuntu 9371 99.5 3.5 285 10 ? Ss 0:47 /tmp/.crypto-miner
|
| 143 |
+
root 1012 9.8 1.5 760 84 ? Ss 0:11 /usr/sbin/cron
|
| 144 |
+
root 678 9.7 3.3 456 59 ? Ss 0:50 /lib/systemd/systemd-udevd
|
| 145 |
+
root 523 9.7 1.3 438 55 ? Ss 0:20 /lib/systemd/systemd-journald
|
| 146 |
+
root 1001 9.6 0.3 967 44 ? Ss 0:53 /usr/sbin/apache2
|
| 147 |
+
root 1004 8.9 0.1 877 94 ? Sl 0:19 /usr/sbin/bind9
|
| 148 |
+
root 1016 8.2 0.3 719 61 ? Ss 0:32 /usr/sbin/gitlab-runner
|
| 149 |
+
root 1000 7.9 2.2 377 34 ? Sl 0:57 /usr/sbin/memcached
|
| 150 |
+
root 1015 7.8 0.1 566 23 ? Ss 0:10 /usr/sbin/redis-server
|
| 151 |
+
root 1005 7.5 3.3 907 65 ? Ss 0:23 /usr/sbin/rabbitmq-server
|
| 152 |
+
root 1014 7.1 2.5 484 91 ? Ss 0:55 /usr/sbin/rsyslog
|
| 153 |
+
root 1013 5.9 4.7 363 29 ? Ss 0:49 /usr/sbin/nginx
|
| 154 |
+
systemd+ 892 5.3 0.4 222 52 ? Sl 0:05 /lib/systemd/systemd-timesyncd
|
| 155 |
+
root 1017 5.0 4.9 506 54 ? Ss 0:25 /usr/sbin/php8.2-fpm
|
| 156 |
+
mysql 1008 4.6 3.9 769 63 ? Ss 0:21 /usr/sbin/mysql
|
| 157 |
+
root 1002 4.1 3.2 282 27 ? Sl 0:59 /usr/sbin/ufw
|
| 158 |
+
root 1007 4.0 3.2 620 62 ? Sl 0:52 /usr/sbin/elasticsearch
|
| 159 |
+
root 1010 3.4 4.1 315 43 ? Sl 0:46 /usr/sbin/samba
|
| 160 |
+
root 1006 3.1 2.4 318 29 ? Ss 0:32 /usr/sbin/postgresql
|
| 161 |
+
root 1011 2.4 4.1 718 63 ? Ss 0:23 /usr/sbin/network-manager
|
| 162 |
+
root 2 2.4 2.1 651 48 ? Sl 0:10 [kthreadd]
|
| 163 |
+
root 1003 2.4 0.8 164 27 ? Sl 0:05 /usr/sbin/ssh
|
| 164 |
+
root 1009 1.3 1.6 110 45 ? Ss 0:20 /usr/sbin/prometheus
|
| 165 |
+
root 1 1.0 1.6 401 48 ? Sl 0:47 /sbin/init
|
| 166 |
+
root 3 0.0 4.7 514 49 ? Ss 0:04 [ksoftirqd/0]
|
| 167 |
+
<eot><b>π Root cause: A crypto-miner process is consuming 99% CPU. Likely installed through compromised application or vulnerability.
|
| 168 |
+
π§ Resolution: Terminate the process: kill -9 [PID]. Investigate how it was installed and remove the binary. Check for unauthorized access in auth.log.
|
| 169 |
+
β
Verification: Run 'top' or 'ps aux' to confirm the process is gone. Monitor for reappearance.
|
| 170 |
+
|
| 171 |
+
π Recommended next steps:
|
| 172 |
+
β’ kill -9 [PID]
|
| 173 |
+
β’ rm -rf /tmp/.crypto-*
|
| 174 |
+
β’ grep -r 'miner' /var/log/auth.log
|
| 175 |
+
|
| 176 |
+
π System state evolving...
|
| 177 |
+
<eot>
|
| 178 |
+
<h>
|
| 179 |
+
π PROBLEM:
|
| 180 |
+
User 'web' needs to install a package but gets 'Permission denied' when running apt install. They need to set up a new service.
|
| 181 |
+
|
| 182 |
+
π» SYSTEM CONTEXT:
|
| 183 |
+
β’ OS: Ubuntu 23.04 (Lunar Lobster)
|
| 184 |
+
β’ Kernel: 6.2.0-39-generic
|
| 185 |
+
β’ Hostname: app-134-184-151dev
|
| 186 |
+
β’ User: web
|
| 187 |
+
β’ Uptime: 24 days, 6:00
|
| 188 |
+
β’ Load average: 1.03, 0.16, 1.55
|
| 189 |
+
β οΈ ERROR MESSAGE:
|
| 190 |
+
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
|
| 191 |
+
|
| 192 |
+
π AVAILABLE COMMANDS:
|
| 193 |
+
|
| 194 |
+
1. groups
|
| 195 |
+
β List user groups
|
| 196 |
+
|
| 197 |
+
2. cat /etc/sudoers | grep web
|
| 198 |
+
β Check sudoers file
|
| 199 |
+
|
| 200 |
+
3. sudo apt update
|
| 201 |
+
β Try updating package list with sudo
|
| 202 |
+
|
| 203 |
+
4. id
|
| 204 |
+
β Check user's group membership
|
| 205 |
+
|
| 206 |
+
β Which command would you run to troubleshoot this issue?
|
| 207 |
+
<eot>
|
| 208 |
+
<b>web@app-134-184-151dev:~$ id
|
| 209 |
+
|
| 210 |
+
<eot><h>π€ COMMAND OUTPUT:
|
| 211 |
+
|
| 212 |
+
uid=1169(web) gid=1169(web) groups=1169(web),web,adm
|
| 213 |
+
<eot><b>π Root cause: User lacks sudo privileges or is not in the sudo group.
|
| 214 |
+
π§ Resolution: Add user to sudo group: sudo usermod -aG sudo web (as root). Then log out and back in.
|
| 215 |
+
β
Verification: Run 'sudo apt update' successfully.
|
| 216 |
+
|
| 217 |
+
π Recommended next steps:
|
| 218 |
+
β’ sudo usermod -aG sudo web
|
| 219 |
+
β’ newgrp sudo
|
| 220 |
+
|
| 221 |
+
π System state evolving...
|
| 222 |
+
<eot>
|
| 223 |
+
<h>
|
| 224 |
+
π PROBLEM:
|
| 225 |
+
System is running slowly and needs investigation. Users report intermittent failures.
|
| 226 |
+
|
| 227 |
+
π» SYSTEM CONTEXT:
|
| 228 |
+
β’ OS: Ubuntu 23.04 (Lunar Lobster)
|
| 229 |
+
β’ Kernel: 6.2.0-39-generic
|
| 230 |
+
β’ Hostname: worker-243-189-194001
|
| 231 |
+
β’ User: app
|
| 232 |
+
β’ Uptime: 20 days, 3:00
|
| 233 |
+
β’ Load average: 0.54, 0.31, 1.90
|
| 234 |
+
β οΈ ERROR MESSAGE:
|
| 235 |
+
High load average and application timeouts
|
| 236 |
+
|
| 237 |
+
π AVAILABLE COMMANDS:
|
| 238 |
+
|
| 239 |
+
1. top -b -n 1
|
| 240 |
+
β Check running processes and resource usage
|
| 241 |
+
|
| 242 |
+
2. echo 3 > /proc/sys/vm/drop_caches
|
| 243 |
+
β Drop filesystem caches
|
| 244 |
+
|
| 245 |
+
3. reboot
|
| 246 |
+
β Restart the system (drastic)
|
| 247 |
+
|
| 248 |
+
4. kill -9 1
|
| 249 |
+
β Kill init/systemd process
|
| 250 |
+
|
| 251 |
+
β Which command would you run to troubleshoot this issue?
|
| 252 |
+
<eot>
|
| 253 |
+
<b>app@worker-243-189-194001:~$ top -b -n 1
|
| 254 |
+
|
| 255 |
+
<eot><h>π€ COMMAND OUTPUT:
|
| 256 |
+
|
| 257 |
+
top - 06:10:09 up 20 day, 3 users, load average: 0.54, 0.31, 1.90
|
| 258 |
+
Tasks: 24 total, 2 running, 21 sleeping, 0 stopped, 0 zombie
|
| 259 |
+
%Cpu(s): 5.4 us, 1.6 sy, 0.0 ni, 88.0 id, 1.3 wa, 0.0 hi, 0.0 si, 0.0 st
|
| 260 |
+
MiB Mem : 12 total, 7 free, 4 used, 2 buff/cache
|
| 261 |
+
MiB Swap: 17 total, 16 free, 0 used. 8 avail Mem
|
| 262 |
+
|
| 263 |
+
PID USER PR NI VIRT RES SHR S %%CPU %%MEM TIME+ COMMAND
|
| 264 |
+
1006 root 20 0 182 89 89 S 9.8 3.3 594:58 /usr/sbin/elasticsearch
|
| 265 |
+
1008 mysql 20 0 429 81 81 S 9.7 1.0 910:09 /usr/sbin/mysql
|
| 266 |
+
1002 root 20 0 859 76 76 S 9.0 3.7 98:38 /usr/sbin/bind9
|
| 267 |
+
1003 root 20 0 780 74 74 S 8.3 2.6 1151:10 /usr/sbin/docker
|
| 268 |
+
3 root 20 0 601 53 53 S 7.9 3.9 1069:28 [ksoftirqd/0]
|
| 269 |
+
1016 root 20 0 549 76 76 S 7.9 0.2 552:21 /usr/sbin/gitlab-runner
|
| 270 |
+
678 root 20 0 605 71 71 S 6.6 4.7 1121:29 /lib/systemd/systemd-udevd
|
| 271 |
+
1010 root 20 0 553 92 92 S 6.3 3.2 268:37 /usr/sbin/mongodb
|
| 272 |
+
1009 root 20 0 330 78 78 S 5.8 2.0 1127:31 /usr/sbin/prometheus
|
| 273 |
+
1015 root 20 0 201 18 18 S 5.7 3.8 259:19 /usr/sbin/redis-server
|
| 274 |
+
<eot><b>π Root cause: Multiple factors could cause slow performance: high CPU, memory pressure, I/O wait, or network issues.
|
| 275 |
+
π§ Resolution: Use standard Linux troubleshooting tools to identify the bottleneck: top, iostat, vmstat, netstat.
|
| 276 |
+
β
Verification: Identify the root cause and resolve accordingly.
|
| 277 |
+
|
| 278 |
+
π System state evolving...
|
| 279 |
+
<eot>
|