Skip to contentSkip to conversation

cryptroot-ask: check that plymouth is running before use

PATCH In review Andrey Borzenkov 2 participants 5 messages Mar 10, 2011 – Mar 11, 2011 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cryptroot-ask: check that plymouth is running before use

Otherwise there is no way to skip pasword prompt. --has-active-vt seems to correctly catch also the case when plymouthd is started but splash is disabled.

---
 modules.d/90crypt/cryptroot-ask.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +2 -3
index 5150688..9c99ccc 100755
@@ -80,9 +80,8 @@ if [ -n "$(getarg rd.luks.key)" ]; then
     rmdir "$mntp"
     unset mntp keypath keydev
 else
-    # Prompt for password with plymouth, if installed.
-    # Should we check if plymouthd is running?
-    if [ -x /bin/plymouth ]; then
+    # Prompt for password with plymouth, if installed and running.
+    if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
         prompt="Password [$device ($luksname)]:" 
         if [ ${#luksname} -gt 8 ]; then
             sluksname=${sluksname##luks-}
Signature · 1 line
tg: (661f9a3..) upstream/crypto-plymouth (depends on: origin/master)

A message that is not in the archive (sent off-list or not yet received): 1299797644-6951-1-git-send-email-arvidjaar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

Am 10.03.2011 23:54, schrieb Andrey Borzenkov:

Quoted 16 lines

Otherwise there is no way to skip pasword prompt. --has-active-vt seems to correctly catch also the case when plymouthd is started but splash is disabled.

---
 modules.d/90crypt/cryptroot-ask.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +0 -0
index 5150688..9c99ccc 100755
@@ -80,9 +80,8 @@ if [ -n "$(getarg rd.luks.key)" ]; then
     rmdir "$mntp"

modules.d/90crypt/cryptroot-ask.sh if [ -n "$(getarg rd.luks.key)" ]; then · line 87

Quoted 10 lines
modules.d/90crypt/cryptroot-ask.sh +2 -3
     unset mntp keypath keydev
 else
-    # Prompt for password with plymouth, if installed.
-    # Should we check if plymouthd is running?
-    if [ -x /bin/plymouth ]; then
+    # Prompt for password with plymouth, if installed and running.
+    if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
         prompt="Password [$device ($luksname)]:" 
         if [ ${#luksname} -gt 8 ]; then
             sluksname=${sluksname##luks-}

Very nice! Thank you!

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 21 lines · Harald Hoyer

Am 10.03.2011 23:54, schrieb Andrey Borzenkov:

Quoted 20 lines

Otherwise there is no way to skip pasword prompt. --has-active-vt seems to correctly catch also the case when plymouthd is started but splash is disabled.

---
 modules.d/90crypt/cryptroot-ask.sh |    5 ++---

 1 files changed, 2 insertions(+), 3 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +0 -0
index 5150688..9c99ccc 100755
@@ -80,9 +80,8 @@ if [ -n "$(getarg rd.luks.key)" ]; then

     rmdir "$mntp"
     unset mntp keypath keydev
 else
-    # Prompt for password with plymouth, if installed.
-    # Should we check if plymouthd is running?

Quoted 9 lines
Quoted 6 lines

-    if [ -x /bin/plymouth ]; then
+    # Prompt for password with plymouth, if installed and running.
+    if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then prompt="Password [$device ($luksname)]:"
         if [ ${#luksname} -gt 8 ]; then sluksname=${sluksname##luks-}

Very nice! Thank you!

I think attached patch still makes sense in addition to (or probably even instead of) this one.

From: Andrey Borzenkov <[email protected]>
Subject: [PATCH] cryptoroot-ask: limit number of plymouth password requests

Set number ot retries to 5 to align with non-plymouth case.

---
 modules.d/90crypt/cryptroot-ask.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +1 -1
index 9c99ccc..4a65c23 100755
@@ -92,7 +92,7 @@ else
         # flock against other interactive activities
         { flock -s 9; 
             /bin/plymouth ask-for-password \
-                --prompt "$prompt" \
+                --prompt "$prompt" --number-of-tries=5 \
                 --command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
         } 9>/.console.lock
         
Signature · 1 line
tg: (664193e..) upstream/passwd-retries (depends on: upstream/crypto-plymouth)

A message that is not in the archive (sent off-list or not yet received): AANLkTiktfbVu4SqV0Y+2=GQ3iGJjTGKXVJDHr0mEAMjf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Am 11.03.2011 10:43, schrieb Andrey Borzenkov:

Quoted 2 lines

I think attached patch still makes sense in addition to (or probably even instead of) this one.

also ok for me

#7 lore raw
In reply to a message not in the archive

Am 11.03.2011 10:43, schrieb Andrey Borzenkov:

Quoted 32 lines · Harald Hoyer
Quoted 21 lines

Am 10.03.2011 23:54, schrieb Andrey Borzenkov:

Quoted 20 lines

Otherwise there is no way to skip pasword prompt. --has-active-vt seems to correctly catch also the case when plymouthd is started but splash is disabled.

---
 modules.d/90crypt/cryptroot-ask.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
modules.d/90crypt/cryptroot-ask.sh +0 -2
index 5150688..9c99ccc 100755
@@ -80,9 +80,8 @@ if [ -n "$(getarg rd.luks.key)" ]; then
     rmdir "$mntp"
     unset mntp keypath keydev
 else
-    # Prompt for password with plymouth, if installed.
-    # Should we check if plymouthd is running?
Quoted 9 lines

modules.d/90crypt/cryptroot-ask.sh if [ -n "$(getarg rd.luks.key)" ]; then · line 87

Quoted 6 lines
modules.d/90crypt/cryptroot-ask.sh +2 -1
-    if [ -x /bin/plymouth ]; then
+    # Prompt for password with plymouth, if installed and running.
+    if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
         prompt="Password [$device ($luksname)]:"
         if [ ${#luksname} -gt 8 ]; then
             sluksname=${sluksname##luks-}

Very nice! Thank you!

Quoted 2 lines

I think attached patch still makes sense in addition to (or probably even instead of) this one.

pushed both