Bug#980436: grub-pc should not suggest LVM physical volumes on a RAID1

Harald Dunkel harri at afaics.de
Tue Jan 19 06:00:30 GMT 2021


Package: grub-pc
Version: 2.04-12

The grub-pc.postinst script lists all my disks to install grub. It
also provides an option to install grub on /dev/md0 (i.e. my RAID1),
even though there is no valid boot sector. Its a physical volume for
LVM2. It is easy to select /dev/md0 in the debconf menu by accident,
potentially corrupting the physical volume.

parted and others show

# parted /dev/md0 u s p
Error: /dev/md0: unrecognised disk label
Model: Linux Software RAID Array (md)
Disk /dev/md0: 7813770880s
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:

# lsscsi
[2:0:0:0]    disk    ATA      WDC WD40EFRX-68W 0A82  /dev/sda
[4:0:0:0]    disk    ATA      WDC WD40EFRX-68N 0A82  /dev/sdc
[5:0:0:0]    disk    ATA      WDC WD40EFRX-68N 0A82  /dev/sdb
[6:0:0:0]    cd/dvd  HL-DT-ST BD-RE BP06LU10   HL03  /dev/sr0
[N:0:4:1]    disk    Samsung SSD 970 EVO Plus 1TB__1            /dev/nvme0n1

# lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                 8:0    0   3.6T  0 disk
|-sda1              8:1    0 992.5K  0 part
`-sda2              8:2    0   3.6T  0 part
sdb                 8:16   0   3.6T  0 disk
|-sdb1              8:17   0 992.5K  0 part
`-sdb2              8:18   0   3.6T  0 part
   `-md0             9:0    0   3.6T  0 raid1
     |-vg01-root   253:0    0    32G  0 lvm
     |-vg01-swap   253:1    0    32G  0 lvm
     `-vg01-export 253:2    0   3.6T  0 lvm   /export
sdc                 8:32   0   3.6T  0 disk
|-sdc1              8:33   0 992.5K  0 part
`-sdc2              8:34   0   3.6T  0 part
   `-md0             9:0    0   3.6T  0 raid1
     |-vg01-root   253:0    0    32G  0 lvm
     |-vg01-swap   253:1    0    32G  0 lvm
     `-vg01-export 253:2    0   3.6T  0 lvm   /export
sr0                11:0    1  1024M  0 rom
nvme0n1           259:0    0 931.5G  0 disk
|-nvme0n1p1       259:1    0    32G  0 part  /
|-nvme0n1p2       259:2    0    32G  0 part  [SWAP]
`-nvme0n1p3       259:3    0 867.5G  0 part  /local

# blkid | sort
/dev/mapper/vg01-export: LABEL="export" UUID="5717b619-2687-4fe0-be84-025c2b289fd1" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg01-root: LABEL="root" UUID="c6a4266c-b164-47f3-b40d-c6ce8b0e71c8" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg01-swap: LABEL="swap" UUID="3a47b489-62f5-4728-9d52-880efe84e8a0" TYPE="swap"
/dev/md0: UUID="gnk29Q-hu2d-1m83-V2Ke-kNxB-r7BR-o2Q0OI" TYPE="LVM2_member"
/dev/nvme0n1p1: LABEL="nvmeroot" UUID="d6b6d2f3-8213-4221-9a69-df7dc69acc45" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="fc91c342-01"
/dev/nvme0n1p2: LABEL="nvmeswap" UUID="4863a5dd-9395-4ec9-a647-02dd64cf80f1" TYPE="swap" PARTUUID="fc91c342-02"
/dev/nvme0n1p3: LABEL="nvmelocal" UUID="6b8b2a25-88d1-4292-b957-d701a39d83fd" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="fc91c342-03"
/dev/sda1: PARTLABEL="bios_grub" PARTUUID="dc5b91c4-41ca-4a44-b38f-af7b3bcecec3"
/dev/sda2: LABEL="data10" UUID="cde2182f-6472-4d22-9743-7a6a0211e415" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="data10" PARTUUID="f669b240-030c-4948-be2a-d40bd677124c"
/dev/sdb1: PARTLABEL="bios_grub" PARTUUID="c941f8dd-f110-4dfe-8faa-0d1b7b95519c"
/dev/sdb2: UUID="6ef149ac-0672-a4c3-5f58-d96e3949124b" UUID_SUB="c794091e-0b56-de68-8452-8692bbcf3e6e" LABEL="cecil.afaics.de:0" TYPE="linux_raid_member" PARTLABEL="raid1" PARTUUID="8c6a95c1-c412-44ae-8668-3dd8c4c0c2c6"
/dev/sdc1: PARTLABEL="bios_grub" PARTUUID="01b16890-b414-43fd-bf97-c266c32b6bbe"
/dev/sdc2: UUID="6ef149ac-0672-a4c3-5f58-d96e3949124b" UUID_SUB="68a9bcf9-ad9f-581a-2fed-228207918ba0" LABEL="cecil.afaics.de:0" TYPE="linux_raid_member" PARTLABEL="raid1" PARTUUID="f19cfa57-3786-497e-9edb-a958417e0682"


Please note the TYPE="LVM2_member" for /dev/md0. Should be easy to recognize.

Of course I didn't try if it *really* corrupts /dev/md0.


Regards
Harri



More information about the Pkg-grub-devel mailing list