Open-AudIT
https://www.open-audit.org/phpBB3/

[general] partition_size error CentOS 7
https://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=6534
Page 1 of 2

Author:  shanimal [ Mon Jun 20, 2016 10:52 pm ]
Post subject:  [general] partition_size error CentOS 7

Just noticed that some CentOS 7 vm's are getting the following error (also, script stops running):

[quote]Starting audit - .
PC . responding to ping
My PID is : 28085
Audit Start Time : 2016-06-20 08:19:39
Audit Location: local
-------------------
System Info
BIOS Info
Processor Info
Memory Info
Motherboard Info
Optical Drives Info
Video Cards Info
Sound Cards Info
Shares Info
Network Cards Info
Hard Disk Info
/usr/share/audit_linux.sh: line 1728: 161119993856
161119993856: syntax error in expression (error token is "161119993856")

Using @version 1.12.6 and this is what I see at line 1728:

partition_size=$((partition_size / 1024 / 1024))

Author:  jpa [ Tue Jun 21, 2016 12:56 am ]
Post subject:  Re: [general] partition_size error CentOS 7

Probably line 1727 isn't getting partition_size set correctly. If you want to fix it fast look over that line and see where it's failing.

Author:  shanimal [ Tue Jun 21, 2016 4:46 am ]
Post subject:  Re: [general] partition_size error CentOS 7

Thank you. Here is what prev line was orignally

[quote]partition_size=$(lsblk -lbo NAME,SIZE /dev/$disk 2>/dev/null | grep "^$partition " | rev | cut -d" " -f1 | rev)

I changed it to:

[quote]partition_size=$(lsblk -lno NAME,SIZE /dev/$disk 2>/dev/null | grep "^$partition " | rev | cut -d" " -f1 | rev)

now the error is:

Hard Disk Info
/usr/share/audit_linux.sh: line 1728: 500M: value too great for base (error token is "500M")


will keep narrowing it down as time permits.

Author:  jpa [ Tue Jun 21, 2016 6:26 am ]
Post subject:  Re: [general] partition_size error CentOS 7

In this case the "-b" parameter is import to the calculation done in the next line. Need to troubleshoot that line a bit more. Maybe put an echo statement just before the line so you can see the value of $disk and $partition and then see what you get from the below calc with those values:
[code]lsblk -lbo NAME,SIZE /dev/$disk 2>/dev/null | grep "^$partition " [/code]
Should probably just add an echo for $partition_size just after line 1727 to see why the partition_size calculation at line 1728 is dying.

