Tuesday, 8 November 2011

CA System edge 5.x ca-setup.sh temp space bug - he '' temporary directory does not have enough free space

installing new *nix ca-setup.sh script and had temp space errors. There is a bug in the script on the CA virtual assurance for infrastructure manager agent for unix dvd in this script. the line that checks temp space reads used space as free space so will fail if /tmp is almost empty.

You get this error when there is plenty of free space in /tmp if you have almost no used in /tmp and install fails.
CA-setup bootstrapper version
The '' temporary directory does not have enough free space. Aborting installation.

Lack of free space??? I don’t think so my /tmp is 2gb and 2% used!
df -P -k /tmp
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/vg00-tmpvol   2030995     38471   1887782       2% /tmp

Debugging where this comes from shows:

+ checkTmpSpace
++ du -ks .
++ awk '{print $1}'
+ NEED_SPACE=53616
++ expr 53616 + 100
+ NEED_SPACE=53716
++ df -P -k /tmp
++ tail -1
++ awk '{print $3}'
+ FREE_SPACE=38470
+ '[' 38470 -lt 53716 ']'
+ logExitWithMsg 1 TMP_TOO_SMALL

Here is the function
    # Find how much space is in the current dir.
    NEED_SPACE=`du -ks . | awk '{print $1}'`
    # Add a bit extra just for case.
    NEED_SPACE=`expr $NEED_SPACE + 100`
    # Find how much free space is in temporary location.
    FREE_SPACE=`df -P -k $CA_SETUP_TMPDIR | tail -1 | awk '{print $3}'`
    if [ $FREE_SPACE -lt $NEED_SPACE ]
        logExitWithMsg 1 TMP_TOO_SMALL

If you look closely at the output the function read you wil see it should be {print $4} not print $3 because it is reading the USED value 38471   as FREE instead of 1887782