1

I am trying to preseed installing grub dynamically with to two disks with an early_command. I am using IPXE. Here is the relevant part:

d-i partman/early_command string \
DISKA=$(realpath /dev/disk/by-id/ata-SuperMicro_SSD_* /dev/disk/by-id/ata-SATA_SSD_*|grep -o '/dev/sd[a-z]'|uniq|sort|head -n1); \
DISKB=$(realpath /dev/disk/by-id/ata-SuperMicro_SSD_* /dev/disk/by-id/ata-SATA_SSD_*|grep -o '/dev/sd[a-z]'|uniq|sort|head -n2|tail -1); \
if [ "${DISKA}" == "" ]; then DISKA="/dev/sda"; fi; \
if [ "${DISKB}" == "" ]; then DISKB="/dev/sdb"; fi; \
debconf-set partman-auto/disk "$DISKA $DISKB"; \
debconf-set partman-auto-raid/recipe "1 2 0 ext4 / ${DISKA}2#${DISKB}2 . 1 2 0 lvm - ${DISKA}4#${DISKB}4 ."; \
debconf-set grub-installer/bootdev "$DISKA $DISKB";

I tried the above with multiple variations (true, false) of the following and without them as well:

d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean false

I even tried it within the early_command:

debconf-set grub-installer/only_debian false; \
debconf-set grub-installer/with_other_os false;

Unfortunately the Install the GRUB boot loader on a hard disk dialog still showing up with the correct disk as shown below, so I need to confirm and continue. Can I preseed this automatically?

Install GRUB to disk

1

Got it. I have to remove the double quotes from the lines:

debconf-set partman-auto/disk "$DISKA $DISKB"; \
debconf-set grub-installer/bootdev "$DISKA $DISKB";

to become:

debconf-set partman-auto/disk "$DISKA $DISKB"; \
debconf-set grub-installer/bootdev $DISKA $DISKB;

EDIT

after reboot I found out that grub was only installed on /dev/sda with the following command dd bs=512 count=1 if=/dev/sda 2>/dev/null | strings, which returns:

ZRr=
`|f 
\|f1
GRUB 
Geom
Hard Disk
Read
 Error

running the same command on /dev/sdb returns nothing which means the first 512B of the disk are empty, so I had to install grub manually to /dev/sdb as follows:

# grub-install /dev/sdb
# dd bs=512 count=1 if=/dev/sdb 2>/dev/null | strings
ZRr=
`|f 
\|f1
GRUB 
Geom
Hard Disk
Read
 Error

I still can't find a way to install grub in to two disks with the early_command

Thanks

1

it seems unti now the only workaround is to add the following two line to the early_command:

. /usr/share/debconf/confmodule;\
db_fset grub-installer/bootdev seen true

so it becomes:

.....
debconf-set grub-installer/bootdev "$DISKA $DISKB";\
. /usr/share/debconf/confmodule;\
db_fset grub-installer/bootdev seen true

I hope this will be fixed soon.

1

This bug is already reported in 2013. It seem that the dialog always shows up when using LVM and/or RAID.

https://wiki.debian.org/DebianInstaller/Bugs/GrubInstaller

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712907

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.