Restore Issues

Issue: Database restore fails with permission denied

Symptoms:
psql: error: /tmp/tmp.XXXXXXX: Permission denied

Cause: Temporary file permissions issue with PostgreSQL user.

Resolution:The restore script should handle this automatically by using the correct database user (triage-www).

If the issue persists:
  1. Verify database user exists:
    id triage-www
  2. Check PostgreSQL service:
    systemctl status postgresql

Issue: ht_token validation fails

Symptoms:
[2025-12-09 14:05:00] ERROR: ht_token value in backup is empty or invalid

Cause: Backup archive contains invalid or missing ht_token.

Resolution: This indicates a corrupted backup. Use a different backup archive.

Issue: Restore validation fails - missing directories

Symptoms:
[2025-12-09 14:02:00] ERROR: Missing required directory: config/triage
[2025-12-09 14:02:00] ERROR: Backup validation failed

Cause: Corrupted or incomplete backup archive.

Resolution:
  1. Verify backup archive integrity:
    tar -tzf amdp_mgr_backup_*.tar.gz | head -20
  2. Try re-transferring backup from source location.
  3. Create new backup from original 20.04 system if still available.

Issue: Configuration files not restored

Symptoms:
cp: cannot stat '/root/.../config/triage/*.yaml': No such file or directory

Cause: Backup extraction issue or missing files in backup.

Resolution:
  1. Manually extract and inspect backup:
    cd /tmp
    tar -xzf /root/amdp_mgr_backup_*.tar.gz
    ls -laR amdp_mgr_backup_*/
  2. Verify backup contains expected files.
  3. If files missing, create new backup from source system.

Issue: rsync fails during data restore

Symptoms:
rsync: failed to set permissions on ...: Operation not permitted

Cause: File ownership or permission issues.

Resolution:
  1. Ensure running as root:
    whoami  # Should show: root
  2. Check target directory permissions:
    ls -la /var/lib/triage/
  3. Fix ownership if needed:
    chown -R triage:triage /var/lib/triage/