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

A Database Error Occurred Error Number: 1452 - Beta 1.1
https://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=5726
Page 1 of 1

Author:  gareth [ Tue Jun 07, 2011 11:35 pm ]
Post subject:  A Database Error Occurred Error Number: 1452 - Beta 1.1

Hi,

After successfully installing Beta 1.1 on an OpenSuSE 11 box with MySQL 5.0.5, Apache 2 and PHP 5.2.12 I'm getting the following error when auditing any machine on my network:

[code]
A Database Error Occurred

Error Number: 1452

Cannot add or update a child row: a foreign key constraint fails (`OAv2/sys_hw_partition`, CONSTRAINT `sys_hw_partition_hard_drive_index` FOREIGN KEY (`hard_drive_index`) REFERENCES `sys_hw_hard_drive` (`hard_drive_index`))

INSERT INTO sys_hw_partition ( system_id, hard_drive_index, partition_mount_type, partition_mount_point, partition_name, partition_size, partition_free_space, partition_used_space, partition_format, partition_caption, partition_device_id, partition_disk_index, partition_bootable, partition_type, partition_quotas_supported, partition_quotas_enabled, partition_serial, timestamp, first_timestamp ) VALUES ( '2', '', 'mount point', '\\\\?\\Volume{2c964749-9014-11df-98af-806e6f6e6963}\\', 'RECOVERY', '949', '722', '227', 'NTFS', '\\\\?\\Volume{2c964749-9014-11df-98af-806e6f6e6963}\\', '', '', '', 'volume', '', '', '-2039350317', '2011-06-07 09:49:25', '2011-06-07 09:49:25')
[/code]

Bug or something wrong with my DB config?

Cheers,
Gareth

Author:  Mark [ Wed Jun 08, 2011 9:18 am ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

I think this is related to the UTF8 issue we discussed in email.
Try the fix I sent you.
If it works, I'll incorporate it into the released code...

As an aside - there seem's to be an underlying issue with UTF8.
I shall be looking closely at this.

Author:  gareth [ Wed Jun 08, 2011 6:32 pm ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

Mark,

The code you emailed over resolves the illegal character issues, but I'm still seeing the MySQL error. The script partially submits the system.

I tried using a fresh DB with the same issues. Fails both uploading via the script and directly pasting the XML in to Add System.

I have emailed across one of the XML outputs causing issues. Not sure I want to post the full output on a public forum due to the info included.

HTH,
Gareth

Author:  Mark [ Wed Jun 08, 2011 7:27 pm ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

OK great - will check my email.
Yep - don't ever post the full output of an audit script in public.
You can always send it to me though - I'm trustworthy :D
Seriously though - what am I gonna do, steal your CD Keys? Believe me, my current DB contains ~6,000 systems. If I want a CD Key, all I have to do is copy & paste ! Besides that fact, I use Linux at home so I don't really have much use for Windows keys (or keys for any Windows software).

I also happen to believe that people have a right to charge and restrict use on software they create in any way they please. I also have a right to choose not to use it (and give the software I create away).

Oh crap - apologies. [/rant]

Now the actual debugging stuff... There is a bit to get right here, but if you can do it, it should very much point us as to what's going wrong.

Can you check the file code_igniter\system\application\config\fireignition.pnp
Set the variable within to TRUE.
Now comes the difficult bit.....
Grab the Firefox extension FireBug.
Once that has been installed, get the extension FirePHP.
Now, restart Firefox and as you browse, click the "cockroach" icon in the bottom toolbar (the FireBug icon).
This should open up the Firebug console.
The FirePHP extension is used to echo from PHP into this window.
It's great for seeing what's going on inside the app.
You should see all SQL statement's that are run by OAv2 echo'd into FirePHP.
Try pasting the XML script output in to the "Admin -> Systems -> Add a System" page.
Hopefully you'll see where in the processing of the system is has an issue.
That should point us to the incorrect XML or the failing SQL statement.

If you can manage that, copy the output of the FireBug console and email it to me.

I know this is a pain, but remote debugging (without a real connection like a VPN) is really painful !!!

The long and the short of it is that OAv2 beta 1.1 works for me on both Ubuntu 10.10 and Windows XP (using the same XAMPPLITE file I posted to Launchpad). We'll get this going....

Author:  Mark [ Wed Jun 08, 2011 7:33 pm ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

I just posted your emailed XML into my system here at home.
Worked fine.
That's probably not a good thing... I can't easily see what's wrong.
It's also good that the basic code does indeed work - it's most likely a setting on your system (the OAv2 Server itself).

Author:  gareth [ Wed Jun 08, 2011 8:30 pm ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

I can see it being a server config issue to be fair.

Firebug outputs sent across.

Author:  Mark [ Wed Jun 08, 2011 10:21 pm ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

FYI for others reading this.
We have been working on this via email (audit outputs involved).
Looks to be the "mount point" seciton of the audit script and the processing of the XML by OAv2 that is causing pain.
Quick and dirty workaround is to remove the entire "mount point" section in audit_windows.vbs - around line 1180 or so.
Shall update as we progress.

Author:  gareth [ Thu Jun 09, 2011 12:46 am ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

This worked. Now successfully auditing.

Many Thanks Mark.

Author:  Mark [ Thu Jun 09, 2011 8:57 am ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

Just to prove this does actually work on my system...
Here's a screenshot of a Win7 system, correctly showing the discovered mount point (the hidden Win7 recovery partition).

[attachment=0] mount_point.png
mount_point.png [ 39.5 KiB | Viewed 11732 times ]

Author:  kumail [ Sat Sep 24, 2011 3:57 am ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

Hey,

I just tried to configure and install OAv2 Beta 2 for the first time and also have this same issue...

[code]A Database Error Occurred
Error Number: 1452

Cannot add or update a child row: a foreign key constraint fails (`openauditv2`.`sys_hw_partition`, CONSTRAINT `sys_hw_partition_hard_drive_index` FOREIGN KEY (`hard_drive_index`) REFERENCES `sys_hw_hard_drive` (`hard_drive_index`))

INSERT INTO sys_hw_partition ( system_id, hard_drive_index, partition_mount_type, partition_mount_point, partition_name, partition_size, partition_free_space, partition_used_space, partition_format, partition_caption, partition_device_id, partition_disk_index, partition_bootable, partition_type, partition_quotas_supported, partition_quotas_enabled, partition_serial, timestamp, first_timestamp ) VALUES ( '1', '', 'mount point', '\\\\?\\Volume{cbb5753e-e4aa-11e0-8b39-806e6f6e6963}\\', 'System Reserved', '99', '71', '28', 'NTFS', '\\\\?\\Volume{cbb5753e-e4aa-11e0-8b39-806e6f6e6963}\\', '', '', '', 'volume', '', '', '-50718127', '2011-09-23 13:35:51', '2011-09-23 13:35:51')
[/code]

I plan on trying with removal of the "mount point" section, but, as this was for Beta 1, I was wondering whether any progress has been made on this issue.
Thanks

Author:  Mark [ Mon Sep 26, 2011 11:47 am ]
Post subject:  Re: A Database Error Occurred Error Number: 1452 - Beta 1.1

Maybe you should try Beta3 - just released!
https://launchpad.net/oav2/trunk/beta3

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