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?
Thanks!
boot the Linux installation manually from Grub2 command prompt. run 'grub-install' from Linux to reinstall the Grub2 boot code to a partition. run 'update-grub' or 'grub2-mkconfig' from Linux to generate a new copy of grub. cfg.
Reinstall Ubuntu GRUB Boot Loader. 1. After you've downloaded and burned the Ubuntu ISO image, or created a bootable USB stick, place the bootable media into your appropriate machine drive, reboot the machine and instruct the BIOS to boot into Ubuntu live image.
The GRUB 2 files will normally be located in the /boot/grub and /etc/grub. d folders and the /etc/default/grub file in the partition containing the Ubuntu installation. If another Ubuntu/Linux distribution controlled the boot process, it will be replaced by the GRUB 2 settings in the new installation.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With