RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1132300 - /sbin/mkdumprd: line 3923: [: : integer expression expected
Summary: /sbin/mkdumprd: line 3923: [: : integer expression expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kexec-tools
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Minfei Huang
QA Contact: Qiao Zhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-21 06:17 UTC by Sumit Rai
Modified: 2015-08-04 06:57 UTC (History)
6 users (show)

Fixed In Version: kexec-tools-2.0.0-281.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 06:01:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot with error message (51.58 KB, image/png)
2014-11-27 11:04 UTC, Jeremy Harris
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1271 0 normal SHIPPED_LIVE kexec-tools bug fix and enhancement update 2015-07-20 17:49:23 UTC

Description Sumit Rai 2014-08-21 06:17:24 UTC
Description of problem:
I know you folks don't support custom kernels, and this corner case will probably won't present itself in enterprise environment, however since the
bug is in user space script, and custom compiled kernel only created a 
condition that's not handled properly by mkdumprd script I feel obligated to report this issue and let you folks decide.

Given that "/proc/sys/crypto/fips_enabled" is not present (Some crypto library is probably not enabled).

Issue 1:
When you start the kdump service when no kdump initial ramdisk is present, it tries to rebuild the ramdisk and calls script mkdumprd at some point.

[root@localhost ~]# service kdump start
No kdump initial ramdisk found.                            [WARNING]
Rebuilding /boot/initrd-2.6.34-rckdump.img
cat: /proc/sys/crypto/fips_enabled: No such file or directory
/sbin/mkdumprd: line 3923: [: : integer expression expected
Starting kdump:                                            [  OK  ]

[root@localhost ~]# echo $?
0

In the absence of fips_enabled file, variable FIPS_MODE is not set.
While the comparison [ "$FIPS_MODE" -eq 1 ] && setup_fips on line 3923
would have worked fine for string comparison regardless of whether variable is set/unset, it doesn't for integer comparison when variable is not set. Script moves ahead regardless, and creates initial ramdisk.

I copied the script, and wrote wrote two patches that takes care of "/sbin/mkdumprd: line 3923: [: : integer expression expected" warning, but as far as "cat: /proc/sys/crypto/fips_enabled: No such file or directory" message is concerned, I don't know how you folks want to handle that.

Patch 1:
--- /sbin/mkdumprd      2014-08-21 10:37:30.848654720 +0530
+++ /root/mkdumprd      2014-08-21 10:33:07.819945059 +0530
@@ -3920,7 +3920,7 @@
     done | sort | uniq | sed '/^ *$/d'`
     rm -f $TEMPLDCFG

-    [ "$FIPS_MODE" -eq 1 ] && setup_fips
+    [ "0$FIPS_MODE" -eq 1 ] && setup_fips   // it's numeric zero not the                           alphabet O

     #copy the binaries and their shared libraries to the archive
     for n in $bin $kdump_libs $k_extras $fips_hmac; do

Patch 2:
--- /sbin/mkdumprd      2014-08-21 10:43:31.793620929 +0530
+++ /root/mkdumprd      2014-08-21 10:43:25.312605379 +0530
@@ -93,7 +93,7 @@
 DISK_TIMEOUT=180
 DEBUG_MEM_LEVEL="0"

-FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled)
+FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled || echo -n 0)

 error()
 {

Issue 2:
Run /sbin/mkinitrd --help
cat: /proc/sys/crypto/fips_enabled: No such file or directory
usage: mkdumprd [--version] [--help] [-v] [-d] [-f] [--preload <module>]
       [--image-version]
       [--builtin=<module>] [--omit-dmraid]
       [--fstab=<fstab>] [--nocompress] <initrd-image> <kernel-version>

       (ex: mkdumprd /boot/initrd-2.2.5-15.img 2.2.5-15)

It should not be checking for fips_enabled file in first place if invoked with --help option.
 
Version-Release number of selected component (if applicable):
kexec-tools-2.0.0-273.el6.x86_64


How reproducible: Since you can't delete "fips_enabled" file from proc, and compiling you own kernel without fips may be too much work, you can easily reproduce the bug if you 
1. Change the path "/proc/sys/crypto/fips_enabled" in line 96 of file /sbin/mkdumprd to a non-existent file.
96: FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled)

2. For Issue 1, Make sure no kdump initial ramdisk are present in /boot folder
and start the kdump service by "service kdump start".
For issue 2, just type /sbin/mkdumprd --help.

Actual results:
Excerpt from 'service kdump start' output:
1. cat: /proc/sys/crypto/fips_enabled: No such file or directory
2. /sbin/mkdumprd: line 3923: [: : integer expression expected

Expected results:
In line 1, I think it's a good idea to let user know that fips will not be
setup instead of this message.
Line 2 is clearly not expected.

In /sbin/mkdumprd output posted above, message "cat: /proc/sys/crypto/fips_enabled: No such file or directory" must not appear.

Let me know if you need any more information.

Comment 2 Sumit Rai 2014-08-25 09:36:13 UTC
It's been a couple of days and I haven't received any comments. Could you please let me know what I did wrong so that I can fix it.
- Thanks

Comment 3 Vivek Goyal 2014-08-25 12:49:30 UTC
I think this is a simple fix and it is reasonable to fix it. Bao can you please have a look at this one.

Comment 5 Jeremy Harris 2014-11-27 11:04:41 UTC
Created attachment 961954 [details]
screenshot with error message

Comment 6 Jeremy Harris 2014-11-27 11:05:44 UTC
Seen also on a first-time boot of 3.10.33-rt32 (self-built).
Attaching screenshot.

Comment 11 errata-xmlrpc 2015-07-22 06:01:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1271.html


Note You need to log in before you can comment on or make changes to this bug.