* Re: [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings.
@ 2015-03-31 19:59 NeilBrown
0 siblings, 0 replies; 3+ messages in thread
From: NeilBrown @ 2015-03-31 19:59 UTC (permalink / raw)
To: harald-H+wXaHxf7aLQT0dZR+AlfA
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, trenn-IBi9RG/b67k
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
[I was alerted that you had replied to the list, but not to me.
I'm not on the list..]
> >
> > + while read _dev _uuid ; do
> > + set_systemd_timeout_for_dev $_dev
> > + done
>
> missing redirector from /etc/crypttab I guess
Sorry about that. The missing redirector is actually from
/usr/lib/dracut/modules.d/90crypt/block_uuid.map
but that looks like an openSUSE specific thing...
https://build.opensuse.org/package/view_file/openSUSE:13.2/dracut/0144-90crypt-Fixed-crypttab_contains-to-also-work-with-de.patch?expand=1
It should just use /etc/crypttab, but then the "read" needs to change
while read _mapper _dev _rest; do
set_systemd_timeout_for_dev $_dev
done < /etc/crypttab
Thanks,
NeilBrown
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 0/4] dracut: fix various issues with newly degraded md arrays
@ 2015-03-26 4:41 NeilBrown
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
When an md array is newly degraded at boot it will not be assembled
until mdraid_start.sh is run.
There are a few problem with the timeout handling that causes this
not to work properly in all circumstances.
These patches fix the bug I had reported.
Thanks,
NeilBrown
---
NeilBrown (4):
mdraid/mdraid_start.sh: tell mainloop if we make progress.
systemd/dracut-iniqueue - continue waiting if any timeout script makes progress
dracut-systemd/rootfs-generator.sh: always create generated files.
crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings.
modules.d/90crypt/parse-crypt.sh | 4 ++
modules.d/90mdraid/mdraid_start.sh | 1
modules.d/98dracut-systemd/dracut-initqueue.sh | 1
modules.d/98dracut-systemd/rootfs-generator.sh | 15 ++++---
modules.d/99base/dracut-lib.sh | 53 +++++++++++++++---------
5 files changed, 48 insertions(+), 26 deletions(-)
--
Signature
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>]
* [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings. [not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org> @ 2015-03-26 4:41 ` NeilBrown [not found] ` <20150326044148.10121.15286.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: NeilBrown @ 2015-03-26 4:41 UTC (permalink / raw) To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA When systemd's crypttab generator parsed crypttab, it tells systemd about several devices which may not appear until later in the boot sequence, and which are not needed while dract is running. This can particularly happen when an md array is encrypted, and the array is newly degraded so that it doesn't appear until dracut runs mdraid_start.sh. This can result in systemd printing warning messages which are inappropriate. So tell systemd that the timeout for each of these is zero. This is involves splitting some functionality out of wait_for_dev() That function does two things: - creates 'finished' hooks so that dracut will wait for the device, and - sets the systemd timeout for the device to zero, so systemd doesn't wait. We only want the second of these for most encrypted devices. So split that out into a new function set_systemd_timeout_for_dev(), and call it from parse-crypt.sh Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org> --- modules.d/90crypt/parse-crypt.sh | 4 +++ modules.d/99base/dracut-lib.sh | 53 ++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh index 94ad1f63ae6f..5a64652cc51c 100755 --- a/modules.d/90crypt/parse-crypt.sh +++ b/modules.d/90crypt/parse-crypt.sh @@ -14,6 +14,10 @@ else LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID) tout=$(getarg rd.luks.key.tout) + while read _dev _uuid ; do + set_systemd_timeout_for_dev $_dev + done + if [ -n "$LUKS" ]; then for luksid in $LUKS; do diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 259e2057b67e..c8ff3c1a32d1 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -895,12 +895,10 @@ dev_unit_name() printf -- "%s" "$dev" } -# wait_for_dev <dev> -# -# Installs a initqueue-finished script, -# which will cause the main loop only to exit, -# if the device <dev> is recognized by the system. -wait_for_dev() +# set_systemd_timeout_for_dev <dev> +# Set 'rd.timeout' as the systemd timeout for <dev> + +set_systemd_timeout_for_dev() { local _name local _needreload @@ -915,19 +913,6 @@ wait_for_dev() _timeout=$(getarg rd.timeout) _timeout=${_timeout:-0} - _name="$(str_replace "$1" '/' '\x2f')" - - type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh" - - [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 - - printf '[ -e "%s" ]\n' $1 \ - >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" - { - printf '[ -e "%s" ] || ' $1 - printf 'warn "\"%s\" does not exist"\n' $1 - } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh" - if [ -n "$DRACUT_SYSTEMD" ]; then _name=$(dev_unit_name "$1") if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then @@ -952,6 +937,36 @@ wait_for_dev() fi fi } +# wait_for_dev <dev> +# +# Installs a initqueue-finished script, +# which will cause the main loop only to exit, +# if the device <dev> is recognized by the system. +wait_for_dev() +{ + local _name + local _noreload + + if [ "$1" = "-n" ]; then + _noreload=-n + shift + fi + + _name="$(str_replace "$1" '/' '\x2f')" + + type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh" + + [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 + + printf '[ -e "%s" ]\n' $1 \ + >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" + { + printf '[ -e "%s" ] || ' $1 + printf 'warn "\"%s\" does not exist"\n' $1 + } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh" + + set_systemd_timeout_for_dev $_noreload $1 +} cancel_wait_for_dev() { ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <20150326044148.10121.15286.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>]
* Re: [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings. [not found] ` <20150326044148.10121.15286.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org> @ 2015-03-26 11:51 ` Harald Hoyer 0 siblings, 0 replies; 3+ messages in thread From: Harald Hoyer @ 2015-03-26 11:51 UTC (permalink / raw) To: NeilBrown; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 26.03.2015 05:41, NeilBrown wrote: > When systemd's crypttab generator parsed crypttab, it tells systemd about > several devices which may not appear until later in the boot sequence, > and which are not needed while dract is running. > > This can particularly happen when an md array is encrypted, and the array > is newly degraded so that it doesn't appear until dracut runs > mdraid_start.sh. > > This can result in systemd printing warning messages which are > inappropriate. > > So tell systemd that the timeout for each of these is zero. > > This is involves splitting some functionality out of wait_for_dev() > > That function does two things: - creates 'finished' hooks so that dracut > will wait for the device, and - sets the systemd timeout for the device > to zero, so systemd doesn't wait. > > We only want the second of these for most encrypted devices. So split > that out into a new function set_systemd_timeout_for_dev(), and call it > from parse-crypt.sh > > Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org> --- > modules.d/90crypt/parse-crypt.sh | 4 +++ > modules.d/99base/dracut-lib.sh | 53 > ++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), > 19 deletions(-) > > diff --git a/modules.d/90crypt/parse-crypt.sh > b/modules.d/90crypt/parse-crypt.sh index 94ad1f63ae6f..5a64652cc51c 100755 > --- a/modules.d/90crypt/parse-crypt.sh +++ > b/modules.d/90crypt/parse-crypt.sh @@ -14,6 +14,10 @@ else LUKS=$(getargs > rd.luks.uuid -d rd_LUKS_UUID) tout=$(getarg rd.luks.key.tout) > > + while read _dev _uuid ; do + set_systemd_timeout_for_dev $_dev > + done + missing redirector from /etc/crypttab I guess ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-31 19:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 19:59 [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings NeilBrown
-- strict thread matches above, loose matches on Subject: below --
2015-03-26 4:41 [PATCH 0/4] dracut: fix various issues with newly degraded md arrays NeilBrown
[not found] ` <20150326043938.10121.34223.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-26 4:41 ` [PATCH 4/4] crypt/parse-crypt.sh: hide encrypted devices from systemd timeout warnings NeilBrown
[not found] ` <20150326044148.10121.15286.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-26 11:51 ` Harald Hoyer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox