Won't boot if grub on partition holding the LVM root fs

Bug #900393 reported by Stephane Chazelas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

$ apt-cache policy libblkid1
libblkid1:
  Installed: 2.19.1-2ubuntu3
  Candidate: 2.19.1-2ubuntu3
  Version table:
 *** 2.19.1-2ubuntu3 0
        500 http://gb.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
        100 /var/lib/dpkg/status

blkid will fail to report a partition as a "LVM2 Member" if it contains a grub boot sector.

On Ubuntu 11.10 where VGs are activated by udev upon finding LVM physical volumes (as opposed to "lvm vgchange -ay" being run unconditionally in earlier versions), that means that it won't boot as it won't find the root FS:

<pre>
Gave up waiting for root device. Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
   - Check root= (did the system wait for the right device?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/VG_linux-ubuntu64 does not exist. Dropping to a shell!

BusyBox v1.18.4 (Ubuntu 1:1.18.4-2ubuntu2) built-in shell (ash)
Enter 'help' for a list of built-in commands.
(initramfs) blkid -o udev -p /dev/vda4
ID_PART_TABLE_TYPE=dos
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_TYPE=0x8e
ID_PART_ENTRY_FLAGS=0x80
ID_PART_ENTRY_NUMBER=4
(initramfs) lvm vgchange -ay
  5 logical volume(s) in volume group "VG_linux" now active
(initramfs) lvm pvs
  PV VG Fmt Attr PSize PFree
  /dev/vda4 VG_linux lvm2 a- 771.30g 503.30g
</pre>

It can be reproduced with the PV on a partition or on a full disk such as with this script:

<pre>
#! /bin/sh -
set -ex
truncate -s 1T test
qemu-nbd -c /dev/nbd0 test
sleep 1
pvcreate /dev/nbd0
vgcreate V /dev/nbd0
: Before grub:
blkid -o udev -p /dev/nbd0
xxd -r << \EOF 1<> /dev/nbd0
0000000: eb63 9000 0000 0000 0000 0000 0000 0000 .c..............
0000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000050: 0000 0000 0000 0000 0000 0080 7eb0 0300 ............~...
0000060: 0000 0000 fffa 9090 f6c2 8074 05f6 c270 ...........t...p
0000070: 7402 b280 ea79 7c00 0031 c08e d88e d0bc t....y|..1......
0000080: 0020 fba0 647c 3cff 7402 88c2 52be 807d . ..d|<.t...R..}
0000090: e817 01be 057c b441 bbaa 55cd 135a 5272 .....|.A..U..ZRr
00000a0: 3d81 fb55 aa75 3783 e101 7432 31c0 8944 =..U.u7...t21..D
00000b0: 0440 8844 ff89 4402 c704 1000 668b 1e5c .@.D..D.....f..\
00000c0: 7c66 895c 0866 8b1e 607c 6689 5c0c c744 |f.\.f..`|f.\..D
00000d0: 0600 70b4 42cd 1372 05bb 0070 eb76 b408 ..p.B..r...p.v..
00000e0: cd13 730d f6c2 800f 84d8 00be 8b7d e982 ..s..........}..
00000f0: 0066 0fb6 c688 64ff 4066 8944 040f b6d1 .f....d.@f.D....
0000100: c1e2 0288 e888 f440 8944 080f b6c2 c0e8 .......@.D......
0000110: 0266 8904 66a1 607c 6609 c075 4e66 a15c .f..f.`|f..uNf.\
0000120: 7c66 31d2 66f7 3488 d131 d266 f774 043b |f1.f.4..1.f.t.;
0000130: 4408 7d37 fec1 88c5 30c0 c1e8 0208 c188 D.}7....0.......
0000140: d05a 88c6 bb00 708e c331 dbb8 0102 cd13 .Z....p..1......
0000150: 721e 8cc3 601e b900 018e db31 f6bf 0080 r...`......1....
0000160: 8ec6 fcf3 a51f 61ff 265a 7cbe 867d eb03 ......a.&Z|..}..
0000170: be95 7de8 3400 be9a 7de8 2e00 cd18 ebfe ..}.4...}.......
0000180: 4752 5542 2000 4765 6f6d 0048 6172 6420 GRUB .Geom.Hard
0000190: 4469 736b 0052 6561 6400 2045 7272 6f72 Disk.Read. Error
00001a0: 0d0a 00bb 0100 b40e cd10 ac3c 0075 f4c3 ...........<.u..
00001b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00001c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00001d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.
EOF
: After grub:
blkid -o udev -p /dev/nbd0
: clean-up
vgchange -an V
qemu-nbd -d /dev/nbd0
rm -f test
</pre>

Which gives:

<pre>
$ sudo sh ./reproduce
+ truncate -s 1T test
+ qemu-nbd -c /dev/nbd0 test
+ sleep 1
+ pvcreate /dev/nbd0
  Writing physical volume data to disk "/dev/nbd0"
  Physical volume "/dev/nbd0" successfully created
+ vgcreate V /dev/nbd0
  Volume group "V" successfully created
+ : Before grub:
+ blkid -o udev -p /dev/nbd0
ID_FS_UUID=1iWyMS-ZzMm-l7nv-kLTc-V2Rq-CqRo-q4RTnz
ID_FS_UUID_ENC=1iWyMS-ZzMm-l7nv-kLTc-V2Rq-CqRo-q4RTnz
ID_FS_VERSION=LVM2\x20001
ID_FS_TYPE=LVM2_member
ID_FS_USAGE=raid
+ xxd -r
+ : After grub:
+ blkid -o udev -p /dev/nbd0
ID_PART_TABLE_TYPE=dos
+ : clean-up
+ vgchange -an V
  0 logical volume(s) in volume group "V" now active
+ qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected
+ rm -f test
</pre>

Revision history for this message
Stephane Chazelas (stephane-chazelas) wrote :

Actually,

00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.

It's the MBR signature (the 55aa above) that causes problem. If I replace it with "0000", blkid sees it as a LVM member again but the system doesn't boot as its not recognised as a boot sector.

Revision history for this message
Stephane Chazelas (stephane-chazelas) wrote :

Also affects 12.04

Phillip Susi (psusi)
Changed in util-linux (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.