apt-get 抛出警告:“W:--force-yes 已弃用,请使用以 --allow 开头的选项之一”

Kev*_*chs 7 debian apt ubuntu-20.04

我在 Circle CI“机器”执行器上运行 Ubuntu 20.04。今天我看到:

sudo apt-get install -y pkg1 pkg2
Run Code Online (Sandbox Code Playgroud)

正在抛出此警告:

W: --force-yes is deprecated, use one of the options starting with --allow instead
Run Code Online (Sandbox Code Playgroud)

我没有使用“--force-yes”。这是从哪里来的?甚至

sudo apt-get update
Run Code Online (Sandbox Code Playgroud)

抛出同样的警告。

mfo*_*tti 5

今天我看到:

sudo apt-get install -y pkg1 pkg2
Run Code Online (Sandbox Code Playgroud)

正在抛出此警告:

W: --force-yes is deprecated, use one of the options starting with --allow instead
Run Code Online (Sandbox Code Playgroud)

apt-get人们可以通过至少三种方式提供论据:

  • 使用其特定的 CLI 参数,例如apt-get --force-yes
  • -o将CLI 参数与配置项一起使用,例如apt-get -o "APT::Get::force-yes=true";或者
  • 使用其配置文件,例如:
    APT {
        Get {
            force-yes "true";
        };
    };
    
    Run Code Online (Sandbox Code Playgroud)/etc/apt/apt.conf

如果您没有看到调用中指定的设置参数apt-get,您可能需要检查/etc/apt/apt.conf/etc/apt/apt.conf.d/*任何其他apt-get配置文件源。

请注意,这--force-yes危险,您可能希望从apt-get配置文件中删除此选项。