At work the other day, we had a long power outage, and afterwards one of our FreeBSD 5.2.1 boxes refused to come back up. It'd power up, go through the BIOS stuff, show the FreeBSD boot manager that lets you select which slice to boot, but when you hit F1, the screen would go black and the machine would reset.
Booted off the 5.2.1 install CD, and after entering fixit mode, was able to mount the disk and see
that the files seemed to be intact. Couldn't run fsck though, the 5.2.1 CD seemed to be missing
fsck_4.2bsd.
FreeSBIE 1.1 on the other hand, was able to fsck the
disk, but that didn't solve the problem. Next guess was that something in the /boot
directory was hosed. I'd setup the machine to do weekly dumps of the root partition to another
machine, and was able to extract /boot from a few days before and pull it back onto
this machine over the network using FreeSBIE, but it still wouldn't boot.
Next theory was that something in the boot sectors was bad. First tried restoring the MBR (Master Boot Record)
from copy that's kept in /boot - even though it was working well enough to show the F1
prompt to select the slice. Wanted to keep what 5.2.1 had been using, so mounted the
non-booting disk readonly and made sure to have boot0cfg use the copy there
instead of anything
that might have been on the FreeSBIE disc.
mkdir /foo mount -r /dev/twed0s1a /foo boot0cfg -B -b /foo/boot/boot0 /dev/twed0 reboot
Unfortunately, that didn't help. Each slice (partition in non-BSD terminology) also has boot sectors, and to
restore them, turns out you use the bsdlabel (a.k.a. disklabel) utility. Again from
FreeSBIE:
mkdir /foo mount -r /dev/twed0s1a /foo bsdlabel -B -b /foo/boot/boot /dev/twed0s1 reboot
That did it. Apparently something in the slice's boot sectors was messed up.
posted at: 18:34 | tags: freebsd unix | 0 comments | permanent link to this entry
Other people have reported the same problem with mod_python on FreeBSD I had seen before, so I'm happy that I'm not losing my mind.
I took a stab at using Valgrind to find the problem. Didn't actually find anything, but I thought I'd jot down notes on how I went about this.
First, the Valgrind port didn't seem to work on FreeBSD 6.0. When I tried running it against the sample code in the Valgrind Quick Start guide, it didn't find anything wrong with it. Ended up finding a FreeBSD 5.4 machine, which did see the expected problem.
Next, I built the Apache 2.0.x port with: make WITH_THREADS=1 WITH_DEBUG=1, and then built mod_python
which uses APXS and picks up the debug compile option from that.
Then, in the mod_python distribution, went into the test directory, and downloaded a Valgrind suppression
file for Python, valgrind-python.supp,
and in it uncommented the suppressions for PyObject_Free and PyObject_Realloc (otherwise the Valgrind output is full
of stuff that is really OK).
Then tweaked test/test.py around line 307 where it starts Apache, to insert
valgrind --tool=memcheck --logfile=/tmp/valgrind_httpd --suppressions=valgrind-python.supp
At the front of the cmd variable that's being composed to execute httpd.
Finally, ran python test.py, and then looked at /tmp/valgrind_httpd.pid#### to
see the results.
posted at: 22:17 | tags: bugs freebsd mod_python | 0 comments | permanent link to this entry
A while ago I threw together this script to automatically create package files for all installed ports on a FreeBSD box. That way, if a portupgrade doesn't work out, you can delete the broken package, and pkg_add the backup.
Stick this in /usr/local/etc/periodic/daily, and the
system will automatically bundle up copies of the installed software
and stick them in /usr/local/packages if they don't already
exist in there.
#!/bin/sh # # Make sure backups exist of all installed FreeBSD packages # # 2005-03-20 Barry Pederson <bp@barryp.org> # ARCHIVE="/usr/local/packages" # # Figure out which pkg_tools binaries to use # if [ -f /usr/local/sbin/pkg_info ] then PKG_TOOLS="/usr/local/sbin" else PKG_TOOLS="/usr/sbin" fi # # Make sure backup directory exists # if [ ! -d $ARCHIVE ] then mkdir $ARCHIVE fi cd $ARCHIVE for p in `${PKG_TOOLS}/pkg_info -E "*"` do if [ ! -f ${p}.tgz ] then ${PKG_TOOLS}/pkg_create -b ${p} fi done
posted at: 21:04 | tags: freebsd unix | 0 comments | permanent link to this entry
I've been testing mod_python 3.2.x betas as requested by the developers on their mailing list. Unfortunately there seems to be some subtle memory-related but that only occurs on FreeBSD (or at least FreeBSD the way I normally install it along with Apache and Python).
Made some mention of it here
and an almost identical problem is reported for MacOSX,
even down to the value 0x58 being at the top of the backtrace.
Did a lot of poking around the core with gdb and browsing of the mod_python and Apache sourcecode, but never quite saw where the problem could be. Took another approach and started stripping down the big mod_python testsuite, and found that the test that was failing ran fine by itself, but when it ran after another test for handling large file uploads - then it would crash.
So I suspect there's a problem in a whole different area of mod_python, that's screwing something up in memory that doesn't trigger a segfault til later during the connectionhandler test. My latest post to the list covers some of that.
posted at: 13:56 | tags: apache bugs freebsd mod_python unix | 0 comments | permanent link to this entry