You are not logged in.

#1 2014-08-11 23:21:02

risho
Member
Registered: 2011-09-06
Posts: 44

Encrypted root with btrfs

So I'm trying to set up my system with /dev/sda1 as a 500mb boot partition and /dev/sda2 as a plain dm crypted btrfs partition.

I've got it all set up and I can chroot into it. Everything is fine except it won't boot into a functional system
i've installed mkinicpio-btrfs from aur and reran mkinitcpio.

i can't figure out where the problem is. any ideas?

FSTAB

#
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>

#### /dev/mapper/btrfs LABEL=btrfs
####UUID=78a05d43-f52a-4086-9255-5062e5fcbb94   /               btrfs           rw,relatime,space_cache,subvol=__active/rootvol 0 0

#### /dev/mapper/btrfs LABEL=btrfs
####UUID=78a05d43-f52a-4086-9255-5062e5fcbb94   /home           btrfs           rw,relatime,space_cache,subvol=__active/home    0 0

# /dev/mapper/btrfs LABEL=btrfs
/dev/mapper/btrfs       /       btrfs   rw,noatime,compress=lzo,discard,autodefrag,inode_cache,subvol=__active/rootvol 0 0
/dev/sda2       /boot   ext2    defaults        0 2
# /dev/mapper/btrfs LABEL=btrfs
/dev/mapper/btrfs       /home   btrfs   rw,noatime,compress=lzo,discard,autodefrag,inode_cache,subvol=__active/home 0 0
# /dev/mapper/btrfs LABEL=btrfs
/dev/mapper/btrfs       /mnt/defvol     btrfs   rw,noatime,compress=lzo,discard,autodefrag,inode_cache 0 0

syslinux.cfg

# Config file for Syslinux -
# /boot/syslinux/syslinux.cfg
#
# Comboot modules:
#   * menu.c32 - provides a text menu
#   * vesamenu.c32 - provides a graphical menu
#   * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
#   * hdt.c32 - hardware detection tool
#   * reboot.c32 - reboots the system
#
# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
# If /usr and /boot are on the same file system, symlink the files instead
# of copying them.
#
# If you do not use a menu, a 'boot:' prompt will be shown and the system
# will boot automatically after 5 seconds.
#
# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
# The wiki provides further configuration examples

DEFAULT arch
PROMPT 0        # Set to 1 if you always want to display the boot: prompt
TIMEOUT 50
# You can create syslinux keymaps with the keytab-lilo tool
#KBDMAP de.ktl

# Menu Configuration
# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
UI menu.c32
#UI vesamenu.c32

# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU TITLE Arch Linux
#MENU BACKGROUND splash.png
MENU COLOR border       30;44   #40ffffff #a0000000 std
MENU COLOR title        1;36;44 #9033ccff #a0000000 std
MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel        37;44   #50ffffff #a0000000 std
MENU COLOR help         37;40   #c0ffffff #a0000000 std
MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07        37;40   #90ffffff #a0000000 std
MENU COLOR tabmsg       31;40   #30ffffff #00000000 std

# boot sections follow
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

LABEL arch
    MENU LABEL Arch Linux
    LINUX ../vmlinuz-linux
    APPEND root=/dev/mapper/btrfs cryptdevice=/dev/sda2:btrfs rw
    INITRD ../initramfs-linux.img

LABEL archfallback
    MENU LABEL Arch Linux Fallback

mkinitcpio.conf

# 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="crc32c"

# 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.
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 block filesystems"
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS="base udev block 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 block mdadm encrypt filesystems"
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev block lvm2 filesystems"
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev autodetect encrypt lvm2 modconf block filesystems keyboard fsck btrfs"

# 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="lz4"

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

and this is what happens when i try to boot into it

http://i.imgur.com/FeaBjvC.jpg



-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --

Offline

#2 2014-08-12 01:04:35

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Encrypted root with btrfs

You're not passing any subvol in your bootloader config.

Strongly recommend against mkinitcpio-btrfs, BTW. Its unmaintained, archaic, and unnecessary for most folks. Device assembly can be done entirely with udev.

Last edited by falconindy (2014-08-12 01:06:00)

Offline

#3 2014-08-12 05:12:37

risho
Member
Registered: 2011-09-06
Posts: 44

Re: Encrypted root with btrfs

falconindy wrote:

You're not passing any subvol in your bootloader config.

thanks that was the problem. it's running perfectly now. it's a great feeling diving into something deep in the command line and accomplishing it. making things work in arch is one of the most satisfying things ever.

Strongly recommend against mkinitcpio-btrfs, BTW. Its unmaintained, archaic, and unnecessary for most folks. Device assembly can be done entirely with udev.


so what do i need as far as hooks? just encrypt? or do i still need btrfs?

and is it going to create problems? i've already done it. does it require a reformat and starting over? can i uninstall mkinitcpio-btrfs and just run mkinitcpio again? or should i just leave it be since it's working?

edit: added rootflags=subvolume=__active/roovol

Last edited by risho (2014-09-07 06:29:28)

Offline

#4 2014-08-12 17:25:05

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Encrypted root with btrfs

risho wrote:

can i uninstall mkinitcpio-btrfs and just run mkinitcpio again? or should i just leave it be since it's working?

This. Just uninstall the package, remove the hook from your mkinitcpio.conf and rebuild your initramfs images. As long as you have the "udev" hook in your image, you don't need anything else in order to assembly btrfs devices. It actually looks like you never added the "btrfs_advanced" hook so you should be fine...

$ mkinitcpio -H btrfs
==> Help for hook 'btrfs':
This hook provides support for multi-device btrfs volumes. This hook
is only needed for initramfs images which do not use udev.

==> This hook has runtime scripts:
  -> pre-mount hook

Last edited by falconindy (2014-08-12 17:26:52)

Offline

Board footer

Powered by FluxBB