Author:  shanimal [ Tue Jun 21, 2016 11:26 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

added that line, here are the results.

[quote][root@vcentossls2 ~]# /usr/share/audit_linux.sh
Starting audit - .
PC . responding to ping
My PID is : 8148
Audit Start Time : 2016-06-21 09:24:18
Audit Location: local
-------------------
System Info
BIOS Info
Processor Info
Memory Info
Motherboard Info
Optical Drives Info
Video Cards Info
Sound Cards Info
Shares Info
Network Cards Info
Hard Disk Info
524288000
160535937024
161119993856
8455716864
98322874368
53686042624
161119993856 161119993856
/usr/share/audit_linux.sh: line 1729: 161119993856
161119993856: syntax error in expression (error token is "161119993856")

Author:  shanimal [ Tue Jun 21, 2016 11:33 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

Also, here is result from "lsblk -lbo NAME,SIZE"

[quote][root@vcentossls2 ~]# lsblk -lbo NAME,SIZE
NAME SIZE
fd0 4096
sda 161061273600
sda1 524288000
sda2 160535937024
centos-root 161119993856
centos-swap 8455716864
centos-home 98322874368
sdb 107374182400
sdb1 53686042624
centos-root 161119993856
sdb2 53687091200
centos-root 161119993856
sr0 1073741312

Author:  jpa [ Wed Jun 22, 2016 4:59 am ]
Post subject:  Re: [general] partition_size error CentOS 7

Yes, that helped. Unfortunately my Linux and script-fu is weak. Mark will need to fix this.

The current script has a problem with the centos-root spread across two partitions on the same disk (sdb).

Author:  shanimal [ Thu Jun 23, 2016 3:26 am ]
Post subject:  Re: [general] partition_size error CentOS 7

I had a feeling from the beginning this isn't a bug. Now with more info, it appears to be human error. I wouldn't want anybody to even attempt to replicate this, it doesn't make any sense. I knew i've deployed dozens of CentOS 7 vm's and none of them have this issue. That's because I would never configure partitions like that. Now it makes sense, all 4 systems that fail were built by the same admin.

I just wish the script wouldn't fail at this error, and would keep collecting info, and then upload it to the server. Guess I could comment these lines out for these systems.

Author:  jpa [ Thu Jun 23, 2016 3:57 am ]
Post subject:  Re: [general] partition_size error CentOS 7

I couldn't get the Centos installer to replicate that particular config in my Virtualbox instance. It's not really necessary given the lsblk output but I thought I'd try.

My vote is for bug on this one since you can successfully partition a system like that.

Author:  satoru [ Tue Aug 02, 2016 10:33 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

I have same problem on V.1.12.6 running on CentOS6.7
My environment is;
---
[root@mng10 other]# cat /etc/redhat-release
CentOS release 6.7 (Final)

[root@mng10 ~]# lsblk -lbo NAME,SIZE /dev/sda
NAME SIZE
sda 250059350016
sda1 524288000
sda2 249533825024
vg_mng10-lv_swap (dm-0) 4127195136
vg_mng10-lv_root (dm-1) 104857600000
vg_mng10-sfvm_net01 (dm-2) 10485760000
vg_mng10-tecnoteca-real (dm-3) 10485760000
vg_mng10-tecnoteca (dm-4) 10485760000
vg_mng10-tecnoteca_snap (dm-6) 10485760000
vg_mng10-tecnoteca_snap-cow (dm-5) 10485760000
vg_mng10-tecnoteca_snap (dm-6) 10485760000
vg_mng10-tecnoteca_clone (dm-7) 10485760000
vg_mng10-josmon0 (dm-8) 10485760000

[root@mng10 other]# ./audit_linux.sh debugging=2 url=http://192.168.x.x/index.php/system/add_system
Starting audit - .
PC . responding to ping
My PID is : 24320
Audit Start Time : 2016-08-02 21:27:41
Audit Location: local
-------------------
System Info
BIOS Info
Processor Info
Memory Info
Motherboard Info
Optical Drives Info
Video Cards Info
Sound Cards Info
Shares Info
Network Cards Info
Hard Disk Info
524288000
249533825024
(dm-0) 4127195136

./audit_linux.sh: line 1729: / 1024 / 1024: syntax error: operand expected (error token is "/ 1024 / 1024")
------
I inserted debug line "echo $partition_name $partition_size" in line 1727 of audit_linux.sh.

Please help me to avoid this error.
Regards,
Satoru

Author:  jpa [ Wed Aug 03, 2016 2:48 am ]
Post subject:  Re: [general] partition_size error CentOS 7

Similar but different problem from the original question but I can't see why it would be failing. Can you change the output you added to the following and post the output?

[code]"echo $disk $partition $partition_size"[/code]

Author:  satoru [ Wed Aug 03, 2016 12:35 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

No, I didn't change output, just inserted debug line into the next of line 1727 of audit_linux.sh
[code]
partition_size=$(lsblk -lbo NAME,SIZE /dev/$disk 2>/dev/null | grep "^$partition " | rev | cut -d" " -f1 | rev)
echo $partition_name $partition_size
partition_size=$(($partition_size / 1024 / 1024))
[/code]
Regards,
Satoru

Author:  jpa [ Wed Aug 03, 2016 2:33 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

That's fine but since I can't tell what's happening I want to know the value of "$disk", "$partition" and "$partition_size" rather than "$partition_name" and "$partition_size". So change your existing "echo" line to the one I have above and post the output from that.

Author:  satoru [ Wed Aug 03, 2016 6:17 pm ]
Post subject:  Re: [general] partition_size error CentOS 7

I inserted debug line as below into audit.linux.sh
[code]
echo $disk $partition $partition_size
[/code]
And the result is below
[quote]
[root@mng10 other]# ./audit_linux.sh debugging=2 url=http://192.168.100.100/index.php/system/add_system
Starting audit - .
PC . responding to ping
My PID is : 10881
Audit Start Time : 2016-08-03 17:03:17
Audit Location: local
-------------------
System Info
BIOS Info
Processor Info
Memory Info
Motherboard Info
Optical Drives Info
Video Cards Info
Sound Cards Info
Shares Info
Network Cards Info
Hard Disk Info
sda sda1 524288000
sda sda2 249533825024
sda vg_mng10-lv_swap 4127195136
sda (dm-0)
./audit_linux.sh: line 1728: / 1024 / 1024: syntax error: operand expected (error token is "/ 1024 / 1024")

It seems to something wrong to process partition_name tailing (dm-X) like as
[quote]
vg_mng10-lv_swap (dm-0) 4127195136

Author:  jpa [ Thu Aug 04, 2016 1:06 am ]
Post subject:  Re: [general] partition_size error CentOS 7

What is the output of the following command? $partition is based on this (line 1703).
[code]lsblk -lno NAME /dev/sda[/code]

Page 1 of 2 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/