# Running update grub-pc in noninteractive mode

**URL:** <https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 23, 2023, 10:14am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541 "2023-10-23T10:14:33Z")\
**Posts on this page:** 9\
**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:** [October 23, 2023, 10:14am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/1 "2023-10-23T10:14:33Z")

</div>

We are trying to update packages on several AWS servers via ansible. In the beginning of our playbook we have the environment to noninteractive like this:  
environment:  
DEBIAN\_FRONTEND: noninteractive

When I run an update (or try to install anything, I get the error stating “/dev/sda does not exist”. That is because for example, when provisioning AWS nodes, the disk type is not /dev/sda but something else.

My question is how do i run update grub-pc with a specific disk? I’m assuming I would get the disk “name” from ansible\_facts (devices), grab the first disk, then run something similar to “apt install grub-pc /dev/nvme01”

Is there a way to do this? I tried the line above and it failed and I’m out of ideas.

---

<div class="post-metadata">

**Author:** ![Thanh\_Nguyen\_Duc](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@Thanh\_Nguyen\_Duc](https://forum.ansible.com/u/Thanh_Nguyen_Duc)\
**Post date:** [October 23, 2023, 10:33am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/2 "2023-10-23T10:33:03Z")

</div>

You may try to gather fact, register the fact then execute the command in the next task. For me i usually use shell to query what i need before proceeding next step, save a bit of time.

— Example:

---

<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:** [October 23, 2023, 10:45am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/3 "2023-10-23T10:45:30Z")

</div>

The only issue is that I don’t know what the name of the disk is - /dev/sda, dev/nvme0n1p1, etc.

---

<div class="post-metadata">

**Author:** ![Thanh\_Nguyen\_Duc](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@Thanh\_Nguyen\_Duc](https://forum.ansible.com/u/Thanh_Nguyen_Duc)\
**Post date:** [October 23, 2023, 10:56am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/4 "2023-10-23T10:56:20Z")

</div>

Example if you know your command only need to execute from the first disk

fdisk -l | grep “^/dev/” | cut -d’ ’ -f1

You may need to custom abit then.

Vào Th 2, 23 thg 10, 2023 vào lúc 18:45 Kathy Lyons \<[lyonsfive@gmail.com](mailto:lyonsfive@gmail.com)\> đã viết:

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [October 23, 2023, 11:15am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/5 "2023-10-23T11:15:11Z")

</div>

What exactly do you mean by ‘update packages’?  
We’re using Debian EC2 instances and never had to bother with manually selecting disks/devices…

---

<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:** [October 23, 2023, 11:31am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/6 "2023-10-23T11:31:27Z")

</div>

That’s great - thank you!

Now, does anyone know how I can do an “update grub-pc” with that particular hard drive so it doesn’t prompt me for the disk drive?

---

<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:** [October 23, 2023, 11:34am UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/7 "2023-10-23T11:34:06Z")

</div>

Dick - just this morning I went to update packages on an AWS instance and it failed because the disk was not /dev/sda. I had to logon to the box, issue apt update -y, then a dialog popped up asking me for the drive to install grub-pc on.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [October 23, 2023, 12:49pm UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/8 "2023-10-23T12:49:56Z")

</div>

What AMI are you using?

---

<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:** [October 23, 2023, 1:08pm UTC](https://forum.ansible.com/t/running-update-grub-pc-in-noninteractive-mode/38541/9 "2023-10-23T13:08:39Z")

</div>

A generic Deb 11 image - not one we “own”.
