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

[FreeBSD]: http://www.freebsd.org/
[NUT]: http://networkupstools.org/ “Network UPS Tools”
[fsck]: http://www.FreeBSD.org/cgi/man.cgi?query=fsck&sektion=8&apropos=0&manpath=FreeBSD+7.1-RELEASE
[this post]: http://markmail.org/message/ijqcch4exhvcznmr “Message explaining (NO WRITE)”

Posted in FreeBSD, Uncategorized | Tagged , , , , | 3 Comments

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!
Posted in Mac OS X, Uncategorized | Tagged , , , | 1 Comment

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.

[FreeBSD]: http://www.freebsd.org/

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:

– [portmaster][]
– [portupgrade][]
– [portaudit][]
– [spinner][]
– [screen][]
– [postfix][]
– [nagios][]
– [sudo][]
– [bash][]
– [emacs][]
– [lynx][]

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.

[GiB]: http://en.wikipedia.org/wiki/Gibibyte “What’s a GiB (gibibyte)?”
[portmaster]: http://www.FreeBSD.org/cgi/url.cgi?ports/ports-mgmt/portmaster/pkg-descr
[bash]: http://www.FreeBSD.org/cgi/url.cgi?ports/shells/bash/pkg-descr
[screen]: http://www.FreeBSD.org/cgi/url.cgi?ports/sysutils/screen/pkg-descr
[postfix]: http://www.FreeBSD.org/cgi/url.cgi?ports/mail/postfix/pkg-descr
[emacs]: http://www.FreeBSD.org/cgi/url.cgi?ports/editors/emacs/pkg-descr
[portupgrade]: http://www.FreeBSD.org/cgi/url.cgi?ports/ports-mgmt/portupgrade/pkg-descr
[spinner]: http://www.FreeBSD.org/cgi/url.cgi?ports/sysutils/spinner/pkg-descr
[portaudit]: http://www.FreeBSD.org/cgi/url.cgi?ports/ports-mgmt/portaudit/pkg-descr
[lynx]: http://www.FreeBSD.org/cgi/url.cgi?ports/www/lynx/pkg-descr
[sudo]: http://www.FreeBSD.org/cgi/url.cgi?ports/security/sudo/pkg-descr
[nagios]: http://www.nagios.org/
[package]: http://www.freebsd.org/doc/en/books/handbook/ports-overview.html “Description of ‘package’ in FreeBSD”

Posted in FreeBSD, Uncategorized | Tagged , , , , , , , , , , , , , , | 1 Comment

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 measure Metric measure
~½ stick 50 g
~1½ Tbsp 20 g
1 lb ~450 g
1 stick (¼ lb) ~115 g
¼ c ~55 g
1 Tbsp ~15 g
Posted in Recipes, Uncategorized | Tagged , | 1 Comment

Thanksgiving pictures

