5

I found this question and basically had the same problem with my script.

But! I am not running it with packer but with a simple script:

DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo dpkg --configure -aq
DEBIAN_FRONTEND=noninteractive sudo apt-get upgrade -yq --force-yes
DEBIAN_FRONTEND=noninteractive sudo apt-get dist-upgrade -yq --force-yes

...and other things.

The script did work on 1404, but with 1604 Xenial and 1804 Bionic I am getting the problem, that the dialog prompt wants to open in the script and doesn't continue on his own. This is because I can't respond with keyboard inputs on the workstation.

This solution seems to be too risky for GRUB in my opinion, but I need to automate because I can't update hundreds of servers manually.

I think this is a problem for all "new" 1604 and 1804 machines.

Does anybody know a solution for this?

Update: I trie this accepted answer solution and it gave me the following error:

E: Invalid operation Dpkg::Options::=--force-confdef
5
  • "I am getting the problem very often" what problem, exactly? FWIW I would expect the DEBIAN_FRONTEND=noninteractive assignment to go after sudo, not before Sep 11, 2018 at 12:29
  • I am getting the problem, that the dialog prompt wants to open in the script and doesn't continue on his own. This is because I can't respond with keyboard inputs on the workstation. The dialog is prompting on the server.
    – Horsty
    Sep 11, 2018 at 12:37
  • @steeldriver I am testing your remark now and put the DEBIAN_FRONTEND=noninteractive after the sudo and it seems that it does the trick. I thank you very much for this comment. It seems that this is the little thing that hindered my script from working.
    – Horsty
    Sep 11, 2018 at 12:43
  • Shall I post the solution as an answer or do you want to do it? Then I can mark it as accepted. Damn, you just saved me precious hours! I am very glad. Thank you!
    – Horsty
    Sep 11, 2018 at 12:45
  • This is more general than Ubuntu and a more comprehensive answer is on serverfault.com/questions/227190/… Jun 26, 2019 at 12:45

1 Answer 1

5

You need to set DEBIAN_FRONTEND=noninteractive inside the sudo environment - not before it:

Ex.

$ sudo DEBIAN_FRONTEND=noninteractive sh -c 'echo $DEBIAN_FRONTEND'
noninteractive

whereas

$ DEBIAN_FRONTEND=noninteractive sudo sh -c 'echo $DEBIAN_FRONTEND'
(empty)

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.