You are not logged in.

#1 2018-12-15 22:16:52

Pastah
Member
Registered: 2017-04-16
Posts: 41

[SOLVED] BTRFS root subvolume + GRUB UEFI

Hi all, I'm transferring my previous GRUB system to a larger disk where I want to make everything into btrfs subvolumes. However I can't get GRUB to work with btrfs subvolumes.

Since this system was already installed, I rsynced everything to the appropriate subvolumes. I skipped to the mounting my old system step and installing GRUB step from the installation guide.

I have a btrfs partition known as /dev/sdb3. Inside I have two subvolumes, one as /root which will be '/', and /home which is self explanatory. My /dev/sdb1 partition is an EFI/ESP partition that's fat32. How do I install and get grub working on this? I tried this:
mount -t btrfs -o subvol=/root /dev/sdb3 /mnt/root
arch-chroot /mnt/root
mount /dev/sdb1 /efi
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

But when I try grub-mkconfig -o /boot/grub/grub.cfg, it says that it failed to connect to lvmetad.
grub-mkconfig gives this: https://ptpb.pw/guet

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
  WARNING: Device /dev/loop0 not initialized in udev database even after waiting 10000000 microseconds.
grep: /tmp/os-prober.PMIzFf/raided-map: No such file or directory
grep: /tmp/os-prober.PMIzFf/swaps-map: No such file or directory
grep: /tmp/os-prober.PMIzFf/mounted-map: No such file or directory
grep: /tmp/os-prober.PMIzFf/raided-map: No such file or directory
grep: /tmp/os-prober.PMIzFf/swaps-map: No such file or directory
grep: /tmp/os-prober.PMIzFf/mounted-map: No such file or directory

It will keep going.

So I edited my old grub.cfg and changed the UUID of the disks and added subvol options to mount the subvolumes.
My grub.cfg: https://ptpb.pw/rBbi

#
# 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
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

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,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  c1519a2d-d095-4cfe-965b-6e516c1150a9
else
  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
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
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  c1519a2d-d095-4cfe-965b-6e516c1150a9
	else
	  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=/root  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  c1519a2d-d095-4cfe-965b-6e516c1150a9
		else
		  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=/root  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  c1519a2d-d095-4cfe-965b-6e516c1150a9
		else
		  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=/root  quiet
		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/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 already edited my fstab too: https://ptpb.pw/jPS1

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sdb3 /
UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9	/         	btrfs     	rw,relatime,ssd,space_cache,subvolid=5,discard,autodefrag,subvol=/root	0 0

# /dev/sdb3 /home
UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9	/home         	btrfs     	rw,relatime,ssd,space_cache,subvolid=5,discard,autodefrag,subvol=/home	0 0

# /dev/sdb2
UUID=42258ce5-52dd-4888-b863-b856c9533c96	none      	swap      	defaults,pri=-2	0 0

# /dev/sde1
UUID=2C7A78077A77CC58  				/mnt/Memory	ntfs-3g   	defaults 	0 0
# /dev/sdd1
UUID=D4ACCAACACCA8886  				/mnt/disk3 	ntfs-3g   	defaults 	0 0
# /dev/sdc2
UUID=0850FA2D50FA215C  				/mnt/disk2 	ntfs-3g   	defaults 	0 0
# /dev/sdb2
# UUID=A84EEA614EEA2830  				/mnt/ssd 	ntfs-3g   	defaults 	0 0

When I try rebooting into my system, GRUB complains that the linux images can't be found, "vmlinuz-linux".

How do I get btrfs subvolumes to work with GRUB UEFI? I don't know how to set this up properly.

Last edited by Pastah (2018-12-16 14:50:05)

Offline

#2 2018-12-15 23:52:54

Pastah
Member
Registered: 2017-04-16
Posts: 41

Re: [SOLVED] BTRFS root subvolume + GRUB UEFI

I got it working by mostly following this steps.

I mounted my efi partition in /boot/efi instead. Generated fstab again, then mkinitcpio -p linux.
Then followed the steps in the link to get UEFI grub-mkconfig working.
https://unix.stackexchange.com/question … n-lvm-disk
Then did grub-install and grub-mkconfig as said above.

Not sure what fixed it. Could be due to my EFI partition not being in fstab, the arch-chroot lvm bug for grub, or what.

EDIT:

If you're interested this is what my files looks like now with the working system.

fstab

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sdb3 LABEL=1TBssd
UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9	/         	btrfs     	rw,relatime,ssd,space_cache,autodefrag,discard,subvolid=340,subvol=/root,subvol=root	0 0

# /dev/sdb3 LABEL=1TBssd
UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9	/home     	btrfs     	rw,relatime,ssd,space_cache,autodefrag,discard,subvolid=341,subvol=/home,subvol=home	0 0

# /dev/sdb1
UUID=BC7B-0806      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 2


# /dev/sdb2
UUID=42258ce5-52dd-4888-b863-b856c9533c96	none      	swap      	defaults,pri=-2	0 0


# /dev/sde1
UUID=2C7A78077A77CC58  				/mnt/Memory	ntfs-3g   	defaults 	0 0
# /dev/sdd1
UUID=D4ACCAACACCA8886  				/mnt/disk3 	ntfs-3g   	defaults 	0 0
# /dev/sdc2
UUID=0850FA2D50FA215C  				/mnt/disk2 	ntfs-3g   	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
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

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='hd1,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt3' --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  c1519a2d-d095-4cfe-965b-6e516c1150a9
else
  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
