Control: tag -1 + pending

On Tue, May 11, 2021 at 12:06:45PM +0200, Andreas Beckmann wrote:
> This was observed on the upgrade path stretch -> buster -> bullseye.
> 
> 
> From the attached log (scroll to the bottom...):
> 
>   Setting up lava-server (2020.12-3) ...
>   Installing new version of config file 
> /etc/apache2/sites-available/lava-server.conf ...
>   
>   Configuration file '/etc/logrotate.d/lava-scheduler-log'
>    ==> Deleted (by you or by a script) since installation.
>    ==> Package distributor has shipped an updated version.
>      What would you like to do about it ?  Your options are:
>       Y or I  : install the package maintainer's version
>       N or O  : keep your currently-installed version
>         D     : show the differences between the versions
>         Z     : start a shell to examine the situation
>    The default action is to keep your current version.
>   *** lava-scheduler-log (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing 
> package lava-server (--configure):
>    end of file on stdin at conffile prompt
>   Processing triggers for ca-certificates (20210119) ...
>   Updating certificates in /etc/ssl/certs...
>   0 added, 0 removed; done.
>   Running hooks in /etc/ca-certificates/update.d...
>   done.
>   Processing triggers for initramfs-tools (0.140) ...
>   Errors were encountered while processing:
>    lava-server

I'm fixing this with the following change.

From 9d145f91c555101314c10e8b6472665d2672cde7 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <antonio.terce...@linaro.org>
Date: Wed, 12 May 2021 10:54:06 -0300
Subject: [PATCH] Reintroduce wrongly removed
 /etc/logrotate.d/lava-scheduler-log

This was a tricky one. What happened:

- The version in stretch had /etc/logrotate.d/lava-scheduler-log
- The version in buster dropped that configuration file, but didn't
  remove it correctly (i.e. it was removed from the filesystem, but was
  still in the dpkg database.
- The version in bullseye adds that file again.

In a stretch -> buster -> bullseye upgrade scenario, the user gets
prompted about changes to the file even if they didn't touch the file
before upgrading to buster, because it was removed incorrectly in the
buster version. We could fix this in buster first, but then the upgraded
would only work if the user is using the very latest stable update
before upgrading.

Instead, on the buster -> bullseye upgrade, if the file is known by dpkg
-S (meaning it was installed by the stretch version) and missing from
the filesystem (i.e. it was removed by the upgrade to buster), we
reinstate the file with its original contents from stretch, so that the
bullseye upgrade will detect it hasn't been changed and just override it
with the new version.

I tested both stretch -> buster -> bullseye and buster -> bullseye
upgrades and both cases are handled correctly.

Closes: #988362
---
 debian/changelog               |  9 +++++++++
 debian/lava-server.maintscript |  1 -
 debian/lava-server.preinst     | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index b6c567b1d..0f457c000 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+lava (2020.12-4) unstable; urgency=medium
+
+  * Reinstate /etc/logrotate.d/lava-scheduler-log with the original contents
+    from stretch on upgrades from buster if the file was installed by the
+    version in stretch. That file has been deprecated in the last version in
+    buster, but it wasn't removed correctly. (Closes: #988362)
+
+ -- Antonio Terceiro <terce...@debian.org>  Wed, 12 May 2021 10:34:00 -0300
+
 lava (2020.12-3) unstable; urgency=medium
 
   * Drop possible celery backends from Recommends.
diff --git a/debian/lava-server.maintscript b/debian/lava-server.maintscript
index b5782f8f3..9f0280f2c 100644
--- a/debian/lava-server.maintscript
+++ b/debian/lava-server.maintscript
@@ -1,5 +1,4 @@
 # Clean up old conffiles
-rm_conffile /etc/logrotate.d/lava-scheduler-log 2019.01-5~
 rm_conffile /etc/logrotate.d/lava-server-uwsgi-log 2019.01-5~
 rm_conffile /etc/lava-server/lava-server.wsgi 2019.01-5~
 rm_conffile /etc/lava-server/debug.wsgi 2019.01-5~
diff --git a/debian/lava-server.preinst b/debian/lava-server.preinst
index c27620a21..2864d17c7 100644
--- a/debian/lava-server.preinst
+++ b/debian/lava-server.preinst
@@ -14,6 +14,27 @@ if [ "${RET}" = 'false' ]; then
     exit 42
 fi
 
+# Restore conffile from stretch that was removed incorrectly during the upgrade
+# to buster, and later reintroduced in bullseye.
+# Delete this after bullseye is released.
+if  [ ! -f /etc/logrotate.d/lava-scheduler-log ] &&
+       [ "$1" = "upgrade" ] &&
+       dpkg --compare-versions "$2" lt 2019.03 &&
+       dpkg -S /etc/logrotate.d/lava-scheduler-log >/dev/null 2>&1
+then
+    cat > /etc/logrotate.d/lava-scheduler-log <<EOF
+/var/log/lava-server/lava-scheduler.log {
+       weekly
+       rotate 12
+       compress
+       delaycompress
+       missingok
+       notifempty
+       create 644 root root
+}
+EOF
+fi
+
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
-- 
2.31.1

Attachment: signature.asc
Description: PGP signature

Reply via email to