aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-02-15 06:44:32 +0100
committerThomas Deutschmann <whissi@gentoo.org>2021-02-15 06:51:59 +0100
commitf8a26eeba219c4027848fd50a2ae4e9d22029168 (patch)
tree98d6f6191e0d826b3ffc0870d021b9902e1d5693
parentinitrd.scripts: openLUKS(): validate argument (diff)
downloadgenkernel-f8a26eeba219c4027848fd50a2ae4e9d22029168.tar.gz
genkernel-f8a26eeba219c4027848fd50a2ae4e9d22029168.tar.bz2
genkernel-f8a26eeba219c4027848fd50a2ae4e9d22029168.zip
initrd.scripts: openLUKS(): differentiate LUKS_DEVICE errors
If LUKS_DEVICE was not found user can either have not set crypt_{root,swap}, set crypt_{root,swap} to an invalid value or kernel is lacking storage support (i.e. missing controller driver). Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rw-r--r--defaults/initrd.scripts8
-rw-r--r--defaults/unlock-luks.sh8
2 files changed, 14 insertions, 2 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 2fcc593..f7e6c3d 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1783,6 +1783,12 @@ openLUKS() {
local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0
local mntkey="/mnt/key/" crypt_filter_ret=
+ if [ -z "${LUKS_DEVICE}" ]
+ then
+ bad_msg "'crypt_${1}' kernel command-line argument is not set!"
+ exit 1
+ fi
+
while true
do
local gpg_cmd=""
@@ -1810,7 +1816,7 @@ openLUKS() {
LUKS_DEVICE=$(find_real_device "${LUKS_DEVICE}")
if [ -z "${LUKS_DEVICE}" ]
then
- bad_msg "Looks like CRYPT_${TYPE} kernel cmdline argument is not set." ${CRYPT_SILENT}
+ bad_msg "Failed to find LUKS device. If crypt_${1} kernel command-line argument is correct you are probably missing kernel support for your storage!" ${CRYPT_SILENT}
DEV_ERROR=1
continue
fi
diff --git a/defaults/unlock-luks.sh b/defaults/unlock-luks.sh
index 59e086a..4c99a1f 100644
--- a/defaults/unlock-luks.sh
+++ b/defaults/unlock-luks.sh
@@ -49,6 +49,12 @@ main() {
eval local cryptsetup_options='"${CRYPT_'${TYPE}'_OPTIONS}"'
eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"'
+ if [ -z "${LUKS_DEVICE}" ]
+ then
+ bad_msg "'crypt_${NAME}' kernel command-line argument is not set!"
+ exit 1
+ fi
+
while true
do
local gpg_cmd crypt_filter_ret
@@ -61,7 +67,7 @@ main() {
LUKS_DEVICE=$(find_real_device "${LUKS_DEVICE}")
if [ -z "${LUKS_DEVICE}" ]
then
- bad_msg "Looks like CRYPT_${TYPE} kernel cmdline argument is not set." "${CRYPT_SILENT}"
+ bad_msg "Failed to find LUKS device. If crypt_${NAME} kernel command-line argument is correct you are probably missing kernel support for your storage!" ${CRYPT_SILENT}
exit 1
fi