23
May

ADODB on FreeBSD

Recently I’ve had one of my student assistants working on setting up a web server. She’s pretty much got it, except that she hasn’t been able to establish a connection from the web server to our database server.

We’re wanting to use ADODB to connect to a mssql server. She figured out how to install the databases/adodb5 port (and how to get ADODB included in the PHP configuration), but that wasn’t enough by itself. I thought there might be a PHP extension required, and a little Unix pipe revealed the missing module:

# grep -i ^php /usr/ports/INDEX-7 | grep -v ^php4 | grep -i adodb

The command above searches the ports index for lines starting with “php” (or “PHP”), ignores those which begin with “php4″ (I’m not interested in version 4 stuff), and searches everything that’s matched so far for “adodb” (or “ADODB”). Results:

php-adodb-ext... (long index line snipped)

A quick check of /var/db/pkg verified that this module hadn’t been installed yet. I installed the module via portmaster(8) and added the new extension per the pkg-message instructions:

# portmaster databases/php-adodb-ext
.
.
.
(installation stuff snipped)
# cat >>/usr/local/etc/php/extensions.ini
extension=adodb.so

Now we’re getting a different error:

PHP Fatal error:  Call to undefined function mssql_get_last_message() in /usr/local/share/adodb/drivers/adodb-mssql.inc.php on line 501

Google indicates the problem is likely that the mssql extension for PHP isn’t installed. I ran the same pipe that I did for ADODB, this time searching for mssql:

# grep -i ^php /usr/ports/INDEX-7 | grep -v ^php4 | grep -i adodb

php5-mssql... (long index line snipped)

So another portmaster(8) installation, this time for php5-mssql. One of php5-mssql’s dependencies is freetds-msdblib, which has some configuration options. The only one I’m setting is MSDBLIB, which enables MS SQLserver (in lieu of the old Sybase DB).

This port (php5-mssql) automatically registers itself as a PHP extension, so you don’t have to add a line to /usr/local/etc/php/extensions.ini yourself.

I’m still getting errors, but they’re starting to look like problems with the database connection string instead of server configuration now. Progress, of a sort. But that’s enough for now–It’s almost 8:00 pm on Friday night before a 3-day weekend, long past time for me to get on with my own life!

07
Mar

DTV conversion

My friends and family know that we generally don’t watch TV, so I haven’t been too worried about the digital television conversion issue. Likewise it was no big deal when I heard that the DTV-to-analog rebate program was suspended due to depletion of funds. But now that they’ve got funding again, I figured I might as well take advantage of the $40 rebate.

I tried to apply via the TV converter box coupon program web site, but it kept throwing errors. The over-the-phone application worked fine. Our coupons are supposed to be in the mail on March 27. The recorded information says that mailing can take up to three weeks, but the program web site now claims to be using first class mail so it shouldn’t take that long.

I’m going to try and get an external antenna hooked up this month, so that’ll be ready when it’s time to buy/install the converter box.

02
Mar

Arden Park hams

I got my amateur radio (”ham”) license last week, but I haven’t posted my callsign very widely because I applied for a vanity callsign as soon as I got my license. (It isn’t possible to apply for a vanity call until one has been granted a license.) It usually takes 18-20 calendar days for a vanity callsign to be granted, so I expect to announce my new call on March 17.

I’m interested in finding other local hams, so I visited QRZ.com and pulled up “my” grid square, CM98ho. The grid doesn’t quite line up with my neighborhood boundaries, so I also needed to look at grid CM98hn for the southern section. The map shows about 20 markers (which may represent more than one person) in Arden Park:

To get to QRZ’s gridmap display, go to QRZ’s search page, enter “grid: CM98ho”, then click on one of the listed callsigns. If that person hasn’t restricted their information, click on the green bar that says “click for more detail”. A map will appear on the right. Click on the “Explore on GridMap” link below the map.

27
Jan

