From 832914043ef6118ef6b30fd5782ba51e53b8047a Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Sun, 23 Feb 2020 09:40:45 +0100 Subject: [PATCH 1/4] Fix `block_device_basename` wrong declaration A wrong variable name was used. Note that this break select_disks(), which is currently (inappropriately) recycling that variable. --- install-zfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-zfs.sh b/install-zfs.sh index 3289d49..b4b9c4e 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -255,7 +255,7 @@ function find_suitable_disks { while read -r disk_id || [[ -n "$disk_id" ]]; do local device_info - local block_device_name + local block_device_basename device_info="$(udevadm info --query=property "$(readlink -f "$disk_id")")" block_device_basename="$(basename "$(readlink -f "$disk_id")")" From 51f104cd08b26a4905f0fc11bfdf4c4e9f7da37d Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Sun, 23 Feb 2020 09:42:22 +0100 Subject: [PATCH 2/4] Fix block device name in disk selection stage The underlying variable was not set! --- install-zfs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install-zfs.sh b/install-zfs.sh index b4b9c4e..d834198 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -307,6 +307,7 @@ function select_disks { else while true; do local menu_entries_option=() + local block_device_basename if [[ ${#v_suitable_disks[@]} -eq 1 ]]; then local disk_selection_status=ON @@ -315,6 +316,7 @@ function select_disks { fi for disk_id in "${v_suitable_disks[@]}"; do + block_device_basename="$(basename "$(readlink -f "$disk_id")")" menu_entries_option+=("$disk_id" "($block_device_basename)" "$disk_selection_status") done From 5e30983ad8397267603fa6a1b2eb115617e00c0d Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Sun, 23 Feb 2020 09:53:43 +0100 Subject: [PATCH 3/4] Set `udevadm settle` timeout On a system, while installing Ubuntu 18.04(.4), all the `udevadm settle` invocations timed out. It's not clear why this happens, so we set a large enough timeout. On systems without this issue, the timeout won't matter, while on systems with the issue, the timeout will be enough to ensure that the devices are created. --- install-zfs.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/install-zfs.sh b/install-zfs.sh index d834198..0f86161 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -49,6 +49,17 @@ c_lsb_release_log=$c_log_dir/lsb_release.log c_disks_log=$c_log_dir/disks.log c_zfs_module_version_log=$c_log_dir/updated_module_versions.log +# On a system, while installing Ubuntu 18.04(.4), all the `udevadm settle` invocations timed out. +# +# It's not clear why this happens, so we set a large enough timeout. On systems without this issue, +# the timeout won't matter, while on systems with the issue, the timeout will be enough to ensure +# that the devices are created. +# +# Note that the strategy of continuing in any case (`|| true`) is not the best, however, the exit +# codes are not documented. +# +c_udevadm_settle_timeout=10 # seconds + # HELPER FUNCTIONS ############################################################# # Chooses a function and invokes it depending on the O/S distribution. @@ -588,7 +599,7 @@ function prepare_disks { # # Current attempt: `udevadm`, which should be the cleanest approach. # - udevadm settle + udevadm settle --timeout "$c_udevadm_settle_timeout" || true # for disk in "${v_selected_disks[@]}"; do # part_indexes=(1 2 3) @@ -668,13 +679,13 @@ function create_temp_volume { # The volume may not be immediately available; for reference, "/dev/zvol/.../os-install-temp" # is a standard file, which turns into symlink once the volume is available. See #8. # - udevadm settle + udevadm settle --timeout "$c_udevadm_settle_timeout" || true v_temp_volume_device=$(readlink -f "/dev/zvol/$v_rpool_name/os-install-temp") sgdisk -n1:0:0 -t1:8300 "$v_temp_volume_device" - udevadm settle + udevadm settle --timeout "$c_udevadm_settle_timeout" || true } # Differently from Ubuntu, the installer (Calamares) requires a filesystem to be ready. @@ -695,7 +706,7 @@ function create_temp_volume_UbuntuServer { zfs create -V "$c_temporary_volume_size" "$v_rpool_name/os-install-temp" - udevadm settle + udevadm settle --timeout "$c_udevadm_settle_timeout" || true v_temp_volume_device=$(readlink -f "/dev/zvol/$v_rpool_name/os-install-temp") } From efcb4c1d0671a1e3dfd2d778a7cb8d306c1d3b0d Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Sun, 23 Feb 2020 09:59:52 +0100 Subject: [PATCH 4/4] Improve free tail space message It's not clear if the unit needed to be specified or not. --- install-zfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-zfs.sh b/install-zfs.sh index 0f86161..6246057 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -422,7 +422,7 @@ function ask_free_tail_space { local tail_space_invalid_message= while [[ ! $v_free_tail_space =~ ^[0-9]+$ ]]; do - v_free_tail_space=$(whiptail --inputbox "${tail_space_invalid_message}Enter the space to leave at the end of each disk (0 for none):" 30 100 0 3>&1 1>&2 2>&3) + v_free_tail_space=$(whiptail --inputbox "${tail_space_invalid_message}Enter the space in GiB to leave at the end of each disk (0 for none):" 30 100 0 3>&1 1>&2 2>&3) tail_space_invalid_message="Invalid size! " done