aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-09-02 15:13:40 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-09-02 15:13:40 +0200
commit97b3a9235fdba36bfc6197baf1f47fd472fb74b6 (patch)
treea20c85c90887e77860a1297b36e0976e5bd16ccb
parentmanpage: Update rootfstype documentation (diff)
downloadgenkernel-97b3a9235fdba36bfc6197baf1f47fd472fb74b6.tar.gz
genkernel-97b3a9235fdba36bfc6197baf1f47fd472fb74b6.tar.bz2
genkernel-97b3a9235fdba36bfc6197baf1f47fd472fb74b6.zip
defaults/initrd.scripts: openLUKS(): Trigger module loading when mounting {root,swap}_keydev
We need to do the same we do for rootfs since commit 05f968fda2c6839744b36c442b3feaa6de974e63 also for {root,swap}_keydev. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rw-r--r--defaults/initrd.defaults2
-rw-r--r--defaults/initrd.scripts15
-rw-r--r--defaults/linuxrc6
-rw-r--r--doc/genkernel.8.txt6
4 files changed, 25 insertions, 4 deletions
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index cf7406d..cd485ca 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -101,8 +101,10 @@ GK_UDEV_TIMEOUT=120
GK_USERINTERACTION_DISABLED_STATEFILE='/tmp/user-interaction.disabled'
CRYPT_ENV_FILE='/etc/CRYPT_ENV.conf'
+CRYPT_ROOT_KEYDEV_FSTYPE='auto'
CRYPT_ROOT_KEYFILE='/tmp/root.key'
CRYPT_ROOT_OPENED_LOCKFILE='/tmp/ROOT.opened'
+CRYPT_SWAP_KEYDEV_FSTYPE='auto'
CRYPT_SWAP_KEYFILE='/tmp/swap.key'
CRYPT_SWAP_OPENED_LOCKFILE='/tmp/SWAP.opened'
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 7a84755..5181d6c 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1780,7 +1780,7 @@ openLUKS() {
exit 1
fi
- case $1 in
+ case ${1} in
root)
local TYPE=ROOT
;;
@@ -1789,8 +1789,12 @@ openLUKS() {
;;
esac
- eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"'
- eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"'
+ local LUKS_NAME="${1}"
+ eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"'
+ eval local LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"'
+ eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"'
+ eval local LUKS_KEYDEV_FSTYPE='"${CRYPT_'${TYPE}'_KEYDEV_FSTYPE}"'
+ eval local LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"'
eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"'
local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0
local mntkey="/mnt/key/" crypt_filter_ret=
@@ -1886,7 +1890,10 @@ openLUKS() {
# At this point a device was recognized, now let's see if the key is there
[ ! -d "${mntkey}" ] && mkdir -p "${mntkey}" >/dev/null 2>&1
- if ! run mount -n -o ro ${REAL_LUKS_KEYDEV} ${mntkey} >/dev/null 2>&1
+ # determine fs -- 'auto' will not trigger module loading!
+ LUKS_KEYDEV_FSTYPE=$(determine_fs "${REAL_LUKS_KEYDEV}" "${LUKS_KEYDEV_FSTYPE}")
+
+ if ! run mount -n -t ${LUKS_KEYDEV_FSTYPE} -o ro ${REAL_LUKS_KEYDEV} ${mntkey} >/dev/null 2>&1
then
KEYDEV_ERROR=1
bad_msg "Mounting of device ${REAL_LUKS_KEYDEV} failed." ${CRYPT_SILENT}
diff --git a/defaults/linuxrc b/defaults/linuxrc
index bab54e1..6d07d9b 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -257,6 +257,9 @@ do
root_keydev=*)
CRYPT_ROOT_KEYDEV=${x#*=}
;;
+ root_keydev_fstype=*)
+ CRYPT_ROOT_KEYDEV_FSTYPE=${x#*=}
+ ;;
root_trim=*)
CRYPT_ROOT_TRIM=${x#*=}
;;
@@ -266,6 +269,9 @@ do
swap_keydev=*)
CRYPT_SWAP_KEYDEV=${x#*=}
;;
+ swap_keydev_fstype=*)
+ CRYPT_SWAP_KEYDEV_FSTYPE=${x#*=}
+ ;;
real_resume=*|resume=*)
REAL_RESUME=${x#*=}
;;
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 7ce7391..5d7b74d 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -646,6 +646,9 @@ recognized by the kernel itself.
root_key. If unset while using root_key, it will automatically
look for the device in every boot.
+*root_keydev_fstype*=<...>::
+ Used filesystem for *root_keydev*. See *rootfstype* for more details.
+
*root_trim*=(yes|no)::
Enables TRIM support for a LUKS-based root device. Only useful
with SSD setups. Have a look at 'https://en.wikipedia.org/wiki/TRIM'
@@ -657,6 +660,9 @@ recognized by the kernel itself.
*swap_keydev*=<...>::
Same as root_keydev for swap.
+*swap_keydev_fstype*=<...>::
+ Used filesystem for *swap_keydev*. See *rootfstype* for more details.
+
*crypt_silent*::
Set this to silent all the output related to the cryptographic
software, and in case your encrypted device isn't open with the