Xserve disk mirror repair

Looking over the last few posts, I seem to be stuck in a rut. I apologize to readers looking for stories about our remodeling project, progress on Barb’s quilt shop, cooking, or other tales of home. Believe me when I say that I’d much rather be writing about those things! Sadly I’ve been attending the school of hard knocks for the last month, and I want to record some of the things I’ve learned in the hopes of helping other people in similar situations. Heck, it may even come in handy for me in the future, although I sincerely hope not!

The system I’m currently fixing has a high-reliability disk setup. The server has two fibre channel interfaces, each connected to a separate RAID-5 array. The server takes care of mirroring, while the external disk arrays implement the RAID-5. This is all done with an Apple Xserve server and an Xserve RAID enclosure.

It looks like one of the RAID arrays got corrupted during our recent power outage, as diskutility (the GUI tool) is reporting “mirror degraded”. I used diskutil (CLI) and the RAID Admin utility to check the RAID arrays, but they both reported no errors on either side of the mirror. A little time on Google turned up a post which suggested using iostat to determine which side of the mirror had failed, but when I tried rebuilding the mirror using those instructions I kept getting “Error -9980″. Some more digging and it looks like the “broken” side of the mirror was unmounted. I tried several things to get that half of the mirror to reconnect, even going so far as shutting down the server and the RAID and rebooting. No luck, although I was able to get ‘diskutil repairMirror raid-disk slice from-disk to-disk‘ accepted. (It didn’t actually do anything, though. But at least it didn’t error out anymore.)

Finally I noticed that one of the RAID controller cards was behaving oddly. It reported status=okay, but it wouldn’t allow connection from the RAID Admin utility (over the LAN). I had been ignoring it, since I was connected to the other controller, but I decided to connect directly to the flaky one and see if there was something it wasn’t reporting to the controller I had been using to diagnose the problem. I found that the IP address of the dodgy controller wasn’t correct, and the passwords for monitoring and management access weren’t working. I shut down the server again, and this time when I shut down the RAID I pulled the power cords. (I had found out that without pulling the power cords, the array isn’t actually powered off; rather, it’s in “sleep” mode.) I powered up the RAID (but not the server!), then reset the RAID controller (just the password reset, not the full-blown one). Between power-cycling the RAID and resetting the controller, I was able to get the RAID Admin utility to connect to the array. Then when I rebooted the server, the disk mirror started rebuilding without any other action on my part.

The mirror seems to be rebuilding right now. The RAID arrays are 1.225 TB (1.1 TiB) each, with ATA100 disks. (It’s a few years old.) At the rate it’s been going, I expect the rebuild to take about 11 hours total.

16
Jan

Duplicate DHCP leases

We’ve been getting the following types of error messages on our DHCP server (running on FreeBSD):

Jan 12 07:01:52 *someserver* dhcpd: uid lease 192.168.100.200 for client 00:12:34:56:78:9a is duplicate on 192.168.100/24

Google turned up a helpful post which told me what the problem was, but I didn’t care for the suggested fix. Initially I concentrated on the MAC addresses listed in the error log, seeing if they were also defined in our dhcpd.conf file:

grep "is duplicate" /var/log/messages \
    | cut -f 11 -d' ' \
    | sort -u \
    | grep -C --file=- /usr/local/etc/dhcpd.conf

But this doesn’t seem like the correct approach. What we really ought to be doing is comparing our dhcpd.leases file to dhcpd.conf, looking for MAC addresses that are listed in both. Anything that’s listed with a fixed-address in dhcpd.conf probably shouldn’t be the leases file, IMHO. That’s probably a bit too complicated for a bunch of shell commands piped together, since we’d need to parse a multi-line DHCP entry from each file. I think a perl script might do the job.

14
Jan

Background fsck problems

