redis / redis-debian

Debian packaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package dependencies make it hard to use an older version

fbartels opened this issue · comments

Hi,

I am using packages.redis.io in a Dockerfile to get a more recent version of Redis for my Ubuntu 20.04 image. When I now try to install a version other than the latest apt is complaining about unmet dependencies:

root@9717bf8432e4:/opt/# apt-get install -y redis=6:6.2.6-2rl1~focal1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 redis : Depends: redis-server (< 6:6.2.6-2rl1~focal1.1~) but 6:7.0.0-1rl1~focal1 is to be installed
E: Unable to correct problems, you have held broken packages.

Only when specifying the version of (redis, ) redis-server and redis-tools at the same time the packages can be installed:

root@9717bf8432e4:/opt/# apt-get install -y redis=6:6.2.6-3rl1~focal1 redis-server=6:6.2.6-3rl1~focal1 redis-tools=6:6.2.6-3rl1~focal1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  ruby-redis
The following packages will be upgraded:
  redis redis-server redis-tools
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,189 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 https://packages.redis.io/deb focal/main amd64 redis all 6:6.2.6-3rl1~focal1 [39.6 kB]
Get:2 https://packages.redis.io/deb focal/main amd64 redis-server amd64 6:6.2.6-3rl1~focal1 [82.5 kB]
Get:3 https://packages.redis.io/deb focal/main amd64 redis-tools amd64 6:6.2.6-3rl1~focal1 [1,067 kB]
Fetched 1,189 kB in 2s (569 kB/s)      
(Reading database ... 21284 files and directories currently installed.)
Preparing to unpack .../redis_6%3a6.2.6-3rl1~focal1_all.deb ...
Unpacking redis (6:6.2.6-3rl1~focal1) over (6:6.2.6-2rl1~focal1) ...
Preparing to unpack .../redis-server_6%3a6.2.6-3rl1~focal1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking redis-server (6:6.2.6-3rl1~focal1) over (6:6.2.6-2rl1~focal1) ...
Preparing to unpack .../redis-tools_6%3a6.2.6-3rl1~focal1_amd64.deb ...
Unpacking redis-tools (6:6.2.6-3rl1~focal1) over (6:6.2.6-2rl1~focal1) ...
Setting up redis-tools (6:6.2.6-3rl1~focal1) ...
Setting up redis-server (6:6.2.6-3rl1~focal1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up redis (6:6.2.6-3rl1~focal1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...

Root cause of this problem is ihmo that redis depends a version number that is equal or higher than the "binary:Version"

redis-server (>= ${binary:Version}),

@fbartels Thanks for reporting this issue. I don't think the control file is wrong, I think it's a limitation of apt which is also discussed here:
https://unix.stackexchange.com/questions/350192/apt-get-not-properly-resolving-a-dependency-on-a-fixed-version-in-a-debian-ubunt

If I'm wrong and there's a better solution, I'll be happy to learn about it.

Hi @yossigo,

I think the situation here is slightly different than in the linked question. But even he managed to install the desired package, by giving the version of the (older) package he wanted to install. With the redis packaging however I need to specify the version of all dependencies, else the redis-server (>= ${binary:Version}), would match a newer version automatically and fail to install.

I would say that instead of larger or equal it should only match with equal versions. This would allow to just do apt-get install redis=1.2.3, which would then use dependencies in the same 1.2.3 version.

@fbartels I think this is incorrect.

As the post I linked mentions, the apt resolver generally tries to install the latest version of every package, unless a specific version is specified. Versions specified in dependencies are used for validation, but not for package selection.

I've also confirmed this by looking at some other official Debian packages (including redis itself), and they all follow this practice.

Ok, since i can live with the current behavior i am going to close the issue.

Thanks for looking into it.