I have a disk encrypted by luks, the encrypted key is stored on a usb stick. When dracut boots the kernel, it gives this error message: [ 3.466770] dracut: Probing /dev/sde1 for /key... [ 3.629063] EXT4-fs (sde1): mounted filesystem with ordered data mode. Opts: (null) [ 3.641960] dracut: Found /key on /dev/sde1 [ 3.652221] dracut: luksOpen /dev/nvme0n1p2 luks-0cd5d4cd-730f-42c1-a2c5-d9ce3dbbff96 [ 3.658428] dracut: Using '/key' on '/dev/sde1' [ 3.821279] EXT4-fs (sde1): mounted filesystem with ordered data mode. Opts: (null) [ 6.882036] EXT4-fs (dm-0): INFO: recovery required on readonly filesystem [ 6.883338] EXT4-fs (dm-0): write access will be enabled during recovery [ 7.275155] EXT4-fs (dm-0): orphan cleanup on readonly fs [ 7.276663] EXT4-fs (dm-0): 2 orphan inodes deleted [ 7.277893] EXT4-fs (dm-0): recovery complete [ 7.294063] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: data=ordered [ 7.322992] dracut: Checking ext4: /dev/disk/by-uuid/7cec672b-cb75-4f9f-812d-77fe1fdb3124 [ 7.324296] dracut: issuing _drv=e2fsck fsck_drv_com -a /dev/disk/by-uuid/7cec672b-cb75-4f9f-812d-77fe1fdb3124 [ 7.327145] /lib/fs-lib.sh: line 109: _drv=e2fsck fsck_drv_com: command not found [ 7.327145] dracut Warning: _drv=e2fsck fsck_drv_com returned with 127 [ 7.329694] dracut Warning: *** An error occurred during the file system check. [ 7.332215] dracut Warning: *** Dropping you to a shell; the system will try [ 7.334721] dracut Warning: *** to mount the filesystem(s), when you leave the shell. [ 7.339653] dracut Warning: /usr/lib64/dracut/modules.d/99fs-lib/fs-lib.sh: # common code for checkers that follow usual subset of options and return codes fsck_drv_com() { local _ret local _out if ! strglobin "$_fop" "-[ynap]"; then _fop="-a ${_fop}" fi info "issuing $_drv $_fop $_dev" # we enforce non-interactive run, so $() is fine _out=$($_drv $_fop "$_dev") _ret=$? fsck_tail return $_ret } Line 109 is that one which starts with _out. It looks like a bug or typo in those dracut script, like it does not evaluate the variable $_drv, just running _drv, or there is a problem in those magic $($_...).
It doesn't seem like the dracut code has changed much recently. Does this work in earlier versions of dracut?
Created attachment 562912 [details] test.sh This is a problem with POSIX mode in bash-5.0: dash: $ dash test.sh issuing echo hello hello world bash-4.3: $ bash test.sh issuing echo hello hello world $ bash --posix test.sh issuing echo hello hello world bash-5.0: $ bash test.sh issuing echo hello hello world $ bash --posix test.sh issuing _drv=echo fsck_drv_com hello test.sh: line 10: _drv=echo: command not found
Note: when bash is called via /bin/sh symlink, then POSIX mode is enabled.
(In reply to Alexander Tsoy from comment #2) > Created attachment 562912 [details] > test.sh After commenting out "local _drv" in fsck_single(), with bash-5.0: $ bash test.sh issuing echo hello hello world $ bash --posix test.sh issuing echo hello hello world
Created attachment 562914 [details] test2.sh Minimal test case. $ bash test2.sh foo: hello world bar: hello world $ bash --posix test2.sh bar: hello world
Created attachment 562916 [details] test2.sh This should better demonstrate what's going on: $ bash --posix test2.sh foo: bye bye bar: hello world $ bash test2.sh foo: hello world bar: hello world
(In reply to Mike Gilbert from comment #1) > It doesn't seem like the dracut code has changed much recently. > > Does this work in earlier versions of dracut? No, it started to happen like a week ago, after a typical "emerge -uDN world". When it started on I second computer, I got worried.
(In reply to Alexander Tsoy from comment #6) > Created attachment 562916 [details] > test2.sh > > This should better demonstrate what's going on: Do I still need to test it with earlier versions of dracut as Mike suggested? Or the problem is clearly in bash?
I just hit the same issue after updating the system and getting bash 5. I found a patch used by Void Linux: https://raw.githubusercontent.com/void-linux/void-packages/fdeed0979a8f63e380d7b8cba24fa0eb2d6f5c7f/srcpkgs/dracut/patches/fix-bash-5.patch I applied it to dracut 049 and after that the boot process works fine.
(In reply to Vadim Dyadkin from comment #8) No need to test older dracut versions.
I had the same error. I found the following Debian bug report which has some more info. I applied the one-line fix locally ("3rd option" as suggested in the Debian bug) and it worked for me. YMMV https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=920563 > The 3rd option could be easily accomplished by adding the following line > to the top of /init (/usr/lib/dracut/modules.d/99base/init.sh) after the > initial comment block: > > [ -f /bin/bash ] && [ "$BASH" = "/bin/sh" ] && exec /bin/bash /init
Have same problem after dracut and bash-5.0_p2 upgrade.
It would be helpful if someone would report this to dracut upstream, since bash-5.0 is not going to be "fixed". Maybe Alexander can send a patch with rationale?
Created attachment 565024 [details, diff] Use bash for init rather than sh so bashisms work
(In reply to Mark Wagner from comment #14) > Created attachment 565024 [details, diff] [details, diff] > Use bash for init rather than sh so bashisms work :) From a brief examination of the source code dracut is full of bashisms and other shells have given in and implemented them (in various ways because there is no standard.) The most egregious is local variables which dracut uses heavily. Other shells have implemented local in kinda the same way which leads to problems on edge cases. See http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_09_18 "Local variables within a function were considered and included in another early proposal (controlled by the special built-in local), but were removed because they do not fit the simple model developed for functions and because there was some opposition to adding yet another new special built-in that was not part of historical practice." See however http://austingroupbugs.net/view.php?id=767
Send patches upstream.
(In reply to Mike Gilbert from comment #16) > Send patches upstream. I didn't send my patch upstream but I did create a bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1676988
(In reply to Mike Gilbert from comment #13) > Maybe Alexander can send a patch with rationale? Sorry, I was on vacation. I'll look into it this week if I have time.
Please block >=app-shells/bash-5.0 from within sys-kernel/dracut-049 until a fix lands portage tree.
(In reply to Martin Mokrejš from comment #19) > Please block >=app-shells/bash-5.0 from within sys-kernel/dracut-049 until a > fix lands portage tree. I hesitate to do that because only a subset of dracut users are affected. Anyone using the systemd module does not run into the problem.
Please try with app-shells/bash-5.0_p3-r1
(In reply to Alexander Tsoy from comment #21) > Please try with app-shells/bash-5.0_p3-r1 That fixed it for me!
(In reply to Alexander Tsoy from comment #21) > Please try with app-shells/bash-5.0_p3-r1 Fixed for me too.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=980830b7e4a2953550338f13dd8525bcad28d8fc commit 980830b7e4a2953550338f13dd8525bcad28d8fc Author: Alexander Tsoy <alexander@tsoy.me> AuthorDate: 2019-12-26 14:26:15 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2019-12-29 19:36:23 +0000 sys-kernel/dracut: Add a bunch of upstream patches * fix dracut-install crashes * install kernel module dependencies of dependencies * add support for compressed firmware files * add support for rngd service * bash-5 compatibility * add fts-standalone dependency and configure check for musl * fix udevdir detection Closes: https://bugs.gentoo.org/676268 Closes: https://bugs.gentoo.org/677788 Closes: https://bugs.gentoo.org/687602 Bug: https://bugs.gentoo.org/703438 Signed-off-by: Alexander Tsoy <alexander@tsoy.me> Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-kernel/dracut/dracut-049-r3.ebuild | 176 +++++++++++++++++++++ ...gure-find-cflags-and-libs-for-fts-on-musl.patch | 97 ++++++++++++ ...t-create-locking-directory-run-cryptsetup.patch | 32 ++++ ...all-Support-the-compressed-firmware-files.patch | 63 ++++++++ .../049-dracut.sh-Fix-udevdir-detection.patch | 38 +++++ .../dracut/files/049-fs-lib-drop-a-bashism.patch | 99 ++++++++++++ ...cut-install.c-install-module-dependencies.patch | 79 +++++++++ ...ing_hash_func-should-not-be-fed-with-NULL.patch | 38 +++++ ...g-the-systemdutildir-variable-before-it-s.patch | 55 +++++++ ...ager-call-the-online-hook-for-connected-d.patch | 32 ++++ ...ager-fix-getting-of-ifname-from-the-sysfs.patch | 37 +++++ ...rk-manager-remove-useless-use-of-basename.patch | 26 +++ ...dule-running-early-during-boot-to-help-ge.patch | 88 +++++++++++ 13 files changed, 860 insertions(+)