apt-get update;安装 apache2:在 1 台虚拟机上运行正常,在另一台虚拟机上运行失败,镜像配置相同:

apt-get update;安装 apache2:在 1 台虚拟机上运行正常,在另一台虚拟机上运行失败,镜像配置相同:

设置

我有 3 个虚拟机,每个都运行 12.04:

VM0:托管由 debmirror 构建的部分 ubuntu 存储库。VM1 和 VM2 想要使用它来安装软件包。

我已经重命名,/etc/apt/sources.list -> /etc/apt/sources.list.dis所以它不会被拾取(并且我没有看到虚拟机在 apt-get 更新期间击中标准 ubuntu 档案),并且两个虚拟机具有相同的 sources.list 配置(1 个文件sources.list.d/foo.list

问题

在一台虚拟机上,我可以apache2从我的 ubuntu 镜像顺利安装,但另一台虚拟机上却不行。是否有任何过时的 apt-get 状态需要我摆脱?

foo.list

deb http://my-mirror.com/repository/ubuntu/ precise main universe multiverse restricted
deb http://my-mirror.com/repository/ubuntu/ precise-security main universe multiverse restricted
deb http://my-mirror.com/repository/ubuntu/ precise-updates main universe multiverse restricted

在尝试在两个虚拟机上安装 apache2 之前,我运行了sudo rm -rf /var/cache/aptsudo apt-get update

VM1运行正常:

me@vm1-172-16-2-18:~$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
  ssl-cert
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 48 not upgraded.
Need to get 102 kB/1,857 kB of archives.
After this operation, 5,686 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
...

VM2 没有:

me@vm2-172-16-2-17:~$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package apache2 is a virtual package provided by:
  apache2-mpm-itk 2.2.22-1ubuntu1.7 [Not candidate version]
  apache2-mpm-worker 2.2.22-1ubuntu1.7 [Not candidate version]
  apache2-mpm-prefork 2.2.22-1ubuntu1.7 [Not candidate version]
  apache2-mpm-event 2.2.22-1ubuntu1.7 [Not candidate version]
  apache2-mpm-itk 2.2.22-1ubuntu1 [Not candidate version]
  apache2-mpm-worker 2.2.22-1ubuntu1 [Not candidate version]
  apache2-mpm-prefork 2.2.22-1ubuntu1 [Not candidate version]
  apache2-mpm-event 2.2.22-1ubuntu1 [Not candidate version]

E: Package 'apache2' has no installation candidate
me@vm2-172-16-2-17:~$

apt-get update没有报告任何错误。

我该如何解决此问题?

我目前已确定的事情:

  • 显然,存储库正在运行,因为 1 台 VM 可以从中安装,所以我认为这一定与第二台 VM 上的 apt-get 有关,但我真的说不出是什么。
  • 两个虚拟机的网络也相同。
  • 我可以很好地卷曲存储库 URL,因此我认为这不是防火墙问题。

apt-get update这也是损坏的虚拟机的输出:

me@vm2-172-16-2-17:~$ sudo apt-get update
Hit http://my-mirror.com stable Release.gpg
Hit http://my-mirror.com stable Release.gpg
Hit http://my-mirror.com precise Release.gpg
Hit http://my-mirror.com precise-security Release.gpg
Hit http://my-mirror.com precise-updates Release.gpg
Hit http://my-mirror.com stable Release
Hit http://my-mirror.com stable Release
Hit http://my-mirror.com precise Release
Hit http://my-mirror.com precise-security Release
Hit http://my-mirror.com precise-updates Release
Hit http://my-mirror.com stable/main amd64 Packages                    
Hit http://my-mirror.com stable/main i386 Packages                     
Ign http://my-mirror.com stable/main TranslationIndex                  
Hit http://my-mirror.com stable/main amd64 Packages                    
Hit http://my-mirror.com stable/main i386 Packages                     
Ign http://my-mirror.com stable/main TranslationIndex                  
Hit http://my-mirror.com precise/main amd64 Packages                   
Hit http://my-mirror.com precise/universe amd64 Packages               
Hit http://my-mirror.com precise/multiverse amd64 Packages             
Hit http://my-mirror.com precise/restricted amd64 Packages             
Hit http://my-mirror.com precise/main i386 Packages                    
Hit http://my-mirror.com precise/universe i386 Packages                
Hit http://my-mirror.com precise/multiverse i386 Packages              
Hit http://my-mirror.com precise/restricted i386 Packages              
Ign http://my-mirror.com precise/main TranslationIndex                 
Ign http://my-mirror.com precise/multiverse TranslationIndex           
Ign http://my-mirror.com precise/restricted TranslationIndex           
Ign http://my-mirror.com precise/universe TranslationIndex             
Ign http://my-mirror.com stable/main Translation-en_US                 
Ign http://my-mirror.com stable/main Translation-en
Hit http://my-mirror.com precise-security/main amd64 Packages          
Hit http://my-mirror.com precise-security/universe amd64 Packages
Hit http://my-mirror.com precise-security/multiverse amd64 Packages
Hit http://my-mirror.com precise-security/restricted amd64 Packages
Hit http://my-mirror.com precise-security/main i386 Packages
Hit http://my-mirror.com precise-security/universe i386 Packages
Hit http://my-mirror.com precise-security/multiverse i386 Packages
Hit http://my-mirror.com precise-security/restricted i386 Packages
Ign http://my-mirror.com precise-security/main TranslationIndex
Ign http://my-mirror.com precise-security/multiverse TranslationIndex
Ign http://my-mirror.com precise-security/restricted TranslationIndex
Ign http://my-mirror.com precise-security/universe TranslationIndex
Hit http://my-mirror.com precise-updates/main amd64 Packages
Hit http://my-mirror.com precise-updates/universe amd64 Packages
Hit http://my-mirror.com precise-updates/multiverse amd64 Packages
Hit http://my-mirror.com precise-updates/restricted amd64 Packages
Hit http://my-mirror.com precise-updates/main i386 Packages
Hit http://my-mirror.com precise-updates/universe i386 Packages
Hit http://my-mirror.com precise-updates/multiverse i386 Packages
Hit http://my-mirror.com precise-updates/restricted i386 Packages
Ign http://my-mirror.com precise-updates/main TranslationIndex
Ign http://my-mirror.com precise-updates/multiverse TranslationIndex
Ign http://my-mirror.com precise-updates/restricted TranslationIndex
Ign http://my-mirror.com precise-updates/universe TranslationIndex
Ign http://my-mirror.com stable/main Translation-en_US
Ign http://my-mirror.com stable/main Translation-en
Ign http://my-mirror.com precise/main Translation-en_US
Ign http://my-mirror.com precise/main Translation-en
Ign http://my-mirror.com precise/multiverse Translation-en_US
Ign http://my-mirror.com precise/multiverse Translation-en
Ign http://my-mirror.com precise/restricted Translation-en_US
Ign http://my-mirror.com precise/restricted Translation-en
Ign http://my-mirror.com precise/universe Translation-en_US
Ign http://my-mirror.com precise/universe Translation-en
Ign http://my-mirror.com precise-security/main Translation-en_US
Ign http://my-mirror.com precise-security/main Translation-en
Ign http://my-mirror.com precise-security/multiverse Translation-en_US
Ign http://my-mirror.com precise-security/multiverse Translation-en
Ign http://my-mirror.com precise-security/restricted Translation-en_US
Ign http://my-mirror.com precise-security/restricted Translation-en
Ign http://my-mirror.com precise-security/universe Translation-en_US
Ign http://my-mirror.com precise-security/universe Translation-en
Ign http://my-mirror.com precise-updates/main Translation-en_US
Ign http://my-mirror.com precise-updates/main Translation-en
Ign http://my-mirror.com precise-updates/multiverse Translation-en_US
Ign http://my-mirror.com precise-updates/multiverse Translation-en
Ign http://my-mirror.com precise-updates/restricted Translation-en_US
Ign http://my-mirror.com precise-updates/restricted Translation-en
Ign http://my-mirror.com precise-updates/universe Translation-en_US
Ign http://my-mirror.com precise-updates/universe Translation-en
Reading package lists... Done

答案1

事实证明,我通过sources.list.d/foo.list从 VM2 复制配置在 VM1 上手动设置了存储库,但我使用 VM2 上的一些 puppet 类进行了设置。我忘记我设置了apt-pinning使用 puppet,与Pin-Priority: -10

删除所有内容/etc/apt/preferences.d/并重新运行后apt-get update && apt-get install apache2,VM2 上运行正常。

相关内容