【问题标题】:Why higher priority for my repository does not works in apt? [closed]为什么我的存储库的更高优先级在 apt 中不起作用? [关闭]
【发布时间】:2017-08-18 16:08:21
【问题描述】:

根据手册:

       A note of caution: the keyword used here is "origin" which can be
       used to match a hostname. The following record will assign a high
       priority to all versions available from the server identified by
       the hostname "ftp.de.debian.org"

           Package: *
           Pin: origin "ftp.de.debian.org"
           Pin-Priority: 999

来源链接:http://manpages.ubuntu.com/manpages/zesty/man5/apt_preferences.5.html

有我的输出:

最适合的偏好是:

# more /etc/apt/preferences.d/default_source_list.pref
Package: *
Pin: origin "ubuntu-repository.youseeu.com"
Pin-Priority: 999

mysql-server 包的策略:

# apt-cache policy mysql-server
mysql-server:
  Installed: (none)
  Candidate: 5.5.57-0ubuntu0.14.04.1
  Version table:
     5.5.57-0ubuntu0.14.04.1 0
        500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages
     5.5.35+dfsg-1ubuntu1 0
        500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

检查它是如何工作的:

# apt-get install -d mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
  libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
  mysql-server-5.5 mysql-server-core-5.5 perl perl-base perl-modules
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
  libsql-statement-perl libipc-sharedcache-perl tinyca mailx perl-doc
  libterm-readline-gnu-perl libterm-readline-perl-perl libb-lint-perl
  libcpanplus-dist-build-perl libcpanplus-perl libfile-checktree-perl
  liblog-message-perl libobject-accessor-perl
The following NEW packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
  libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
  mysql-server mysql-server-5.5 mysql-server-core-5.5
The following packages will be upgraded:
  perl perl-base perl-modules
3 upgraded, 12 newly installed, 0 to remove and 195 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 97.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl amd64 5.18.2-2ubuntu1.1 [2,648 kB]
Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.1 [1,146 kB]
Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.1 [2,673 kB]
Get:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6,364 B]
Get:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.57-0ubuntu0.14.04.1 [13.0 kB]
Get:6 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libmysqlclient18 amd64 5.5.57-0ubuntu0.14.04.1 [596 kB]
Get:7 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libdbi-perl amd64 1.630-1 [879 kB]
Get:8 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libdbd-mysql-perl amd64 4.025-1ubuntu0.1 [87.6 kB]
Get:9 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libterm-readkey-perl amd64 2.31-1 [27.4 kB]
Get:10 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [707 kB]
Get:11 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,588 kB]
Get:12 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [3,766 kB]
Get:13 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,866 kB]
Get:14 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libhtml-template-perl all 2.95-1 [65.5 kB]
Get:15 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server all 5.5.57-0ubuntu0.14.04.1 [11.3 kB]
Fetched 16.1 MB in 0s (21.1 MB/s)
Download complete and in download only mode

检查政策:

# apt-cache policy | head -n 20
Package files:
 100 /var/lib/dpkg/status
     release a=now
 999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages
     release o=ysu_ubuntu14 trusty,a=trusty,n=trusty,l=ysu_ubuntu14 trusty,c=main
     origin ubuntu-repository.youseeu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
     origin security.ubuntu.com
 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe Translation-en
 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main Translation-en
 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe
     origin us-east-2.ec2.archive.ubuntu.com
 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages

那么,为什么包 mysql-server 是从主机 us-east-2.ec2.archive.ubuntu.com 下载的?

为什么我的存储库 ubuntu-repository.youseeu.com 的更高优先级不起作用?

【问题讨论】:

    标签: repository apt


    【解决方案1】:

    同一版本的软件包可能有多个实例可用 当 sources.list(5) 文件包含对多个的引用时 来源。在这种情况下,apt-get 下载最早列出的实例 sources.list(5) 文件。 APT 偏好不影响选择 例如,只有版本的选择。 源链接(你的链接):http://manpages.ubuntu.com/manpages/zesty/man5/apt_preferences.5.html

    所以首先apt搜索可用版本:

    apt-cache policy mysql-server mysql-server:已安装:(无)候选:5.5.57-0ubuntu0.14.04.1 版本表:

     5.5.57-0ubuntu0.14.04.1 0
        500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages
     5.5.35+dfsg-1ubuntu1 0
        500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    

    在 3 个来源中找到版本 5.5.57,优先级忽略根据:

    在这种情况下,apt-get 会下载列表中最早列出的实例 source.list(5) 文件。 APT 偏好不影响选择 例如,只有版本的选择。

    【讨论】:

      猜你喜欢
      • 2014-03-21
      • 1970-01-01
      • 2017-02-17
      • 2014-01-17
      • 1970-01-01
      • 2021-04-16
      • 1970-01-01
      • 2022-01-11
      • 1970-01-01
      相关资源
      最近更新 更多