From 8ac5ed591cdb7dced88f7802e76e501bc278c268 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 6 Oct 2025 10:37:02 +0200 Subject: [PATCH] Add Proxmox compatibility detection and warning - Created PROXMOX_COMPATIBILITY.md with detailed analysis - Added check_proxmox() function to detect Proxmox VE hosts - Shows warning about potential issues (RAM allocation, kernel params) - Allows user to continue or abort - Updated README.md with Proxmox warning - Recommends running inside VMs instead of on host Key concerns on Proxmox host: - zram reduces RAM available for VMs - tmpfs allocates up to 40% of RAM - Desktop kernel parameters not optimal for hypervisor - Safe to use: inside VMs or monitoring scripts only --- PROXMOX_COMPATIBILITY.md | 167 +++++++++++++++++++++++++++++++++++++++ README.md | 2 + one-button-optimizer.sh | 31 ++++++++ 3 files changed, 200 insertions(+) create mode 100644 PROXMOX_COMPATIBILITY.md diff --git a/PROXMOX_COMPATIBILITY.md b/PROXMOX_COMPATIBILITY.md new file mode 100644 index 0000000..5a96143 --- /dev/null +++ b/PROXMOX_COMPATIBILITY.md @@ -0,0 +1,167 @@ +# Proxmox Host Compatibility Analysis + +## ⚠️ Running on Proxmox Host: Safety Considerations + +### 🔴 **NOT RECOMMENDED for Proxmox Host** + +This toolkit is designed for **Linux desktop systems** and **should NOT be used on a Proxmox host** without modifications. Here's why: + +--- + +## ❌ Potential Issues on Proxmox Host + +### 1. **zram Configuration** +- **Issue**: Creates compressed swap in RAM +- **Impact on Proxmox**: + - Reduces available RAM for VMs/containers + - Can cause memory pressure affecting VM performance + - Proxmox already manages memory efficiently for VMs +- **Risk Level**: 🔴 **HIGH** - Can destabilize VMs + +### 2. **tmpfs Mounts** +- **Issue**: Creates multiple tmpfs filesystems (browser, IDE, packages) +- **Impact on Proxmox**: + - Allocates significant RAM (up to 40% by default) + - RAM allocated to tmpfs cannot be used by VMs + - Desktop-oriented paths may not exist on server +- **Risk Level**: 🟡 **MEDIUM** - Reduces VM memory + +### 3. **Kernel Parameters (vm.swappiness, vm.dirty_ratio)** +- **Issue**: Tunes for desktop workload +- **Impact on Proxmox**: + - `vm.swappiness=1`: Too aggressive for hypervisor + - `vm.dirty_ratio=3`: May cause I/O issues under VM load + - Proxmox has its own memory management for KVM +- **Risk Level**: 🟡 **MEDIUM** - Suboptimal for VMs + +### 4. **Desktop Application Configuration** +- **Issue**: Configures Firefox, Brave, Chromium, IDEs +- **Impact on Proxmox**: + - Not applicable (no GUI applications on host) + - Harmless but useless +- **Risk Level**: 🟢 **LOW** - Just unnecessary + +--- + +## ✅ What's Safe to Use + +### Monitoring/Analysis Tools (Read-Only) +These scripts are **safe** to run on Proxmox as they only read information: + +```bash +./quick-status-check.sh # System overview (safe) +./tmpfs-info.sh # tmpfs information (safe) +./benchmark-tmpfs.sh # Performance tests (safe) +./benchmark-realistic.sh # Cache simulation (safe) +``` + +--- + +## 🎯 Recommended Approach for Proxmox + +### Option 1: **Use Inside VMs Only** ✅ +- Run the optimizer **inside your desktop VMs**, not on the host +- Perfect for workstation VMs running KDE/GNOME +- Won't affect Proxmox host or other VMs + +### Option 2: **Custom Proxmox Tuning** (Advanced) +If you want to optimize the Proxmox **host**, use Proxmox-specific tuning: + +```bash +# Proxmox-recommended settings +cat >> /etc/sysctl.conf << 'EOF' +# Proxmox VM host optimization +vm.swappiness = 10 # Not 1 (allow some swap for cache) +vm.dirty_ratio = 10 # Not 3 (handle VM write bursts) +vm.dirty_background_ratio = 5 +vm.vfs_cache_pressure = 50 +net.core.default_qdisc = fq +net.ipv4.tcp_congestion_control = bbr +EOF + +sysctl -p +``` + +--- + +## 🛡️ Safety Checklist + +Before running on Proxmox host, answer these: + +- [ ] Do I understand this removes RAM from VM allocation? +- [ ] Are my VMs okay with reduced available memory? +- [ ] Do I have a backup/snapshot of the host? +- [ ] Can I access the host console if SSH breaks? +- [ ] Do I know how to revert kernel parameter changes? + +**If you answered NO to any**: **DON'T RUN IT** on the Proxmox host. + +--- + +## 🔧 Creating a Proxmox-Safe Version + +If you really want to run optimizations on Proxmox host, here's what needs modification: + +### Changes Required: + +1. **Disable zram** (keep for VMs only) + - Remove zram setup entirely + - Proxmox manages memory differently + +2. **Reduce tmpfs allocation** + - Instead of 40% of RAM, use max 5-10% + - Only for logs/temporary package cache + +3. **Adjust kernel parameters** + - `vm.swappiness = 10` (not 1) + - `vm.dirty_ratio = 10` (not 3) + - Add VM-specific tuning + +4. **Skip desktop applications** + - No browser/IDE configuration + - Focus on APT cache, logs + +--- + +## 📋 Summary + +| Component | Desktop VM | Proxmox Host | +|-----------|------------|--------------| +| zram | ✅ Recommended | ❌ Don't use | +| tmpfs (40%) | ✅ Great | ❌ Too much | +| tmpfs (5-10%) | ⚠️ Optional | ✅ Acceptable | +| Desktop apps | ✅ Perfect | ❌ N/A | +| Kernel params | ✅ Optimized | ⚠️ Wrong values | +| Monitoring | ✅ Use anytime | ✅ Use anytime | + +--- + +## 🎯 Final Recommendation + +**For Proxmox Users:** + +1. **Run optimizer INSIDE your desktop VMs** - fully safe and beneficial +2. **Don't run on Proxmox host** - wrong optimizations for hypervisor +3. **Use Proxmox-specific tuning** - if you need host optimization +4. **Monitor tools are safe** - run anytime to check system status + +**Need help?** Create a Proxmox-specific profile or use inside VMs only. + +--- + +## 🚀 Quick Test (Safe) + +Want to see what would happen without making changes? + +```bash +# This is safe - just shows what it would do +sudo ./one-button-optimizer.sh + +# When prompted, answer 'N' to all changes +# You'll see the analysis without modifications +``` + +Then decide if you want to: +- Use inside VMs (recommended) +- Create custom Proxmox version +- Skip host optimization entirely diff --git a/README.md b/README.md index 909e319..f868f61 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This repository provides automated system tuning based on hardware detection, usage patterns, and best practices for tmpfs and kernel parameter optimization. +> ⚠️ **Proxmox Users:** This tool is designed for desktop systems. See [PROXMOX_COMPATIBILITY.md](PROXMOX_COMPATIBILITY.md) before running on a Proxmox host. **Recommended:** Use inside desktop VMs instead. + ## ✨ **NEW: One-Button Optimizer** 🎯 **Quick Start:** `sudo ./one-button-optimizer.sh` diff --git a/one-button-optimizer.sh b/one-button-optimizer.sh index 855fa09..637cbbe 100755 --- a/one-button-optimizer.sh +++ b/one-button-optimizer.sh @@ -42,6 +42,36 @@ check_root() { fi } +check_proxmox() { + # Detect if running on Proxmox host + if [[ -f /etc/pve/.version ]] || [[ -d /etc/pve ]] || pveversion &>/dev/null; then + warn "⚠️ Proxmox VE host detected!" + echo "" + echo "This tool is designed for desktop Linux systems and may not be" + echo "suitable for Proxmox hosts. Key concerns:" + echo "" + echo " 🔴 zram: Reduces RAM available for VMs" + echo " 🟡 tmpfs: Allocates significant memory (up to 40%)" + echo " 🟡 Kernel params: Tuned for desktop, not hypervisor" + echo "" + echo "📖 See PROXMOX_COMPATIBILITY.md for detailed analysis" + echo "" + echo "Recommendations:" + echo " ✅ Run inside desktop VMs (fully safe)" + echo " ⚠️ Run on Proxmox host (may affect VM performance)" + echo " 📊 Monitoring scripts are always safe" + echo "" + read -p "Continue anyway? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + log "Aborted by user. Consider running inside VMs instead." + exit 0 + fi + warn "Proceeding on Proxmox host - monitor VM performance carefully!" + echo "" + fi +} + analyze_and_prompt() { log "Analyzing current system optimizations..." @@ -1290,6 +1320,7 @@ main() { echo "" check_root + check_proxmox # Setup directories mkdir -p "$(dirname "$LOG_FILE")" "$BACKUP_DIR"