Comment 3 for bug 1993503

Revision history for this message
Daniel Krambrock (danielky) wrote :

Hi Brett.

As for cc_grub_dpkg:

In the case of /boot being on a mdraid cc_grub_dpkg is not fit for deciding on where to install grub onto. In my case there is:

```
~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 79.9M 1 loop /snap/lxd/22923
loop1 7:1 0 62M 1 loop /snap/core20/1587
loop2 7:2 0 47M 1 loop /snap/snapd/16292
loop3 7:3 0 48M 1 loop /snap/snapd/17336
loop4 7:4 0 63.2M 1 loop /snap/core20/1623
loop5 7:5 0 103M 1 loop /snap/lxd/23541
sda 8:0 0 16G 0 disk
├─sda1 8:1 0 2G 0 part [SWAP]
└─sda2 8:2 0 14G 0 part
  └─md0 9:0 0 14G 0 raid1
    └─vg0-lv_root 253:0 0 10G 0 lvm /
sdb 8:16 0 16G 0 disk
├─sdb1 8:17 0 2G 0 part [SWAP]
└─sdb2 8:18 0 14G 0 part
  └─md0 9:0 0 14G 0 raid1
    └─vg0-lv_root 253:0 0 10G 0 lvm /
```

And grub is installed on both sda and sdb.

cc_grub_dpkg runs `grub-probe -t disk /boot`:
```
~# grub-probe -t disk /boot
/dev/mapper/vg0-lv_root
```

And then:
```
~# udevadm info --root --query=symlink /dev/mapper/vg0-lv_root
/dev/disk/by-id/dm-uuid-LVM-BindKhTTGAfz7SYEYNKBhYfDBDMFj1rUd0gseyG07zzER7dQAaTIie7dxnIpxQZP /dev/disk/by-dname/vg0-lv_root /dev/vg0/lv_root /dev/mapper/vg0-lv_root /dev/disk/by-id/dm-name-vg0-lv_root /dev/disk/by-uuid/8f1733e5-498d-4f1b-aab7-f64acc678e8f
```

It picks the "disk/by-id" item (/dev/disk/by-id/dm-name-vg0-lv_root) and sets the grub-pc debconf item "grub-pc/install_devices" to that. This is in almost any case not a good choice.

Detecting the raid-setup and the right disks might be out of scope for cc_grub_dpkg, so why not just skip setting the "grub-pc/install_devices" item if it is already set in debconf and there is no "grub-pc/install_devices" given in cc_grub_dpkg config?

Bests, daniel