6

I've exported a completely done VM image from Virtualbox and am trying to do an unattended setup with a script I created. So, when I get to apt-get upgrade this window eventually pops up which is making my script hang. The user should not have to do interact with the setup at all.

How can I get past this automatically for the user? Or just ignore the grub update?

grub-pc

Thanks!

Godzilla74
  • 2,358
  • 1
  • 31
  • 67

1 Answers1

11

Try this:

apt-get -y upgrade

and if that does not work, try this:

DEBIAN_FRONTEND=noninteractive apt-get -y upgrade

Please note: using the code above would just simply tell the system to choose the default answer for each question (do you always want the default answer? think about that).

Edit: there's one more situation in which the system could still ask the user to interact with the upgrade: if you manually modified a configuration file of a program that will be updated, the system may halt the upgrade and ask you whether you want to keep the old configuration file or overwrite it with the new configuration file. The code below would avoid the system asking the user to make this choice:

DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" upgrade

Regarding the configuration file, the code above would instruct the system to:

1) Check if the package being installed specifies by default that the new configuration file should be installed - if that is the case, then the new configuration file will be installed and overwrite the old one.

2) If the package being installed does not specify by default that the new configuration file should be installed, then the old configuration file would be kept - that is very useful, specially when you customized the installation of that package.

Jamil Said
  • 2,033
  • 3
  • 15
  • 18