This commit completes the core infrastructure for multi-target backups.
Only main menu integration remains.
COMPLETED IN THIS COMMIT:
1. Per-target wrapper functions:
- interactive_config_for_target(name) - Full configuration wizard
- reconfigure_connection_for_target(name) - Connection-only updates
- reconfigure_backup_settings_for_target(name) - Settings-only updates
- run_backup_for_target(name) - Execute backup with live progress
2. Systemd service creation for named targets:
- create_systemd_service_for_target(name) - Complete service generation
- Generates pbs-backup-TARGET.service (scheduled backups)
- Generates pbs-backup-TARGET-manual.service (manual full backups)
- Generates pbs-backup-TARGET.timer (scheduler)
- Creates target-specific backup scripts with embedded target name
- All configs stored in /etc/proxmox-backup-client/targets/TARGET.conf
3. Main menu partially updated:
- Added migrate_legacy_config() call at startup
- Started new multi-target menu structure
- Menu shows: List, Add, Edit, Delete, Run, View, Reinstall, Exit
FEATURES:
- Each target = independent systemd services
- Target-specific backup scripts include target name in logs
- Live progress monitoring per target
- Complete isolation between targets
- Backward compatible via automatic migration
TESTING STATUS:
- Syntax validated (no errors)
- Not yet functionally tested
- Migration logic not tested
- Menu integration incomplete
REMAINING WORK (Part 3):
- Complete main menu case statement updates
- Add first-time setup flow for new installations
- Add "Run all targets" bulk backup option
- Test legacy→multi-target migration
- Full integration testing
- Update README with multi-target examples
CHANGELOG UPDATED:
- Detailed breakdown of completed components
- Clear TODO list for remaining work
- Marked as "90% Complete"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Documentation improvements to showcase the new live backup progress
monitoring feature and make it easier for users to understand how
to run and monitor backups.
README.md Updates:
Step 13 - Optional Immediate Backup:
- Added example output showing live progress monitoring
- Shows the progress box, real-time stats, and completion
- Example includes file counts, transfer speeds, and timing
- Explains what users will see during backup
- Notes ability to exit with Ctrl+C
Reconfiguration Section:
- Updated to numbered list format for clarity
- Added option 4: "Run backup now" with description
- Explains what "Run backup now" provides:
* Immediate backup testing
* Live progress monitoring with real-time statistics
* File counts, transfer speeds, compression ratios
* Automatic completion detection
* Option to exit early (backup continues)
Post-Installation → Manual Backup:
- Added "Easy way (with live progress)" section
- Shows how to use installer option 4 for backups
- Lists benefits: live monitoring, auto-completion, clear status
- Kept "Direct command" section for advanced users
- Makes it clear which method provides better UX
CHANGELOG.md Updates:
- Documented README changes in "Changed" section
- Listed all three sections that were updated
- Notes recommendation of easy method via installer
Impact:
Users now have clear documentation showing:
1. What live progress looks like during backups
2. How to access it (option 4 in main menu)
3. Why it's better than manual systemctl commands
4. What information they'll see in real-time
This makes the feature discoverable and encourages users to
use the built-in progress monitoring instead of manual log following.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
User Experience Enhancement: Show real-time backup progress instead
of just asking if user wants to follow logs.
Changes to Backup Progress Display:
1. Automatic Progress Monitoring:
- No longer prompts to follow logs
- Automatically starts showing journalctl output
- Displays PBS client's built-in progress bars and stats
- Runs in background with PID tracking
2. Visual Progress Box:
╔════════════════════════════════════════════════════════╗
║ Backup Progress (Live) ║
║ Press Ctrl+C to exit (backup continues in background) ║
╚════════════════════════════════════════════════════════╝
3. Automatic Completion Detection:
- Monitors systemd service with `systemctl is-active`
- Polls every 2 seconds until service completes
- Kills journal follow process when done
- Shows final status (success or failure)
4. Helpful Post-Backup Information:
- On success: Shows how to list snapshots
- On failure: Shows how to check full logs
- Includes repository info for easy copy/paste
Applied to Two Functions:
- run_backup_now() - Called after initial installation
- Main menu option 4 - "Run backup now"
Technical Implementation:
- Uses `timeout 3600` to prevent runaway journal process
- Background journal follow with PID capture
- Clean process termination with kill + wait
- Proper error handling for failed backups
CHANGELOG.md Updates:
- Added new "Live backup progress monitoring" feature
- Listed all capabilities and use cases
This provides immediate visual feedback and shows the user
exactly what's happening during the backup process, including
file counts, transfer speeds, and compression stats from PBS client.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
CRITICAL FIX: Added robust newline stripping as a defensive measure
when writing passwords to the config file.
The Problem:
Even though prompt_password() was fixed to output to stderr, the
newline was still somehow getting into the PBS_PASSWORD variable
in some cases, causing the config file to be malformed.
The Solution (Defense in Depth):
Before writing PBS_PASSWORD to config file, explicitly strip all
newline and carriage return characters:
PBS_PASSWORD_CLEAN=$(echo -n "$PBS_PASSWORD" | tr -d '\n\r')
This ensures the password is always clean, regardless of how it
was captured or what's in the original variable.
Changes:
- pbs-client-installer.sh:
- Line 298: Added newline filter in reconfigure_connection()
- Line 593: Added newline filter in create_systemd_service()
- Both use: tr -d '\n\r' to remove \n and \r characters
CHANGELOG.md:
- Updated to document defensive filtering approach
- Lists both functions that apply the filter
This is a belt-and-suspenders approach: we fix the source
(prompt_password) AND filter at write time for maximum safety.
Impact:
Config file will now ALWAYS have single-line passwords, even if
something goes wrong with password capture. This prevents the
"authentication failed - invalid credentials" error in the
backup service.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
User Experience Improvements:
1. Changed Default Realm from "pbs" to "pam"
- "pam" is the standard realm for root authentication
- More intuitive for most users
- Matches common Proxmox setup patterns
2. Changed Default Encryption from "yes" to "no"
- Removes friction for quick testing and setup
- Users can easily opt-in during configuration
- Reduces complexity for basic backup scenarios
- Advanced users still have the option available
3. Added "Run backup now" to Main Menu
- New option 4 in the existing configuration menu
- Allows immediate backup testing without reconfiguration
- Starts backup service and offers to follow logs
- Provides helpful commands if backup fails
- Makes it easy to test backups after setup
Changes:
- pbs-client-installer.sh:
- Line 265, 349: PBS_REALM default changed to "pam"
- Line 462: ENABLE_ENCRYPTION default changed to "no"
- Lines 895-939: Added option 4 "Run backup now" with log following
- Shifted "Exit" from option 4 to option 5
CHANGELOG.md:
- Documented all three changes in "Changed" section
- Highlighted default changes in bold
This makes the installer more user-friendly for the common case
(root@pam authentication, no encryption for testing) while still
supporting advanced configurations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
CRITICAL BUG FIX: The prompt_password() function was capturing a newline
character along with the password/token, causing the config file to have
malformed multi-line password values.
The Problem:
- prompt_password() used `echo` to print a newline after password input
- This echo was captured by command substitution: PBS_PASSWORD=$(prompt_password ...)
- Config file ended up with:
PBS_PASSWORD="
actual-token-here"
- PBS client couldn't authenticate with the malformed password
- Error: "authentication failed - invalid credentials"
The Fix:
- Changed `echo` to `echo >&2` (output to stderr)
- Stderr is not captured by command substitution
- Only the actual password is captured and stored
- Config file now correctly has: PBS_PASSWORD="actual-token-here"
File Changed: pbs-client-installer.sh
- Line 54: echo >&2 # Output newline to stderr so it doesn't get captured
CHANGELOG.md Updated:
- Documented as CRITICAL fix
- Explains the authentication failure in backup service
- Notes config file formatting fix
Impact:
- Connection test passed but backup service failed with auth error
- This affected both password and API token authentication
- Backups would fail silently on scheduled runs
- Now fixed: backups will authenticate correctly
Testing:
User should run installer again and the backup service will now work.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
DOCUMENTATION UPDATE: Added detailed step-by-step guide covering the
entire installation process from PBS server setup to completion.
README.md Changes:
Prerequisites Section (Expanded):
- How to create API tokens in PBS web interface
- How to configure datastore permissions
- Common permission error and how to fix it
- Information gathering checklist before running installer
New: Step-by-Step Walkthrough (14 Steps):
1. Running the installer
2. PBS server configuration (IP, port, datastore)
3. Authentication method selection (why API tokens)
4. Entering API token details
5. Backup type selection (files/block/hybrid)
6. File backup paths configuration
7. Block device selection and auto-detection
8. Backup schedule configuration
9. Retention policy settings
10. Encryption setup and key management
11. 3-step connection test process
12. Systemd service creation
13. Optional immediate backup
14. Completion summary
Each step includes:
- Example prompts and responses
- Explanation of options
- Recommendations and best practices
- Common device types and their paths
- Troubleshooting tips
CHANGELOG.md Updates:
- Documented new comprehensive walkthrough
- Listed PBS server setup documentation
- Added permission error troubleshooting to Added section
This addresses the most common user questions and provides a
complete reference for first-time users. Users can now follow
the guide step-by-step to successfully configure PBS backups.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
CRITICAL FIX: The PBS client was waiting for interactive SSL
certificate fingerprint confirmation, causing the installer to
timeout during authentication testing.
Changes to pbs-client-installer.sh:
- Authentication test now pipes 'y' to auto-accept SSL fingerprints
- Displays accepted fingerprint in logs for transparency
- Added SSL certificate issues to error troubleshooting
- References new test-connection.sh script in error messages
New file: test-connection.sh
- Parameterized diagnostic script for testing PBS connections
- No hardcoded credentials (security best practice)
- Handles SSL fingerprint acceptance interactively
- Tests all 3 steps: reachability, auth, datastore access
- Provides detailed error messages and guidance
- Usage examples for both password and API token auth
Updated CHANGELOG.md:
- Documented SSL fingerprint auto-acceptance as critical fix
- Listed all improvements since v1.0.0
- Highlighted test-connection.sh script addition
Updated README.md:
- Added comprehensive troubleshooting section
- Documented test-connection.sh usage with examples
- Explained 3-step connection verification process
- Added SSL fingerprint handling instructions
- Clarified timeout values for each step
This resolves the "authentication hanging" issue where the login
command was waiting indefinitely for user input on SSL fingerprint
confirmation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Document the fix for using correct PBS client commands
(login instead of non-existent status command)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added:
- CHANGELOG.md following Keep a Changelog format
- Documented all changes from v1.0.0 to current unreleased version
- README section explaining reconfiguration options
- Enhanced troubleshooting section with connection test details
The CHANGELOG documents:
- Reconfiguration feature for existing installations
- Connection test timeout and improved error messages
- Installation method change from wget to git clone
The README now clearly explains:
- How to reconfigure existing installations
- Connection-only vs full reconfiguration options
- Use cases for quick connection updates
- Connection test timeout behavior and error types
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>