fi
    font="/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
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	set root='hd1,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt3' --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  c1519a2d-d095-4cfe-965b-6e516c1150a9
	else
	  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
	fi
	echo	'Loading Linux linux ...'
	linux	/root/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=root  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/root/boot/intel-ucode.img /root/boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		set root='hd1,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt3' --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  c1519a2d-d095-4cfe-965b-6e516c1150a9
		else
		  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
		fi
		echo	'Loading Linux linux ...'
		linux	/root/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=root  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/root/boot/intel-ucode.img /root/boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-c1519a2d-d095-4cfe-965b-6e516c1150a9' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		set root='hd1,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt3' --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  c1519a2d-d095-4cfe-965b-6e516c1150a9
		else
		  search --no-floppy --fs-uuid --set=root c1519a2d-d095-4cfe-965b-6e516c1150a9
		fi
		echo	'Loading Linux linux ...'
		linux	/root/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=root  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/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/30_os-prober ###
menuentry 'Arch Linux (on /dev/sda2)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-0053697c-114d-4b32-b154-7e373b3090b2' {
	insmod part_gpt
	insmod btrfs
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  0053697c-114d-4b32-b154-7e373b3090b2
	else
	  search --no-floppy --fs-uuid --set=root 0053697c-114d-4b32-b154-7e373b3090b2
	fi
	linux /boot/vmlinuz-linux root=UUID=0053697c-114d-4b32-b154-7e373b3090b2 rw quiet
	initrd /boot/intel-ucode.img
}
submenu 'Advanced options for Arch Linux (on /dev/sda2)' $menuentry_id_option 'osprober-gnulinux-advanced-0053697c-114d-4b32-b154-7e373b3090b2' {
	menuentry 'Arch Linux (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--0053697c-114d-4b32-b154-7e373b3090b2' {
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  0053697c-114d-4b32-b154-7e373b3090b2
		else
		  search --no-floppy --fs-uuid --set=root 0053697c-114d-4b32-b154-7e373b3090b2
		fi
		linux /boot/vmlinuz-linux root=UUID=0053697c-114d-4b32-b154-7e373b3090b2 rw quiet
		initrd /boot/intel-ucode.img
	}
	menuentry 'Arch Linux, with Linux linux (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--0053697c-114d-4b32-b154-7e373b3090b2' {
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  0053697c-114d-4b32-b154-7e373b3090b2
		else
		  search --no-floppy --fs-uuid --set=root 0053697c-114d-4b32-b154-7e373b3090b2
		fi
		linux /boot/vmlinuz-linux root=UUID=0053697c-114d-4b32-b154-7e373b3090b2 rw quiet
		initrd /boot/intel-ucode.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--0053697c-114d-4b32-b154-7e373b3090b2' {
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  0053697c-114d-4b32-b154-7e373b3090b2
		else
		  search --no-floppy --fs-uuid --set=root 0053697c-114d-4b32-b154-7e373b3090b2
		fi
		linux /boot/vmlinuz-linux root=UUID=0053697c-114d-4b32-b154-7e373b3090b2 rw quiet
		initrd /boot/initramfs-linux-fallback.img
	}
}

### 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 ###

Last edited by Pastah (2018-12-16 14:58:31)

Offline

#3 2018-12-16 01:53:31

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] BTRFS root subvolume + GRUB UEFI

It's the lvm bug which manifests via arch-chroot, but I'd hardly call it an "arch-chroot bug" just because lvm is being silly.

Anyway I don't get why grub.cfg is supposed to be so complicated that you need to use some silly script which parses lvm output to figure out where your disk is.

It's pretty dead simple to write a 4-line grub.cfg that does literally everything the huge, gross script does.

Here is your LVM example: https://ptpb.pw/mk7y

More generally my WIP rewrite of the wiki: https://wiki.archlinux.org/index.php/Us … figuration


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2018-12-16 15:07:33

Pastah
Member
Registered: 2017-04-16
Posts: 41

Re: [SOLVED] BTRFS root subvolume + GRUB UEFI

I think that LVM example wouldn't work. My grub.cfg ended up showing this:
linux    /root/boot/vmlinuz-linux root=UUID=c1519a2d-d095-4cfe-965b-6e516c1150a9 rw rootflags=subvol=root  quiet
Also I am not working with logical volumes or anything relating to LVM. I heard that btrfs has nothing to do with LVM as they are subvolumes not logical volumes.

I also have no understanding how fstab, grub.cfg, the kernel, etc, all work in order to setup the grub.cfg and fstab manually for subvolumes since I was doing flat subvolume scheme.
https://btrfs.wiki.kernel.org/index.php … Guide#Flat

Offline

#5 2018-12-16 16:27:43

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] BTRFS root subvolume + GRUB UEFI

You don't need to setup the fstab manually, you can use genfstab just like you do with any other method.
There is nothing you need to do with the kernel either.

Btrfs subvolumes are only a little more complicated than anything else. There are two things to consider: first, the path to the /boot/.... files must be relative to the root mountpoint, without subvolumes -- so since you said you have a subvolume label "root" which is I assume in /root/ on the btrfs volume and when you pacstrapped to /mnt while in the installation ISO, you mounted it using

mount -o subvol=root /dev/sdb3 /mnt/

Then the path you want to tell grub to boot, is "linux /root/boot/vmlinuz-linux" and "initrd /root/boot/initramfs-linux.img".

As with any bootloader, in order to tell the kernel to mount the correct subvolume as the root filesystem, pass the "subvol=root" option on the kernel command line as "rootflags=subvol=root".


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB