You are not logged in.

#1 2012-11-30 16:03:44

fernando_costa
Member
Registered: 2011-02-03
Posts: 31

GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

Hi folks,

   I'm installing a brand new Arch Virtualbox VM and I got stuck trying to install Grub2 with a LVM /boot.

   The command:

grub-install --target=i386-pc --recheck --debug /dev/sda

   The error:

/usr/sbin/grub-bios-setup: info: Looking for /dev/sda.
/usr/sbin/grub-bios-setup: info: /dev/sda is a parent of /dev/sda.
/usr/sbin/grub-bios-setup: info: /dev/dm-4 is an LVM.
/usr/sbin/grub-bios-setup: info: the size of hostdisk//dev/sda is 20971520.
/usr/sbin/grub-bios-setup: info: Scanning for DISKFILTER devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid1x devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09 devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09_be devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Scanning for dmraid_nv devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Scanning for ldm devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: scanning hostdisk//dev/sda for LDM.
/usr/sbin/grub-bios-setup: info: no LDM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for lvm devices on disk hostdisk//dev/sda.
/usr/sbin/grub-bios-setup: info: Found array vg01.
/usr/sbin/grub-bios-setup: info: Inserting hostdisk//dev/sda into vg01 (lvm)
.
/usr/sbin/grub-bios-setup: info: the size of hostdisk//dev/sda is 20971520.
/usr/sbin/grub-bios-setup: info: Scanning for DISKFILTER devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid1x devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09 devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09_be devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: Scanning for dmraid_nv devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: Scanning for ldm devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: scanning lvm/vg01-lv_home for LDM.
/usr/sbin/grub-bios-setup: info: no LDM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for lvm devices on disk lvm/vg01-lv_home.
/usr/sbin/grub-bios-setup: info: no LVM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for DISKFILTER devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid1x devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09 devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09_be devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: Scanning for dmraid_nv devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: Scanning for ldm devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: scanning lvm/vg01-lv_system for LDM.
/usr/sbin/grub-bios-setup: info: no LDM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for lvm devices on disk lvm/vg01-lv_system.
/usr/sbin/grub-bios-setup: info: no LVM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for DISKFILTER devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid1x devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09 devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09_be devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: Scanning for dmraid_nv devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: Scanning for ldm devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: scanning lvm/vg01-lv_boot for LDM.
/usr/sbin/grub-bios-setup: info: no LDM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for lvm devices on disk lvm/vg01-lv_boot.
/usr/sbin/grub-bios-setup: info: no LVM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for DISKFILTER devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid1x devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09 devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: Scanning for mdraid09_be devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: Scanning for dmraid_nv devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: Scanning for ldm devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: scanning lvm/vg01-lv_swap for LDM.
/usr/sbin/grub-bios-setup: info: no LDM signature found.
/usr/sbin/grub-bios-setup: info: Scanning for lvm devices on disk lvm/vg01-lv_swap.
/usr/sbin/grub-bios-setup: info: no LVM signature found.
/usr/sbin/grub-bios-setup: info: guessed root_dev `lvm/vg01-lv_boot' from dir `/boot/grub/i386-pc'.
/usr/sbin/grub-bios-setup: info: setting the root device to `lvm/vg01-lv_boot'.
/usr/sbin/grub-bios-setup: error: unable to identify a filesystem in hostdisk//dev/sda; safety check can't be performed.
+ exit 1

   /etc/mkinitcpio.cfg:

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES="dm_mod"

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
# Some users may wish to include modprobe.conf for custom module options
# like so:
#    FILES="/etc/modprobe.d/modprobe.conf"
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS="base"
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS="base udev autodetect pata scsi sata filesystems"
#
##   This is identical to the above, except the old ide subsystem is
##   used for IDE devices instead of the new pata subsystem.
#    HOOKS="base udev autodetect ide scsi sata filesystems"
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS="base udev pata scsi sata usb filesystems"
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS="base udev pata mdadm encrypt filesystems"
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev usb lvm2 filesystems"
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev lvm2 pata sata usb filesystems usbinput autodetect"

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=""

   /boot/grub/grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ad4103fa-d940-47ca-8506-301d8071d467
else
  search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch GNU/Linux, with Linux core repo kernel' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-ad4103fa-d940-47ca-8506-301d8071d467' {
	insmod lvm	
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='vg01-lv_boot'
	#if [ x$feature_platform_search_hint = xy ]; then
	#  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ad4103fa-d940-47ca-8506-301d8071d467
	#else
	#  search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
	#fi
	echo	'Loading Linux core repo kernel ...'
	linux	/boot/vmlinuz-linux root=/dev/mapper/vg01-lv_system ro
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-linux.img
}
menuentry 'Arch GNU/Linux, with Linux core repo kernel (Fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-fallback-ad4103fa-d940-47ca-8506-301d8071d467' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='vg01-lv_boot'
	#if [ x$feature_platform_search_hint = xy ]; then
	#  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ad4103fa-d940-47ca-8506-301d8071d467
	#else
	#  search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
	#fi
	echo	'Loading Linux core repo kernel ...'
	linux	/boot/vmlinuz-linux root=/dev/mapper/vg01-lv_system ro
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-linux-fallback.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###



   Any ideas of what I'm doing wrong?


Regards,

Last edited by fernando_costa (2012-11-30 16:04:14)

Offline

#2 2012-11-30 23:11:38

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

Try this...

change mkinitcpio.conf to...

HOOKS="base udev autodetect pata scsi sata usb lvm2 filesystems usbinput fsck"

Then rebuild initramfs and grub.cfg

mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg

Last edited by hunterthomson (2012-11-30 23:13:09)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#3 2012-12-01 02:21:31

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

@hunterthomson, I don't think the OP is even able to get grub installed.  So although he/she probably does need the things you mention, they are problems that have not even had the possibility of arising.

Offline

#4 2012-12-02 02:17:19

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

Is everything necessary mounted correctly and so on? I take it that /boot is in the lvm. Is this set up correctly when you try to install grub i.e. / is mounted and (if applicable) /boot/. And you've modprobed dm-mod etc. before doing arch-chroot?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-12-03 10:31:39

fernando_costa
Member
Registered: 2011-02-03
Posts: 31

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

@hunterthomson, I did what you said... Nothing different happened.

@cfr, Everything is mounted and I've modprobed dm-mod before archrooting....


So far, no idea of what can be happening.

Offline

#6 2012-12-07 10:04:43

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

So, you are trying to install Grub while in the chroot'ed correct?

I have /boot on it's own partition. Then all other partitions in LVM lv's... Can /boot be on an LVM Logical Volume? I don't have time to check. However, there really is no need to have it on a Logical Volume. It is only like 150MB and it is easy enough to reinstall Grub and the kernel.

Like you could have /dev/sda1 be /boot
/dev/sda2 be a LVM Physical Volume VolumeGroup00
Then the logical volumes lv_home, lv_root ... in VolumeGroup00

(or however you like to name the Volume Groups and Logical Volumes.)

Last edited by hunterthomson (2012-12-07 10:09:25)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#7 2012-12-07 10:21:32

fernando_costa
Member
Registered: 2011-02-03
Posts: 31

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

hunterthomson, yes I'm trying to install Grub chroot'ed.

The only reason that I have my /boot in LVM is because I think it should work!  ("If you use LVM for your /boot, you can install GRUB2 on multiple physical disks", https://wiki.archlinux.org/index.php/Gr … de_region)

I mean, I'm installing a VM and I want it to be only LVM. I already have a VM with Arch and an Arch physically installed, both with "standard partitions".

Offline

#8 2012-12-07 11:13:08

p0x8
Member
Registered: 2012-09-20
Posts: 70

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

From grub-install man page:

--recheck

    probe a device map even if it already exists

    This option is unreliable and its use is strongly discouraged.

Did you try invoking grub-install without the --recheck option?

Also, from your grub.cfg:

set root='vg01-lv_boot'

The wiki recomends the form 'set root=lvm/lvm_group_name-lvm_logical_boot_partition_name'. Notice the 'lvm/' prefix.

Offline

#9 2012-12-07 12:22:32

fernando_costa
Member
Registered: 2011-02-03
Posts: 31

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

I had already seen the --recheck note in the man of grub-install, tried with and without the --recheck and the result was the same.

My grub.cfg had the problem you mentioned, but now I think it is OK, but yet I got the same error.

Current grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
insmod lvm
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod lvm
insmod ext2
set root='lvm/vg01-lv_boot'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvm/vg01-lv_system'  bcd8ffa8-8130-4bc3-be74-e700ca88c02d
else
  search --no-floppy --fs-uuid --set=root bcd8ffa8-8130-4bc3-be74-e700ca88c02d
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch GNU/Linux, with Linux core repo kernel' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-bcd8ffa8-8130-4bc3-be74-e700ca88c02d' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod lvm
	insmod ext2
	set root='lvm/vg01-lv_boot'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='lvm/vg01-lv_boot'  075d81a8-dab9-4f1f-b1ca-a62068e2de80
	else
	  search --no-floppy --fs-uuid --set=root 075d81a8-dab9-4f1f-b1ca-a62068e2de80
	fi
	echo	'Loading Linux core repo kernel ...'
	linux	/vmlinuz-linux root=/dev/mapper/vg01-lv_system ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initramfs-linux.img
}
menuentry 'Arch GNU/Linux, with Linux core repo kernel (Fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-fallback-bcd8ffa8-8130-4bc3-be74-e700ca88c02d' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod lvm
	insmod ext2
	set root='lvm/vg01-lv_boot'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='lvm/vg01-lv_boot'  075d81a8-dab9-4f1f-b1ca-a62068e2de80
	else
	  search --no-floppy --fs-uuid --set=root 075d81a8-dab9-4f1f-b1ca-a62068e2de80
	fi
	echo	'Loading Linux core repo kernel ...'
	linux	/vmlinuz-linux root=/dev/mapper/vg01-lv_system ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initramfs-linux-fallback.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

I'm not attaching the error log because it's exactly the same as in the first post.

Last edited by fernando_costa (2012-12-07 12:23:14)

Offline

#10 2013-06-07 07:04:09

Tucky
Member
Registered: 2012-10-24
Posts: 9

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

I know it is an old topic, but I had the same problem and I think It can be useful for people searching for a solution.

The fact was that I forgot to make a partition table and (in my case since I used GPT) to make a BIOS boot partition.
Now It works.

Offline

#11 2013-11-17 12:55:46

xpaolo
Member
From: Spresiano (TV) - Italy
Registered: 2009-09-11
Posts: 17
Website

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

Hi all
I had the same problem but first i'll try to explain what i did
I have 2 disk sata 320GB Western Digital, /dev/sda and /dev/sdb. I also have another disk of 1TB as /dev/sdc.
I want to use LVM with striping using the 2 wd disks. As grub 2 can boot from LVM a partition i followed this steps:
- pvcreate /dev/sda and pvcreate /dev/sdb (i didn't have a partition table on both disks)
- vgcreate vg /dev/sda /dev/sdb
- lvcreate -i 2 -L30G -n rootlv vg
- install archlinux from scratch in rootlv without a problem
- install grub2 on /dev/sda with the same error message of the first message of this thread:
"/usr/bin/grub-bios-setup: error: unable to identify a filesystem in hostdisk//dev/sda: safety check can't be performed"

After googling around for i while and didn't find any solution  i created a partition table on both sda and sdb with only 1 partition (type 8e "linux lvm") and did this steps:
- pvcreate /dev/sda1 and pvcreate /dev/sdb1
- vgcreate vg /dev/sda1 /dev/sdb1
- lvcreate -i 2 -L30G -n rootlv vg
- install archlinux from scratch in rootlv without a problem
- install grub2 on /dev/sda with only a warning
Now i'm happy using my archlinux box on whole disks on lvm with striping

BUT i don't understand why grub2 wan't install on /dev/sda if there is not a partition table....
Looking at the pvcreate man page and at the grub2 archwiki article i tought that could be a post MBR gap problem.
So i created a Virtual box virtual machine and tryed to install archlinux there:
- boot from arch-boot iso
- pvcreate --bootloaderareasize 1M /dev/sda (i think this should create enough room for grub2)
- vgcreate vg /dev/sda
- lvcreate -L5G -n rootlv vg
- install archlinux on rootlv
BUT when it's time to install the bootloader i had the same problem of before:
"/usr/bin/grub-bios-setup: error: unable to identify a filesystem in hostdisk//dev/sda: safety check can't be performed"

So the question is: are LVM and grub2 able to live together or not ? Why grub2 need a partition table ?

Offline

#12 2014-09-08 22:25:51

throwaway2014
Member
Registered: 2014-08-27
Posts: 26

Re: GRUB2 and LVM - grub-install is "Unable to identify a filesystem"

I was having the same issue and came to an understanding about the situation. In my setup I have two USB drives in RAID 1 using mdadm with metadata v1.2 (the default), over the entire drives (not partitions on them).

The basic idea is that GRUB needs to embed itself into your storage device to boot load the operating system. As I understand it, there are three locations in which this data is embedded:

1. The first block of your device, typically (always?) 512 bytes. This is what the BIOS runs at startup, leaving the responsibility of the entire startup sequence to this 512 byte program. GRUB embeds its first stage boot loader to this location, the sole purpose of which is to find and load GRUB stage 2, which is stored elsewhere (and thus can be larger than 512 bytes).
2. The partition table. Since the 512 byte block is usually insufficient to boot the main OS, the partition table leaves space at its start so that first stage boot loaders can embed additional data (specifically the GRUB stage 2 boot loader). The exact amount of space available depends on the partition table being used, which means that during installation GRUB attempts to identify the partition table to verify that there is enough space.
3. The filesystem. In the same way that the partition table leaves space for the second stage boot loader, so does the filesystem. In this case GRUB needs to identify the filesystem to determine how much space is available to embed.

The second stage GRUB boot loader that is embedded directly into the free space allowed by the partition table and filesystem is /boot/grub/i386-pc/core.img. In my case this file is 25KB in size.

The error here is because GRUB was unable to detect a filesystem on the device, so it cannot know that the boot loader is safe. One workaround for this the --skip-fs-probe, -s option for GRUB which disables this check, making GRUB assume that there is enough space. However if you do not have a partition table on the device, you will simply get an error indicating that it cannot find the partition table (and thus cannot find where to store the second stage boot loader).

At this point the only option left is using blocklists instead of embedding core.img directly. Since GRUB can't find a spot to put it, it uses the obsolete technique of leaving core.img on the filesystem (in my case, on my /boot partition at /grub/i386-pc/core.img) and embedding the location within the 512 byte first stage boot loader, instead of the file itself. Since the first stage boot loader doesn't have enough space to safely access the filesystem, it bypasses it and simply accesses where core.img was last. This is unsafe because the filesystem containing core.img may reorganize files, or if for example you reinstall grub (thus deleting and recreating core.img), it will likely be at a new location. Again to work around this uncertainty it is possible to set the immutable attribute on the file to prevent the filesystem from moving or modifying it in any way. See the wiki entry for more information.

In my case, I was receiving the error because mdadm metadata version 1.2 stores the persistent superblock information (containing identifying information of each RAID array member) 4KB from the start of the device. This prevented GRUB from detecting the partition table and filesystem that was stored on the whole device RAID array. To solve this issue I recreated the RAID array using metadata version 1.0, where the superblock is stored at the end of the device (otherwise it is the same). Since it was simply RAID 1, GRUB was able to natively detect my partition table and filesystem and embed core.img without error.

Sources:

  • GRUB Technical Info: A low level overview of the boot process and design (paraphrased above).

  • $grub2_src/util/setup.c lines 359 to 594: The source code responsible for embedding GRUB into BIOS systems.

  • mdadm(8) --metadata, -e: a description of different mdadm metadata formats and their locations on the device.

Offline

Board footer

Powered by FluxBB