Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Fri Mar 29, 2024 1:44 am

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 28 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jun 20, 2016 10:52 pm 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
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))

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 21, 2016 12:56 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 21, 2016 4:46 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
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.

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 21, 2016 6:26 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 21, 2016 11:26 pm 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
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")

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 21, 2016 11:33 pm 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
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

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 22, 2016 4:59 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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).


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 23, 2016 3:26 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
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.

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 23, 2016 3:57 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 02, 2016 10:33 pm 
Offline
Newbie

Joined: Tue Aug 02, 2016 9:52 pm
Posts: 11
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


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 03, 2016 2:48 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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]


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 03, 2016 12:35 pm 
Offline
Newbie

Joined: Tue Aug 02, 2016 9:52 pm
Posts: 11
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


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 03, 2016 2:33 pm 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 03, 2016 6:17 pm 
Offline
Newbie

Joined: Tue Aug 02, 2016 9:52 pm
Posts: 11
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 04, 2016 1:06 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
What is the output of the following command? $partition is based on this (line 1703).
[code]lsblk -lno NAME /dev/sda[/code]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 28 posts ]  Go to page 1, 2  Next

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group