You are not logged in.

#1 2013-04-16 17:29:52

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Grub won't show on new btrfs and gpt install.

Hello,

I am trying out btrfs. I followed Bitloom's tutorial and Installing on Btrfs root using GPT and Grub2.

1. I created three partitions using gdisk.

sda1 2MB ef02 BIOS boot partition
sda2 swap
sda3 btrfs parition with legacy BIOS bootable flag.

2. Created subvolumes

mkswap /dev/sda2
swapon /dev/sda2

mkfs.btrf -L "btrfs-root" /dev/sda3
mkdir /mnt/btrfs-root
mount -o defaults,relatime /dev/sda3 /mnt/btrfs-root

mkdir -p /mnt/btrfs-root/__snapshot
mkdir -p /mnt/btrfs-root/__active
btrfs subvolume create /mnt/btrfs-root/__active/root
btrfs subvolume create /mnt/btrfs-root/__active/home

mkdir -p /mnt/btrfs-active
mount -o defaults,relatime,nodev,subvol=__active/root /dev/sda1 /mnt/btrfs-active
mkdir -p /mnt/btrfs-active/home

mount -o defaults,relatime,nodev,nosuid,subvol=__active/home /dev/sda3 /mnt/btrfs-active/home


pacstrap -i /mnt/btrfs-active base base-devel
genfstab -U -p /mnt/btrfs-active >> /mnt/btrfs-active/etc/fstab
arch-chroot /mnt/btrfs-active

Installation steps from beginner's guide.

removed fsck and added btrfs-progs

mkinitcpio -p linux

pacman -S grub-bios
grub-install --recheck /dev/sda
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg

exit, umount and reboot.

Fstab

# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# /dev/sda3 LABEL=btrfs-root
UUID=f5428261-ec73-4626-b6f8-d4e07918ef26	/         	btrfs     	rw,nodev,relatime,space_cache,subvol=__active/root		0 0

# /dev/sda3 LABEL=btrfs-root
UUID=f5428261-ec73-4626-b6f8-d4e07918ef26	/home     	btrfs     	rw,nosuid,nodev,relatime,space_cache,subvol=__active/home	0 0

# /dev/sda2
UUID=faf0a0ee-bb54-45f9-b9e0-4450edc371eb	none      	swap      	defaults  							0 0

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_gpt
insmod btrfs
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  f5428261-ec73-4626-b6f8-d4e07918ef26
else
  search --no-floppy --fs-uuid --set=root f5428261-ec73-4626-b6f8-d4e07918ef26
fi
    font="/__active/root/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-f5428261-ec73-4626-b6f8-d4e07918ef26' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	set root='hd0,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  f5428261-ec73-4626-b6f8-d4e07918ef26
	else
	  search --no-floppy --fs-uuid --set=root f5428261-ec73-4626-b6f8-d4e07918ef26
	fi
	echo	'Loading Linux core repo kernel ...'
	linux	/__active/root/boot/vmlinuz-linux root=UUID=f5428261-ec73-4626-b6f8-d4e07918ef26 ro rootflags=subvol=__active/root  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/__active/root/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-f5428261-ec73-4626-b6f8-d4e07918ef26' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	set root='hd0,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  f5428261-ec73-4626-b6f8-d4e07918ef26
	else
	  search --no-floppy --fs-uuid --set=root f5428261-ec73-4626-b6f8-d4e07918ef26
	fi
	echo	'Loading Linux core repo kernel ...'
	linux	/__active/root/boot/vmlinuz-linux root=UUID=f5428261-ec73-4626-b6f8-d4e07918ef26 ro rootflags=subvol=__active/root  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/__active/root/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 ###

All of this goes without any errors but when I reboot there is no bootloader. I am able to access newly created paritions using liveCD. Am I missing something?

Thanks.

Last edited by donniezazen (2013-04-16 17:57:50)

Offline

#2 2013-04-16 21:51:01

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Grub won't show on new btrfs and gpt install.

donniezazen wrote:

I am trying out btrfs. I followed Bitloom's tutorial and Installing on Btrfs root using GPT and Grub2.

1. I created three partitions using gdisk.

sda1 2MB ef02 BIOS boot partition
sda2 swap
sda3 btrfs parition with legacy BIOS bootable flag.

GRUB doesn't use the legacy BIOS bootable flag; that's used by SYSLINUX and I believe one or two other more obscure boot loaders. Setting that flag shouldn't be causing you problems, but it's also unnecessary if you're using GRUB.

All of this goes without any errors but when I reboot there is no bootloader. I am able to access newly created paritions using liveCD. Am I missing something?

Chances are you've got a BIOS/firmware that's got GPT problems. See my Web page on the topic:

http://www.rodsbooks.com/gdisk/bios.html

If your computer is recent enough (bought in the last year or two), it's probably got an EFI rather than a BIOS. In that case, you might want to look into EFI-mode booting rather than BIOS/CSM/legacy-mode booting. Although EFI-mode booting is still pretty "bleeding edge," it does have certain advantages, like being slightly faster and providing facilities like the ability to store debug information in NVRAM in case of a kernel panic.

Offline

#3 2013-04-16 22:21:31

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Grub won't show on new btrfs and gpt install.

Yeah, I have a recent laptop that supports both EFI and BIOS boot. I chose Grub because it would be simple for me now with new btrfs system that I am trying to learn. GRUB MBR setup failed because core.img is too big. GRUB GPT installs but won't boot. I can give EFI-rEFInd-GPT a try. I am just wondering how this will work with above mentioned btrfs system.

sda1 1GB ef00 EFI Boot partition
sda2 swap
sda3 Linux Filesystem

Do I need to create boot directory or subvolume and mount EFI partition there and follow the installation as usual?

Create boot subvolume
btrfs subvolume create /mnt/btrfs-root/__active/boot

Mount boot subvolume
mount -o defaults,relatime,nodev,nosuid,subvol=__active/boot /dev/sda3 /mnt/btrfs-active/boot

Thanks.

UPDATE:- It seems trying to install bootloader is subvolume may not work on btrfs. Maybe I should mount /boot/efi in a separate folder in /btrfs-root.

Last edited by donniezazen (2013-04-16 22:59:59)

Offline

#4 2013-04-17 04:04:02

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Grub won't show on new btrfs and gpt install.

You can mount the ESP (type code EF00 in gdisk, with a FAT filesystem) at /boot in Linux. You'd then install rEFInd (refind_x64.efi and associated files and subdirectories) in /boot/EFI/refind or /boot/EFI/arch and your kernel and initrd would go in the usual place in /boot. This will render rEFInd, the kernel, and the initrd accessible to the EFI, so they can load and then the kernel can access Btrfs normally.

Offline

Board footer

Powered by FluxBB