From 56f390967ff87515f7269f4793b9a651f0e3b87c Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Mon, 21 Sep 2015 12:37:14 +0200 Subject: [PATCH] 90crypt: Don't use systemd for crypt - rd.luks.key is not implemented (properly) if systemd is enabled, so ignore systemd in 90crypt - Source of this patch: https://github.com/jsynacek/dracut/commit/058aa18e3ec2bd6b34e6afff0f2653d742dea0f5 - Fixes boo#915849 Signed-off-by: Fabian Vogt --- modules.d/90crypt/crypt-run-generator.sh | 31 ------------------------------- modules.d/90crypt/module-setup.sh | 9 --------- modules.d/90crypt/parse-crypt.sh | 20 -------------------- 3 files changed, 60 deletions(-) delete mode 100755 modules.d/90crypt/crypt-run-generator.sh Index: dracut-043/modules.d/90crypt/crypt-run-generator.sh =================================================================== --- dracut-043.orig/modules.d/90crypt/crypt-run-generator.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -. /lib/dracut-lib.sh -type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh - -dev=$1 -luks=$2 - -crypttab_contains "$luks" && exit 0 - -allowdiscards="-" - -# parse for allow-discards -if strstr "$(cryptsetup --help)" "allow-discards"; then - if discarduuids=$(getargs "rd.luks.allow-discards"); then - discarduuids=$(str_replace "$discarduuids" 'luks-' '') - if strstr " $discarduuids " " ${luks##luks-}"; then - allowdiscards="allow-discards" - fi - elif getargbool 0 rd.luks.allow-discards; then - allowdiscards="allow-discards" - fi -fi - -echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab - -if command -v systemctl >/dev/null; then - systemctl daemon-reload - systemctl start cryptsetup.target -fi -exit 0 Index: dracut-043/modules.d/90crypt/module-setup.sh =================================================================== --- dracut-043.orig/modules.d/90crypt/module-setup.sh +++ dracut-043/modules.d/90crypt/module-setup.sh @@ -89,14 +89,5 @@ install() { inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh" inst_simple "/tmp/dracut_block_uuid.map" "/usr/lib/dracut/modules.d/90crypt/block_uuid.map" - inst_multiple -o \ - $systemdutildir/system-generators/systemd-cryptsetup-generator \ - $systemdutildir/systemd-cryptsetup \ - $systemdsystemunitdir/systemd-ask-password-console.path \ - $systemdsystemunitdir/systemd-ask-password-console.service \ - $systemdsystemunitdir/cryptsetup.target \ - $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \ - systemd-ask-password systemd-tty-ask-password-agent - inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator dracut_need_initqueue } Index: dracut-043/modules.d/90crypt/parse-crypt.sh =================================================================== --- dracut-043.orig/modules.d/90crypt/parse-crypt.sh +++ dracut-043/modules.d/90crypt/parse-crypt.sh @@ -25,7 +25,6 @@ else luksid=${luksid##luks-} - if [ -z "$DRACUT_SYSTEMD" ]; then { printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", ' printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid @@ -33,17 +32,6 @@ else printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask) printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout } >> /etc/udev/rules.d/70-luks.rules.new - else - if ! crypttab_contains "$luksid"; then - { - printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", ' - printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid - printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue) - printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl) - printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n' - } >> /etc/udev/rules.d/70-luks.rules.new - fi - fi uuid=$luksid while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done @@ -56,19 +44,11 @@ else } >> $hookdir/emergency/90-crypt.sh done elif getargbool 0 rd.auto; then - if [ -z "$DRACUT_SYSTEMD" ]; then { printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue) printf -- '--unique --settled --onetime --name cryptroot-ask-%%k ' printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout } >> /etc/udev/rules.d/70-luks.rules.new - else - { - printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue) - printf -- '--unique --settled --onetime --name crypt-run-generator-%%k ' - printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator) - } >> /etc/udev/rules.d/70-luks.rules.new - fi fi echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new Index: dracut-043/modules.d/90crypt/crypt-lib.sh =================================================================== --- dracut-043.orig/modules.d/90crypt/crypt-lib.sh +++ dracut-043/modules.d/90crypt/crypt-lib.sh @@ -90,7 +90,7 @@ ask_for_password() { [ "$tty_echo_off" = yes ] && stty $stty_orig fi - } 9>/.console_lock + } <> /dev/tty0 >&0 2>&1 9>/.console_lock [ $ret -ne 0 ] && echo "Wrong password" >&2 return $ret