当我尝试删除 g++ 时,为什么 apt-get 会尝试安装它?

当我尝试删除 g++ 时,为什么 apt-get 会尝试安装它?

注意:最初,我曾对为什么要执行 进行了很长的背景解释apt-get remove g++。在全新安装的 11.10 (32 位) 中尝试执行此操作,然后在升级到 12.04 后尝试执行此操作后,我删除了不相关的内容。

看来这只是 12.04 的问题。是时候改变焦点并查看这是否是已报告的错误了。


我没有找到任何相关内容,因此我将其报告为错误 #982716


在尝试解决 Octave 编译问题时,我删除了编译 Octave 所需的所有软件包,以便重新安装它们。在执行此操作时,我在apt-get12.04 中遇到了意外响应。

当我尝试删除g++软件包时,apt-get 反而尝试安装g++-4.6。我预期会收到消息Package g++ is not installed, so not removed。为什么没有收到?

me@BlueUbuntu64:~$ sudo apt-get -V --dry-run remove g++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
   g++-4.6 (4.6.3-1ubuntu4)
   libstdc++6-4.6-dev (4.6.3-1ubuntu4)
Suggested packages:
   g++-multilib (4.6.3-1ubuntu5)
   g++-4.6-multilib (4.6.3-1ubuntu4)
   gcc-4.6-doc (4.6.3-1ubuntu4)
   libstdc++6-4.6-dbg (4.6.3-1ubuntu4)
   libstdc++6-4.6-doc (4.6.3-1ubuntu4)
The following NEW packages will be installed:
   g++ (4.6.3-1ubuntu5)
   g++-4.6 (4.6.3-1ubuntu4)
   libstdc++6-4.6-dev (4.6.3-1ubuntu4)
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Inst libstdc++6-4.6-dev (4.6.3-1ubuntu4 Ubuntu:12.04/precise [amd64]) []
Inst g++-4.6 (4.6.3-1ubuntu4 Ubuntu:12.04/precise [amd64])
Inst g++ (4:4.6.3-1ubuntu5 Ubuntu:12.04/precise [amd64])
Conf libstdc++6-4.6-dev (4.6.3-1ubuntu4 Ubuntu:12.04/precise [amd64])
Conf g++-4.6 (4.6.3-1ubuntu4 Ubuntu:12.04/precise [amd64])
Conf g++ (4:4.6.3-1ubuntu5 Ubuntu:12.04/precise [amd64])

更新

--no-install-recommends指定选项的结果apt-get。令人惊讶的是(对我来说)似乎以同样的方式失败。也将(最终)更新错误报告。(为什么不呢?)

me@Vbubux86-11:~$ sudo apt-get -V --dry-run --no-install-recommends remove g++
[sudo] password for me: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
   g++-4.6 (4.6.3-1ubuntu4)
   libstdc++6-4.6-dev (4.6.3-1ubuntu4)
Suggested packages:
   g++-multilib (4.6.3-1ubuntu5)
   g++-4.6-multilib (4.6.3-1ubuntu4)
   gcc-4.6-doc (4.6.3-1ubuntu4)
   libstdc++6-4.6-dbg (4.6.3-1ubuntu4)
   libstdc++6-4.6-doc (4.6.3-1ubuntu4)
The following NEW packages will be installed:
   g++ (4.6.3-1ubuntu5)
   g++-4.6 (4.6.3-1ubuntu4)
   libstdc++6-4.6-dev (4.6.3-1ubuntu4)
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Inst libstdc++6-4.6-dev (4.6.3-1ubuntu4 Ubuntu:12.04/precise [i386]) []
Inst g++-4.6 (4.6.3-1ubuntu4 Ubuntu:12.04/precise [i386])
Inst g++ (4:4.6.3-1ubuntu5 Ubuntu:12.04/precise [i386])
Conf libstdc++6-4.6-dev (4.6.3-1ubuntu4 Ubuntu:12.04/precise [i386])
Conf g++-4.6 (4.6.3-1ubuntu4 Ubuntu:12.04/precise [i386])
Conf g++ (4:4.6.3-1ubuntu5 Ubuntu:12.04/precise [i386])
me@Vbubux86-11:~$ apt-cache policy g++
g++:
  Installed: (none)
  Candidate: 4:4.6.3-1ubuntu5
  Version table:
     4:4.6.3-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages

答案1

从更新到错误 #982716

This bug was fixed in the package apt - 0.8.16~exp12ubuntu10

(我从来没有想过要附加包括的结果--no-install-recommends。哦,好吧。)

答案2

尝试这样做:

sudo apt-get -V --dry-run --no-install-recommends remove g++

相关内容