{"id":49637413,"url":"https://github.com/suresh-1001/linux-auto-debug","last_synced_at":"2026-05-05T17:33:40.326Z","repository":{"id":351471406,"uuid":"1066756464","full_name":"suresh-1001/linux-auto-debug","owner":"suresh-1001","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-15T05:20:38.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-15T07:21:53.550Z","etag":null,"topics":["bash","devops","linux","sre","troubleshooting"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suresh-1001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T23:18:13.000Z","updated_at":"2026-04-15T05:20:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/suresh-1001/linux-auto-debug","commit_stats":null,"previous_names":["suresh-1001/linux-auto-debug"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/suresh-1001/linux-auto-debug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suresh-1001%2Flinux-auto-debug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suresh-1001%2Flinux-auto-debug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suresh-1001%2Flinux-auto-debug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suresh-1001%2Flinux-auto-debug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suresh-1001","download_url":"https://codeload.github.com/suresh-1001/linux-auto-debug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suresh-1001%2Flinux-auto-debug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32660379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","devops","linux","sre","troubleshooting"],"created_at":"2026-05-05T17:33:39.564Z","updated_at":"2026-05-05T17:33:40.319Z","avatar_url":"https://github.com/suresh-1001.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux Auto-Debug \u0026 Self-Heal\n\n\u003e **Automated Linux triage and remediation — read-only diagnostics or full self-healing with a single flag.**\n\nA portable Bash script built for real-world production servers. It detects the OS family (Ubuntu/Debian vs RHEL/Alma/Rocky), runs a comprehensive baseline health report, and optionally applies safe remediations — no external dependencies, no Python, no pip.\n\nUsed to diagnose and stabilize Linux servers across cloud and on-prem environments in Bay Area SMB and enterprise settings.\n\n![Linux Auto Debug](./image/linux-auto-debug.webp)\n\n---\n\n## Quick Run (Read-Only, No Install)\n\n```bash\ncurl -sSL https://raw.githubusercontent.com/suresh-1001/linux-auto-debug/main/linux-autodebug.sh | sudo bash\n```\n\n---\n\n## Installation\n\n```bash\ngit clone https://github.com/suresh-1001/linux-auto-debug.git\ncd linux-auto-debug\nchmod +x linux-autodebug.sh\n```\n\n---\n\n## Usage\n\n| Command | What it does |\n|---|---|\n| `sudo ./linux-autodebug.sh` | Read-only baseline report |\n| `sudo ./linux-autodebug.sh --apply` | Baseline + safe auto-remediations |\n| `sudo ./linux-autodebug.sh --apply --aggressive` | Also restarts processes holding deleted log files |\n| `sudo ./linux-autodebug.sh --apply --report /root/health-$(date +%F).txt` | Saves full report to file |\n\n---\n\n## What It Checks\n\n**System Health**\n- Uptime, load average, CPU \u0026 memory top offenders\n- Filesystem usage with alerting at 85% threshold\n- Biggest space consumers under `/var` and `/var/log`\n- Files deleted-but-still-open (a common cause of unreclaimed disk space)\n\n**Network \u0026 DNS**\n- Interface status, routing table\n- Listening ports (security surface review)\n- `/etc/resolv.conf` validation — alerts if no valid nameservers found\n\n**Services \u0026 Logs**\n- All running systemd services\n- Failed unit detection with pre-remediation log capture\n- `journalctl -p 3` errors + syslog/messages grep for `error|warn|fail`\n\n**Time \u0026 Security**\n- NTP sync status via `timedatectl`\n- SELinux enforcement mode on RHEL-family hosts\n\n---\n\n## What It Fixes (`--apply`)\n\n| Fix | Detail |\n|---|---|\n| Restart failed services | Logs status before and after |\n| Vacuum systemd journals | Caps at 200MB or 7 days |\n| Force logrotate | Runs `logrotate -f /etc/logrotate.conf` |\n| Truncate oversized logs | Logs \u003e300MB under `/var/log` |\n| Clean package caches | `apt-get clean` or `dnf clean all` |\n| Clear stale `/tmp` | Files older than 7 days |\n| DNS fallback | Appends `1.1.1.1` / `8.8.8.8` if no valid resolvers found |\n| Enable NTP | Starts `systemd-timesyncd` or `chronyd` if not synced |\n| Restart processes holding deleted files | `--aggressive` only |\n\n---\n\n## Example Output\n\n```\n=== Linux Auto-Debug + Self-Heal ===\nHost: prod-web-01   |   Time (UTC): 2025-09-29T20:30:00Z\n----------------------------------------------\n[System] Uptime / Load\n  20:30:00 up 12 days, 4:11,  1 user,  load average: 0.08, 0.11, 0.09\n\n[Disk] ALERT: /var at 91% used (/dev/sda1)\n[Services] Failed services\n  nginx.service\n  postgresql.service\n\n=== APPLY MODE: Performing safe remediations ===\n[Fix] Restarting FAILED services\n -\u003e nginx.service (logs last 30 lines)\n -\u003e postgresql.service (logs last 30 lines)\n[Fix] Vacuuming systemd journals (200M OR 7d)\n[Fix] Truncating very large logs (\u003e300MB) under /var/log\n\n============================================================\n[Final Summary - Plain English]\n- ✅ System load is normal (0.08).\n- ✅ Memory is healthy (1842MB available).\n- ⚠️ Root filesystem is 91% full. Free up space soon.\n- ✅ No critical kernel I/O errors detected.\n- ✅ All systemd services are running normally.\n- ✅ System clock is synchronized via NTP.\n\n[Verdict] Overall system health looks stable unless flagged above.\n============================================================\n```\n\nSee a full sample run: [`examples_output.txt`](./examples_output.txt)\n\n---\n\n## Tested On\n\n| Distro | Version |\n|---|---|\n| Ubuntu | 22.04 LTS, 24.04 LTS |\n| AlmaLinux | 8, 9, 10 |\n| Rocky Linux | 8, 9 |\n| Debian | 11, 12 |\n\n---\n\n## Why This Exists\n\nMost Linux issues in SMB environments fall into a short list of categories — full disks, failed services, stale logs, DNS gaps, and clock drift. This script was built to cover all of them in a single pass, with zero external dependencies and output that's readable by both engineers and clients.\n\nThe `--apply` mode is deliberately conservative: it vacuums rather than deletes, restarts rather than removes, and backs up before touching system files.\n\n---\n\n## Repository Structure\n\n```\nlinux-auto-debug/\n├── linux-autodebug.sh      # Main script\n├── examples_output.txt     # Full sample run output\n├── README.md\n└── LICENSE                 # MIT\n```\n\n---\n\n## 🔗 Related\n\n- [linux-server-onboarding-baseline](https://github.com/suresh-1001/linux-server-onboarding-baseline) — harden a server before debugging it\n- [linux-cis-audit](https://github.com/suresh-1001/linux-cis-audit) — CIS Benchmark audit and remediation\n- [prometheus-grafana-stack](https://github.com/suresh-1001/prometheus-grafana-stack) — monitor the servers you just fixed\n\n---\n\n## 👤 Author\n\n**Suresh Chand** — IT Consultant \u0026 Fractional IT Director, San Jose CA\n20+ years in Linux systems administration, VMware, Azure, and SMB infrastructure.\n\n---\n\n## 📜 License\n\nMIT — free to use, modify, and distribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuresh-1001%2Flinux-auto-debug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuresh-1001%2Flinux-auto-debug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuresh-1001%2Flinux-auto-debug/lists"}