FS#56679 - [backuppc] Package upgrade overwrites symlinks for /var/lib/backuppc and below

Attached to Project: Community Packages
Opened by Alexander Kobel (akobel) - Monday, 11 December 2017, 13:24 GMT
Last edited by Doug Newgard (Scimmia) - Monday, 11 December 2017, 14:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

A package upgrade for backuppc overwrites any symlinks for /var/lib/backuppc/{cpool,pc,pool} with empty directories.

Those directories are the actual data vaults for backups. Since by default the backuppc user has a home directory at /var/lib/backuppc, it is not too unlikely that those are symlinked to another partition while the user directory ~backuppc (i.e., /var/lib/backuppc) itself is on the system partition; e.g., to have the massive data on a traditional HDD, but keep the home dir on an SSD.
If those links are overwritten, it means that old backups will be invisible, new backups might fill (choke) the partition /var/lib/backuppc resides on, and, worse, new backups will download the entire pool from all clients, potentially starving backups.

AFAIU, replacing symlinks is by design of pacman; if so, a safe workaround or solution would require changes in the packaging process.

{cpool,pc,pool} are automatically generated by backuppc when a backup starts, if they are not yet in place. So there should be no harm in not having those empty directories in the distributed package.

Furthermore, the documentation of $Conf{TopDir} (which defaults to /var/lib/backuppc) in /etc/backuppc/config.pl says:
# Instead of changing TopDir here it is recommended that you use
# a symbolic link to the new location, or mount the new BackupPC
# store at the existing $Conf{TopDir} setting.
This is especially dangerous, since such a symlink would be overwritten even if just an empty /var/lib/backuppc appears in the .pkg.

However, the home directory should exist. I assume that the only sane and safe way to leave symlinks in place would be to remove both /var/lib/backuppc and /var/lib/backuppc/{cpool,pc,pool} from the .pkg and only create them *if necessary* in a post-transaction hook, not overwriting existing symlinks.


Additional info:

backuppc update from 4.1.3-4 to 4.1.5-1 (or even reinstalling backuppc)

# in /etc/backuppc/config.pl (the default)
$Conf{TopDir} = '/var/lib/backuppc';


Steps to reproduce:

cd /var/lib/backuppc
for i in cpool pc pool; do
mv $i $i.org
ln -s $i.org $i
done
pacman -Syu backuppc
ls -l

cd /var/lib
mv backuppc backuppc.org
ln -s backuppc.org backuppc
pacman -Syu backuppc
ls -l
This task depends upon

Closed by  Doug Newgard (Scimmia)
Monday, 11 December 2017, 14:27 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Don't replace managed dirs with symlinks. Bind mounts are a much better option.

Loading...