Thanks to visit codestin.com
Credit goes to github.com

Skip to content

thepinak503/maintain-arch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Ultimate Arch Linux Maintenance & System Verification Script

A comprehensive Bash script for maintaining and verifying Arch Linux systems with enhanced UKI detection and system health monitoring.

Overview

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.

Features

  • 🔍 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

System Requirements

  • OS: Arch Linux
  • Privileges: Root access required for system modifications
  • Dependencies: Standard Arch Linux utilities (pacman, systemctl, journalctl)

Installation

Option 1: Direct Download

wget https://raw.githubusercontent.com/thepinak503/maintain-arch/main/maintain-arch.sh
chmod +x maintain-arch.sh

Option 2: Clone Repository

git clone https://github.com/thepinak503/maintain-arch.git
cd maintain-arch
chmod +x maintain-arch.sh

Usage

Basic Usage

# Run with sudo for full functionality
sudo ./maintain-arch.sh

What the Script Does

  1. Prerequisites Check - Verifies system compatibility and required tools
  2. Pre-update Safety Checks - Checks Arch news, disk space, and pending updates
  3. Failed Services Analysis - Identifies and reports system/user service failures
  4. System Log Analysis - Scans for critical errors and common issues
  5. Comprehensive Boot Detection - Locates all boot-related files and configurations
  6. UKI Detection - Advanced Unified Kernel Image detection and verification

Configuration

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

Output Examples

Success Status

✅ SUCCESS: No failed system services
✅ SUCCESS: Sufficient disk space available (45% used, 25GB free)

Warning Status

⚠️ WARNING: Less than 5GB free space. Consider cleaning up.
⚠️ WARNING: Wireless regulatory database issue detected
💡 TIP: Fix: sudo pacman -S wireless-regdb

Critical Issues

🚨 CRITICAL: Disk usage is 90% (>85%). Clean up before updating!
❌ ERROR: 3 failed system services found

Boot Detection Results

🔍 FOUND: systemd-boot file: BOOTX64.EFI
    → /efi/EFI/BOOT/BOOTX64.EFI
🔍 FOUND: Kernel files matching vmlinuz-*:
    → /boot/vmlinuz-linux (8.9M)

Logging

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

Troubleshooting

Common Issues

  1. Permission Denied

    # Ensure script is executable
    chmod +x maintain-arch.sh
    
    # Run with sudo for system operations
    sudo ./maintain-arch.sh
    
  2. Network Issues

    • Script will continue if network checks fail
    • Install curl for Arch news checking: sudo pacman -S curl
  3. Missing Dependencies

    • Install efibootmgr for better boot detection: sudo pacman -S efibootmgr

Service Troubleshooting Tips

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

Advanced Features

UKI Detection

The script can detect various UKI configurations:

  • Direct .efi kernel files
  • systemd-boot UKI entries
  • UKI generation tools (ukify, mkinitcpio with UKI support)

Boot Analysis

  • Multiple bootloader detection methods
  • EFI boot manager analysis
  • Boot command line inspection
  • Critical boot file verification

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly on Arch Linux
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

thepinak503

Support

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

⚠️ Important: Always review the script before running and ensure you have backups of critical system configurations.

About

arch linux maintainer scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages