B
B
bozuriciyu2019-09-09 16:29:07
linux
bozuriciyu, 2019-09-09 16:29:07

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)
5d76537e1b6b1932130834.png
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

5 answer(s)
A
Andrey Barbolin, 2019-09-09
@bozuriciyu

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

R
Radjah, 2019-09-09
@Radjah

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/

B
blackbeard, 2019-09-09
@Black_beard_ast

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?

R
Ruslan Fedoseev, 2019-09-09
@martin74ua

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...

I
Ivan Shumov, 2019-09-09
@inoise

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 question

Ask a Question

731 491 924 answers to any question