ubuntu 14.04 trusty:“apt-get install”默默拒绝具有未满足依赖关系的升级包

ubuntu 14.04 trusty:“apt-get install”默默拒绝具有未满足依赖关系的升级包

我认为,这个问题是关于同一个问题的。虽然问题没有解决,但那个问题被标记为已回答,所以我提出了一个包含更多细节的新问题。

简短的介绍:

apt如果缺少某些依赖项,则无法升级软件包(没关系),但我在 ubuntu 14.04 上观察到的是,它以退出代码 0(问题 1)进行升级,并且没有报告“未满足的依赖项”(问题 2)。

详细说明:

我在 Ubuntu 14.04,apt 版本1.0.1ubuntu2.6

# uname -a       
Linux myhost 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

# lsb_release -c      
Codename:       trusty

# dpkg -l apt         
||/ Name            Version        Architecture Description
+++-===============-==============-============-====================================
ii  apt             1.0.1ubuntu2.6 amd64        commandline package manager

我安装了一个包,版本 0.03,没有依赖项:

# dpkg -l fake-test-package
||/ Name                  Version         Architecture    Description
+++-=====================-===============-===============-===============================================
ii  fake-test-package     0.03-1          all             package to test apt

# apt-cache depends fake-test-package=0.03-1
fake-test-package

我想将软件包升级到版本 0.04(具有未满足的依赖关系very-strange-dependency):

# apt-cache depends fake-test-package=0.04-1
fake-test-package
  Depends: <very-strange-dependency>

因此,我执行apt-get install

# apt-get install fake-test-package=0.04-1         
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  fake-test-package
0 upgraded, 0 newly installed, 0 to remove and 217 not upgraded.

# echo $?
0

一切似乎正常,退出代码为 0,但软件包未更新:

# dpkg -l fake-test-package
||/ Name                  Version         Architecture    Description
+++-=====================-===============-===============-===============================================
ii  fake-test-package     0.03-1          all             package to test apt

问题就在这里,因为它apt默默地拒绝升级软件包,而且我既不知道这件事发生的原因也不知道它发生的原因。

在 Ubuntu 12.04 上,我观察到不同的行为:退出代码=100 和“未满足的依赖项”报告:

precise# apt-get install fake-test-package=0.04-1
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:
 fake-test-package : Depends: very-strange-dependency but it is not installable
E: Unable to correct problems, you have held broken packages.

precise# echo $?
100

有趣的是,问题仅在升级现有软件包时发生。如果我从系统中删除版本 0.03 并尝试直接安装 0.04,apt则会出现预期的行为:

trusty# apt-get purge fake-test-package
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  fake-test-package*
0 upgraded, 0 newly installed, 1 to remove and 217 not upgraded.
After this operation, 13.3 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 157742 files and directories currently installed.)
Removing fake-test-package (0.03-1) ...
Purging configuration files for fake-test-package (0.03-1) ...

trusty# apt-get install fake-test-package=0.04-1
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:
 fake-test-package : Depends: very-strange-dependency but it is not installable
E: Unable to correct problems, you have held broken packages.

trusty# echo $?
100 

问题:

如何apt在已安装包升级时报告未满足的依赖关系并通过非零退出代码显示升级失败?

答案1

这似乎是 的一个错误apt。版本 1.0.1 受到影响。

我们从源代码构建了 1.0.9.2 版本,它的行为符合预期:报告未满足的依赖关系并以非零状态退出。

也许这是同一个错误:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745046

相关内容