Closed cfellinger closed 8 years ago
Please test these two patches:
--- /etc/zfs/zfs-functions~ 2016-04-17 20:49:18.226373449 +0100
+++ /etc/zfs/zfs-functions 2016-04-18 11:20:55.020041123 +0100
@@ -388,6 +388,37 @@
/proc/cmdline
}
+# Disable debugging
+disable_debug()
+{
+ if [ -n "${ZFS_DEBUG}" ]; then
+ unset ZFS_DEBUG
+ set +x
+ fi
+
+ # Restore STDERR from #6.
+ exec 2<&6 6<&-
+}
+
+# Enable debugging
+enable_debug()
+{
+ ZFS_DEBUG=1
+ mkdir -p /var/log
+
+ # Save STDERR as #6.
+ exec 6<&2
+
+ # Close and reopen STDERR and redirect it.
+ exec 2<&-
+
+ [ -f "/var/log/zfs-boot.debug" ] && \
+ exec 2>> /var/log/zfs-boot.debug || \
+ exec 2> /var/log/zfs-boot.debug
+
+ set -x
+}
+
# Check if the specified module is loaded.
check_module_loaded()
{
@@ -1019,13 +1050,9 @@
local i=1
local SNAP snapnr snap debug
- # We need to temporarily disable debugging. Set 'debug' so we
- # remember to enabled it again.
- if [ -n "${ZFS_DEBUG}" ]; then
- unset ZFS_DEBUG
- set +x
- debug=1
- fi
+ # We need to temporarily disable debugging because it interferes with the output.
+ # Set 'debug' so we remember to enabled it again.
+ disable_debug ; debug=1
# Because we need the resulting snapshot, which is sent on
# stdout to the caller, we use stderr for our questions.
@@ -1046,10 +1073,7 @@
read snapnr
# Reenable debugging.
- if [ -n "${debug}" ]; then
- ZFS_DEBUG=1
- set -x
- fi
+ [ -n "${debug}" ] && enable_debug
echo "$(eval echo "$"SNAP_${snapnr})"
}
--- /usr/share/initramfs-tools/scripts/zfs~ 2016-04-17 18:18:16.283302248 +0100
+++ /usr/share/initramfs-tools/scripts/zfs 2016-04-18 11:07:56.015928425 +0100
@@ -103,17 +103,7 @@
# ------------
# Support debug option
- if check_zfs_debug
- then
- ZFS_DEBUG=1
- mkdir /var/log
-
- # Close and reopen STDERR and redirect it.
- exec 2<&-
- exec 2> /var/log/zfs-boot.debug
-
- set -x
- fi
+ check_zfs_debug && enable_debug
# ------------
# Load ZFS module etc.
Sorry, that won't work properly if NOT zfsdebug=1
. Try this:
# Disable debugging
disable_debug()
{
if check_zfs_debug
then
unset ZFS_DEBUG
set +x
# Restore STDERR from #6.
exec 2<&6 6<&-
fi
}
This is fixed in the new v0.6.5.6-6
which is on its way up to the repository.
sorry it took me so long to test, but I'm glad its fixed. Yes, it works here too.
running debian jessie, initramfs 5.6.5.6-5, booting with zfs_debug=yes and an empty or a non-existing snapshot makes the ask_user_snap output to become invisible. answering the invisible question (1 enter) results in a proper boot, whereas a plain enter results in this: