5

I'm running on Ubuntu 20.04 on Circle CI "machine" executor. Today I see that:

sudo apt-get install -y pkg1 pkg2

is throwing this warning:

W: --force-yes is deprecated, use one of the options starting with --allow instead

I'm not using "--force-yes". Where is this coming from? Even

sudo apt-get update

throws the same warning.

Kevin Buchs
  • 353
  • 1
  • 3
  • 20
  • 1
    Did you have `APT::Get::force-yes "true"` set in your `/etc/apt/apt.conf` or in any files in `/etc/apt/apt.conf.d/`? – mforsetti Aug 10 '21 at 13:21
  • @mforsetti - that is it! Please add an answer saying that. Here is the relevant section from apt.conf: // Auto "-y" for apt-get APT { Get { Assume-Yes "true"; force-yes "true"; }; }; – Kevin Buchs Aug 10 '21 at 22:55

2 Answers2

5

Today I see that:

sudo apt-get install -y pkg1 pkg2

is throwing this warning:

W: --force-yes is deprecated, use one of the options starting with --allow instead

One can supply arguments to apt-get in at least three ways:

  • using its specific CLI arguments, e.g. apt-get --force-yes;
  • using -o CLI arguments with Configuration Item, e.g. apt-get -o "APT::Get::force-yes=true"; or
  • using its configuration files, e.g.:
    APT {
        Get {
            force-yes "true";
        };
    };
    
    in /etc/apt/apt.conf.

If you don't see set arguments specified in your apt-get calls, you probably want to check /etc/apt/apt.conf, /etc/apt/apt.conf.d/*, or any other sources of apt-get configuration files.

Note that --force-yes is dangerous and you may want to remove this options from your apt-get configuration files.

mforsetti
  • 2,666
  • 2
  • 16
  • 20
  • 1
    Yes, I’m going to have to let Circle CI know about this problem with their images. In the mean time, I am just removing the force=yes part of the config file as a part of my job. Thanks for the answer. – Kevin Buchs Aug 12 '21 at 14:15
0

The first answer is right, but I could not understand from that what should be written instead of --force-yes. In my code, it was:

--allow-change-held-packages 

This is taken from a comment below much of the same question at Ubuntu 18 command apt-get dist-upgrade -qq --force-yes deprecated - Super User.

This is tested, the warning "W: --force-yes is deprecated, use one of the options starting with --allow instead" vanished. If this does not help, check the link for other --allow-... strings.

questionto42
  • 353
  • 5
  • 23