{ "id": "linux-troubleshooting-framework", "title": "A Service Won't Start — Apply the Framework, Don't Just Guess", "category": "Troubleshooting", "isolation_type": "shared_namespace", "difficulty": "Medium", "type": "task", "weight": 6, "description": "## A Service Won't Start — Apply the Framework, Don't Just Guess\n\nA startup script at `/srv/trouble-lab/start.sh` is failing. Don't just poke at it randomly — apply OBSERVE → GATHER EVIDENCE → FORM HYPOTHESIS → TEST → REPAIR → VALIDATE → PREVENT.\n\n**Your task:**\n\n1. **Observe**: run `/srv/trouble-lab/start.sh` and note that it fails\n2. **Gather evidence**: the script's own error output tells you exactly what's missing — read it\n3. **Form a hypothesis and repair**: create whatever the error says is missing, with the correct content\n4. **Validate**: rerun the script and confirm it now succeeds AND that `/srv/trouble-lab/service.ready` is created", "hints": [ { "title": "Reading the real error", "body": "Redirect both stdout and stderr to a log file, then read it — the script's failure message names the exact missing path.", "command": "/srv/trouble-lab/start.sh > /srv/trouble-lab/service.log 2>&1; cat /srv/trouble-lab/service.log" }, { "title": "The fix", "body": "The script expects a config file at a specific path with SOME content — any non-empty content satisfies it, since the script only checks that the file exists.", "command": "mkdir -p /srv/trouble-lab/config\necho 'mode=production' > /srv/trouble-lab/config/settings.conf\n/srv/trouble-lab/start.sh" } ], "setup_commands": [ { "command": "mkdir -p /srv/trouble-lab" }, { "command": "printf '#!/bin/bash\\nCONFIG=/srv/trouble-lab/config/settings.conf\\nif [ ! -f \"$CONFIG\" ]; then\\n echo \"FATAL: config file not found: $CONFIG\" >&2\\n exit 1\\nfi\\necho \"Started with config: $(cat $CONFIG)\"\\necho ready > /srv/trouble-lab/service.ready\\n' > /srv/trouble-lab/start.sh" }, { "command": "chmod +x /srv/trouble-lab/start.sh" } ], "validation": { "commands": [ { "description": "the service now starts successfully", "command": "/srv/trouble-lab/start.sh >/dev/null 2>&1; echo $?", "expected_output": "0", "match": "exact" }, { "description": "the ready marker was actually created", "command": "cat /srv/trouble-lab/service.ready", "expected_output": "ready", "match": "exact" } ] }, "default_namespace": "default", "teardown_commands": [ { "command": "rm -rf /srv/trouble-lab" } ] }