Bug 1218334 - Zypper package can be installed but not yet uninstalled. (rpm without problem)
Summary: Zypper package can be installed but not yet uninstalled. (rpm without problem)
Status: RESOLVED INVALID
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: libzypp (show other bugs)
Version: Leap 15.5
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-22 08:18 UTC by Stefan Sabolowitsch
Modified: 2023-12-22 17:06 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
zypper logfile (6.94 MB, text/plain)
2023-12-22 10:11 UTC, Stefan Sabolowitsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Sabolowitsch 2023-12-22 08:18:47 UTC
Hi there,
i have leap 15.5 here and would like to install an rpm package created with nfpm.
When i want to remove the package with zypper rm, i get the error message that this package does not exist.
i have no problems of this kind with rpm -i or rpm -e. i can install or uninstall the package without any problems.

Question, why does zypper have these problems with uninstalling the package at this point?

These commands do not help here:
rpm --rebuilddb && zypper clean -a

The following additional information:
ldap-proxy-01:~ # zypper -vv in haproxy.rpm
Verbosity: 3
Non-option program arguments: 'haproxy.rpm'
'haproxy.rpm' looks like an RPM file. Will try to download it.
Initializing Target
Checking whether to refresh metadata for Netdata Edge
Checking whether to refresh metadata for Netdata Repoconfig
Checking whether to refresh metadata for openSUSE Leap 15.5 (x86_64)
Checking whether to refresh metadata for Update repository of openSUSE Leap 15.5 Backports (x86_64)
Checking whether to refresh metadata for openSUSE 15.5 non oss (x86_64)
Checking whether to refresh metadata for openSUSE Leap 15.5 non oss Updates (x86_64)
Checking whether to refresh metadata for Update repository with updates from SUSE Linux Enterprise 15 for openSUSE Leap 15.5 (x86_64)
Checking whether to refresh metadata for openSUSE Leap 15.5 Updates (x86_64)
Checking whether to refresh metadata for Uyuni Client Tools for openSUSE Leap 15.5 (x86_64)
Checking whether to refresh metadata for Webmin Distribution RPM (15.5)
Checking whether to refresh metadata for Plain RPM files cache
Loading repository data...
Reading installed packages...
Selecting 'haproxy-3.0.0~dev-dc0e1ab4-1.x86_64' from repository 'Plain RPM files cache' for installation.
Resolving package dependencies...
Force resolution: No

The following NEW package is going to be installed:
  haproxy  3.0.0~dev-dc0e1ab4-1  x86_64  Plain RPM files cache  haproxy

1 new package to install.
Overall download size: 31.8 MiB. Already cached: 0 B. After the operation, additional 88.1 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):
committing
Retrieving: haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 (Plain RPM files cache)                                                                   (1/1),  31.8 MiB
haproxy.rpm:
    Header SHA256 digest: OK
    Payload SHA256 digest: OK
    Package header is not signed!

haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 (Plain RPM files cache): Signature verification failed [6-File is unsigned]
Abort, retry, ignore? [a/r/i] (a): i

Checking for file conflicts: ...........................................................................................................................[done]
(1/1) Installing: haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 ..................................................................................................[done]
CommitResult  (total 1, done 1, error 0, skipped 0, updateMessages 0)
ldap-proxy-01:~ #

,#,#,#,#,#,#,#,#,#,

ldap-proxy-01:~ # zypper -vv rm haproxy
Verbosity: 3
Non-option program arguments: 'haproxy'
Initializing Target
Reading installed packages...
Selecting 'haproxy-3.0.0~dev-dc0e1ab4-1.x86_64' for removal.
Resolving package dependencies...
Force resolution: Yes

The following package is going to be REMOVED:
  haproxy  3.0.0~dev-dc0e1ab4-1  x86_64  haproxy

1 package to remove.
After the operation, 88.1 MiB will be freed.
Continue? [y/n/v/...? shows all options] (y):
committing
error: package haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 is not installed
(1/1) Removing haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 ....................................................................................................[error]
Removal of (176)haproxy-3.0.0~dev-dc0e1ab4-1.x86_64(@System) failed:
Error: Subprocess failed. Error: RPM failed: Command exited with status 1.
Abort, retry, ignore? [a/r/i] (a): i
CommitResult  (total 1, done 1, error 0, skipped 0, updateMessages 0)
Checking for running processes using deleted libraries...
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.

ldap-proxy-01:~ #

#,#,#,#,#,#,#,#,#,#,#,

ldap-proxy-01:~ # zypper se -si '/^haproxy/'
Loading repository data...
Reading installed packages...

S  | Name    | Type    | Version              | Arch   | Repository
---+---------+---------+----------------------+--------+------------------
i+ | haproxy | package | 3.0.0~dev-dc0e1ab4-1 | x86_64 | (System Packages)
ldap-proxy-01:~ #

#,#,#,#,#,#,#,#,#,#,#,

ldap-proxy-01:~ # rpm -qi haproxy
Name        : haproxy
Epoch       : 0
Version     : 3.0.0~dev-dc0e1ab4
Release     : 1
Architecture: x86_64
Install Date: Fri Dec 22 09:03:26 2023
Group       : Converted/net
Size        : 92333187
License     : MIT
Signature   : (none)
Source RPM  : haproxy-3.0.0~dev-dc0e1ab4-1.src.rpm
Build Date  : Wed Dec 20 15:53:23 2023
Build Host  : runner-7j1bewjvk-project-35-concurrent-2
Relocations : (not relocatable)
Packager    : StefanS
Vendor      : haproxy
URL         : https://www.haproxy.org
Summary     : fast and reliable load balancing reverse proxy
Description :
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
availability environments. It features connection persistence through HTTP
cookies, load balancing, header addition, modification, deletion both ways. It
has request blocking capabilities and provides interface to display server
status.
This package specifically adds the QuicTLS fork of OpenSSL and enables QUIC
frontend support in HAProxy

Distribution: (none)
ldap-proxy-01:~ #

#,#,#,#,#,#,#,#

ldap-proxy-01:~ # rpm -ev haproxy
Preparing packages...
haproxy-0:3.0.0~dev-dc0e1ab4-1.x86_64
ldap-proxy-01:~ #

#,#,#,#,#,#,#,#,#,

The package could also be successfully installed and uninstalled with Oracle Linux 8 and yum.
To me, this looks like a problem with zypper.


thx
Stefan

PS: Happy and above all peaceful holidays.
Comment 1 Andreas Stieger 2023-12-22 08:49:45 UTC
As you were pointed to on the mailing list, your assertion that this is a zypper problem is premature. Provide the package along with it's sources
Comment 2 Stefan Sabolowitsch 2023-12-22 08:55:04 UTC
Hi Andreas,
(Yes) I'd be happy to be proven wrong :)

i can provide the rpm file, where can i upload it ?

Regards
Stefan
Comment 3 Stefan Sabolowitsch 2023-12-22 08:59:42 UTC
Andreas,
is there a possibility to activate a debug for zypper to understand why zypper has these problems ?
Comment 4 Andreas Stieger 2023-12-22 09:25:14 UTC
(In reply to Stefan Sabolowitsch from comment #2)
> i can provide the rpm file, where can i upload it ?

Anywhere, probably the internet. You may want to try the "Add attachment" option in this bugzilla.

(In reply to Stefan Sabolowitsch from comment #3)
> is there a possibility to activate a debug for zypper to understand why
> zypper has these problems ?

Yes. Google "zypper debug", find https://en.opensuse.org/SDB:Zypper_troubleshooting
Comment 5 Michael Andres 2023-12-22 09:25:18 UTC
(In reply to Stefan Sabolowitsch from comment #0)
> Removal of (176)haproxy-3.0.0~dev-dc0e1ab4-1.x86_64(@System) failed:
> Error: Subprocess failed. Error: RPM failed: Command exited with status 1.
> Abort, retry, ignore? [a/r/i] (a): i

`rpm --rebuilddb' would have been my first suggestion. If this does not help, we need to know why rpm fails. 

@Stefan 
- Please attach the /var/log/zypper.log (or an older and compressed /var/log/zypper.log-YYYYMMDD.xz) that shows the reported behavior. To see the execution dates and zypper commands included in a zypper LOGFILE you can install the zypper-log package and execute:
    zypper-log -l LOGFILE


- Calling `ZYPP_RPM_DEBUG=1 zypper rm ....` will log any rpm output to the screen. Maybe this reveals something.


- Also worth checking in his case: `ls -l /var/lib/rpm /usr/lib/sysimage/rpm`
Expected is '/var/lib/rpm -> ./../../usr/lib/sysimage/rpm' being a symlink to the directory `/usr/lib/sysimage/rpm` (which actually contains the database).
Comment 6 Andreas Stieger 2023-12-22 09:26:16 UTC
Additional causes to eliminate: rpm scriptlets
Comment 7 Michael Andres 2023-12-22 10:00:33 UTC
(In reply to Andreas Stieger from comment #6)
> Additional causes to eliminate: rpm scriptlets
Should be visible in the zypper output.
Comment 8 Stefan Sabolowitsch 2023-12-22 10:10:57 UTC
(In reply to Michael Andres from comment #5)
> (In reply to Stefan Sabolowitsch from comment #0)
> > Removal of (176)haproxy-3.0.0~dev-dc0e1ab4-1.x86_64(@System) failed:
> > Error: Subprocess failed. Error: RPM failed: Command exited with status 1.
> > Abort, retry, ignore? [a/r/i] (a): i
> 
> `rpm --rebuilddb' would have been my first suggestion. If this does not
> help, we need to know why rpm fails. 
> 
> @Stefan 
> - Please attach the /var/log/zypper.log (or an older and compressed
> /var/log/zypper.log-YYYYMMDD.xz) that shows the reported behavior. To see
> the execution dates and zypper commands included in a zypper LOGFILE you can
> install the zypper-log package and execute:
>     zypper-log -l LOGFILE
> 
> 
> - Calling `ZYPP_RPM_DEBUG=1 zypper rm ....` will log any rpm output to the
> screen. Maybe this reveals something.
> 
> 
> - Also worth checking in his case: `ls -l /var/lib/rpm /usr/lib/sysimage/rpm`
> Expected is '/var/lib/rpm -> ./../../usr/lib/sysimage/rpm' being a symlink
> to the directory `/usr/lib/sysimage/rpm` (which actually contains the
> database).

@Andreas
a zypper debug doesn't really help much here.

#,#,#,#,#,#,#,#,#,
ldap-proxy-01:/var/log # zypper -vv rm haproxy
Verbosity: 3
Non-option program arguments: 'haproxy'
Initializing Target
Reading installed packages...
Selecting 'haproxy-3.0.0~dev-dc0e1ab4-1.x86_64' for removal.
Resolving package dependencies...
Force resolution: Yes

The following package is going to be REMOVED:
  haproxy  3.0.0~dev-dc0e1ab4-1  x86_64  haproxy

1 package to remove.
After the operation, 88.1 MiB will be freed.
Continue? [y/n/v/...? shows all options] (y):
committing
error: package haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 is not installed
(1/1) Removing haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 ....................................................................................................[error]
Removal of (176)haproxy-3.0.0~dev-dc0e1ab4-1.x86_64(@System) failed:
Error: Subprocess failed. Error: RPM failed: Command exited with status 1.
Abort, retry, ignore? [a/r/i] (a): i
CommitResult  (total 1, done 1, error 0, skipped 0, updateMessages 0)
Checking for running processes using deleted libraries...
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.

ldap-proxy-01:/var/log #
#,#,#,#,#,#,#,#,#,#

zypper.log should now be attached to the ticket, the rpm file will follow shortly.
Comment 9 Stefan Sabolowitsch 2023-12-22 10:11:43 UTC
Created attachment 871527 [details]
zypper logfile
Comment 10 Stefan Sabolowitsch 2023-12-22 10:22:57 UTC
Here is the download link for the affected rpm file. 

https://share.mailbox.org/ajax/share/0a1917640a634c4da9da3eea634c4ba0a37d4bd469b5ee52/1/8/MjEzNQ

For your information.
The link is valid for 1 week, after that it will be deleted automatically
Comment 11 Michael Andres 2023-12-22 10:33:11 UTC
The log does not reveal that much.

> rpm --root / --dbpath /usr/lib/sysimage/rpm --define '_dump_posttrans 1' -e --allmatches --nodeps -- haproxy-3.0.0~dev-dc0e1ab4-1.x86_64

@Stefan: This is the command zypper executes. Could you please try, whether it also returns 1 if executed on the commandline (maybe adding -vv reveals more).
Comment 12 Michael Andres 2023-12-22 10:44:54 UTC
Well, at least it's reproducible on my system. The package can be installed, but not removed. So we should be able to figure out why...
Comment 13 Michael Andres 2023-12-22 10:55:47 UTC
> hobbes:~ (0)# rpm -q haproxy
> haproxy-3.0.0~dev-dc0e1ab4-1.x86_64
> hobbes:~ (0)# rpm --test -e 'haproxy-3.0.0~dev-dc0e1ab4-1.x86_64'
> error: package haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 is not installed
> hobbes:~ (1)# rpm --test -e 'haproxy.x86_64'
> hobbes:~ (0)# 

> hobbes:~ (1)# rpm -q zoo
> zoo-2.10-1.29.x86_64
> hobbes:~ (0)# rpm --test -e 'zoo-2.10-1.29.x86_64'
> hobbes:~ (0)# 

@Michael - May it be rpm has issues with the '~' embedded in the version number?

(my rpm is rpm-4.14.3-150300.55.1.x86_64; Stefan's is most probably a bit newer from Leap15.5)
Comment 14 Michael Andres 2023-12-22 11:03:19 UTC
@Stefan There's probaly no workaround but removing the package manually with:
> rpm -e haproxy

As we support multiversion packages, zypper alwasy passes the version number when deleting a package (even if it's not multi version installable).
Comment 15 Stefan Sabolowitsch 2023-12-22 11:07:15 UTC
@Michael
Thanks for the good analysis.
What would be the correct notation of zypper for multiversion?
Please give an example.
Comment 16 Stefan Sabolowitsch 2023-12-22 11:12:08 UTC
@Michael
This is the version number of opensuse offizell repo.
What is the big difference here?

Name        : haproxy
Version     : 2.9.0+git0.fddb8c13b
Release     : lp155.2.1
Architecture: x86_64
Install Date: (not installed)
Comment 17 Michael Andres 2023-12-22 11:27:18 UTC
Multiversion packages (like the kernel) may have (intentionally!) multiple versions installed at the same time. (They are installed with `rpm -i`, while `rpm -U` is used for ordinary packages).

> hobbes:~ (0)# rpm -q kernel-default
> kernel-default-5.14.21-150400.22.1.x86_64
> kernel-default-5.14.21-150400.24.66.1.x86_64

> hobbes:~ (0)# zypper se -six kernel-default
> S  | Name           | Type    | Version                | Arch   | Repository
> ---+----------------+---------+------------------------+--------+----------------
> i+ | kernel-default | package | 5.14.21-150400.24.66.1 | x86_64 | repo-sle-update
> i+ | kernel-default | package | 5.14.21-150400.22.1    | x86_64 | repo-oss

To delete a specific version, you pass the complete N-V-R.A:
> rpm -e kernel-default-5.14.21-150400.22.1.x86_64

And for zypper it's basically the same:
> zypper rm kernel-default-5.14.21-150400.22.1.x86_64

It's of course possible to specify just N-V-R or N-V or just the Name. All matching packages will be removed then. 

In my case Name and N-V will remove both kernel (kernel-default-5.14.21.). I need to specify the Release as well to match just one.
Comment 18 Stefan Sabolowitsch 2023-12-22 11:35:13 UTC
Okkk, can you please explain this with the example of the official opensuse haproxy release ?

Version     : 2.9.0+git0.fddb8c13b
Release     : lp155.2.1

I'm trying to understand what i need to configure so that zypper can remove the package.
Comment 19 Michael Andres 2023-12-22 11:43:00 UTC
(In reply to Stefan Sabolowitsch from comment #16)
> This is the version number of opensuse offizell repo.
> What is the big difference here?

'~'(before) and '^'(after) are somewhat special in rpm's version string. They denote "versions" immediately before or after a specific version

(older)
0.5
0.5.0~rc1 #
0.5.0~rc2 # ~ means before 0.5.0 but after any lower version
0.5.0
0.5.0^v1  # ^ means after 0.5.0 but before any higher version
0.5.0^v2  #
0.5.1
(newer)

(e.g. https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/)
Comment 20 Michael Andres 2023-12-22 11:47:00 UTC
(In reply to Stefan Sabolowitsch from comment #18)
> I'm trying to understand what i need to configure so that zypper can remove
> the package.

It's just a guess that the '~' (dues to it's special meaning) makes rpm fail. The rpm maintainer should be able to figure this out.

Avoid the ~. If it still fails, it's probably something specific to the package, though I never had such a case.
Comment 21 Michael Schröder 2023-12-22 11:53:47 UTC
Sorry, that's an illegal package. The package version must not contain a '-' character. The rpmbuild tool will abort with an error if you try that.

Your haproxy package has been created by some other means, but it is not a valid rpm package. I think rpm should refuse to install it.

What happens is that the erase code tries to split the version and release from the specified argument. So it checks for a package called "haproxy-3.0.0~dev" with version "dc0e1ab4" and release "1".
Comment 22 Michael Andres 2023-12-22 11:55:41 UTC
> hobbes:~ (0)# rpm -q haproxy --qf '%{NAME} @ %{VERSION} @ %{RELEASE}\n'
> haproxy @ 3.0.0~dev-dc0e1ab4 @ 1
Comment 23 Michael Andres 2023-12-22 11:58:47 UTC
Quite unexpected. @Michael do you want to keep this for rpm (rejecting the install) or shall we close it.
Comment 24 Stefan Sabolowitsch 2023-12-22 11:59:53 UTC
Oops, so many Michaels here.
OK, the package was created exactly according to the instructions with nfpm. Which has been on the market for a long time now. Why does only zypper have a problem with it and not yum or rpm?
Comment 25 Michael Andres 2023-12-22 12:00:11 UTC
@Stefan whatever you used to build the package, it might be worth reporting this.
Comment 26 Michael Andres 2023-12-22 12:04:10 UTC
(In reply to Stefan Sabolowitsch from comment #24)
> Which has been on the market for a long time now. Why does only zypper have
> a problem with it and not yum or rpm?

Rpm has the same issue if the 'version' is specified in the `rpm -e` command. 
while a simple `rpm -e haproxy` works.

zypper fails because we always pass the version to `rpm -e`. This reveals the miss-built package.
Comment 27 Stefan Sabolowitsch 2023-12-22 12:06:56 UTC
This is also no problem wit ~, i have created a new package, same behavior.

Version     : 3.0-dev-3d5e2258
Release     : 1

error: package haproxy-3.0-dev-3d5e2258-1.x86_64 is not installed
Comment 28 Michael Andres 2023-12-22 12:07:55 UTC
> ma@hobbes:~ (0)> rpm -q zypper
> zypper-1.14.61-150400.3.24.1.x86_64
> ma@hobbes:~ (0)> rpm -q zypper-1.14.61-150400.3.24.1.x86_64
> zypper-1.14.61-150400.3.24.1.x86_64

vs.

> ma@hobbes:~ (0)> rpm -q haproxy
> haproxy-3.0.0~dev-dc0e1ab4-1.x86_64
> ma@hobbes:~ (0)> rpm -q haproxy-3.0.0~dev-dc0e1ab4-1.x86_64
> package haproxy-3.0.0~dev-dc0e1ab4-1.x86_64 is not installed
Comment 29 Michael Andres 2023-12-22 12:10:40 UTC
(In reply to Stefan Sabolowitsch from comment #27)
> This is also no problem wit ~, i have created a new package, same behavior.

Yes, it's a bug in your build tool that it allows a rpm version number with an embedded '-'. And as you can see, even rpm itself has issues handling it.
Comment 30 Michael Andres 2023-12-22 12:22:13 UTC
As reference:
https://rpm-software-management.github.io/rpm/manual/spec.html

Preamble tags

Name

The Name tag contains the proper name of the package. Names must not include whitespace and may include a hyphen ‘-‘ (unlike version and release tags). Names should not include any numeric operators (‘<’, ‘>’,’=’) as future versions of rpm may need to reserve characters other than ‘-‘.

Version

Version of the packaged content, typically software.

The version string consists of alphanumeric characters, which can optionally be segmented with the separators ., _ and +, plus ~ and ^ (see below).
Comment 31 Stefan Sabolowitsch 2023-12-22 12:24:55 UTC
OK, i understand.
I'll have to take a closer look at nfpm.
You can close the ticket.
Thank you for your time.

Frohe Feiertage !
Comment 32 Michael Andres 2023-12-22 12:27:31 UTC
Gleichfalls!
Comment 33 Andrei Borzenkov 2023-12-22 16:58:12 UTC
(In reply to Michael Schröder from comment #21)
> Sorry, that's an illegal package. The package version must not contain a '-'
> character. 

That is simply not true.

commit db28221a4a48f6ee3c804c92314330637c808638
Author: Michael Schroeder <mls@suse.de>
Date:   Mon Apr 23 11:04:02 2012 +0300

    Add support for dpkg-style sorting of tilde in version/release
    
    - This allows much nicer handling some common scenarios such as
      upstream pre-releases where the pre-release version would normally
      appear newer than final release, eg 1.0-rc1 vs 1.0. Previously this
      required mapping the pre-release tag into the release tag to achieve
      desired sorting, with tild this becomes simply 1.0~rc1 < 1.0.
    - Add a rpmlib() tracking dependency to prevent older rpm versions
      from getting confused with packages relying on the new behavior.
    
    Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Comment 34 Andrei Borzenkov 2023-12-22 17:06:04 UTC
(In reply to Andrei Borzenkov from comment #33)
> (In reply to Michael Schröder from comment #21)
> > Sorry, that's an illegal package. The package version must not contain a '-'
> > character. 
> 
> That is simply not true.
> 
> commit db28221a4a48f6ee3c804c92314330637c808638
> Author: Michael Schroeder <mls@suse.de>
> Date:   Mon Apr 23 11:04:02 2012 +0300
> 
>     Add support for dpkg-style sorting of tilde in version/release
>     
>     - This allows much nicer handling some common scenarios such as
>       upstream pre-releases where the pre-release version would normally
>       appear newer than final release, eg 1.0-rc1 vs 1.0. Previously this
>       required mapping the pre-release tag into the release tag to achieve
>       desired sorting, with tild this becomes simply 1.0~rc1 < 1.0.
>     - Add a rpmlib() tracking dependency to prevent older rpm versions
>       from getting confused with packages relying on the new behavior.
>     
>     Signed-off-by: Panu Matilainen <pmatilai@redhat.com>

Sorry, it is font issue. I thought it was about ~. My apologies.