# updating grub via Ansible without presenting a dialog box

**URL:** <https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691>\
**Category:** Ansible Project\
**Created:** [February 23, 2023, 12:34pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691 "2023-02-23T12:34:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kathy\_L](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kathy_l/32/2652_2.png) [@Kathy\_L](https://forum.ansible.com/u/Kathy_L)\
**Post date:** [February 23, 2023, 12:34pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/1 "2023-02-23T12:34:11Z")

</div>

We are updating packages via Ansible, and when grub needs to be run after the update, it fails on Debian 11. When I run the update command manually, grub displays a dialog box asking the user to select the grub install device (/dev/vda, /dev/vda2, /dev/vda3, etc.).

We have our playbook running with an environment variable DEBIAN\_FRONTEND: noninteractive.

How do we fix this error in Ansible?

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [February 23, 2023, 12:46pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/2 "2023-02-23T12:46:23Z")

</div>

Is there a way to specify the install device on the command line / in the module so it doesn’t prompt?

Walter

---

<div class="post-metadata">

**Author:** ![Kathy\_L](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kathy_l/32/2652_2.png) [@Kathy\_L](https://forum.ansible.com/u/Kathy_L)\
**Post date:** [February 23, 2023, 1:03pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/3 "2023-02-23T13:03:00Z")

</div>

That’s what we started to look at, but the issue becomes during a general package update, you don’t always know if grub will need to be updated. I’m not even sure how you’d tell this in an apt-get update.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [February 23, 2023, 6:56pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/4 "2023-02-23T18:56:48Z")

</div>

Sounds like you’ll need to `apt-mark hold grub` first, and handle updates to grub separately from the others.  
Also sounds like a bug in the grub package.

---

<div class="post-metadata">

**Author:** ![Kathy\_L](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kathy_l/32/2652_2.png) [@Kathy\_L](https://forum.ansible.com/u/Kathy_L)\
**Post date:** [February 27, 2023, 5:00pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/5 "2023-02-27T17:00:00Z")

</div>

If we do an apt-mark hold grub first, we are left with the dilemma of how to update grub without presenting a dialog. This is only happening on Debian 11 boxes. We have tried using the :

environment:  
DEBIAN\_FRONTEND: noninteractive

option, but it is not working.

---

<div class="post-metadata">

**Author:** ![Will\_McDonald](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@Will\_McDonald](https://forum.ansible.com/u/Will_McDonald)\
**Post date:** [February 27, 2023, 6:08pm UTC](https://forum.ansible.com/t/updating-grub-via-ansible-without-presenting-a-dialog-box/37691/6 "2023-02-27T18:08:24Z")

</div>

The core problem here is a grub / Debian issue rather than Ansible and it looks like you’ve already tried a few places for help. ([https://unix.stackexchange.com/questions/735375/update-grub-on-debian-11-fails](https://unix.stackexchange.com/questions/735375/update-grub-on-debian-11-fails) and [https://forums.debian.net/viewtopic.php?t=154015](https://forums.debian.net/viewtopic.php?t=154015))

1, Is it ALL Debian 11 machines or just one/a few?  
2. How was(/were) the VM(s) installed/created? If you create a new, clean VM, and just do a grub-update do you have the same problem?  
3. Try reviewing and feeding back on the questions/advice on either or both of SO and the Debian forum.

1. Try spinning up an AWS Debian 11 instance and compare/contrast to your broken instance(s). This is one I’ve just spun up moments ago:

root@ip-172-31-31-103:~# ls -l /etc/grub.d/  
total 84  
-rwxr-xr-x 1 root root 10046 Nov 8 17:29 00\_header  
-rwxr-xr-x 1 root root 6260 Nov 8 17:29 05\_debian\_theme  
-rwxr-xr-x 1 root root 14123 Nov 8 17:29 10\_linux  
-rwxr-xr-x 1 root root 14180 Nov 8 17:29 20\_linux\_xen  
-rwxr-xr-x 1 root root 12910 Nov 8 17:29 30\_os-prober  
-rwxr-xr-x 1 root root 1372 Nov 8 17:29 30\_uefi-firmware  
-rwxr-xr-x 1 root root 214 Nov 8 17:29 40\_custom  
-rwxr-xr-x 1 root root 215 Nov 8 17:29 41\_custom  
-rw-r–r-- 1 root root 483 Nov 8 17:29 README  
-rw-r–r-- 1 root root 0 Jan 24 04:24 enable\_cloud

root@ip-172-31-31-103:~# ls -l /etc/default/grub.d/  
total 8  
-rw-r–r-- 1 root root 15 Jan 24 04:27 15\_timeout.cfg  
-rw-r–r-- 1 root root 274 Aug 3 2022 init-select.cfg

root@ip-172-31-31-103:~# update-grub  
Generating grub configuration file …  
Found linux image: /boot/vmlinuz-5.10.0-21-cloud-amd64  
Found initrd image: /boot/initrd.img-5.10.0-21-cloud-amd64  
done

Something’s borked your grub build config, you need to find and fix that.
