main
Build and Publish Release / Build Packages and Publish (push) Successful in 26s
feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
Linux System Updater (linux-updater)
linux-updater is an enterprise-grade, standalone, zero-dependency Python 3 CLI tool designed to safely inspect, auto-remediate, and update Linux systems. It supports Debian, Ubuntu, RHEL (8 & 9), Fedora, AlmaLinux, Rocky Linux, and Arch Linux.
Key Features
- Zero External Dependencies: Built entirely with the Python standard library. Runs out of the box on Python >= 3.6 (including stock AlmaLinux 8 / RHEL 8 without pip or AppStream updates).
- Pre-flight Health Diagnostics:
- Disk Space: Enforces safety thresholds on
/boot(>= 250 MB),/var(>= 1024 MB), and/(>= 1024 MB). - Process Locks: Detects active package manager locks (via PID checking and non-blocking
fcntl.flockadvisory locks). - Package Database Consistency: Verifies package manager integrity (
dpkg --audit,dnf check,pacmanlock integrity) and auto-remediates interrupted transactions (dpkg --configure -a,apt-get install -f,dnf clean all). - Memory & OOM Pressure: Inspects
/proc/meminfoto warn or halt if available RAM is dangerously low (< 300 MB). - AC Power Protection: Inspects
/sys/class/power_supplyon laptops to prevent updates on battery power. - Reboot Detection: Detects pending reboots from previous kernel/library updates.
- Disk Space: Enforces safety thresholds on
- Safe Automated Remediation: Safely cleans package cache when
/varis low, clears stale locks if the holder process is dead, and repairs interrupted package transactions. - Advanced Update Capabilities:
- Security-only Updates:
--securityflag restricts updates strictly to CVE/security advisories on RHEL, Fedora, CentOS, Rocky, AlmaLinux, Debian, and Ubuntu. - Package Filtering:
--excludeskips specified packages or glob patterns (e.g.,--exclude "kernel*" "nginx"). - Selective Packages:
--packagesselectively targets specific packages for updates. - Flatpak Integration:
--flatpaktriggers Flatpak application updates after OS packages.
- Security-only Updates:
- Shell Tab Autocompletion: Native, zero-latency Bash and Zsh completions with instant flag/subcommand suggestions (
linux-updater completion bash|zsh). - Two Update Tiers:
update: Routine updates with security filters, exclusions, and Flatpak support.release-upgrade: Major distribution upgrades (e.g. Debian 12\rightarrow13, Ubuntu 22.04\rightarrow24.04, Fedora 40\rightarrow41, or RHEL/AlmaLinuxleappupgrades) with safety warnings.
- Standard Linux FHS Logging & Logrotate:
- Logs transactions to
/var/log/linux-updater/linux-updater-<YYYYMMDD>-<HHMMSS>.log. - Atomically maintains
/var/log/linux-updater/latest.logsymlink. - Ships with
/etc/logrotate.d/linux-updater(weekly rotation, 4 copies, compressed).
- Logs transactions to
- Automation Ready:
- Structured
--jsonoutput for Zabbix, Wazuh, Prometheus node exporters, or custom agents. - Non-interactive mode (
-y/--non-interactive) for cron, Ansible, and central management. - Deterministic exit codes.
- Structured
Distribution Support Matrix
| Family | Distributions Supported | Package Manager Driver | Major Upgrade Driver |
|---|---|---|---|
| Debian | Debian 11/12/Testing, Ubuntu 20.04/22.04/24.04, Linux Mint | apt / apt-get |
do-release-upgrade or apt-get dist-upgrade |
| RHEL | RHEL 8 & 9, AlmaLinux 8 & 9, Rocky Linux 8 & 9, CentOS Stream, Fedora 39/40/41 | dnf |
dnf system-upgrade (Fedora) or leapp (RHEL/AlmaLinux) |
| Arch | Arch Linux, Manjaro, EndeavourOS | pacman |
pacman -Syu (Rolling sync) |
Installation
Option 1: Native .deb Package (Debian / Ubuntu)
# Build package using pure Python standard library:
python3 packaging/build_packages.py
# Install generated deb:
sudo dpkg -i dist/linux-updater_2.0.0_all.deb
Option 2: Native .rpm Package (RHEL / Fedora / AlmaLinux / Rocky)
# Build package (sets up RPM tree and calls rpmbuild):
python3 packaging/build_packages.py
# Install generated rpm:
sudo rpm -Uvh dist/rpm/RPMS/noarch/linux-updater-*.noarch.rpm
Option 3: Standalone Tarball (All Linux Distributions)
tar -xzf dist/linux-updater-2.0.0.tar.gz
cd linux-updater-2.0.0
sudo ./install.sh
Quickstart & Common Usage
# 1. Run pre-flight health checks and print diagnostics:
linux-updater health
# 2. Output health diagnostics as JSON (monitoring):
linux-updater health --json
# 3. Check for available updates non-destructively:
linux-updater check
# 4. Simulate a routine system update (dry run):
linux-updater update --dry-run
# 5. Apply routine updates interactively (prompts for reboot if required):
sudo linux-updater update
# 6. Apply updates non-interactively with automated reboot:
sudo linux-updater update -y --reboot
# 7. Apply security-only updates non-interactively:
sudo linux-updater update -y --security
# 8. Exclude specific packages or glob patterns:
sudo linux-updater update -y --exclude "kernel*" "nginx"
# 9. Update system packages and Flatpak apps:
sudo linux-updater update -y --flatpak
# 10. Selectively update specific packages:
sudo linux-updater update -y --packages openssl nginx
# 11. Major distribution release upgrade (interactive confirmation & prompt for reboot):
sudo linux-updater release-upgrade -t 44
# 12. Major release upgrade with alias syntax and automated reboot:
sudo linux-updater release-upgrade --releasever 44 --reboot
# 13. Clean package cache and remove orphaned packages:
sudo linux-updater clean --all
# 14. Enable Bash or Zsh tab autocompletion:
eval "$(linux-updater completion bash)"
Configuration Reference (/etc/linux-updater.json)
Default settings can be customized in /etc/linux-updater.json:
{
"thresholds": {
"min_boot_mb": 250,
"min_var_mb": 1024,
"min_root_mb": 1024,
"min_ram_mb": 300
},
"behavior": {
"auto_remediate": true,
"non_interactive": false,
"check_ac_power": true,
"clean_after_update": false,
"auto_reboot": false,
"exclude_packages": [],
"security_only": false,
"update_flatpak": false
},
"logging": {
"log_dir": "/var/log/linux-updater",
"log_file": null,
"verbose": false
}
}
CLI flags always take precedence over configuration file values.
Exit Codes
| Code | Status | Meaning |
|---|---|---|
0 |
Success | All operations completed cleanly (or automated reboot successfully initiated). |
1 |
Error | Pre-flight check failed and unrecovered, or package manager command returned non-zero. |
2 |
Reboot Required | Operation succeeded, but a system reboot is required (and --reboot was not supplied). |
3 |
Aborted | User cancelled operation at interactive confirmation prompt. |
Containerized Testing Matrix
All packaging builds and integration tests run inside clean Podman containers:
# Run tests for all distros (Debian 12, Ubuntu 22.04, Fedora 40, AlmaLinux 8):
./tests/containers/run_tests.sh all
# Or run for a specific distro:
./tests/containers/run_tests.sh debian
./tests/containers/run_tests.sh ubuntu
./tests/containers/run_tests.sh fedora
./tests/containers/run_tests.sh almalinux8
Documentation
- User Guide: Comprehensive instructions for operators and desktop users (selective updates, filtering, security-only, Flatpak, shell completion).
- Administrator Guide: Automation, cron/systemd configuration, monitoring, logrotate setup, and Gitea Package Registry integration (RPM & Debian).
- Developer Guide: Internal architecture, adding package managers, test development, packaging, and Gitea Actions CI/CD release workflow.
- MAN Page (Section 8): System administration manual (
man 8 linux-updater).
License
MIT License. See LICENSE for details.