Multiplay Labs

tech hits and tips from Multiplay

Archive for June, 2011

php Segmentation fault (core dumped) in xmlFreeMutex

without comments

Having just rebuilt a clean install of php 5.3.6 it was crashing left right and center even a php -m caused it.

The stack looks like the following under gdb

#0 0x0000000103db8600 in ?? ()
#1 0x0000000100ce1a95 in xmlFreeMutex () from /usr/local/lib/
#2 0x0000000100ce14d5 in xmlCleanupGlobals () from /usr/local/lib/
#3 0x0000000100c79f4a in xmlCleanupParser () from /usr/local/lib/
#4 0x000000000044daa8 in php_libxml_shutdown ()
#5 0x000000000044dad9 in zm_shutdown_libxml ()
#6 0x000000000055289f in module_destructor ()
#7 0x0000000000559be4 in zend_hash_apply_deleter ()
#8 0x0000000000559e58 in zend_hash_graceful_reverse_destroy ()
#9 0x000000000054dfc8 in zend_shutdown ()
#10 0x00000000004fbb9a in php_module_shutdown ()
#11 0x00000000005d55e2 in main ()
#12 0x0000000000417125 in _start ()

The problem is being caused by libxml2 under FreeBSD being compiled as threaded by default where as php isn’t.

The fix is simple select the LINKTHR option from make config and recompile php and its modules to be safe 🙂

Written by Dilbert

June 16th, 2011 at 11:47 am

Posted in FreeBSD,PHP

IPMI under FreeBSD is easy!

without comments

Its easy, first you need the ipmi kernel module loaded e.g. kldload ipmi. Add ipmi kernel module and its dependency i2c (for smbus) to your kernel and recompile if its not already available.

Next build / install ipmitool package (/usr/ports/sysutils/ipmitool)

That’s all, see man ipmitool for the myriad of options 🙂

Written by Dilbert

June 7th, 2011 at 12:18 am

Posted in FreeBSD

Finding the cause of kldload “Exec format error”

without comments

I’ve just been trying to get ipmitool working on our custom kernel, which requires the ipmi kernel module loaded however after adding this module to our kernel config it refused to load giving the following error:-
kldload ipmi.ko
kldload: can't load ipmi.ko: Exec format error

Not exactly helpful 🙁

After much digging I finally figured out it the ipmi module depends on the smbus module, so I added this and in doing so noticed some messages on the console of the machine, I’d been working over ssh. These messages told me exactly the issue:-

Jun 6 23:27:47 test kernel: KLD ipmi.ko: depends on smbus - not available or version mismatch
Jun 6 23:27:47 test kernel: linker_load_file: Unsupported file type

If only it output those to controlling console as well as the main console and /var/log/messages I would have not spent ages searching for the solution.

The moral of this little tale is if you have kldload spit out “Exec format error” at you, check /var/log/messages to find out why 🙂

Written by Dilbert

June 6th, 2011 at 11:58 pm

Posted in FreeBSD

“version” perl Module Upgrade on SFU results in broken perl!

without comments

For those of you who use SFU, a useful POSIX layer thats freely available for Windows that want to update / install new perl modules using CPAN, be aware that the updated the “version” module can lead to a broken perl install. The resulting symptoms are that perl commands hang doing nothing. The cause of this is that you end up with two “version” module folders, one lower case “version” and one upper-case “Version”.

The fix is simply to remove the old “Version” folder from /usr/local/lib/perl5/site_perl//x86-interix-thread-multi/auto/

Written by Dilbert

June 1st, 2011 at 7:56 pm

Posted in Perl