I have an ansible playbook running against a Debian 10 VM. At the top of my playbook I have this environment variable:
environment:
DEBIAN-FRONTEND: noninteractive
When I try to install any package, or update all packages I get the following error:
…
Setting up grub-pc…
/dev/sda does not exist, so cannot grub-install to it!
You must correct your GRUB install devices before proceeding
DEBIAN_FRONTEND=dialog dpkg --configure grub-pc
dpkg --configure -a
dpkg: error processing package grub-pc
installed grub-pc package post-installation script subprocess returne error exit status 1
dpkg: depending problems prevent configuration of grub2:
grub2 depends on grub-pc (= 2.06-3-deb10u4); however:
Package grub-pc is not configured yet.
Where is /dev/sda set as the disk to run grub-pc against? (Or is that the default?) Do I have to find the real hard drive and pass it to grub-pc? I obviously don’t want a dialog to pop up as this will be running against multiple machines, some of which I can’t ssh into.
Can anyone help me figure out how to get around this?
Not 'holding' but you pre populate the questions to avoid the
prompting. Sadly `DEBIAN-FRONTEND: noninteractive` is not enough to
avoid prompts when the package requires and answer, so the only way
around this issue is 'answering before they ask', dpkg_selections
allows you to do this.
Sorry, I meant debconf, not dpkg_selections (not sure why I keep
confusing those), here is an example of me doing the same for
installing java package.
That make sense. I am trying to upgrade grub-pc which then prompts for the hard drive where / is mounted. When I type in debconf-show grub-pc I get a number of variables, including “install_devices”. I expect this to be something like /dev/sda or dev/nvme0n1p1, but instead it reads something similar to "/dev/disk/by-id/ata-LITEONIT_LCS256M6S…
This is what I expected to do with the debconf module:
I took your suggestion to use debconf. The only issue is that in order to use debconf, I have to install debconf-utils. And when I try to install that, it tries to install grub-pc and the dialog appears.
I’m not sure where to go from here - I can’t update grub-pc or install anything without it trying to update grub-pc and bringing up a dialog box.
In the beginning of my playbook I have this:
environment:
DEBIAN_FRONTEND: noninteractive
which doesn’t seem to have any effect. (Someone suggested that it should be debian-frontend, but I did some research and it is indeed debian_frontend.)
I’m back. Now the problem I have has migrated to Debian 11. I am trying to update packages which gives me the error below. So then I try to install grub-pc by its own which does not work. Any further ideas?
Here is the code I am using and still I get the error “dpkg: dependency problems prevent configuration of grub2” and my ansible playbook dies.