Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 447328 - sys-kernel/genkernel-3.4.45: encrypted filesystems from initramfs.mounts cannot be mounted
Summary: sys-kernel/genkernel-3.4.45: encrypted filesystems from initramfs.mounts cann...
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Low normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: Bug, LATER, NeedPatch
Depends on:
Blocks:
 
Reported: 2012-12-15 11:13 UTC by mcbeagle
Modified: 2013-06-06 07:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mcbeagle 2012-12-15 11:13:12 UTC
At least since version 3.4.45 genkernel provides '/etc/initramfs.mounts' which is evaluated during initramfs creation.
The mountpoints within this file are completed with the settings from '/etc/fstab' and appropriate adjustments are included in the initramfs to mount these filesystems when the initramfs is loaded and it's scripts are executed (before switching to 'real_root').

However, encrypted filesystems are not supported (at least I couldn't find anything related):
The initramfs tries to mount the device which is specified in '/etc/fstab' and fails because this device does not yet exist as a crypt mapping was not yet created.

Reproducible: Always

Steps to Reproduce:
1. Have an encrypted filesystem whose mapping is used as filesystem device in '/etc/fstab'
2. Edit '/etc/initramfs.mount': add the mountpoint for the above filesystem
3. Run 'genkernel initramfs' to (re-)create the initramfs
4. Reboot using the newly created initramfs
Actual Results:  
During system boot the initramfs tries to mount the crypt mapping device at the desired mountpoint and fails because the crypt mapping was not yet created.
The boot process then continues, which of course might/will fail once the mountpoint is really required for the early boot process.

Expected Results:  
During initramfs execution the crypt mapping should be created before trying to mount it (like it's currently done with the root filesystem).

Relevant extract from boot log:
...
Freeing unused kernel memory: 496k freed
Write protecting the kernel read-only data: 6144k
Freeing unused kernel memory: 508k freed
Freeing unused kernel memory: 1020k freed
>> Activating mdev 
>> Skipping module load; no modules in the ramdisk! 
>> Hint: Use parameter scandelay[=seconds] if you need waiting here 
mdadm: /dev/md0 has been started with 2 drives.
mdadm: /dev/md1 has been started with 2 drives.
mdadm: /dev/md2 has been started with 2 drives.
>> Scanning for and activating Volume Groups 
  81 logical volume(s) in volume group "vg-mcclure" now active
Enter passphrase for /dev/vg-mcclure/mcclure-rootfs: 
>> LUKS device /dev/vg-mcclure/mcclure-rootfs opened 
>> Scanning for and activating Volume Groups 
  Reading all physical volumes.  This may take a while...
  Found volume group "vg-mcclure" using metadata type lvm2
  81 logical volume(s) in volume group "vg-mcclure" now active
>> Determining root device... 
>> Mounting /dev/mapper/root as root... 
>> Using mount -t ext4 -o ro 
>> Mounting /dev/mapper/mcclure.usr as /usr: mount -t ext4 -o atime,strictatime,ro /dev/mapper/mcclure.usr /newroot/usr 
mount: mounting /dev/mapper/mcclure.usr on /newroot/usr failed: No such file or directory
!! Unable to mount /dev/mapper/mcclure.usr for /usr 
>> Booting (initramfs)..
INIT: version 2.88 booting

   OpenRC 0.11.8 is starting up Gentoo Linux (x86_64) [XEN0]
...

mcclure ~ # emerge --info
Portage 2.1.11.31 (hardened/linux/amd64, gcc-4.5.4, glibc-2.15-r3, 3.6.10-gentoo-c0 x86_64)
=================================================================
System uname: Linux-3.6.10-gentoo-c0-x86_64-AMD_Athlon-tm-_II_X4_640_Processor-with-gentoo-2.1
Timestamp of tree: Sat, 15 Dec 2012 00:45:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo portage-overlay
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-fomit-frame-pointer -march=amdfam10 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-fomit-frame-pointer -march=amdfam10 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install protect-owned sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo           http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror               http://distfiles.gentoo.org             http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl amd64 bash-completion berkdb bzip2 cli cracklib crypt cups cxx dri gdbm hardened iconv ipv6 justify lm_sensors mmx modules mudflap multilib ncurses nls nptl openmp pam pax_kernel pcre pppd readline session sse sse2 ssl tcpd threads udev unicode urandom 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="authn_core authz_core socache_shmcb unixd 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="kexi words flow plan sheets stage tables krita karbon braindump" 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Richard Yao gentoo-dev 2013-06-06 07:07:11 UTC
I am CCing the hardened team because this will likely interest them. However, it might be easier if people affected by this adopted some form of volume management. For instance, you could use LVM on MD RAID or my personal favorite, ZFS.

There is a blog post that shows how to do this with ZFS that might be useful to anyone affected by this:

https://mthode.org/posts/2012/Dec/gentoo-hardened-zfs-rootfs-with-dm-cryptluks-updated-2012-12-12/

With that said, the genkernel team is composed of volunteers who are stretched thin across not only genkernel, but other parts of Gentoo. As such, this will likely be a low priority for us. Anyone who wants to see this done sooner should provide a patch.