# [SOLVED] problems with crypted root filesystem over LVM2

## arkas

Hi,

I´m trying to set up a root filesystem over lvm2 as described in this tutorial

http://en.gentoo-wiki.com/wiki/Root_filesystem_over_LVM2,_DM-Crypt_and_RAID

(without raid) and have problems.

It is a new installation, never booted!!

Once I have everything set up and have tried to boot I get the following error after 

enter passphrase for /dev/sda2 (as shown on screen):

```

     3 logical volume(s) in volume group "sys" now active

2

[    49.741941] EXT3-fs (dm-1): error: couldn`t mount because of unsupported

optional features (240)

[    49.824091] EXT4-fs (dem-1): mounted filesystem with ordered data mode.

Opts: (null)

[    49.824213] exe used greatest stack depth: 4792 bytes left

3

4

[    51.761450] init-early.sh used greatest stack depth: 4424 bytes left

```

initramfs:

```

## create symlinks

/bin/busybox --install -s

## catch cmdline

#CMDLINE=`cat /proc/cmdline`

 

## mount pseudo filesystems

mount -t proc none /proc

mount -t sysfs none /sys

 

## disable kernel messages

#echo 0 > /proc/sys/kernel/printk

 

## load de keymap

loadkmap < /etc/kmap-de

 

## assamble raid

#/bin/mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1

## start eth0

#ifconfig eth0 10.0.0.11

#route add default gw 10.0.0.2

 

## clear screen

clear

 

## do something

echo ""

echo ""

#cat /etc/msg

echo ""

echo "0"

 

## decrypt disk

/bin/cryptsetup luksOpen /dev/sda2 gentoo

sleep 1

echo "1"

 

## lvm

/bin/vgchange -ay sys

echo "2"

 

## mount rootfs

mount -r /dev/mapper/sys-root /mnt/root

echo "3"

 

## clean up

umount /proc

umount /sys

echo "4"

 

## boot system

exec switch_root /mnt/root /sbin/init

echo "5"

```

As seen on the error on boot, I get to the point echo "4 " in the file.

initram-tree:

```

    initram # tree

    .

    ├── bin

    │   ├── busybox

    │   ├── cryptsetup

    │   ├── loadkmap -> busybox

    │   ├── lvm.static

    │   ├── vgchange -> lvm.static

    │   └── vgscan -> lvm.static

    ├── dev

    │   ├── console

    │   ├── null

    │   ├── random

    │   ├── sda1

    │   ├── sda2

    │   ├── tty

    │   ├── urandom

    │   └── vc

    │       └── 0 -> ../console

    ├── etc

    │   └── kmap-de

    ├── init

    ├── initramfs.cpio.gz

    ├── mnt

    │   └── root

    ├── newroot

    ├── proc

    └── sys

```

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

    if [ -s $prefix/grubenv ]; then

      load_env

    fi

    set default="0"

    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 {

      insmod vbe

      insmod vga

      insmod video_bochs

      insmod video_cirrus

    }

     

    insmod part_msdos

    insmod ext2

    set root='(hd0,msdos1)'

    search --no-floppy --fs-uuid --set=root c1a6ac1f-94a8-4d79-88c3-be3e9fbe6de9

    set locale_dir=($root)/grub/locale

    set lang=de_DE

    insmod gettext

    set timeout=5

    ### END /etc/grub.d/00_header ###

     

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

    menuentry 'Gentoo GNU/Linux, with Linux 2.6.39-gentoo' --class gentoo --class gnu-linux --class gnu --class os {

            load_video

            insmod part_msdos

            insmod ext2

            set root='(hd0,msdos1)'

            search --no-floppy --fs-uuid --set=root c1a6ac1f-94a8-4d79-88c3-be3e9fbe6de9

            echo    'Loading Linux 2.6.39-gentoo ...'

            linux   /kernel-2.6.39-gentoo root=/dev/mapper/sys-root ro  

            initrd  /initramfs.cpio.gz

    }

    menuentry 'Gentoo GNU/Linux, with Linux 2.6.39-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {

            load_video

            insmod part_msdos

            insmod ext2

            set root='(hd0,msdos1)'

            search --no-floppy --fs-uuid --set=root c1a6ac1f-94a8-4d79-88c3-be3e9fbe6de9

            echo    'Loading Linux 2.6.39-gentoo ...'

            linux   /kernel-2.6.39-gentoo root=/dev/mapper/sys-root ro single

    }

    ### 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  $prefix/custom.cfg ]; then

      source $prefix/custom.cfg;

    fi

    ### END /etc/grub.d/41_custom ###

```

