0

I read this answer about how to apt install from a specific source. https://askubuntu.com/questions/27362/how-to-only-install-updates-from-a-specific-repository/57749#57749

But I feel confused with this example.

source is: deb http://mozilla.debian.net/ squeeze-backports iceweasel-release

command is: apt-get install -t squeeze-backports iceweasel

So it is what after deb http://xxx.xxx.xx/ that uniquely define a source.

Then I checked my source list. I found duplicated paths and wonder how does apt distinguish one from another?

Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease                                                       
Hit:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease                                                                                     
Hit:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease                                                                                    
Hit:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease                                                                                   
Ign:6 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                             
Hit:7 http://packages.microsoft.com/repos/vscode stable InRelease                                                                                        
Hit:8 http://dl.google.com/linux/chrome/deb stable Release                                                                                               
Ign:10 https://dl.bintray.com/rabbitmq-erlang/debian {distribution} InRelease                                                                            
Err:11 https://dl.bintray.com/rabbitmq-erlang/debian {distribution} Release                                                                              
  404  Not Found [IP: 52.41.180.114 443]
Hit:12 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease                                                                                  
Hit:13 http://linux.teamviewer.com/deb stable InRelease                                                                                                  
Hit:14 https://www.charlesproxy.com/packages/apt charles-proxy InRelease                                                                                 
Hit:15 http://ppa.launchpad.net/fontforge/fontforge/ubuntu bionic InRelease                                                                              
Hit:16 https://download.sublimetext.com apt/stable/ InRelease                                                              
Hit:18 http://ppa.launchpad.net/nathan-renniewaldock/flux/ubuntu bionic InRelease                                          
Hit:17 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu bionic InRelease

For exmaple:

 Hit:17 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu bionic InRelease
 Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
 Hit:12 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease  
 Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease

All the 4 source links have ubuntu bionic InRelease.

How would apt know which specific source I want to install from, if simply provided

apt install something_all_these_4_source_has -t ubuntu bionic InRelease, without the full url ?

(Assume that all 4 sources has the application I want to install, but with different version)

Rick
  • 1,157

1 Answers1

1

So it is what after deb http://xxx.xxx.xx/ that uniquely define a source.

No, a source is defined by its Release file, and the entries there, in particular the Codename entry; see for example the Stretch backports Release file.

When you specify the -t option, that overrides apt’s “default release”, which is the highest-priority release. The possible values are the accessible releases, based on the configured repositories. “ubuntu bionic InRelease” isn’t a valid target.

If multiple repositories with the same name have different versions of a given package, apt’s priority-based resolution determines which version is used; see APT Pinning dependencies resolution (this allows you to distinguish between package origins, i.e. the repository containing them). By default, the highest version wins. You can override that by specifying a specific version (rather than repository or target release) with =: apt install package=version.

There is a fundamental assumption underlying all this: all available copies of a given version of a package are identical, across all repositories advertising it.

Stephen Kitt
  • 434,908
  • I noticed that my observation is totally wrong. squeeze-backports iceweasel != squeeze-backports iceweasel-release. Anyway, I successfully installed newer version fo erlang with the rabbitMQ installation guide. – Rick Mar 25 '20 at 15:05
  • I checked the release file you provided and opened several source urls to examine some directory strcutures. I found it hard to connect these things together in my mind. Source url format, Source url directory structures, Codename, blablabla and how these things are related to the argument after -t. Complicated stuff but I am still curious. Some elementary materials (videos, webpages) are much appreciated, if you have spare time :P. – Rick Mar 25 '20 at 15:12