We had some trouble with our FreeBSD systems over the holiday shutdown a few weeks ago. Our backup generator didn’t kick in during an extended power outage, and our UPS’s didn’t provide enough runtime to see us through. Result: all our systems crashed. (Before anybody mentions it… Yes, I know I should have installed NUT and configured our network to shutdown in such cases.)

When I got to the office and started powering systems back up, I noticed the expected messages about the filesystems not being dismounted properly. After all the systems were up, I went back around and started logging in to survey the damage. Here’s an example of what happened when I tried to run fsck on one of our filesystems:

# fsck -y /tmp
** /dev/twed0s1e (NO WRITE)
** Last Mounted on /tmp
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
.
.
.

I had never seen “(NO WRITE)” show up on fsck before. A little searching turned up this post which explains that (NO WRITE) means the filesystem is mounted, thus fsck cannot write to it. I went back and rebooted each system into single-user mode. Then I was able to fsck all the local filesystems and reboot cleanly.

# init 1
# fsck -y -t ufs
# reboot
13
Jan

Burning ISO images on a Mac

I burn ISO images on my Mac fairly frequently, but not often enough to have the process committed to memory. In the past I’ve always followed the instructions I found in a macosxhints post. It works, but it has always seemed a little convoluted to me. I found a much simpler method today:

  1. Insert a blank CD/DVD.
  2. In Finder, double-click on the ISO image you want to burn.
  3. Open Disk Utility (in Finder / Applications / Utilities / Disk Utility). Depending on your settings, either of the previous steps might open Disk Utility for you.
  4. In the left pane of Disk Utility, select the ISO image (e.g. “7.2-RELEASE-i386-disc1.iso”, not the “FreeBSD_Install” contents of it).
  5. Click the Burn icon on the top of the window (or Apple-B on the keyboard, or via the menu select Images / Burn ).
(Original instructions below. Thanks for the tip, Nick!)
  1. Open Disk Utility (in Finder / Applications / Utilities / Disk Utility).
  2. Make sure nothing is selected in the left pane of Disk Utility (in case you had it open already).
  3. From the menu, select Images / Burn (or Apple-B on the keyboard).
  4. A file requester will pop up. Navigate to the ISO image you wish to burn.
  5. Insert a blank CD/DVD if you haven’t done so already.
  6. Click Burn.
  7. Done!
11
Jan

Unattended port installation and FreeBSD setup

We are currently building about a dozen FreeBSD servers at work. The build process is pretty well documented, but it’s a bit labor intensive. So I had one of my student assistants look into automating the process somewhat. This post discusses our assumptions and initial conditions, along with our results and recommendations. Hopefully this can help others trying to implement similar plans.

We implemented this on FreeBSD versions 6.2, 6.3, 6.4. We will also be testing this on version 7.1 later this month. We are focusing on the i386 architecture, and we would like to try large (≥3 GiB) memory configurations with the amd architecture as well.

All of our systems have a common set of basic tools:

Ideally we would like to install all of these common tools with one command that doesn’t require further user intervention. We could have created a package for this, but I’m pretty sure we would need to build a separate package for every possible FreeBSD version and architecture — that’s 4 O/S versions x 2 architectures = 8 packages, which doesn’t seem worthwhile for ~12 systems.

Another possible approach would have been creation of a “metaport”, a single pseudo-application listing all of the tools as dependencies. I didn’t pursue this because it doesn’t (by itself) address the user intervention issue.

One more goal of this project was the automation/scripting of some common system configuration tasks such as enabling/starting NTP, setting up network printers, etc. This doesn’t have anything to do with the ports/packages system, so we needed to write a script for this part. Most of this code is pretty obvious and mundane, but I’ve included it in the article for the sake of completeness.

The trickiest part of this whole project was figuring out how to do unattended installation of ports with options, e.g. screen. Normally when you install such a port, you will be presented with an ncurses menu of options for that port. Each of these options should correspond to a WITH_* / WITHOUT_* variable that controls how the port is built, possibly affecting the port’s dependencies, etc. The options menu is displayed when the ‘config’ target is built:

