-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packaging: fix preremove script preventing the upgrade #4801
Conversation
3d468af
to
76072ff
Compare
If possible include this fix when building 2.8.0~rc1 or 2.8.0 otherwise the upgrade process from 2.7 -> 2.8 & 2.8 -> 2.9 would raise error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my question.
76072ff
to
b560ca6
Compare
nfpm migration introduce 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 expect *only* `remove` and raises an error for anything else. Therefore when trying to upgrade the script would failed with such 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>
b560ca6
to
2c11293
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I received confirmation from @lamida btw that he will backport your fix into 2.8.0.rc1 on Monday. |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-4801-to-release-2.8 origin/release-2.8
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 26fdb452ee21c62ef5e0ca0c474c47a8b1be33cc
# Push it to GitHub
git push --set-upstream origin backport-4801-to-release-2.8
git switch main
# Remove the local backport branch
git branch -D backport-4801-to-release-2.8 Then, create a pull request where the |
I will fix the backport later. |
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)
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>
What this PR does
nfpm migration introduce 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
orupgrade
. The script expect onlyremove
and raises an error for anything else. Therefore when trying to upgrade the script would failed with such error:The error is also triggered when trying to downgrade:
With the resulting package built with the patched preremove script we have the following, notice that the error is gone:
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
Alternatively we could do like loki or tempo packaging and not include. This way it would be consistent across all three of them.
Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]