FS#17067 - Partial upgrade breaks system

Attached to Project: Pacman
Opened by Aleksey Kazantsev (ioctl) - Sunday, 08 November 2009, 20:44 GMT
Last edited by Rémy Oudompheng (remyoudompheng) - Tuesday, 24 May 2011, 06:38 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 3.3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

Partial upgrade of the system and/or installation of a new package on old installation can make some other packages broken.

Problem description:

So, you should have working installation with old packages. Then say pacman -Sy, and upgrade one, or install a new one package.

For example (I will write about specific packages just below), you have an old package A with version 1.0, which depends on old library libB. At that, in the description of the package A version on the needed library is not specified.

You want to install new/upgrade old package C to the version 1.1. This package needs libB version 1.1. Ok, pacman will upgrade/install C version 1.1, and will automatically upgrade existing libB.
At that, it is very possible, that the package A became unworking, because it has a binary, for example /usr/bin/A, which is linked with the /usr/lib/libB-1.0.so.0 .

There are a lot of examples, but, it seems to me that the best one is mplayer. Here are a few commands output from my system:

# LANG=C pacman -Qi mplayer | grep -A 3 Depends
Depends On : libxxf86dga libxv libmad giflib cdparanoia gtk2 sdl
lame libtheora xvidcore zlib libmng libxss libgl
smbclient aalib jack-audio-connection-kit x264>=20090108
faac lirc-utils ttf-dejavu fribidi

# ldd /usr/bin/mplayer | grep libjpeg
libjpeg.so.62 => not found
libjpeg.so.62 => not found


So, libjpeg library binary is not found, because I have upgraded ghostscript which needs libjpeg>=7. As the result, pacman thinks that all right, but mplayer does not work.

So, I think there are two ways to solve this problem:

1) While upgrading any package, pacman should check, that all packages that depend on the upgraded package can be dynamically linked with a new version of the upgraded package. I.e., when pacman decides to upgrade libjpeg, for example, it should check (with ldd, or, for example, readelf) all binary of all packages that depends on the libjpeg to be sure, that they can be dynamically linked with that version. I case of some of them can not work with new version, pacman should show error and exit, or suggest to upgrade that packages too, in my case it will be mplayer.

Advantage: This method should work in any system just after this functionality will be implemented in the pacman utility. All existing "bad" packages will be checked.

Disadvantage: This method can be very slow, at that this check will be run at any computer with any upgrade or new package install.

2) Modify package build script to make such check at a build time:
Makepkg should build package (in our case -- mplayer), then should collate depends=() from the PKGBUILD and ldd mplayer.
In case of PKGBUILD has words like "libjpeg>=6", or "libjpeg", but ldd (readelf) says that the /usr/bin/mplayer depends on libjpeg.so.62, it is clear that when pacman will upgrade libjpeg to the version 7-1, mplayer will not work, while all its dependencies officially satisfied.

Unfortunately it is not clear to me what to do after this potential problem will be detected. May be makepkg should show warning, or it should write needed libjpeg version to the dependencies of the binary package like Debian build system can do this (this is better but harder to implement).

Advantage: Check is performed only once at the build time.
Disadvantage: This fix will work only when all existing packages with not quite correct dependencies will be replaced by the packages whose dependencies specified precisely. This can take a lot of time, especially on systems that upgraded seldom.
This task depends upon

Closed by  Rémy Oudompheng (remyoudompheng)
Tuesday, 24 May 2011, 06:38 GMT
Reason for closing:  Not a bug
Additional comments about closing:  The fix is to write better packages. Also have a look to the sodeps feature proposal.
Comment by Allan McRae (Allan) - Monday, 09 November 2009, 00:22 GMT
All this can currently be handled by pacman if packages are made to deal with this.

e.g. the libjpeg PKGBUILD could have:
provides=('libjpeg.so.62')

and then packages would depend on libjpeg.so.62 instead of libjpeg.

The problem arises in Arch Linux as only that latest packages are supported and so this is not implemented. Thus the only upgrade path is a complete upgrade.
Comment by Aleksey Kazantsev (ioctl) - Monday, 09 November 2009, 11:42 GMT
Hm. It appears, that if one would like to install a new package in old system, he must upgrade whole installation. If he will not do this, he will get potentially unworking system. This could be very surprising to a user.

Is it possible to detect such cases and show warning?
Or, alternatively, could pacman upgrade whole system before installing any new package?
Comment by Gavin Bisesi (Daenyth) - Wednesday, 11 November 2009, 16:10 GMT
Wasn't there another bug report for this exact issue a few months ago? I don't think there's any reliable way to autodetect stuff like this without running ldd on a TON of things, which would probably make everything slow to a crawl.

Also, restricting installs to only work with -Su sounds like a terrible idea. There are a ton of valid reasons not to upgrade all at once, it doesn't seem worth it to restrict pacman just to prevent a use-case that is unsupported to begin with.

-1 to all this.
Comment by Aleksey Kazantsev (ioctl) - Thursday, 12 November 2009, 08:44 GMT
Ok, it is expected by design that a user installs a new package on updated system.

The only I would like to say is that it is not good that such important system program as package manager does not check correctness of the command in context of the existing installation and repository interrelationship.
Comment by Gavin Bisesi (Daenyth) - Thursday, 12 November 2009, 14:26 GMT
How do you propose that it should work? Pacman would have to extract _every_ package you download and check _every_ binary. I don't think you understand how slow that would be. It would slow down every sync operation by several orders of magnitude. Pacman is a *package manager*, it is not a automated system maintenance tool. It installs what you tell it to install. It keeps track of the things you've installed. It provides a method to remove or upgrade old packages. It does NOT run your system for you.
Comment by Allan McRae (Allan) - Thursday, 12 November 2009, 14:31 GMT
As I pointed out in the first comment, pacman CAN do this already. Arch just chooses not to package that way as it requires much more effort and there is an expectation that users keep their system fully (not partially) up to date.
Comment by Aleksey Kazantsev (ioctl) - Thursday, 12 November 2009, 15:25 GMT
Ok. What about this idea: when user installs a new package, pacman resolves dependencies and make list of packages to be installed (as it do this now).
If no one of already installed package should be updated, this guarantee that the existing installation will not be broken. Otherwise, if there are installed packages that must be updated to satisfy dependencies, pacman may at least show warning and suggestion to update whole system. In this case user will be notified that such installation potentially dangerous and he needs to perform entire system upgrade to make it safely.
Comment by Xavier (shining) - Thursday, 12 November 2009, 15:37 GMT
Not exactly what you want, as pacman would not detect it automatically, but there could be a non-default option for this behavior :
pacman-dev@archlinux.org/msg03029.html"> http://www.mail-archive.com/pacman-dev@archlinux.org/msg03029.html

Would you be happy with that ?
(Just FYI, pacman will never make any suggestion to update whole system).
Comment by Aleksey Kazantsev (ioctl) - Thursday, 12 November 2009, 17:26 GMT
Yes, it is that I wrote about.
Comment by Rémy Oudompheng (remyoudompheng) - Tuesday, 12 April 2011, 22:35 GMT
Why is this considered as a pacman bug? It is obviously a consequence of bad packaging and has nothing to do with pacman. I think that if we are talkingabout sodepends, the discussion should go in the suitable feature request.

If we are talking about unversioned dependencies leading to broken linking with libraries, then this is an Archlinux problem and IMO has nothing to do here.

Loading...