Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-module-setup.sh | 2 +- kdump-lib.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ mkdumprd | 25 ++----------------------- 3 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index eeb348c..efafc16 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -43,7 +43,7 @@ kdump_to_udev_name() { dev=`blkid -L "${dev#LABEL=}"` ;; esac - echo $(get_persistent_dev "$dev") + echo $(get_persistent_devce "$dev") }
kdump_is_bridge() { diff --git a/kdump-lib.sh b/kdump-lib.sh index e62b4e2..35aa533 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,49 @@ get_root_fs_device() return }
+# get_maj_min <device> +# Prints the major and minor of a device node. +# Example: +# $ get_maj_min /dev/sda2 +# 8:2 +get_maj_min() { + local _maj _min _majmin + _majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)" + printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))" +} + +get_persistent_devce() { + local i _tmp _dev + + _dev=$(get_maj_min "$1") + [ -z "$_dev" ] && { + perror_exit "Kernel dev name of $1 is not found." + } + + for i in \ + /dev/mapper/* \ + /dev/disk/${persistent_policy:-by-uuid}/* \ + /dev/disk/by-uuid/* \ + /dev/disk/by-label/* \ + /dev/disk/by-partuuid/* \ + /dev/disk/by-partlabel/* \ + /dev/disk/by-id/* \ + /dev/disk/by-path/* \ + ; do + [[ -e "$i" ]] || continue + [[ $i == /dev/mapper/control ]] && continue + [[ $i == /dev/mapper/mpath* ]] && continue + _tmp=$(get_maj_min "$i") + if [ "$_tmp" = "$_dev" ]; then + echo $i + return + fi + done + + perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name" + echo $1 +} + # findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/mkdumprd b/mkdumprd index 28ecdd7..ac8a63a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -29,26 +29,6 @@ perror() { echo $@ >&2 }
-get_persistent_dev() { - local i _tmp _dev - - _dev=$(udevadm info --query=name --name="$1" 2>/dev/null) - [ -z "$_dev" ] && { - perror_exit "Kernel dev name of $1 is not found." - } - - for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do - _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null) - if [ "$_tmp" = "$_dev" ]; then - echo $i - return - fi - done - - perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name" - echo $1 -} - add_dracut_arg() { local arg qarg is_quoted=0 while [ $# -gt 0 ]; @@ -138,11 +118,10 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then - _pdev="$(get_persistent_dev $_source)" + _pdev="$(get_persistent_devce $_source)" if [ $? -ne 0 ]; then return 1 fi - else _pdev=$_dev fi @@ -565,7 +544,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" } - _praw=$(get_persistent_dev $config_val) + _praw=$(get_persistent_devce $config_val) if [ $? -ne 0 ]; then exit 1 fi
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 2 +- kdump-lib.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ mkdumprd | 25 ++----------------------- 3 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index eeb348c..efafc16 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -43,7 +43,7 @@ kdump_to_udev_name() { dev=`blkid -L "${dev#LABEL=}"` ;; esac
- echo $(get_persistent_dev "$dev")
- echo $(get_persistent_devce "$dev")
}
kdump_is_bridge() { diff --git a/kdump-lib.sh b/kdump-lib.sh index e62b4e2..35aa533 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,49 @@ get_root_fs_device() return }
+# get_maj_min <device> +# Prints the major and minor of a device node. +# Example: +# $ get_maj_min /dev/sda2 +# 8:2 +get_maj_min() {
- local _maj _min _majmin
- _majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
- printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
+}
+get_persistent_devce() {
- local i _tmp _dev
- _dev=$(get_maj_min "$1")
- [ -z "$_dev" ] && {
perror_exit "Kernel dev name of $1 is not found."
- }
- for i in \
/dev/mapper/* \
/dev/disk/${persistent_policy:-by-uuid}/* \
/dev/disk/by-uuid/* \
/dev/disk/by-label/* \
/dev/disk/by-partuuid/* \
/dev/disk/by-partlabel/* \
/dev/disk/by-id/* \
/dev/disk/by-path/* \
; do
[[ -e "$i" ]] || continue
[[ $i == /dev/mapper/control ]] && continue
[[ $i == /dev/mapper/mpath* ]] && continue
_tmp=$(get_maj_min "$i")
if [ "$_tmp" = "$_dev" ]; then
echo $i
return
fi
- done
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
+}
# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/mkdumprd b/mkdumprd index 28ecdd7..ac8a63a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -29,26 +29,6 @@ perror() { echo $@ >&2 }
-get_persistent_dev() {
- local i _tmp _dev
- _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
- [ -z "$_dev" ] && {
perror_exit "Kernel dev name of $1 is not found."
- }
- for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
if [ "$_tmp" = "$_dev" ]; then
echo $i
return
fi
- done
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
-}
add_dracut_arg() { local arg qarg is_quoted=0 while [ $# -gt 0 ]; @@ -138,11 +118,10 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source)"
_pdev="$(get_persistent_devce $_source)" if [ $? -ne 0 ]; then return 1 fi
- else _pdev=$_dev fi
@@ -565,7 +544,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" }
_praw=$(get_persistent_dev $config_val)
_praw=$(get_persistent_devce $config_val) if [ $? -ne 0 ]; then exit 1 fi
-- 2.1.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Got it.
Thanks Minfei
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 2 +- kdump-lib.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ mkdumprd | 25 ++----------------------- 3 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index eeb348c..efafc16 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -43,7 +43,7 @@ kdump_to_udev_name() { dev=`blkid -L "${dev#LABEL=}"` ;; esac
- echo $(get_persistent_dev "$dev")
- echo $(get_persistent_devce "$dev")
}
kdump_is_bridge() { diff --git a/kdump-lib.sh b/kdump-lib.sh index e62b4e2..35aa533 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,49 @@ get_root_fs_device() return }
+# get_maj_min <device> +# Prints the major and minor of a device node. +# Example: +# $ get_maj_min /dev/sda2 +# 8:2 +get_maj_min() {
- local _maj _min _majmin
- _majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
- printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
+}
+get_persistent_devce() {
- local i _tmp _dev
- _dev=$(get_maj_min "$1")
- [ -z "$_dev" ] && {
perror_exit "Kernel dev name of $1 is not found."
- }
- for i in \
/dev/mapper/* \
/dev/disk/${persistent_policy:-by-uuid}/* \
/dev/disk/by-uuid/* \
/dev/disk/by-label/* \
/dev/disk/by-partuuid/* \
/dev/disk/by-partlabel/* \
/dev/disk/by-id/* \
/dev/disk/by-path/* \
; do
[[ -e "$i" ]] || continue
[[ $i == /dev/mapper/control ]] && continue
[[ $i == /dev/mapper/mpath* ]] && continue
_tmp=$(get_maj_min "$i")
if [ "$_tmp" = "$_dev" ]; then
echo $i
return
fi
- done
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
+}
# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/mkdumprd b/mkdumprd index 28ecdd7..ac8a63a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -29,26 +29,6 @@ perror() { echo $@ >&2 }
-get_persistent_dev() {
- local i _tmp _dev
- _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
- [ -z "$_dev" ] && {
perror_exit "Kernel dev name of $1 is not found."
- }
- for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
if [ "$_tmp" = "$_dev" ]; then
echo $i
return
fi
- done
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
-}
add_dracut_arg() { local arg qarg is_quoted=0 while [ $# -gt 0 ]; @@ -138,11 +118,10 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source)"
_pdev="$(get_persistent_devce $_source)" if [ $? -ne 0 ]; then return 1 fi
- else _pdev=$_dev fi
@@ -565,7 +544,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" }
_praw=$(get_persistent_dev $config_val)
_praw=$(get_persistent_devce $config_val) if [ $? -ne 0 ]; then exit 1 fi
-- 2.1.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
So it is complicatable to source the dracut-functions.sh, instead of defining the common lib functions in kdump-lib.sh.
Bao. Do you have any idea about this?
Thanks Minfei
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
Thanks Dave
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
Thanks Dave
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Thanks Dave
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Just source the dracut-functions.sh to mkdumprd, without any correction.
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] /mnt/var/crash/127.0.0.1-2015-07-22-18:13:42/vmcore Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img initdir not set mkdumprd: failed to make kdump initrd Starting kdump: [FAILED]
Once I define the initdir in the mkdumprd, the error message raises like below:
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . ... kexec: loaded kdump kernel Starting kdump: [OK]
Once I have resolved this issue, there is other error message raised.
Thanks Minfei
On 07/27/15 at 11:28am, Minfei Huang wrote:
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote: > Since get_persistent_dev is called in dracut-module-setup.sh and > mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus > dracut-module-setup.sh can use this lib, not the function in dracut.sh. > > Copy the function get_persistent_dev from dracut to make the function > consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Just source the dracut-functions.sh to mkdumprd, without any correction.
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] /mnt/var/crash/127.0.0.1-2015-07-22-18:13:42/vmcore Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img initdir not set mkdumprd: failed to make kdump initrd Starting kdump: [FAILED]
Once I define the initdir in the mkdumprd, the error message raises like below:
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . ... kexec: loaded kdump kernel Starting kdump: [OK]
Once I have resolved this issue, there is other error message raised.
How did you source dracut-functions.sh? what is your changes?
Dave
On 07/27/15 at 12:43pm, Dave Young wrote:
On 07/27/15 at 11:28am, Minfei Huang wrote:
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote: > On 07/22/15 at 06:20pm, Minfei Huang wrote: > > Since get_persistent_dev is called in dracut-module-setup.sh and > > mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus > > dracut-module-setup.sh can use this lib, not the function in dracut.sh. > > > > Copy the function get_persistent_dev from dracut to make the function > > consistent. > > Cleanup means drop get_presistent_dev function and use dracut one instead > of moving it to another file... >
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Just source the dracut-functions.sh to mkdumprd, without any correction.
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] /mnt/var/crash/127.0.0.1-2015-07-22-18:13:42/vmcore Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img initdir not set mkdumprd: failed to make kdump initrd Starting kdump: [FAILED]
Once I define the initdir in the mkdumprd, the error message raises like below:
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . ... kexec: loaded kdump kernel Starting kdump: [OK]
Once I have resolved this issue, there is other error message raised.
How did you source dracut-functions.sh? what is your changes?
If there's more error, the best way is do below in dracut:
Move general functions which does not depend on dracut variables to another file like dracut-functions-common.sh
Then dracut-functions.sh can source dracut-functions-common.sh
Thanks Dave
On 07/27/15 at 12:43pm, Dave Young wrote:
On 07/27/15 at 11:28am, Minfei Huang wrote:
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote: > On 07/22/15 at 06:20pm, Minfei Huang wrote: > > Since get_persistent_dev is called in dracut-module-setup.sh and > > mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus > > dracut-module-setup.sh can use this lib, not the function in dracut.sh. > > > > Copy the function get_persistent_dev from dracut to make the function > > consistent. > > Cleanup means drop get_presistent_dev function and use dracut one instead > of moving it to another file... Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Just source the dracut-functions.sh to mkdumprd, without any correction.
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] /mnt/var/crash/127.0.0.1-2015-07-22-18:13:42/vmcore Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img initdir not set mkdumprd: failed to make kdump initrd Starting kdump: [FAILED]
Once I define the initdir in the mkdumprd, the error message raises like below:
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . ... kexec: loaded kdump kernel Starting kdump: [OK]
Once I have resolved this issue, there is other error message raised.
How did you source dracut-functions.sh? what is your changes?
Below is the code which I patched to the mkdumprd.
11 # include the dracut functions 12 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut 13 [[ $dracutfunctions ]] || dracutfunctions=$dracutbasedir/dracut-functions.sh 14 15 [[ $tmpdir ]] || tmpdir=/var/tmp 16 readonly TMPDIR="$tmpdir" 17 readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)" 18 19 fileloglvl=0 20 21 . $dracutfunctions
Then, kdump service will generate the initramfs successfully, except for some warning.
Thanks Minfei
On 07/27/15 at 01:03pm, Minfei Huang wrote:
On 07/27/15 at 12:43pm, Dave Young wrote:
On 07/27/15 at 11:28am, Minfei Huang wrote:
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote: > On 07/23/15 at 04:47pm, Dave Young wrote: > > On 07/22/15 at 06:20pm, Minfei Huang wrote: > > > Since get_persistent_dev is called in dracut-module-setup.sh and > > > mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus > > > dracut-module-setup.sh can use this lib, not the function in dracut.sh. > > > > > > Copy the function get_persistent_dev from dracut to make the function > > > consistent. > > > > Cleanup means drop get_presistent_dev function and use dracut one instead > > of moving it to another file... > Try the way which you points out. It seems difficult to source the > dracut-functions.sh into mkdumprd, because there are several variants > which are defined in dracut.sh, such as initdir. In the other hand, > dracut-functions.sh will source the dracut-logger.sh and other file.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
..
Just source the dracut-functions.sh to mkdumprd, without any correction.
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] /mnt/var/crash/127.0.0.1-2015-07-22-18:13:42/vmcore Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img initdir not set mkdumprd: failed to make kdump initrd Starting kdump: [FAILED]
Once I define the initdir in the mkdumprd, the error message raises like below:
[root@localhost 99kdumpbase]# kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Force rebuild /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img Rebuilding /boot/initramfs-3.11.10-301.fc20.x86_64kdump.img logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . /usr/lib/dracut/dracut-logger.sh: line 339: ((: 4 <= : syntax error: operand expected (error token is "<= ") logger: unknown facility name: . ... kexec: loaded kdump kernel Starting kdump: [OK]
Once I have resolved this issue, there is other error message raised.
How did you source dracut-functions.sh? what is your changes?
Below is the code which I patched to the mkdumprd.
11 # include the dracut functions 12 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut 13 [[ $dracutfunctions ]] || dracutfunctions=$dracutbasedir/dracut-functions.sh 14 15 [[ $tmpdir ]] || tmpdir=/var/tmp 16 readonly TMPDIR="$tmpdir" 17 readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)" 18 19 fileloglvl=0 20 21 . $dracutfunctions
Then, kdump service will generate the initramfs successfully, except for some warning.
So dracut-functions need more cleanup, except the functions which do not depend on dracut variables, all other stuff should be moved to dracut-init.sh below commit introduced..
commit 777f2db0373ccbc1a44fc2d960ecefbe50195055 Author: Harald Hoyer harald@redhat.com Date: Thu Jul 2 15:40:13 2015 +0200
splitup dracut-init.sh from dracut-functions.sh
other tools want to source dracut-functions.sh without any mkdir side effects.
Thanks Dave
On 07/27/15 at 10:23am, Dave Young wrote:
On 07/27/15 at 09:57am, Minfei Huang wrote:
On 07/27/15 at 08:50am, Dave Young wrote:
On 07/25/15 at 04:11pm, Minfei Huang wrote:
On 07/23/15 at 04:47pm, Dave Young wrote:
On 07/22/15 at 06:20pm, Minfei Huang wrote:
Since get_persistent_dev is called in dracut-module-setup.sh and mkdumprd, we move this lib from mkdumprd to kdump-lib.sh. Thus dracut-module-setup.sh can use this lib, not the function in dracut.sh.
Copy the function get_persistent_dev from dracut to make the function consistent.
Cleanup means drop get_presistent_dev function and use dracut one instead of moving it to another file...
Hi, Dave.
Try the way which you points out. It seems difficult to source the dracut-functions.sh into mkdumprd, because there are several variants which are defined in dracut.sh, such as initdir. In the other hand, dracut-functions.sh will source the dracut-logger.sh and other file.
Thanks Dave.
I am a bit confused with this patch. IMOP, if there is not heavy dependency with other module, self_containing is better.
Also as Vivek reported in bugzilla, moving the common libraries to kdump-lib.sh is suggested.
kdump-lib.sh can have a wrapper, but we should use dracut fuctions especially in module-setup.sh. I have posted one patch to dracut so that we can use dracut-functions.sh. I still do not see what is the difficulty? Can you post your error messages?
Thanks Minfei
What's the error you see? I think it does not matter, if there's something which should not be in dracut-functions.sh you can send patch to dracut list and cleanup. OTOH, the functions mkdumprd uses do not care about initdir.
Hi, Dave.
What I mean is that the issue is not too hard to be fixed. But do we need to fix this like this way?
Yes, dracut-module-setup.sh will use the function in dracut-functions.sh, since this script is one part of the dracut. For mkdumprd, it is individual with dracut.
Thanks Minfei