grub install error with root on LVM

Thomas Neumann blacky+fai at fluffbunny.de
Thu Jul 31 16:17:07 CEST 2014


Hello Aaron

On Thursday 31 July 2014 08:44:28 Aaron Hall wrote:
> But if after this error, I go into a shell and "chroot /target", I can
> run "grub-install /dev/sda" and that works: the installed system boots
> fine off the LVM. If we set up root or /boot as a traditional physical
> partition, this does not happen.

Aside from possible bugs in setup-storage: My advice would be to always 
reserve a physical partition for boot and swap. For /boot it's just about 
principle of least surprise and keep all configurations as similar as possible. 
(root on LVM does not require separate boot partition, root on encrypted LVM 
requires /boot, root on LVM on GPT may require separate partition, root on 
btrfs - who knows?) I cannot be bothered to RTFM for each combination of 
msdos/gpt/md/lvm so I prefere to always configure a separate /boot.

Separate swap partition avoids a deadlock if the memory is exhausted. At least 
in the past it was possible for the kernel to deadlock itself if swap was 
placed on LVM.

It was roughly like this:

  1) I need some memory.
  2) Free memory is exhausted. I need to free some memory first.
  3) I need to allocate some pages for swapping out memory.
  4) swap needs to write data
  5) LVM needs some memory to manage the swap LV
  6) proceed with 1)

I do not know if the bug still exists. (Maybe it's not even fixable?) Just to 
be sure I always configure at least one physical swap partition.
 
>   disk_config sda
>   primary /boot           300             ext4    rw
>   primary - 0- - -
 
>   disk_config lvm
>   vg VolGroup00 sda2
>   VolGroup00-LVroot     /       4096    ext4 rw
>   VolGroup00-LVswap     swap    2048    swap    sw
>   VolGroup00-LVusr     /usr       4096    ext4 rw
>   VolGroup00-LVvar     /var       4096    ext4 rw
 
> Are we doing something wrong? We're still not sure we're using
> setup-storage correctly.

Looks fine to me. You could improve the config a bit by using align-at:4KiB to 
disk_config sda to avoid a misalignment between partition layout and the 
underlying device geometry.

disk_config sda align-at:4KiB
primary /boot  300MiB    ext4    rw
primary swap   2GiB      swap sw
primary -      12GiB-    -        -

disk_config lvm
vg VolGroup00 sda3
VolGroup00-LVroot    /       4GiB    ext4 rw
VolGroup00-LVusr     /usr    4GiB    ext4 rw,nodev
VolGroup00-LVvar     /var    4GiB    ext4 rw,nodev

(I also replaced all raw numbers with appropriate units and configured the 
correct minimum size for the LVM PV. Additional tip: if this is a VM configure 
/tmp and optionally /var/tmp as tmpfs devices to improve performance.)

tschüß
thomas


More information about the linux-fai mailing list