If the dump target is the root disk, kdump scripts add an entry in /etc/fstab for root disk with /sysroot as the mount point. The root disk, passed through root=<> kernel commandline parameter, is mounted at /sysroot in read-only mode before switching from initial ramdisk. So, in fadump mode, a remount of /sysroot to read-write mode is needed to capture dump successfully, because /sysroot is already mounted as read-only based on root=<> boot parameter.
Commit e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") removed initialization of $_op variable, the variable holding the options the dump target was mounted with, leading to the below error as remount was skipped:
kdump[586]: saving to /sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/ kdump.sh[587]: mkdir: cannot create directory '/sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/': Read-only file system kdump[589]: saving vmcore failed
Restore $_op variable initialization in dump_fs() function to fix this.
Fixes: e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") Signed-off-by: Hari Bathini hbathini@linux.ibm.com --- kdump-lib-initramfs.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 5cb0223..15bbd85 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -119,7 +119,8 @@ dump_fs() { local _exitcode local _mp=$1 - ddebug "dump_fs _mp=$_mp" + local _op=$(get_mount_info OPTIONS target $_mp -f) + ddebug "dump_fs _mp=$_mp _opts=$_op"
if ! is_mounted "$_mp"; then dinfo "dump path "$_mp" is not mounted, trying to mount..." @@ -139,8 +140,8 @@ dump_fs()
# Only remount to read-write mode if the dump target is mounted read-only. if [[ "$_op" = "ro"* ]]; then - dinfo "Mounting Dump target $_dev in rw mode." - mount -o remount,rw $_dev $_mp || return 1 + dinfo "Remounting the dump target in rw mode." + mount -o remount,rw $_mp || return 1 fi
mkdir -p $_dump_path || return 1
On Thu, Apr 22, 2021 at 8:52 PM Hari Bathini hbathini@linux.ibm.com wrote:
If the dump target is the root disk, kdump scripts add an entry in /etc/fstab for root disk with /sysroot as the mount point. The root disk, passed through root=<> kernel commandline parameter, is mounted at /sysroot in read-only mode before switching from initial ramdisk. So, in fadump mode, a remount of /sysroot to read-write mode is needed to capture dump successfully, because /sysroot is already mounted as read-only based on root=<> boot parameter.
Commit e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") removed initialization of $_op variable, the variable holding the options the dump target was mounted with, leading to the below error as remount was skipped:
kdump[586]: saving to /sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/ kdump.sh[587]: mkdir: cannot create directory '/sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/': Read-only file system kdump[589]: saving vmcore failed
Restore $_op variable initialization in dump_fs() function to fix this.
Fixes: e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") Signed-off-by: Hari Bathini hbathini@linux.ibm.com
kdump-lib-initramfs.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 5cb0223..15bbd85 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -119,7 +119,8 @@ dump_fs() { local _exitcode local _mp=$1
- ddebug "dump_fs _mp=$_mp"
local _op=$(get_mount_info OPTIONS target $_mp -f)
ddebug "dump_fs _mp=$_mp _opts=$_op"
if ! is_mounted "$_mp"; then dinfo "dump path "$_mp" is not mounted, trying to mount..."
@@ -139,8 +140,8 @@ dump_fs()
# Only remount to read-write mode if the dump target is mounted read-only. if [[ "$_op" = "ro"* ]]; then
dinfo "Mounting Dump target $_dev in rw mode."
mount -o remount,rw $_dev $_mp || return 1
dinfo "Remounting the dump target in rw mode."
mount -o remount,rw $_mp || return 1
fi
mkdir -p $_dump_path || return 1
Thanks for the fix!
Acked-by: Kairui Song kasong@redhat.com
-- Best Regards, Kairui Song