emerge --info:

```

    Portage 2.2.0_alpha38 (default/linux/amd64/10.0, gcc-4.4.5, glibc-2.12.2-r0, 2.6.38-8-generic x86_64)

    =================================================================

    System uname: Linux-2.6.38-8-generic-x86_64-Intel-R-_Core-TM-2_Duo_CPU_P8600_@_2.40GHz-with-gentoo-2.0.2

    Timestamp of tree: Tue, 07 Jun 2011 10:00:01 +0000

    app-shells/bash:          4.2_p10

    dev-lang/python:          2.7.1-r1, 3.1.3-r1

    sys-apps/baselayout:      2.0.2

    sys-apps/openrc:          0.8.2-r1

    sys-apps/sandbox:         2.4

    sys-devel/autoconf:       2.65-r1

    sys-devel/automake:       1.11.1

    sys-devel/binutils:       2.20.1-r1

    sys-devel/gcc:            4.4.5

    sys-devel/gcc-config:     1.4.1-r1

    sys-devel/libtool:        2.2.10

    sys-devel/make:           3.82

    sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)

    sys-libs/glibc:           2.12.2

    Repositories:

     

    gentoo

        location: /usr/portage

        sync: rsync://rsync.gentoo.org/gentoo-portage

        priority: -1000

     

    Installed sets:

    ABI="amd64"

    ACCEPT_KEYWORDS="amd64 ~amd64"

    ACCEPT_LICENSE="*"

    ACCEPT_PROPERTIES="*"

    ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"

    ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol"

    APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias"

    ARCH="amd64"

    ASFLAGS_x86="--32"

    AUTOCLEAN="yes"

    CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words"

    CAMERAS="ptp2"

    CBUILD="x86_64-pc-linux-gnu"

    CFLAGS="-march=native -O2 -pipe"

    CFLAGS_x86="-m32"

    CHOST="x86_64-pc-linux-gnu"

    CHOST_amd64="x86_64-pc-linux-gnu"

    CHOST_x86="i686-pc-linux-gnu"

    CLEAN_DELAY="5"

    COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"

    COLLISION_IGNORE="/lib/modules"

    COLORTERM="gnome-terminal"

    CONFIG_PROTECT="/etc"

    CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"

    CVS_RSH="ssh"

    CXXFLAGS="-march=native -O2 -pipe"

    DEFAULT_ABI="amd64"

    DISPLAY=":0.0"

    DISTDIR="/usr/portage/distfiles"

    EDITOR="/bin/nano"

    ELIBC="glibc"

    EMERGE_DEFAULT_OPTS="--verbose --tree --keep-going"

    EMERGE_WARNING_DELAY="10"

    EPREFIX=""

    EROOT="/"

    FCFLAGS=""

    FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

    FETCHCOMMAND="/usr/bin/wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

    FETCHCOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

    FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec sftp -P \${port} \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}""

    FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}""

    FFLAGS=""

    GCC_SPECS=""

    GDM_LANG="de_DE.UTF-8"

    GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://de-mirror.org/distro/gentoo/ ftp://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/"

    GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx"

    GUILE_LOAD_PATH="/usr/share/guile/1.8"

    HOME="/root"

    INFOPATH="/usr/share/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.20.1/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.5/info"

    INPUT_DEVICES="evdev synaptics"

    KERNEL="linux"

    LANG="de_DE.UTF-8"

    LANGUAGE="de_DE:en"

    LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"

    LC_COLLATE="C"

    LDFLAGS="-Wl,-O1 -Wl,--as-needed"

    LDFLAGS_x86="-m elf_i386"

    LESS="-R -M --shift 5"

    LESSCLOSE="/usr/bin/lesspipe %s %s"

    LESSOPEN="|lesspipe.sh %s"

    LIBDIR_amd64="lib64"

    LIBDIR_amd64_fbsd="lib64"

    LIBDIR_ppc="lib32"

    LIBDIR_ppc64="lib64"

    LIBDIR_s390="lib32"

    LIBDIR_s390x="lib64"

    LIBDIR_sparc32="lib32"

    LIBDIR_sparc64="lib64"

    LIBDIR_x86="lib32"

    LIBDIR_x86_fbsd="lib32"

    LINGUAS="de en"

    LOGNAME="root"

    LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:<snipped to de-b0rk forum layout --cach0rr0>

    MAIL="/var/mail/root"

    MAKEOPTS="-j3"

    MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.20.1/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.5/man"

    MULTILIB_ABIS="amd64 x86"

    MULTILIB_STRICT_DENY="64-bit.*shared object"

    MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"

    MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev)"

    NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"

    OLDPWD="/boot/grub"

    PAGER="/usr/bin/less"

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.5"

    PHP_TARGETS="php5-3"

    PKGDIR="/usr/portage/packages"

    PORTAGE_ARCHLIST="ppc sparc64-freebsd ppc-openbsd x86-openbsd ppc64 x86-winnt x86-fbsd ppc-aix alpha arm x86-freebsd s390 amd64 arm-linux x86-macos x64-openbsd ia64-hpux hppa x86-netbsd x86-cygwin amd64-linux ia64-linux x86 sparc-solaris x64-freebsd sparc64-solaris x86-linux x64-macos sparc m68k-mint ia64 mips ppc-macos x86-interix hppa-hpux amd64-fbsd x64-solaris mips-irix m68k sh x86-solaris sparc-fbsd"

    PORTAGE_BINHOST_CHUNKSIZE="3000"

    PORTAGE_BIN_PATH="/usr/lib64/portage/bin"

    PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"

    PORTAGE_CONFIGROOT="/"

    PORTAGE_DEBUG="0"

    PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"

    PORTAGE_ECLASS_WARNING_ENABLE="0"

    PORTAGE_ELOG_CLASSES="log warn error info"

    PORTAGE_ELOG_MAILFROM="portage@localhost"

    PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"

    PORTAGE_ELOG_MAILURI="root"

    PORTAGE_ELOG_SYSTEM="echo:log,warn,error,info  save:log,warn,error,info syslog:error"

    PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"

    PORTAGE_FETCH_RESUME_MIN_SIZE="350K"

    PORTAGE_GID="250"

    PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --clearsign --yes --default-key "${PORTAGE_GPG_KEY}" --homedir "${PORTAGE_GPG_DIR}" "${FILE}""

    PORTAGE_INST_GID="0"

    PORTAGE_INST_UID="0"

    PORTAGE_PYM_PATH="/usr/lib64/portage/pym"

    PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

    PORTAGE_RSYNC_RETRIES="-1"

    PORTAGE_SANDBOX_COMPAT_LEVEL="22"

    PORTAGE_SYNC_STALE="30"

    PORTAGE_TMPDIR="/var/tmp"

    PORTAGE_VERBOSE="1"

    PORTAGE_WORKDIR_MODE="0700"

    PORTDIR="/usr/portage"

    PORTDIR_OVERLAY=""

    PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND"

    PWD="/root"

    PYTHONDONTWRITEBYTECODE="1"

    RESUMECOMMAND="/usr/bin/wget -c -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

    RESUMECOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

    RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}""

    ROOT="/"

    ROOTPATH="/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.5"

    RPMDIR="/usr/portage/rpm"

    RUBY_TARGETS="ruby18"

    RUNNING_UNDER_GDM="yes"

    SHELL="/bin/bash"

    SHLVL="2"

    STAGE1_USE="multilib nptl nptlonly unicode"

    SUDO_COMMAND="/bin/su"

    SUDO_GID="999"

    SUDO_UID="999"

    SUDO_USER="ubuntu"

    SYMLINK_LIB="yes"

    SYNC="rsync://rsync.gentoo.org/gentoo-portage"

    TERM="xterm"

    USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb bluetooth bzip2 cdr cli consolekit corefonts cracklib crypt cups curl cxx dbus dri dts exif faac faad ffmpeg flac fortran gd gdbm gif gnome gpm gstreamer gtk gtk2 gtk3 iconv idn ios iphone ipod ipv6 jpeg kvm lame laptop libkms libnotify lm_sensors matroska mmx modules mp3 mp4 mudflap multilib nautilus ncurses networkmanager nls nptl nptlonly nsplugin ogg opengl openmp openvg pam pcre perl pidgin png policykit pppd pulseaudio python quicktime readline session sqlite sse sse2 ssl startup-notification synaptics sysfs tcpd theora threads truetype unicode v4l2 vaapi vdpau vim-syntax vorbis x264 xorg xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

    USER="root"

    USERLAND="GNU"

    USERNAME="root"

    USE_EXPAND="ALSA_CARDS ALSA_PCM_PLUGINS APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CROSSCOMPILE_OPTS DRACUT_MODULES DVB_CARDS ELIBC FCDSL_CARDS FOO2ZJS_DEVICES FRITZCAPI_CARDS GPSD_PROTOCOLS INPUT_DEVICES KERNEL LCD_DEVICES LINGUAS LIRC_DEVICES MISDN_CARDS NETBEANS_MODULES NGINX_MODULES_HTTP NGINX_MODULES_MAIL PHP_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS RUBY_TARGETS SANE_BACKENDS USERLAND VIDEO_CARDS XFCE_PLUGINS XTABLES_ADDONS"

    USE_EXPAND_HIDDEN="CROSSCOMPILE_OPTS ELIBC KERNEL USERLAND"

    USE_ORDER="env:pkg:conf:defaults:pkginternal:env.d"

    VIDEO_CARDS="nvidia"

    XAUTHORITY="/var/run/gdm/auth-for-ubuntu-5odx2C/database"

    XDG_SESSION_COOKIE="eab11212be8dce06bd39c90500000012-1307480458.189723-1325044842"

    XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

    _="/usr/bin/emerge"

```

I have no idea anymore what to do.

Thanks for help!!Last edited by arkas on Wed Jun 08, 2011 11:41 am; edited 2 times in total

----------

## cach0rr0

try appending rootfstype=ext4 to your kernel command-line in grub.cfg

e.g.

```

linux   /kernel-2.6.39-gentoo root=/dev/mapper/sys-root rootfstype=ext4 ro

```

----------

## arkas

same error...  :Sad: 

----------

## Hu

Since init-early.sh is not in the initramfs, the fact that it ran means the kernel booted successfully and mounted root.  There have been a number of posts here recently about botched baselayout2 setups that stop with the message shown.

----------

## arkas

now i have found the solution on my own:

fiirst from livecd (not chrooted, complete sys mounted on /mnt/gentoo , except /dev):

# cd /mnt/gentoo/dev

# rm null

# mknod --mode=600 console c 5 1

# mknod --mode=666 null c 1 3

# mknod --mode=666 zero c 1 5

then chrooted:

# rc-update add udev sysinit

after that, everything is working fine!!

----------

