Godzilla74 Godzilla74 - 1 year ago 88
Linux Question

Virtual machine apt-get grub issue

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?



Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download