We have automated build bash script where at the beginning executed command

apt-get update;
apt-get upgrade -q -y -u 
  --allow-downgrades --allow-remove-essential --allow-change-held-packages 
  --allow-change-held-packages --allow-unauthenticated;

but it keeps asking this question with popup in terminal

A new version (/tmp/grub.xC3mMKP0zx) of configuration file /etc/default/grub is available, but the version installed currently has been locally modified.

enter image description here

which is reason that automated script execution is hanging and i can't force skip it somehow with --allow* or -y options

our ubuntu is 16.04

how i kan avoid that popup appearce ?

Please help, Thanks

-- UPDATE --

I have tried many solutions also this one: Force non-interactive "dpkg --configure" when using apt-get install which was mentioned as duplicate to this question

apt-get -o DPkg::Options::=--force-confdef upgrade -q -y -u --force-yes

it still the same promt popup asking for choose default option

  • Any comment why -1 ?
    – Armen
    Feb 6 '18 at 13:28
  • @StephenKitt actually this is not duplicate in your suggested article it is suggested to pass none interactive option it is done here -y param is passed. The problem is that popup is not yes/no question but choose option
    – Armen
    Feb 6 '18 at 14:09
  • 2
    The problem you’re running into is the same: installing a package stops because of a file conflict during the installation. The answer explains how to resolve the file conflict without manual intervention. Feb 6 '18 at 14:46
  • @StephenKitt actually solution suggested in unix.stackexchange.com/questions/416815/… not works for me. apt-get -o DPkg::Options::=--force-confdef upgrade -q -y -u --force-yes anyway keep promoting with option popup
    – Armen
    Feb 7 '18 at 5:58

I found DEBIAN_FRONTEND=noninteractive option here: https://superuser.com/questions/164553/automatically-answer-yes-when-using-apt-get-install

And only combination of DEBIAN_FRONTEND=noninteractive and Dpkg::Options::="--force-confdef" prevented that option popup to open

So the final command is

apt-get update;
DEBIAN_FRONTEND=noninteractive apt-get upgrade -q -y -u  -o 
   Dpkg::Options::="--force-confdef" --allow-downgrades 
   --allow-remove-essential --allow-change-held-packages 
   --allow-change-held-packages --allow-unauthenticated;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.