Question

So I have a Debian package I have made in my private repo and I want to install a specific version.

the package has a common lib dependency and I want to install the matching version of that package. apt-get is insisting on installing the lastest version of the dependency and not the version the package is dependent on.

You can see the output of the command here:

cmcc@cmcc-VirtualBox:~/Desktop/repo$ sudo apt-get install my_program=57.0.93
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:
 my_program : Depends: my_program-common (= 57.0.93) but 57.3.102 is to be installed
E: Unable to correct problems, you have held broken packages.
Was it helpful?

Solution

Simply install the versioned commmon-package as well:

aptitude install my_program=57.0.93 my_program-common=57.0.93

Note: in general aptitude does a much better job for resolving dependencies than apt-get. usage is very similar so it's easy to switch.

UPDATE

If you can live with an interactive process, the easiest way is probably to let aptitude give you a number of suggestion and choose the one that downgrades the packages. e.g.:

# aptitude install my_program=57.0.93-1
The following packages will be DOWNGRADED:
  my_program{b} 
0 packages upgraded, 0 newly installed, 1 downgraded, 0 to remove and 3 not upgraded.
Need to get 180 kB of archives. After unpacking 12.3 kB will be used.
The following packages have unmet dependencies:
 my_program : Depends: my_program-common (= 57.0.93-1) but 57.3.102-1 is to be installed
The following actions will resolve these dependencies:

     Remove the following packages:              
1)     my_program-common                                  
2)     my_program

     Leave the following dependencies unresolved:
3)     my_program recommends my_program-foo      


Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:
1)     my_program-common [57.3.102-1 (now, unstable) -> 57.0.93-1 (stable)]

Accept this solution? [Y/n/q/?] Y

Note on package-versions

It seems that your package has a version like 57.0.93. Such a versioning scheme is explicitley forbidden for non-native packages, e.g. check the DebianMentorsFAQ.

You really should create versions like 57.3.102-1 (that is <upstreamversion>-<pkgversion>), even if <pkgversion> is always "1", due to your way of creating the package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top