When nfs-utils is not installed, mounting as NFS fs would fail. Currently, the error message is not user-friendly, mount: /tmp/mkdumprd.HyPGpS/target: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program. kdump: Failed to mount on xxx for kdump preflight check. kdump: mkdumprd: failed to make kdump initrd
Prompt the user to install nfs-utilsa in the error message, kdump: Failed to mount on xxx for kdump preflight check. Please make sure nfs-utils has been installed.
Signed-off-by: Coiby Xu coxu@redhat.com --- mkdumprd | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/mkdumprd b/mkdumprd index c34b79c..50ebdc8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -185,6 +185,26 @@ check_save_path_fs() fi }
+mount_failure() +{ + local _target=$1 + local _mnt=$2 + local _fstype=$3 + local msg="Failed to mount $_target" + + if [ -n "$_mnt" ]; then + msg="$msg on $_mnt" + fi + + msg="$msg for kdump preflight check." + + if [[ $_fstype = "nfs" ]]; then + msg="$msg Please make sure nfs-utils has been installed." + fi + + perror_exit "$msg" +} + check_user_configured_target() { local _target=$1 _cfg_fs_type=$2 _mounted @@ -210,7 +230,7 @@ check_user_configured_target() if ! is_mounted "$_mnt"; then if [[ $_opt = *",noauto"* ]]; then mount $_mnt - [ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check." + [ $? -ne 0 ] && mount_failure "$_target" "$_mnt" "$_fstype" _mounted=$_mnt else perror_exit "Dump target "$_target" is neither mounted nor configured as "noauto"" @@ -220,7 +240,7 @@ check_user_configured_target() _mnt=$MKDUMPRD_TMPMNT mkdir -p $_mnt mount $_target $_mnt -t $_fstype -o defaults - [ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check." + [ $? -ne 0 ] && mount_failure "$_target" "" "$_fstype" _mounted=$_mnt fi
On Sat, Feb 20, 2021 at 11:58 AM Coiby Xu coxu@redhat.com wrote:
When nfs-utils is not installed, mounting as NFS fs would fail. Currently, the error message is not user-friendly, mount: /tmp/mkdumprd.HyPGpS/target: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program. kdump: Failed to mount on xxx for kdump preflight check. kdump: mkdumprd: failed to make kdump initrd
Prompt the user to install nfs-utilsa in the error message, kdump: Failed to mount on xxx for kdump preflight check. Please make sure nfs-utils has been installed.
Signed-off-by: Coiby Xu coxu@redhat.com
mkdumprd | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/mkdumprd b/mkdumprd index c34b79c..50ebdc8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -185,6 +185,26 @@ check_save_path_fs() fi }
+mount_failure() +{
- local _target=$1
- local _mnt=$2
- local _fstype=$3
- local msg="Failed to mount $_target"
- if [ -n "$_mnt" ]; then
msg="$msg on $_mnt"
- fi
- msg="$msg for kdump preflight check."
- if [[ $_fstype = "nfs" ]]; then
msg="$msg Please make sure nfs-utils has been installed."
- fi
- perror_exit "$msg"
+}
check_user_configured_target() { local _target=$1 _cfg_fs_type=$2 _mounted @@ -210,7 +230,7 @@ check_user_configured_target() if ! is_mounted "$_mnt"; then if [[ $_opt = *",noauto"* ]]; then mount $_mnt
[ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check."
[ $? -ne 0 ] && mount_failure "$_target" "$_mnt" "$_fstype" _mounted=$_mnt else perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\""
@@ -220,7 +240,7 @@ check_user_configured_target() _mnt=$MKDUMPRD_TMPMNT mkdir -p $_mnt mount $_target $_mnt -t $_fstype -o defaults
[ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check."
fi[ $? -ne 0 ] && mount_failure "$_target" "" "$_fstype" _mounted=$_mnt
-- 2.30.0 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Looks good,
Acked-by: Kairui Song kasong@redhat.com