7

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.

3
  • 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
    Commented Aug 10, 2021 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"; }; }; Commented Aug 10, 2021 at 22:55
  • For any later wanderers in, the -y flag is short for --force-yes . Hence the deprecation warning there. ...Without the flag and the deprecation warning is new to me also. Defer to wiser greybeards. Commented Sep 20, 2023 at 21:08

2 Answers 2

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.

1
  • 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. Commented Aug 12, 2021 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.

2
  • I don't believe you need to replace it, just remove it. Commented Feb 13, 2023 at 23:10
  • @KevinBuchs Good guess, strange wording then. I will not take the time to test it, anyone else who does so may comment. Commented Feb 17, 2023 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .