执行连续任务时,Aptitude 不会征求我的同意

执行连续任务时,Aptitude 不会征求我的同意

我遇到了一个奇怪的问题aptitude:当我执行多个连续的任务时,它不会征求我的同意(IE每次输入yn继续。

举个例子,我正在安装cuetools,它在继续之前征求我的同意(见第七行):

user@host:~$ sudo aptitude install cuetools 
[sudo] password for user: 
The following NEW packages will be installed:
  cuetools flac{a} python-mutagen{a} vorbis-tools{a} 
0 packages upgraded, 4 newly installed, 0 to remove and 4 not upgraded.
Need to get 398 kB of archives. After unpacking 1.628 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 flac i386 1.3.1-4 [147 kB]
Get: 2 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 python-mutagen all 1.31-1ubuntu1 [102 kB]                                        
Get: 3 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 vorbis-tools i386 1.4.0-7ubuntu1 [105 kB]                                        
Get: 4 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 cuetools i386 1.4.0-2 [43,2 kB]                                                  
Fetched 398 kB in 24s (16,4 kB/s)                                                                                                                
Selecting previously unselected package flac.
(Reading database ... 209720 files and directories currently installed.)
Preparing to unpack .../archives/flac_1.3.1-4_i386.deb ...
Unpacking flac (1.3.1-4) ...
Selecting previously unselected package python-mutagen.
Preparing to unpack .../python-mutagen_1.31-1ubuntu1_all.deb ...
Unpacking python-mutagen (1.31-1ubuntu1) ...
Selecting previously unselected package vorbis-tools.
Preparing to unpack .../vorbis-tools_1.4.0-7ubuntu1_i386.deb ...
Unpacking vorbis-tools (1.4.0-7ubuntu1) ...
Selecting previously unselected package cuetools.
Preparing to unpack .../cuetools_1.4.0-2_i386.deb ...
Unpacking cuetools (1.4.0-2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up flac (1.3.1-4) ...
Setting up python-mutagen (1.31-1ubuntu1) ...
Setting up vorbis-tools (1.4.0-7ubuntu1) ...
Setting up cuetools (1.4.0-2) ...

此后我几乎立即安装了它们shntoolwavpack但系统并未征求我的同意就安装了它们:

user@host:~$ sudo aptitude install shntool 
[sudo] password for user: 
The following NEW packages will be installed:
  shntool 
0 packages upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 71,8 kB of archives. After unpacking 283 kB will be used.
Get: 1 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 shntool i386 3.0.10-1 [71,8 kB]
Fetched 71,8 kB in 1s (59,9 kB/s)
Selecting previously unselected package shntool.
(Reading database ... 209823 files and directories currently installed.)
Preparing to unpack .../shntool_3.0.10-1_i386.deb ...
Unpacking shntool (3.0.10-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up shntool (3.0.10-1) ...

user@host:~$ sudo aptitude install wavpack 
[sudo] password for user: 
The following NEW packages will be installed:
  wavpack 
0 packages upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 57,2 kB of archives. After unpacking 165 kB will be used.
Get: 1 http://co.archive.ubuntu.com/ubuntu xenial/universe i386 wavpack i386 4.75.2-2 [57,2 kB]
Fetched 57,2 kB in 1s (43,6 kB/s)
Selecting previously unselected package wavpack.
(Reading database ... 209857 files and directories currently installed.)
Preparing to unpack .../wavpack_4.75.2-2_i386.deb ...
Unpacking wavpack (4.75.2-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up wavpack (4.75.2-2) ...

所以我的问题是:为什么aptitude不每次都征求我的同意,我该如何让它这样做?


笔记:

在其他地方问这个问题时,我得到的建议是sudo每次调用时都要求输入密码。我照做了(如日志中所示),但显然这不是解决我问题的办法。

答案1

apt-getaptitude仅在要安装其他软件包(如依赖项)时才会要求确认。您可以使用以下选项使其始终提示单次运行-P

$ sudo aptitude -P install wavpack
The following NEW packages will be installed:
  wavpack
0 packages upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
Need to get 0 B/68.3 kB of archives. After unpacking 160 kB will be used.
Do you want to continue? [Y/n/?] n
Abort.

或者您可以通过执行以下命令使其在每次运行时始终提示:

echo 'Aptitude::CmdLine::Always-Prompt "true";' | sudo tee -a /etc/apt/apt.conf.d/05aptitude

但这些选项是aptitude特定的;它们不能与apt或一起使用apt-get

相关内容