Score:1

ubiquity installer fails to install grub to correct path

us flag

am I missing something or why can't grub always be installed where it is directed to with manual partitioning + preseed?

I use a preseed file for xubuntu 20.04.2 desktop that is devoid of partitioning directives. when "automatic-ubiquity" is booted, after manually partitioning sda selecting /dev/sda1 is ignored and grub is installed into /dev/sda.

added d-i grub-installer/only_debian boolean false and/or d-i grub-installer/with_other_os boolean false to preseed. after manually partitioning sda selecting /dev/sda1 is ignored and grub is installed into /dev/sda.

I hacked a way to dynamically set d-i grub-installer/bootdev string default but that requires booting into the live environment, partitioning the disk and setting the active partition first, then starting "ubiquity -‑automatic" or rebooting with "automatic-ubiquity".

d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string default
d-i partman/early_command string                                               \
 BOOTFLAG=$(lsblk -rpo PARTFLAGS,PKNAME,PATH | grep "0x80" | cut -f 3 -d ' '); \
 if [ $BOOTFLAG ]; then debconf-set grub-installer/bootdev $BOOTFLAG; fi;

testing this works with a vm with a single disk, but may not work as desired on hardware with multiple disks or installing from usb.

d-i grub-installer/skip boolean true seems ignored always. again I hacked a way to make that work, I set d-i grub-installer/bootdev string leaving it empty. manually installing grub in ubiquity/success_command does not work though. inspecting the first few sectors of /dev/sda1, all are 00. the other command completes sucessfully.

d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string 
ubiquity ubiquity/success_command string                                       \
 in-target grub-install -‑force /dev/sda1;                                     \
 echo "tmpfs /tmp tmpfs nosuid,nodev 0 0" >> /target/etc/fstab;
guiverc avatar
cn flag
Grub's MBR goes to a device (sda) and **not** a partition (sda1). The first 512 bytes of the drive (outside of partitioning space) has been reserved for the MBR since ~1981 and machines won't boot if it's on a partition (using legacy/BIOS standard)
dickfitzwell avatar
us flag
riiight. I should have made it more clear that the reason I want to install to the partition is because I use a alternate boot loader. also, while not recommended, grub CAN be installed to the partition and chainloaded from said alternate boot loader.
oldfred avatar
cn flag
If using another boot loader you may not even need to install grub. `sudo ubiquity -b` http://askubuntu.com/questions/838450/how-can-ubiquity-be-forced-not-to-install-grub/838527#838527
Score:0
us flag

eventually I dropped the partman/early_command method. currently I set grub-installer/bootdev to empty and the use ubiquity/success_command to force install grub to the /target partition and mark it active.

kind of ugly, but it works. tested for sata/nvme/mbr partition table only and separate boot/home/root partitions with ext2/3/4.

d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string 
ubiquity ubiquity/success_command string                                   \
 echo 'tmpfs /tmp tmpfs nosuid,nodev 0 0' >> /target/etc/fstab            ;\
 worker() { grub-install --force --root-directory=/target $2             &&\
 parted -s $3 -- set ${4##*-} boot on; }                                  ;\
 worker $(lsblk -lpo MOUNTPOINT,KNAME,PKNAME,PARTUUID | grep '/target ');

ultimately I think ubiquity needs to be updated to reflect the selections in the gui.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.