I only took a few pictures of [our Thanksgiving feast][tg]. 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][sonicchicken photoset]. Jeremy and Ducky have [their own Thanksgiving photoset][pinkboi 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

[tg]: http://sonicchicken.net/blog/wordpress/20081129/tg-2008-recap/ “Thanksgiving 2008 AAR”
[sonicchicken photoset]: http://www.flickr.com/photos/sonicchicken/sets/72157610548564011/ “Greg and Cal’s Thanksgiving photos”
[pinkboi photoset]: http://www.flickr.com/photos/duckie_and_pinkboi/sets/72157610510446880/ “Jeremy and Ducky’s Thanksgiving photos”

Posted in Uncategorized | Tagged | Leave a comment

Cider baked ham

Barb made this *fantastic* ham for our [Thanksgiving dinner][]. The mustard is very subtle and makes a nice change of taste!

– 1 ready-to-eat ham, 14-16 lbs, with bone
– *lots* of whole cloves
– ¼ c apricot preserves
– 3 Tbsp Dijon mustard
– 1 c packed light brown sugar
– 2 c apple cider

1. Preheat over to 350°.
1. Carefully cut off the rind and most of the fat from the top of the ham, but don’t cut through to the meat! Score the top of the ham in a diamond pattern (1 inch?) with a sharp knife.
1. Set the ham in a shallow roasting pan. Stud the ham with a whole clove at each intersection in the diamond pattern.
1. Place the apricot preserves in a small sauce pan over low heat to melt slightly. Brush the melted preserves all over the ham, then brush all over with the mustard. (Why not combine the mustard and preserves and brush them all on at once?) Pat the brown sugar all over the ham.
1. Pour the apple cider into the roasting pan and bake the ham for 90 minutes, basting frequently, until the ham is glazed and brown.

When the ham is finished baking, slice thinly and serve.

[Thanksgiving dinner]: http://sonicchicken.net/blog/wordpress/20081127/thanksgiving-2008/ “Our 2008 Thanksgiving menu”

Posted in Recipes, Uncategorized | Tagged , | Leave a comment

Thanksgiving 2008-recap

We had a wonderful Thanksgiving this year–lots of family and friends, good food and drink, and great company!
But as usual with such an ambitious project, there was room for improvement.
Here’s what worked well, and how we can do a better job *next* year.

Thanksgiving_2008-1 Thanksgiving_2008-2 Thanksgiving_2008-3

For reference, please see the [2008 Thanksgiving menu][menu-2008].

Appetizers

– Aditi’s samosas were a smash, the very first thing we ran out of IIRC.

– Peeling the deviled eggs was a pain. Next year don’t use ultra fresh eggs. Maybe add a little vinegar to the water also. (Test this ahead of time to make sure it doesn’t change the taste.) On the positive side, we cooked 2 dozen eggs for 27 people, which was the perfect amount–we had 4 halves left over.

– Poppy seed rolls could have been a little smaller and/or taken more filling. Double the dough and triple (instead of quadruple) the filling? A double batch was good for this size party. Remember to check poppy seed stock *before* Thanksgiving day! (Buying poppy seeds in ½ cup spice jars is way too expensive.)

– We did a baked brie, but the cheese was too big. Stick to an 8 oz brie, preferably not triangular. Also we should *not* have prepped this early, since the jam soaked through the filo dough.

– The artichoke dip was excellent, but it would have been even better if we’d done this in a shallow pan instead of a loaf pan. (More surface area to brown!)

– Our cheese tray had four cheeses (4-8 oz each). We sliced up one pear, which was the right amount for that.

– Four cans of black olives weren’t enough. We could have used more olives, preferably a variety.

Menu

– We did an 11 lb ham and 18 lb turkey. This was a good amount for 27 people–enough leftovers for sending home, sandwiches, etc.

– A double recipe of stuffing worked well. The half-loaf of red pepper bread gave it a nice zing. (We also used 1.5 sourdough rounds.)

– Turkey in a browning bag came out nice and moist, but we didn’t get enough gravy. We’re going to try a large covered roasting pan next time.

– We made about 7 lbs of potatoes. Although we didn’t run out, I think some of the folks toward the end of the serving line took less than they wanted because it was obvious we were running low. We should probably plan on 1/3 lb per person next year.

– A single recipe of cranberry sauce *might* have been enough, but I don’t know if we’d have leftovers. Eek! We’ll stick with a double recipe for this size crowd.

– 1.5 recipes of “awesome strawberry stuff” was too much. We didn’t even touch the extra half recipe, so just make a single.

– We made both our traditional candied yams as well as sweet potato casserole, two large sweet potatoes for each. The casserole was a hit, and almost nobody ate the candied yams. (In fact, I think most people who *did* take some only did so to be polite.) Next year we’ll skip the candied yams.

– Very few people took the carrots. We probably shouldn’t even bother with a veggie dish. (Unless it’s carrot halwa, see below.)

Dessert

– Two pumpkin/butternut squash pies was too much. Just do one or the other. (Make the butternut and call it “pumpkin” so people don’t freak out.)

– Two apple pies was too much. Everybody went for the French apple pie, so don’t bother with the country apple.

– Not many people tried Karthik’s halwa (kind of a carrot pudding, fantastic!) I wonder if we should have put this out during the main course?

Drinks

– We asked everybody to bring drinks, but I guess we weren’t sufficiently clear about that. Some of our guests thought that they were responsible for *all* the drinks on their own. Result: we have ***lots*** of leftover drinks. Perhaps next year we should have people bring 500-1000 mL per member of their party, e.g. a bottle of cider per child or a bottle of wine per adult.

Seating

– We let people seat themselves, so we ended up with many folks sitting down with people they eat with every day, plus a few “outsiders” who were sort of out in the cold. We should have done a seating chart to keep branches of the family from dominating their tables. Also, both of our foreign guests (my two student assistants from India) ended up at the same table. We should have placed them at separate tables so more people would have a chance to speak with them.

– Two tables (8- and 6-person) fit in the nook by turning them so the ends butted into the south wall. We got our 10-person table in the central hallway between the nook and great room by putting a carpet runner on the hardwood floor (to keep the chair legs from scratching the floor).

– The bar could accommodate 8 people if we had 4 more bar stools.

– We could put another 10-person table in the great room, but it would have to be set up right before dinner and taken down immediately afterward.

– Max 42 people without shoehorning anybody, not including infants or other non-social diners.

One thing where we really screwed up, though–we didn’t take nearly enough pictures!

[menu-2008]: http://sonicchicken.net/blog/wordpress/20081127/thanksgiving-2008/

Posted in Uncategorized | Tagged | 3 Comments

Thanksgiving 2008

Happy Thanksgiving!

It’s been four long years since we hosted Thanksgiving dinner for our extended family. This is the first time we’ve been able to do so since we moved up to Sacramento, and we’re pulling out all the stops to make up for it! We’re having about 30 people over, so the house will be pleasantly full. (I designed our addition to accommodate about 50 people for dinner.)

Packed frig

Usually everybody brings a dish to share, but contrary to tradition we’re preparing almost all the food this year. The biggest problem so far has been refrigerator space. The menu for this year is fairly typical for our family:

Appetizers

– Cheese
– Baked brie
– Olives
– Stuffed celery
– Pickles
– Artichoke dip
– [Deviled eggs][]
– Poppy seed rolls
– Samosas and chutney (Aditi is bringing this)

The meal

– [Cider baked ham][]
– Roast turkey
– [Cornbread stuffing][stuffing]
– Mashed potatoes
– Gravy
– Vichy carrots
– Cranberry sauce
– “Awesome strawberry stuff”
– Sweet potato casserole
– Candied yams
– Green bean casserole (Jeremy & Ducky)

Desserts

– Pecan pie
– Butternut squash pie
– Pumpkin pie
– Apple pies (Patricia)
– Mincemeat pie (Nana)
– Carrot [halwa][] (Karthik)

I’ve only got a few of these recipes online so far, but I hope to write up some of these in the next few days (since all of the recipes are gathered on the counter). I’ll cross-link to the recipes as I get them typed up.

[deviled eggs]: http://sonicchicken.net/blog/wordpress/20051118/barbs-deviled-eggs/
[stuffing]: http://sonicchicken.net/blog/wordpress/20081126/cornbread-stuffing/
[cider baked ham]: http://sonicchicken.net/blog/wordpress/20081201/cider-baked-ham/
[halwa]: http://en.wikipedia.org/wiki/Halwa “Wikipedia article on halwa (halva)”

Posted in Uncategorized | Tagged | 2 Comments

Cornbread stuffing

I was just making the stuffing for tomorrow’s Thanksgiving feast. I noticed that the recipe, (which I wrote down over 20 years ago), is becoming illegible and doesn’t include the changes we’ve made over the years. So I decided to record our current recipe here. Hats off to my mother and grandmother for the original recipe!

– 1 c (1/2 lb) butter
– 1 medium onion, peeled and chopped
– celery, including leaves, chopped (about twice the volume of the chopped onion)
– 1 c raw cranberries
– 1 tart apple, cored and chopped
– ½ to 1 Tbsp salt
– 1 Tbsp thyme, sage, and/or marjoram (or use poultry seasoning)
– 1 tsp pepper
– 12 (yes, twelve) c bread cubes
– ½ recipe cornbread
– turkey stock

Presumably you’re going to stuff a turkey with this recipe. I like to make the stuffing the day before we roast the turkey. (Otherwise, you’re shoving warm stuffing into the uncooked bird, contrary to safe food handling practices.)

Two days before roasting the bird, chop up the bread and leave it out overnight. (Alternately, you can toast the bread in the oven, but that’s a *lot* of bread!) The bread needs to be a bit dried out for this recipe.

We also make the cornbread now–one less thing for us to do on Thanksgiving Eve.

One day before roasting the bird, (usually Thanksgiving Eve):

1. Chop the apple, onion and celery. (I prefer the leafy celery stalks, especially the inner ones, but you need some solid celery ribs for texture.) Keep the leaves and stalks separate.
1. In a very large (at least 8 qt) pan, melt butter.
1. Saute the celery stalks for about a minute.
1. Add the chopped onion and cook until the onions and celery are just softening, maybe 3-5 minutes?
1. Add the celery leaves, cranberries, chopped apple, and cook for just a minute.
1. Add ~half of the salt and all the other seasonings, mix.
1. Add as much of the bread as will easily fit in the pan. (Now you know why you need a big one!) Toss to coat.
1. Find a large bowl, perhaps 12 qt. Dice the cornbread up into 3/4″ cubes and spread them out on the bottom of the bowl.
1. Pour the celery/onion/bread mixture over the cornbread.
1. Place any remaining bread cubes in the saute pan and stir them around to pick up any of the butter, herbs, etc. Pour into the bowl.
1. Toss together everything in the bowl. Adjust seasoning and salt to taste.
1. Cover the bowl and place in the refrigerator.

The stuffing is usually a bit dry when it’s time to roast the bird. Add some turkey stock to moisten the stuffing. It should just hold together when you mix it.

Stuff the bird, roast it, and enjoy!

Posted in Recipes, Uncategorized | Tagged | 3 Comments

Macaroni and cheese

From the movie [What’s Cooking?][wc]

Ingredients

* 8 oz package of macaroni
* 4 Tbsp butter, divided, plus more for casserole dish
* 1 c fresh bread crumbs
* 1 small onion, chopped
* 1 Tbsp flour
* 1 tsp salt
* 1/4 tsp dry mustard
* pepper to taste
* 1/2 Tbsp Tabasco sauce (optional)
* 1 1/2 c milk
* 3 c (~9 oz) shredded cheddar cheese

Pre-heat oven to 350°.

Cook macaroni according to package directions.

Melt half of the butter in a small saucepan.
Add the breadcrumbs and toss to coat.
Set aside.

Melt remaining butter in a medium saucepan over medium heat.
Add onion and cook until tender, about 5 minutes.
Stir in flour, salt, mustard, pepper, and Tabasco sauce until blended.
*Slowly* stir in milk, stirring constantly, until smooth.
**Remove from heat** and stir in cheese until melted.

Use some more butter to grease a casserole dish.
Place drained macaroni in casserole.
Pour cheese mixture over macaroni.
Sprinkle breadcrumb mixture over top.

Bake 20 minutes or until bubbling.

[wc]: http://www.imdb.com/title/tt0197096/ “IMDB entry for ‘What’s Cooking?'”

Posted in Recipes, Uncategorized | Tagged , , | 5 Comments