Skip to content

Commit 644b0f1

Browse files
committed
Use an early-setup hook to force console init in release images
Setting rd.hostonly=0 in the release and recovery images causes dracut to throw out the initqueue hooks that ZBM installs to force the event loop to fire at least once. As a result, the console is often not initialized before ZBM takes control. ZFSBootMenu early-setup hooks provide a convenient place to force the console initialization, allowing things like fonts and keymaps to be set before password prompts might appear.
1 parent ec89a7c commit 644b0f1

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

contrib/console-init.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
## This early-setup hook forces the dracut console initialization hook to run.
4+
##
5+
## ZFSBootMenu release builds embed rd.hostonly=0 in the kernel command line,
6+
## which causes the normal dracut initqueue to be thrown out; the ZFSBootMenu
7+
## initqueue hooks that force the dracut event loop to run at least once are
8+
## purged, so dracut terminates the event loop before console initialization.
9+
10+
# There is nothing to do if the console initializer is not executable
11+
[ -x /lib/udev/console_init ] || exit 0
12+
13+
if [ -z "${control_term}" ] && [ -f /etc/zfsbootmenu.conf ]; then
14+
# If control_term isn't defined, check the runtime config for it
15+
# shellcheck disable=SC1091
16+
source /etc/zfsbootmenu.conf
17+
fi
18+
19+
# There is nothing to do without a valid control_term device
20+
[ -c "${control_term}" ] || exit 0
21+
22+
# Try to initialize the console
23+
/lib/udev/console_init "${control_term##*/}" >/dev/null 2>&1

etc/zfsbootmenu/recovery.conf.d/recovery.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
zfsbootmenu_teardown+=" /zbm/contrib/xhci-teardown.sh "
2+
zfsbootmenu_early_setup+=" /zbm/contrib/console-init.sh "
23
install_optional_items+=" /etc/zbm-commit-hash /bin/gdisk /bin/parted /bin/mkfs.vfat /bin/mkfs.ext4 /bin/curl /bin/efibootmgr /bin/ip /bin/dhclient /sbin/dhclient-script "
34
omit_drivers+=" amdgpu radeon nvidia nouveau i915 "
45

etc/zfsbootmenu/release.conf.d/release.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
zfsbootmenu_teardown+=" /zbm/contrib/xhci-teardown.sh "
2+
zfsbootmenu_early_setup+=" /zbm/contrib/console-init.sh "
23
install_optional_items+=" /etc/zbm-commit-hash "
34
omit_drivers+=" amdgpu radeon nvidia nouveau i915 "
45

0 commit comments

Comments
 (0)