Skip to content
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

uninstall old mimir version package fails on RHEL8 #6063

Closed
JustNZ opened this issue Sep 19, 2023 · 2 comments · Fixed by #6067
Closed

uninstall old mimir version package fails on RHEL8 #6063

JustNZ opened this issue Sep 19, 2023 · 2 comments · Fixed by #6067
Assignees

Comments

@JustNZ
Copy link

JustNZ commented Sep 19, 2023

Describe the bug

Upgrading Mimir on RHEL8 fails on PRERUN scriptlet.

dnf remove mimir-2.9.0


Updating Subscription Management repositories.
Dependencies resolved.
=========================================================================================================================================================================================================
 Package                                     Architecture                                 Version                                        Repository                                                 Size
=========================================================================================================================================================================================================
Removing:
 mimir                                       x86_64                                       2.9.0-1                                        @system                                        57 M

Transaction Summary
=========================================================================================================================================================================================================
Remove  1 Package

Freed space: 57 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                 1/1
  Running scriptlet: mimir-2.9.0-1.x86_64                                                                                                                                                            1/1
Unsupported action: 1
error: %preun(mimir-0:2.9.0-1.x86_64) scriptlet failed, exit status 1

Error in PREUN scriptlet in rpm package mimir
  Verifying        : mimir-2.9.0-1.x86_64                                                                                                                                                            1/1
Installed products updated.

Failed:
  mimir-2.9.0-1.x86_64

Error: Transaction failed

To Reproduce

Steps to reproduce the behavior:

  1. dnf install mimir-2.10.0
  2. see failure of uninstall mimir-2.9.0

Expected behavior

Correct return status code behaviour for prerun

Environment

Additional Context

@pracucci
Copy link
Collaborator

@wilfriedroset Can anyone on your team look at this?

@wilfriedroset
Copy link
Collaborator

I've tried to make a quick troubleshooting on AlmaLinux 8.8. As said in the description, the issue occurs when we upgrade the package not when we install/uninstall.

Example:

[root@test ~]# dnf install mimir-2.9.0
Last metadata expiration check: 0:00:49 ago on Tue 19 Sep 2023 07:45:10 PM UTC.
Dependencies resolved.
======================================================================================================================
 Package                   Architecture               Version                       Repository                   Size
======================================================================================================================
Installing:
 mimir                     x86_64                     2.9.0-1                       grafana                      20 M

Transaction Summary
======================================================================================================================
Install  1 Package

Total download size: 20 M
Installed size: 57 M
Is this ok [y/N]: y
Downloading Packages:
mimir-2.9.0_amd64.rpm                                                                 9.8 MB/s |  20 MB     00:02
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 9.8 MB/s |  20 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Installing       : mimir-2.9.0-1.x86_64                                                                         1/1
  Running scriptlet: mimir-2.9.0-1.x86_64                                                                         1/1
 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
Created symlink /etc/systemd/system/multi-user.target.wants/mimir.service → /usr/lib/systemd/system/mimir.service.

  Verifying        : mimir-2.9.0-1.x86_64                                                                         1/1

Installed:
  mimir-2.9.0-1.x86_64

Complete!
[root@test ~]# dnf remove mimir-2.9.0
Dependencies resolved.
======================================================================================================================
 Package                   Architecture               Version                      Repository                    Size
======================================================================================================================
Removing:
 mimir                     x86_64                     2.9.0-1                      @grafana                      57 M

Transaction Summary
======================================================================================================================
Remove  1 Package

Freed space: 57 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Running scriptlet: mimir-2.9.0-1.x86_64                                                                         1/1
  Erasing          : mimir-2.9.0-1.x86_64                                                                         1/1
  Running scriptlet: mimir-2.9.0-1.x86_64                                                                         1/1
  Verifying        : mimir-2.9.0-1.x86_64                                                                         1/1

Removed:
  mimir-2.9.0-1.x86_64

Complete!

However when we upgrade from 2.9 to 2.10 we have the same error

[root@test ~]# dnf install mimir-2.9.0
Last metadata expiration check: 0:01:44 ago on Tue 19 Sep 2023 07:45:10 PM UTC.
Dependencies resolved.
======================================================================================================================
 Package                   Architecture               Version                       Repository                   Size
======================================================================================================================
Installing:
 mimir                     x86_64                     2.9.0-1                       grafana                      20 M

Transaction Summary
======================================================================================================================
Install  1 Package

Total download size: 20 M
Installed size: 57 M
Is this ok [y/N]: y
Downloading Packages:
mimir-2.9.0_amd64.rpm                                                                  22 MB/s |  20 MB     00:00
----------------------------------------------------------------------------------------------------------------------
Total                                                                                  22 MB/s |  20 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Installing       : mimir-2.9.0-1.x86_64                                                                         1/1
  Running scriptlet: mimir-2.9.0-1.x86_64                                                                         1/1
 Post Install of an clean install
 Reload the service unit from disk
 Unmask the service
 Set the preset flag for the service unit
Removed /etc/systemd/system/multi-user.target.wants/mimir.service.
 Set the enabled flag for the service unit
Created symlink /etc/systemd/system/multi-user.target.wants/mimir.service → /usr/lib/systemd/system/mimir.service.

  Verifying        : mimir-2.9.0-1.x86_64                                                                         1/1

Installed:
  mimir-2.9.0-1.x86_64

Complete!
[root@test ~]# dnf install mimir-2.10.0
Last metadata expiration check: 0:01:54 ago on Tue 19 Sep 2023 07:45:10 PM UTC.
Dependencies resolved.
======================================================================================================================
 Package                   Architecture               Version                       Repository                   Size
======================================================================================================================
Upgrading:
 mimir                     x86_64                     2.10.0-1                      grafana                      21 M

Transaction Summary
======================================================================================================================
Upgrade  1 Package

Total download size: 21 M
Is this ok [y/N]: y
Downloading Packages:
mimir-2.10.0_amd64.rpm                                                                 10 MB/s |  21 MB     00:02
----------------------------------------------------------------------------------------------------------------------
Total                                                                                  10 MB/s |  21 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1
  Upgrading        : mimir-2.10.0-1.x86_64                                                                        1/2
  Running scriptlet: mimir-2.10.0-1.x86_64                                                                        1/2
 Post Install of an upgrade
 Post Install of an upgrade
Warning: The unit file, source configuration file or drop-ins of mimir.service changed on disk. Run 'systemctl daemon-reload' to reload units.

  Running scriptlet: mimir-2.9.0-1.x86_64                                                                         2/2
Unsupported action: 1
error: %preun(mimir-0:2.9.0-1.x86_64) scriptlet failed, exit status 1

Error in PREUN scriptlet in rpm package mimir
error: mimir-0:2.9.0-1.x86_64: erase failed

  Verifying        : mimir-2.10.0-1.x86_64                                                                        1/2
  Verifying        : mimir-2.9.0-1.x86_64                                                                         2/2

Upgraded:
  mimir-2.10.0-1.x86_64
Failed:
  mimir-2.9.0-1.x86_64

Error: Transaction failed

The interesting part is Unsupported action: 1 which is from preremove script:

echo "Unsupported action: ${action}"

Following nfpm documentation the error seems to be this line:

"2" | "upgrade")

It should be

  "1" | "upgrade")

We can also note that we are missing the purge target as well. This can call an empty func like we do for upgrade.
I will submit a PR for review and make some more testing by the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants