Bug 9914 - urpmi doesn't handle well doble installed packages (installation of package-x.y.z failed because that (same) package is already installed)
Summary: urpmi doesn't handle well doble installed packages (installation of package-x...
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Low normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-29 17:38 CEST by Richard Neill
Modified: 2015-05-03 20:47 CEST (History)
1 user (show)

See Also:
Source RPM: urpmi-7.25-1.mga3
CVE:
Status comment:


Attachments

Description Richard Neill 2013-04-29 17:38:00 CEST
Description of problem:

Urpmi gets stuck trying to upgrade, if the package exists already. It seems to happen when:

* package foo is installed in 2 versions:  foo-1  and foo-2
* urpmi --auto-select wants to install foo-2
* urpmi then gets stuck, and provides a very unhelpful error message, claiming that it "can't install foo-2 because foo-2 is already installed"!


What is happening is that urpmi sees foo-1 and tries to upgrade it to foo-2. When it discovers foo-2 is already installed, it simply gives up. It should 
in fact either just remove foo-1, or at least detect that both versions of foo- are installed and then prompt the user to take some action.  

As a minimum, may I suggest changing that error message to 
"Installation failed. you have two versions of this package installed. Try 'rpm -qa | grep foo' and remove the older one with rpm -e' "


----------

Here's a log of what just happened to me: I've seen this problem several times since I upgraded Mga2 to Mga3-beta.  This is a  direct copy of my session (slightly edited for brevity)


# sudo urpmi --auto-update
medium "Core Release" is up-to-date
medium "Core Updates" is up-to-date
... 

The following package has to be removed for others to be upgraded:
usermode-consoleonly-1.111-3.mga3.x86_64
 (in order to install usermode-consoleonly-1.111-3.mga3.x86_64) (y/N) y
To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch
(medium "Core Release")
  lib64udev-devel                195          21.mga3       x86_64
  lib64udev1                     195          21.mga3       x86_64
  lib64uuid-devel                2.22.2       5.mga3        x86_64
  systemd                        195          21.mga3       x86_64
  systemd-units                  195          21.mga3       x86_64
  usermode-consoleonly           1.111        3.mga3        x86_64
1.4MB of disk space will be freed.
1.6MB of packages will be retrieved.
Proceed with the installation of the 6 packages? (Y/n) y

installing systemd-units-195-21.mga3.x86_64.rpm lib64udev-devel-195-21.mga3.x86_64.rpm lib64udev1-195-21.mga3.x86_64.rpm lib64uuid-devel-2.22.2-5.mga3.x86_64.rpm systemd-195-21.mga3.x86_64.rpm usermode-consoleonly-1.111-3.mga3.x86_64.rpm from /var/cache/urpmi/rpms
Preparing...                     Installation failed:    package usermode-consoleonly-1:1.111-3.mga3.x86_64 is already installed

# rpm -qa | grep usermode-consoleonly-
usermode-consoleonly-1.109-1.mga2
usermode-consoleonly-1.111-3.mga3

# rpm -e usermode-consoleonly-1.109-1.mga2

# urpmi --auto-update
medium "Core Release" is up-to-date
medium "Core Updates" is up-to-date
...

To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch
(medium "Core Release")
  lib64udev-devel                195          21.mga3       x86_64
  lib64udev1                     195          21.mga3       x86_64
  lib64uuid-devel                2.22.2       5.mga3        x86_64
  systemd                        195          21.mga3       x86_64
  systemd-units                  195          21.mga3       x86_64
732KB of disk space will be freed.
1.5MB of packages will be retrieved.
Proceed with the installation of the 5 packages? (Y/n) y


installing systemd-units-195-21.mga3.x86_64.rpm lib64udev-devel-195-21.mga3.x86_64.rpm lib64udev1-195-21.mga3.x86_64.rpm lib64uuid-devel-2.22.2-5.mga3.x86_64.rpm systemd-195-21.mga3.x86_64.rpm from /var/cache/urpmi/rpms
Preparing...                     
      1/5: lib64udev1            
      2/5: systemd               
      3/5: systemd-units         
      4/5: lib64udev-devel       
      5/5: lib64uuid-devel       
      1/6: removing systemd-195-20.mga3.x86_64
      2/6: removing systemd-units-195-20.mga3.x86_64
      3/6: removing lib64udev-devel-195-20.mga3.x86_64
      4/6: removing lib64udev1-195-20.mga3.x86_64
removing package udev-181-8.mga2.x86_64
      5/6: removing udev-181-8.mga2.x86_64
      6/6: removing lib64uuid-devel-2.22.2-4.mga3.x86_64
You should restart your computer for systemd


--------------

I'm marking this as "major" rather than "normal" because urpmi getting stuck is going to cause a lot of pain for people undergoing the 2->3 update.


Reproducible: 

Steps to Reproduce:
claire robinson 2013-04-30 10:24:20 CEST

CC: (none) => thierry.vignaud

Comment 1 Thierry Vignaud 2013-04-30 10:35:47 CEST
You should not have two versions of the same package installed.
We've make sure this doesn't happens since the beginning, more than a decade ago.

If you've such a double package, then you either forced it or you interrupted an upgrade (reset, crashed VM, ...).
While it would be nice for urpmi to clean those, just manually remove the older one for now

Priority: Normal => Low
Severity: major => normal

Thierry Vignaud 2013-04-30 10:36:08 CEST

Summary: urpmi: installation of package-x.y.z failed because that (same) package is already installed => urpmi doesn't handle well doble installed packages (installation of package-x.y.z failed because that (same) package is already installed)

Comment 2 Richard Neill 2013-05-01 02:17:37 CEST
I can see how this resulted from a crash of urpmi (which I have had to kill sometimes because of a previous bug with os-prober preventing grub installing, in turn stopping the urpmi process). I'm not sure how the underlying RPM can get into the state where both version are actually installed, given that the files themselves will conflict.

Anyway, I think the most useful thing here would be to simply alter the error message string to explain what's happening. It took me a long time to figure out the problem.
Comment 3 Thierry Vignaud 2013-05-01 02:32:42 CEST
It's very simple to explain. When you upgrade from foobar-1 to foobar-2, librpm does:
- start transaction
  - install new librpm-2
  - remove librpm-1
- close transaction

With the details (scriptlets):

- start transaction
    - run foobar-2's %pre
  - install new librpm-2 (aka unpack)
    - run foobar-2's %post
    - run foobar-1's %preun
  - remove librpm-1 (aka remove older files, rename new ones)
    - run foobar-1's %postun
- close transaction

(the figure is actually a little more complex with more scripts: %pretrans, %posttrans as well as the various %trigger*)

So if you interrupt it before the end of transaction, you ends with old & new package installed.
Comment 4 Thierry Vignaud 2013-05-01 02:36:39 CEST
As for the message, it cames directly from librpm.
urpmi only get notified there was an error and a strings describing the error.
Comment 5 Thierry Vignaud 2013-05-01 02:37:41 CEST
eg:
$ rpm -ivh glibc-2.17-5.mga3.x86_64.rpm --test
Preparing...                          ################################# [100%]
        package glibc-6:2.17-5.mga3.x86_64 is already installed
$ echo $?
1
Comment 6 Samuel Verschelde 2015-05-03 20:47:47 CEST
If I understood correctly, this is not a bug. Closing. Please reopen if needed.

Status: NEW => RESOLVED
Resolution: (none) => INVALID


Note You need to log in before you can comment on or make changes to this bug.