在安装过程中如何预先安装Grub到设备而无需提示?

我正在尝试进行完全自动化的Ubuntu预置安装。我遇到了困难,因为我无法预置答案来将Grub安装在除/dev/sda之外的设备上,而不需要手动按下"Enter"键继续安装。
它显示如下:
[!] 在硬盘上安装Grub引导加载程序
并正确选择了我要安装引导加载程序的设备,但仍然需要我手动按下Enter键。
您可以在这里看到它的图片:

http://i.imgur.com/lWvAHWV.png

我在我的预设中尝试了各种不同的数值组合,但它们最终都得到了相同的结果。
# Option 1 (works when installing to /dev/sda. Prompts with sdm)
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

# Option 2
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/sdm

# Option 3
d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev  string /dev/sdm

# Option 2
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/sdm

I've also tried adding the following:
d-i grub-pc/install_devices multiselect /dev/sdm

无论这些设置如何,我都会收到提示。
在安装过程中,我将日志设置为详细模式。当我被提示停止时,日志显示了以下内容:
Dec  9 07:30:35 debconf: --> SET grub-installer/bootdev /dev/sdm
Dec  9 07:30:35 debconf: <-- 0 value set
Dec  9 07:30:35 debconf: --> PROGRESS STEP 1
Dec  9 07:30:35 debconf: <-- 0 OK
Dec  9 07:30:35 debconf: --> PROGRESS INFO grub-installer/progress/step_bootdev
Dec  9 07:30:35 debconf: <-- 0 OK
Dec  9 07:30:35 debconf: --> INPUT critical grub-installer/bootdev
Dec  9 07:30:35 debconf: <-- 0 question will be asked
Dec  9 07:30:35 debconf: --> GO

如果我按下回车键并继续安装,它会继续进行到这一步:
Dec  9 07:30:35 debconf: --> SET grub-installer/bootdev /dev/sdm
Dec  9 07:30:35 debconf: <-- 0 value set
Dec  9 07:30:35 debconf: --> PROGRESS STEP 1
Dec  9 07:30:35 debconf: <-- 0 OK
Dec  9 07:30:35 debconf: --> PROGRESS INFO grub-installer/progress/step_bootdev
Dec  9 07:30:35 debconf: <-- 0 OK
Dec  9 07:30:35 debconf: --> INPUT critical grub-installer/bootdev
Dec  9 07:30:35 debconf: <-- 0 question will be asked
Dec  9 07:30:35 debconf: --> GO
Dec  9 07:37:20 debconf: <-- 0 ok
Dec  9 07:37:20 debconf: --> GET grub-installer/bootdev
Dec  9 07:37:20 debconf: <-- 0 /dev/sdm
Dec  9 07:37:20 debconf: --> PROGRESS STEP 1
Dec  9 07:37:20 debconf: <-- 0 OK
Dec  9 07:37:20 debconf: --> SUBST grub-installer/progress/step_install_loader BOOTDEV /dev/sdm
Dec  9 07:37:20 debconf: Adding [BOOTDEV] -> [/dev/sdm]
Dec  9 07:37:20 debconf: <-- 0
Dec  9 07:37:20 debconf: --> PROGRESS INFO grub-installer/progress/step_install_loader
Dec  9 07:37:20 debconf: <-- 0 OK
Dec  9 07:37:20 grub-installer: info: Installing grub on '/dev/sdm'
Dec  9 07:37:20 grub-installer: info: grub-install supports --no-floppy
Dec  9 07:37:20 grub-installer: info: Running chroot /target grub-install  --no-floppy --force "/dev/sdm"
Dec  9 07:37:22 grub-installer: Installation finished. No error reported.
Dec  9 07:37:22 grub-installer: info: grub-install ran successfully
...

我不太清楚准确的提示是什么。是这个吗?
Dec  9 07:37:20 debconf: <-- 0 ok

如果是这样的话,我该如何输入一个“好”呢?
非常感谢任何帮助。
2个回答

在你的预设文件中,这一行应该出现在更高的位置:
d-i debconf/priority string critical

这样做可以确保只有“关键”的问题被提出。
仅凭这一行似乎已经足够提供足够的信息,以便将引导加载程序放置在/dev/sda上;
根据您的需求进行修改。
d-i grub-installer/bootdev string /dev/sda

关于你的另一个问题,行“<-- 0 ok”只是一个返回值(成功);你可以忽略它。
希望这能帮到你。

仅仅设置debconf/priority=critical是不够的。虽然应该是这样,但安装程序似乎存在一个错误,详见bug 1012629 - RolKau

我也很高兴如果我能找到如何自动回答“是”这个问题,意思是我对它建议的任何内容都感到满意。通常情况下,它与您用于分区和安装操作系统的设备相同(由partman使用)。
对于Stephen的问题。如果你可以硬编码指定grub的安装位置,那就没问题。 如果这样不起作用:
d-i grub-installer/bootdev string /dev/sdb

尝试:

grub-pc grub-pc/install_devices string /dev/sdb

我的希望是找到如何自动回答Grub问题,而无需为安装Grub的位置指定静态名称。只需自动按下回车键即可。