ppc64: Mention missing /proc or /sys mount
Subsystems (2)
RFC PATCH 1/1 ppc64: Mention missing /proc or /sys mount
On custom initrds, that don't have mount of /sys by default, kexec -p fails with below error:
# cat /proc/cmdline crashkernel=256M # kexec -p -s /kernel Memory for crashkernel is not reserved Please reserve memory by passing"crashkernel=Y@X" parameter to kernel Then try to loading kdump kernel
The error is misleading since it actually failed due to failing to read linux,crashkernel-base inside /proc/device-tree, which points into sys/
Add checks for /proc and /sys to ensure they are mounted, as they are required for kexec -p:
# kexec -p -s /kernel Cannot determine crashkernel reservation: /sys is not mounted. Please mount sysfs at /sys (e.g. 'mount -t sysfs sysfs /sys') and retry.
# kexec -p -s /kernel Cannot determine crashkernel reservation: /proc is not mounted. Please mount procfs at /proc (e.g. 'mount -t proc proc /proc') and retry.
Signed-off-by Aditya Gupta <[email protected]>
--- kexec/arch/ppc64/crashdump-ppc64.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
kexec/arch/ppc64/crashdump-ppc64.c +18 -1
@@ -622,10 +622,27 @@ int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)int is_crashkernel_mem_reserved (void ) {int fd; +struct stat st; fd =open (DEVTREE_CRASHKERNEL_BASE ,O_RDONLY ); -if (fd <0 ) +if (fd <0 ) { +/* +* The lookup fails, even if memory is reserved, when /proc is +* not mounted or when /sys is not mounted, since +* /proc/device-tree is a symlink into /sys. +*/ +if (stat ("/proc/self" , &st) !=0 ) +die ("Cannot determine crashkernel reservation: " +"/proc is not mounted.\n" +"Please mount procfs at /proc (e.g. " +"'mount -t proc proc /proc') and retry.\n" ); +if (stat ("/sys/kernel" , &st) !=0 ) +die ("Cannot determine crashkernel reservation: " +"/sys is not mounted.\n" +"Please mount sysfs at /sys (e.g. " +"'mount -t sysfs sysfs /sys') and retry.\n" );return 0 ; + }close (fd);return 1 ; }
Signature · 1 line
2.56.1