Answer the question
In order to leave comments, you need to log in
How to automate grub setup?
I have a small script that did the basic setup of a Debian 9 server. Everything was ok for months, but today, on newly created instances in Google Cloud, the script breaks, at the stage sudo apt-get update && sudo apt-get upgrade -y
- a looped output appears in the console, something related to grub.
After manually checking this script on a new instance, I see this window (which was not automated in the old bash script, because it simply did not exist before)
How to deal with it? Do I need to somehow write this setting into the script? Or can it be turned off? Why did it come out at all?
Answer the question
In order to leave comments, you need to log in
While installing the package, the installer found that it already had a configuration file on the system and that it was different from the file in the package. And in order not to break your system with this update, it offers you to resolve this dependency yourself. To skip such questions, add the --force-confdef key.
man dpkg
confnew: If a conffile has been modified and the version in the package did change, always install the new version without prompting, unless the --force-confdef is also specified, in which case the default action is
preferred.
you should set DEBIAN_FRONTEND=noninteractive, this will stop debconf prompts from appearing.
After that, add force-confold and force-confdef to your /etc/dpkg/dpkg.cfg file. then use the -y option
sudo apt-get -y update && sudo apt-get -y upgrade
or use this command
apt-get -o Dpkg::Options::="--force-confnew --force-confdef" --force-yes -y upgrade
and if it doesn't work try
apt-get -o Dpkg::Options::="--force-confnew" --force-yes -y upgrade
No need to edit configs from the package. To do this, there are always directories like grub.conf.d where you need to put your changes. For grub there is /etc/default/grub.d/
How to be with him? Do I need to somehow write this setting into the script?
Yes! It's my pleasure.
PS: Didn't ks-files come to Debian?
Look towards ansible
The problem is that /etc/default/grub was changed during the installation process and suddenly an update arrived that the package manager could not merge automatically. Most likely there should be a key that does this forcibly.
PS. Debian, so Debian...
Are you still configuring with handles? Then we go to you!
Ansible, Chef, Puppet, Salt at your service (the first two are the most common) and Infrastracture as Code. You will be able to test all your changes before deploying for errors, versioning and running on other virtual machines in which case. If you are in GCP, then add k8s and terraform to your list, but that's later
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question