When uninstalling all GRUB packages for EC2 AMI build script, how do I bypass prompting?

Posted by Skaperen on Ask Ubuntu See other posts from Ask Ubuntu or by Skaperen
Published on 2012-10-03T02:45:10Z Indexed on 2012/10/03 3:50 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

When I try to uninstall all GRUB packages from the cloud-image version of Ubuntu I use in AWS EC2, I get an interactive prompt. I need put this all in a script under automation, so prompts need to be avoided. I have searched for means to bypass this, and all of the features like debconf apply to prompts for config settings which can be provided in advance. But the prompt I am getting is not a config prompt. It would be in the class of "are you sure" prompts. I tried --force-all and that did not work. The prompt is referring to the files in /boot/grub so I tried by first doing "rm -fr /boot/grub" (they do all go away) and it still prompts to ask me if I want to delete them even though there is nothing to delete.

The wording of the prompt is:

Do you want to have all GRUB 2 files removed from /boot/grub?
This will make the system unbootable unless another boot loader is installed.
Remove GRUB 2 from /boot/grub?
                     <YES>                         <NO>

The command I am doing is:

dpkg --purge grub-common grub-gfxpayload-lists grub-legacy-ec2 grub-pc grub-pc-bin grub2-common

How can I get past this prompt without trying to encapsulate it in something that tries to answer (which itself has issues when there is no TTY so I want to avoid that) ?

© Ask Ubuntu or respective owner

Related posts about grub2

Related posts about uninstall