A comprehensive Bash script for maintaining and verifying Arch Linux systems with enhanced UKI detection and system health monitoring.
This script provides automated maintenance and thorough system verification for Arch Linux installations. It includes advanced boot file detection, Unified Kernel Image (UKI) support, and comprehensive system health checks.
- 🔍 Comprehensive Boot Detection - Detects all bootloader types (GRUB, systemd-boot, rEFInd)
- 🛡️ UKI Support - Full Unified Kernel Image detection and verification
- 📊 System Health Analysis - Failed services, logs, and system status
- 🧹 Automated Maintenance - Package updates, cache cleaning, and system optimization
- 📝 Detailed Logging - All actions logged with timestamps
⚠️ Pre-update Safety - Checks disk space, news, and system state before updates- 🎨 Colored Output - Clear visual feedback with status indicators
- OS: Arch Linux
- Privileges: Root access required for system modifications
- Dependencies: Standard Arch Linux utilities (pacman, systemctl, journalctl)
wget https://raw.githubusercontent.com/thepinak503/maintain-arch/main/maintain-arch.sh
chmod +x maintain-arch.sh
git clone https://github.com/thepinak503/maintain-arch.git
cd maintain-arch
chmod +x maintain-arch.sh
# Run with sudo for full functionality
sudo ./maintain-arch.sh
- Prerequisites Check - Verifies system compatibility and required tools
- Pre-update Safety Checks - Checks Arch news, disk space, and pending updates
- Failed Services Analysis - Identifies and reports system/user service failures
- System Log Analysis - Scans for critical errors and common issues
- Comprehensive Boot Detection - Locates all boot-related files and configurations
- UKI Detection - Advanced Unified Kernel Image detection and verification
The script includes several configurable parameters at the top:
JOURNAL_RETENTION="2weeks" # Journal log retention period
PACMAN_CACHE_KEEP=3 # Number of package versions to keep
REQUIRED_FREE_SPACE_GB=5 # Minimum free space requirement
MAX_DISK_USAGE_PERCENT=85 # Maximum disk usage threshold
✅ SUCCESS: No failed system services
✅ SUCCESS: Sufficient disk space available (45% used, 25GB free)
⚠️ WARNING: Less than 5GB free space. Consider cleaning up.
⚠️ WARNING: Wireless regulatory database issue detected
💡 TIP: Fix: sudo pacman -S wireless-regdb
🚨 CRITICAL: Disk usage is 90% (>85%). Clean up before updating!
❌ ERROR: 3 failed system services found
🔍 FOUND: systemd-boot file: BOOTX64.EFI
→ /efi/EFI/BOOT/BOOTX64.EFI
🔍 FOUND: Kernel files matching vmlinuz-*:
→ /boot/vmlinuz-linux (8.9M)
All script actions are logged to /var/log/arch_maintenance.log with timestamps:
# View recent logs
sudo tail -f /var/log/arch_maintenance.log
# View specific date logs
sudo grep "2025-08-25" /var/log/arch_maintenance.log
-
Permission Denied
# Ensure script is executable chmod +x maintain-arch.sh # Run with sudo for system operations sudo ./maintain-arch.sh -
Network Issues
- Script will continue if network checks fail
- Install
curlfor Arch news checking:sudo pacman -S curl
-
Missing Dependencies
- Install efibootmgr for better boot detection:
sudo pacman -S efibootmgr
- Install efibootmgr for better boot detection:
The script provides automated suggestions for common service issues:
- Bluetooth:
sudo systemctl restart bluetooth - Network:
sudo systemctl restart NetworkManager - Audio:
systemctl --user restart pipewire pipewire-pulse - GNOME:
systemctl --user restart gnome-session-manager
The script can detect various UKI configurations:
- Direct .efi kernel files
- systemd-boot UKI entries
- UKI generation tools (ukify, mkinitcpio with UKI support)
- Multiple bootloader detection methods
- EFI boot manager analysis
- Boot command line inspection
- Critical boot file verification
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly on Arch Linux
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
thepinak503
- GitHub: @thepinak503
- Repository: maintain-arch
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation and logs first
- Provide system information and error logs when reporting issues