# cd /usr/ports/sysutils/screen
# make config
(ncurses option menu appears, user chooses which options to enable/disable)
# grep ^WITH /var/db/ports/screen/options
WITHOUT_CJK=true
WITH_INFO=true
WITH_MAN=true
WITH_NETHACK=true
WITH_XTERM_256=true
WITHOUT_HOSTINLOCKED=true
WITHOUT_SHOWENC=true

The options are saved in /var/db/ports/portname/options, as shown above. Once you have figured out which options to enable/disable on one system (interactively), you can copy them into a port-specific section of /etc/make.conf as follows:

# echo '# Options for sysutils/screen' >>/etc/make.conf
# echo 'if ${.CURDIR:M*ports/sysutils/screen}' >>/etc/make.conf
# grep ^WITH /var/db/ports/screen/options >>/etc/make.conf
# echo '.endif' >>/etc/make.conf

We’ll now test this by removing the config file and building the port with the BATCH=yes flag set. This should prevent the ncurses config screen from popping up.

# cd /usr/ports/sysutils/screen
# make rmconfig clean
(We're using /bin/sh for our installation script, as well as for testing.)
(If you're using csh, you'll need to use *setenv* instead of *export*.)
# export BATCH=yes
# make install clean
(Lots and lots of output, but no configuration prompting!)

The components of the solution are all in place! Now all we need is to put them together and write the script, but that’ll have to wait until next week.

11
Dec

Metric recipe conversion-butter

We have a few recipes from friends in France and Sweden that use metric measurements. Some of the volume-volume (e.g. 1 teaspoon=5 mL) or weight-weight (e.g. 500 g=1.1 pounds) conversions are pretty trivial. Other conversions are more difficult, and I wanted to document these to ease future recipe conversion.

One of the common, slightly difficult ingredients is butter. Most domestic recipes with which I am familiar give butter measurements by volume (e.g. “2 Tbsp butter”), whereas all of the metric recipes I’ve made measure butter by weight (e.g. “50 g butter”). I don’t want to go through deriving the conversion; instead, here’s a table showing a few common measurements and approximations (indicated by a leading “~”):

US-metric butter conversion
US measureMetric measure
~½ stick50 g
~1½ Tbsp20 g
1 lb~450 g
1 stick (¼ lb)~115 g
¼ c~55 g
1 Tbsp~15 g
02
Dec

Thanksgiving pictures

I only took a few pictures of our Thanksgiving feast. Fortunately, my cousins brought their cameras and didn’t hesitate to use them (and share)! I’ve included a few crowd shots from Greg and Cal. They also allowed me to add their pictures to our photoset. Jeremy and Ducky have their own Thanksgiving photoset on Flickr, including pics of the annual “appetite enhancement” ride (and pictures from our dinner, obviously).

Thanksgiving crowd #1 Thanksgiving crowd #2 Thanksgiving crowd #3





July 2009
M T W T F S S
« May    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Tags

abramoff accessibility acetylene activism adodb aerial photo afrofunk aim4tree air america airport express alite alito amtrak andante andy antenna anti failure any browser apache apple apple pie applescript arden arcade arden park ariana arnold ashland astronomy attic attika audio avid reader backup baen bart bash batch bathroom bbq bee beef begonia bgg bike bike hikers bike journal bikejournal biketalk bill oreilly bittorrent blacklist blog bloggercode blogroll blueberry boardgamegeek boardgames bonjour book bookcrossing boot failure bootcamp borderline chaos bugmenot bush business card butter cabinetry caira caitlin california candamir caroline carpet cat cateye cdrom celebration cellular phone century cheese chicken chico chimney chinese chipotle chocolate christmas chumby city bikes civilization cjd claire club club fed co op coconut coffee comfort food community computer concord congress conquest conservation consumer reports copyright costco crazybikerchick crepe crock pot cruftbox css csus curl currency custard cvntrak dagoba daniel goetz darwinports database datarescue date format death delicious monster democracy now Democrat demolition dessert dhcp dickens diff disaster discrimination discworld dishwasher disk mirror diskutil diskutility diskwarrior dixie belle dock doors downing street memo drm dryer drywall dtv dump ed burke eff eggs eject election electric car electric truck electrical electricity elvgren emacs email energy efficiency eric meyer esr etext euthanasia facebook family faq faux news feed feedreader fence finder firefox fireworks first4internet first amendment fishmeal flash flickr flooring fondue foreign exchange foundation fox and goose framing freebsd freedback freetds fsck fundraiser fyq garage garden geek geotag geourl gnutar go gonuls google google earth google maps gpl gracenote graywater greek green group concat gtd gunthers gutters gwbush gymnastics hacking halloween ham ham radio handspring hardwood harry potter headmeta high speed photograph high tech inv hoax hobbies hobby hodgins holiday holly home power magazine horcrux houseblogs how to html humor hvac ilovejackdaniels imac impeach init inspection insulation intel internet iostat ipod ipodder iq iraq isight iso itunes ivins iwantsandy java city javascript joint chiefs joseph jott journalized blue judges cup kctc khs kimkerry kitchen kyocera la salles la times labor landscape laundry law leatherbys legal lego leopard lhc liberal library linkedin ljurban lodi logic logo lungren lynx maaloufs mac macaroni macbook mailinator make.conf malware map marin markdown mason media media clip media reform meetup metric mexican microsoft mike comfort military milonic mindstorms mlk model railroading modoc hall monterey morning sedition motorcycle movie moving mssql munchkin murray mushroom music mynetflix mysql nagios naked lounge nerd score netflix network new urbanism new year New Yorker nofollow nut nutella oatmeal obama obcz occidental occupation omni openssl oracle organic osx owp paint pair palast palm panasonic parallels party patch peak adventures peak oil pear pedestrian village perl petaluma php ping pingback pingomatic pingomation pingqueue pirate pl sql planet bike plasma playroom entertainment plugin plugin:preview theme plugin:text control plugin:ultimate tag warrior plumbing podcast podsite politics portaudit portmaster ports portupgrade postfix potato powerbook Pozsars printer programming project gutenberg pryde punk puzzle qiana qrz quilt quilt shop quiz quote r5 records racism radio RAID railroad recent comments recipe redalt remodel repairmirror resaurant resolution restaurant restore review richmond rio americano robotics roger niello ron montana roof rootkit rss sacbee sacog sacramento sacramento spotlight magazine salad san francisco sandwich santa cruz scam scandal school days scplugin screen security session report shakespeare shuffle sigma siriradha sitemap snl snopes social social network software soma somafab sonicchicken sonicchicken blog sony spam spam karma spellcheck spinach spinner spirit spoiler etiquette spring hill cheese sql sqlserver stairs standards statcounter stephen king stop loss stucco stunt subversion sudo sudoku superbowl superhero supreme court sushi svn sysadmin tacoma tags plugin takara technology telephone television template terms and conditions textcontrol thai kitchen thanksgiving theater theme theme:borderline chaos theme:elvgren theme:elvgren wordpress google code theme:fluid blue theme:fullwidth theme:head theme:journalized theme:journalized blue theme:psycho theme:redoable theme:sharepoint like theme:simple green theme:spirit theme:steam theme:wuhan theme:yadda theme switcher thomas tigris euphrates tile tinfoil hat toc tofu tower theater training transit transit oriented development tribute u haul uneasy rhetoric university village ups van zant veterans day video vie viking hobby vote smart w3c wall warboss washer washington post weather web web developer web server wikipedia windows wishlist woodworking wordpress workplace wpblacklist wpgatekeeper wsj xserve yaaarr yard