From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 15EFE13835B for ; Mon, 15 Feb 2021 06:01:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3DAF8E0B0E; Mon, 15 Feb 2021 06:01:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 24F6AE0B0E for ; Mon, 15 Feb 2021 06:01:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D969133BDFF for ; Mon, 15 Feb 2021 06:01:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4A1914C9 for ; Mon, 15 Feb 2021 06:01:19 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1613368319.f8a26eeba219c4027848fd50a2ae4e9d22029168.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts defaults/unlock-luks.sh X-VCS-Directories: defaults/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: f8a26eeba219c4027848fd50a2ae4e9d22029168 X-VCS-Branch: master Date: Mon, 15 Feb 2021 06:01:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 70d866e4-1c55-4d01-8153-fb74bcb4634b X-Archives-Hash: e3426df51985f0ed89704bd7af692da5 commit: f8a26eeba219c4027848fd50a2ae4e9d22029168 Author: Thomas Deutschmann gentoo org> AuthorDate: Mon Feb 15 05:44:32 2021 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Mon Feb 15 05:51:59 2021 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f8a26eeb 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 gentoo.org> defaults/initrd.scripts | 8 +++++++- defaults/unlock-luks.sh | 8 +++++++- 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