From b98c7bd40c3b65fbd07c48e2e0876c4f4725f612 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 8 Dec 2023 00:20:29 +0100 Subject: [PATCH] v8.25 - DietPi-Backup | Resolved an issue where updating or restoring backups between different distro version may have been incomplete (particularly in case of Bookworm and Bullseye), since the /etc/debian_version is identical in size and mtime, and hence seen as identical by rsync (by default), while its content is different. --- CHANGELOG.txt | 1 + dietpi/dietpi-backup | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cce2d1fabd..0994c4decd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -12,6 +12,7 @@ Enhancements: Bug fixes: - Proxmox | Now really resolved the issue where the QEMU guest agent was not always installed automatically on first boot. - DietPi-Update | Resolved an issue on RPi 4 systems with 32-bit userland/OS (but 64-bit kernel enabled) where wrong package variants could have been installed during patch stages. Many thanks to @diment08 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6768 +- DietPi-Backup | Resolved an issue where updating or restoring backups between different distro version may have been incomplete (particularly in case of Bookworm and Bullseye), since the /etc/debian_version is identical in size and mtime, and hence seen as identical by rsync (by default), while its content is different. - DietPi-Software | Ampache: Resolved an issue on Bullseye and Bookworm systems where the initial web UI access failed because our pre-generated database was too old. A template shipped with Ampache will now be used, the initial admin user and music catalogue added via CLI. Many thanks to @mostly_offline for reporting this issue: https://dietpi.com/forum/t/bypassing-ampache-update-page/17367 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/ADDME diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index 143a91cc4a..f354397cd9 100755 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -216,6 +216,11 @@ However, this check is a rough estimation in reasonable time, thus it could be m rsync "${aRSYNC_RUN_OPTIONS_BACKUP[@]}" -v --log-file="$FP_TARGET/$FP_LOG" "$FP_SOURCE" "$FP_TARGET/data/" EXIT_CODE=$? + # Manually backup /etc/debian_release, since it can have same size and mtime between different Debian version, hence backing up e.g. a Bookworm system onto an existing Bullseye backup won't include this critical file. + # - The alternative would be "-c" to compare checksums, but this can increases the duration significantly. + G_EXEC cp -a "${FP_SOURCE}etc/debian_release" "$FP_TARGET/$DATA/etc/debian_release" + + # touch target directory to show the correct last update timestamp when restoring one of multiple backups from the archive. This needs to be done after the backup since it applies the root / timestamps. G_EXEC touch "$FP_TARGET/data" @@ -388,6 +393,10 @@ However, this check is a rough estimation in reasonable time, thus it could be m rsync "${aRSYNC_RUN_OPTIONS_RESTORE[@]}" -v --log-file="$FP_TARGET/$FP_LOG" "$FP_TARGET/$DATA/" "$FP_SOURCE" EXIT_CODE=$? + # Manually restore /etc/debian_release, since it can have same size and mtime between different Debian version, hence restoring e.g. a Bullseye system on Bookworm won't restore this critical file. + # - The alternative would be "-c" to compare checksums, but this can increases the duration significantly. + G_EXEC cp -a "$FP_TARGET/$DATA/etc/debian_release" "${FP_SOURCE}etc/debian_release" + hash -r # Clear PATH cache (( $UPDATE_UUIDs )) && Update_UUIDs