commit:     3b69162f8760e4f49631706723921c3c5dc6986e
Author:     Louis Sautier <sautier.louis <AT> gmail <DOT> com>
AuthorDate: Sat Jan  5 01:29:01 2019 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Mar  1 05:59:06 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3b69162f

Fix init/login-remote logic so that init keeps going once disks are decrypted

* Kill the cryptsetup process started by init, otherwise it will hang
  forever.
* Make init check for an already-opened device before prompting the
  user, otherwise we have to wait for the prompt_user calls to time out.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 defaults/initrd.scripts  | 10 +++++-----
 defaults/login-remote.sh |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index a88ed60..c57f016 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1295,8 +1295,12 @@ openLUKS() {
        while [ 1 ]
        do
                local gpg_cmd=""
+               if [ -e ${flag_opened} ]
+               then
+                       good_msg "The LUKS device ${LUKS_DEVICE} meanwhile was 
opened by someone else."
+                       break
                # if crypt_silent=1 and some error occurs, enter shell quietly
-               if [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 
\) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ]
+               elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 
1 \) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ]
                then
                        run_shell
                elif [ ${DEV_ERROR} -eq 1 ]
@@ -1311,10 +1315,6 @@ openLUKS() {
                then
                        prompt_user "LUKS_KEYDEV" "${LUKS_NAME} key device"
                        KEYDEV_ERROR=0
-               elif [ -e ${flag_opened} ]
-               then
-                       good_msg "The LUKS device ${LUKS_DEVICE} meanwhile was 
opened by someone else."
-                       break
                else
                        LUKS_DEVICE=$(find_real_device "${LUKS_DEVICE}")
 

diff --git a/defaults/login-remote.sh b/defaults/login-remote.sh
index 4d7aac6..c667b5e 100644
--- a/defaults/login-remote.sh
+++ b/defaults/login-remote.sh
@@ -104,6 +104,9 @@ openLUKSremote() {
                                then
                                        touch ${flag_opened}
                                        good_msg "LUKS device ${LUKS_DEVICE} 
opened" ${CRYPT_SILENT}
+                                       # Kill the cryptsetup process started 
by init
+                                       # so that the boot process can continue
+                                       killall cryptsetup
                                        break
                                else
                                        bad_msg "Failed to open LUKS device 
${LUKS_DEVICE}" ${CRYPT_SILENT}

Reply via email to