Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
nfpm migration introduces a regression in the prerm step. This step is used by the OS for doing necessary cleaning before removing a package. The underlying script is called upon remove or upgrade of a package by passing an argument to it, argument being `remove` or `upgrade`. The script expects *only* `remove` and raises an error for anything else. Therefore when trying to upgrade, the script will fail with such an error: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: mimir 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/20.8 MB of archives. After this operation, 5,796 kB of additional disk space will be used. Do you want to continue? [Y/n] Y (Reading database ... 53494 files and directories currently installed.) Preparing to unpack .../mimir_2.8.0~rc.0_amd64.deb ... Unsupported action: upgrade <--- breaking change here dpkg: warning: old mimir package pre-removal script subprocess returned error exit status 1 dpkg: trying script from the new package instead ... Unsupported action: failed-upgrade dpkg: error processing archive /var/cache/apt/archives/mimir_2.8.0~rc.0_amd64.deb (--unpack): new mimir package pre-removal script subprocess returned error exit status 1 Alpine Post Install of an clean install Reload the service unit from disk Unmask the service Set the preset flag for the service unit Set the enabled flag for the service unit Errors were encountered while processing: /var/cache/apt/archives/mimir_2.8.0~rc.0_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) ``` The error is also triggered when trying to downgrade: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be DOWNGRADED: mimir 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. Need to get 0 B/19.4 MB of archives. After this operation, 5,796 kB disk space will be freed. Do you want to continue? [Y/n] y dpkg: warning: downgrading mimir from 2.8.0~rc.0 to 2.7.1 (Reading database ... 53400 files and directories currently installed.) Preparing to unpack .../archives/mimir_2.7.1_amd64.deb ... Unsupported action: upgrade <-- again dpkg: error processing archive /var/cache/apt/archives/mimir_2.7.1_amd64.deb (--unpack): installed mimir package pre-removal script subprocess returned error exit status 1 Alpine Post Install of an clean install Reload the service unit from disk Unmask the service Set the preset flag for the service unit Set the enabled flag for the service unit Errors were encountered while processing: /var/cache/apt/archives/mimir_2.7.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) ``` With the resulting package built with the patched preremove script we have the following, notice that the error is gone: ``` Selecting previously unselected package mimir. (Reading database ... 53397 files and directories currently installed.) Preparing to unpack mimir_2.8.0~rc.0_amd64.deb ... Unpacking mimir (2.8.0~rc.0) ... Setting up mimir (2.8.0~rc.0) ... Post Install of an upgrade Post Install of an upgrade Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be DOWNGRADED: mimir 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. Need to get 0 B/19.4 MB of archives. After this operation, 6,148 kB disk space will be freed. Do you want to continue? [Y/n] y dpkg: warning: downgrading mimir from 2.8.0~rc.0 to 2.7.1 (Reading database ... 53400 files and directories currently installed.) Preparing to unpack .../archives/mimir_2.7.1_amd64.deb ... Unpacking mimir (2.7.1) over (2.8.0~rc.0) ... Setting up mimir (2.7.1) ... Post Install of an upgrade Post Install of an upgrade ``` With this information we can patch the prerm script to do nothing on upgrade as nothing is necessary. Unfortunately there is nothing we can do from here for fixing the upgrade from 2.7 to 2.8 Signed-off-by: Wilfried Roset <wilfriedroset@users.noreply.github.com> (cherry picked from commit 26fdb45) Co-authored-by: Wilfried ROSET <wilfriedroset@users.noreply.github.com>
- Loading branch information