Spotted on the North Bank of the Charles

Yeah, the snow today was gorgeous. I walked to work this morning. As I crossed the BU Bridge I noticed a flock of ducks in the water in the lee of the railroad bridge. On the north side of the bridge is a small clearing where the ducks and geese congregate in the warmer weather. I noticed the snow was well beaten down there, and wondered if that was from people or waterfowl. As I continued to walk and look, I noticed a large, brown bird overlooking the same clearing. I recognized the Brown feather with black horizontal lines of my favorite raptor: The Peregrine Falcon. I had seen one in this area earlier in the year, while on a bike ride with my family. As I stopped and watched it, I noticed it’s white underbelly with brown spots that you would see it the bird were in flight. I stopped a bunch of people on the bridge and pointed it out. Seeing a peregrine falcon in the snow while crossing the Charles River is truly a special experience.

Go Read the Milblogs

If you are at all an American you care about our boys and girls in the sand. If you are a Conservative, you feel proud that they are doing their part in the Global War on Terror and hope they come back home in one piece. If you are a Liberal, you hate the fact that we are at war and just hope they come back in one piece. I’m not going to go into my own position on Iraq and Afghanistan; there are enough political blogs out there. But I want everyone to be hyper-aware that we have friends and family and neighbors in the sand, in the mountains, and the urban sprawl along the old Silk Road.

I can’t tell their stories, and I don’t have to. They are telling them right now, online, in the various military blogs. Doonesbury Creator Gary Trudeau has done a great thing in posting an array of their blog postings on his “Sandbox” page.

I started reading them their, and have gone on tow check the authors own pages daily to see if they are OK. I’m not going to say anything more about them: go to the sandbox, then click on the links for the author’s own pages, and read what they have to say themselves.

If anyone comes up with good blogs that are not linked to from the Sandbox, please let me know.

Military Lessons from the Game Go (Wei Qi)

Go is often compared to Chess. My favorite quote is that Chess is a battle, Go is a war. Go is all about the essence of using scarce resources for maximum effect.

I think the most interesting part of Go is that you are attempting to surround empty space. The idea that the land itself is valuable, but only if not occupied by soldiers. If soldiers are using up the resources of the land, it cannot be used for other purposes.

Territory must be defended to be valuable. People can only produce if they feel safe in their homes.

Where one party attacks is where the other party defends. Whereas the insurgents in Iraq were able to kill many soldier’s in a dining tent, now the whole region has overhead cover against mortar fire.

Defending inefficiently can cause the whole effort to collapse under it’s own weight. The American way of waging war is very resource intensive. We may win the region, but cripple our ability to counter threats elsewhere.

There is a Go Koan that says to attach for defense. If you want to make your opponent spend resources in an area, get close enough to attack that area, and do so visibly.

Stones live by being connected to other stones. An Army lives by it’s supply lines. An Army can forage only for so long before it needs to get food from somewhere else. The ideal is to have a secured line back to where your food comes from. In todays motorized world, oil is even more important than food, as you need oil to move food.

Efficiency matters. You don’t have the resources to do everything. Make sure you do the things that you absolutely have to do.

Linux init process

The BProc project supports an older protocol called RARP to assign an IP address for a compute node. While this made sense when BProc was written, it has been made obsolete by DHCP. Since I really don’t want to write a DHCP server, I’ve decided to try to use the DHCP and TFTP servers that come with CentOS to boot the compute nodes. Here’s what I’ve (re)learned:

The initrd image that the Linux kernel builds has a file in it’s / directory called init. This is a shell script that executes in the lash interpreter. It does a modprobe for a set of modules, greats /dev a file for and mounts the root file system, and performs a switchroot.

Aside: Anyone on a linux system can find this out by running:

zcat /boot/initrd<version>.img | cpio -di

I would suggest doing this in an empty directory.

My thinking is that I should hack this script to do a tftp fetch before creating the /dev file. What I plan on fetching is a file that contains an ext2 file system that can be mounted as a ram disk. This ramdisk can be created by creating a (large) file, then running mke2fs. This file will not dynamically resize, so I need to make it large enough to fit all my files needed for booting, but not so large that it is going to eat up a significant portion of ram on the compute node. I know I am going to need the bproc kernel modules (bproc.ko, vmadump.ko), bpmaster, some process to act as init (I’ll use bash to start) and the support libraries:

  • /lib/ 374024
  • /lib/ 14624
  • /lib/ 1367432
  • /lib64/ 119536
  • bproc.ko 1929345
  • vmadump.ko 285821
  • /bin/bash 797208
  • bpmaster 112920

Turning to my old friend the binary calculator:

echo “( 374024 + 14624 + 1367432 + 119536 + 1929345 + 285821 +112920 + 797208 ) / ( 1024 * 1024 )” | bc


So roughly 4 MB. I’ll make it an odd 5 to start.

To create the file:

$ dd if=/dev/zero of=/tmp/ramdisk bs=1024 count=51105110+0 records in
5110+0 records out
5232640 bytes (5.2 MB) copied, 0.024132 seconds, 217 MB/s

I’ll take the defaults for ext2 for now. Notice that I have to type ‘Y when asked to proceed.

$ mke2fs /tmp/ramdisk
mke2fs 1.40-WIP (14-Nov-2006)
/tmp/ramdisk is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1280 inodes, 5108 blocks
255 blocks (4.99%) reserved for the super user
First data block=1
Maximum filesystem blocks=5242880
1 block group
8192 blocks per group, 8192 fragments per group
1280 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Now That I have a ramdisk, I can copy to it

$ sudo mkdir /mnt/ramdisk
$ sudo mount -o loop /tmp/ramdisk /mnt/ramdisk/
$ ls /mnt/ramdisk/

And we have a file system.

Update 1: The initrd layout seems to be distribution specific. On my debian box, there is no lash, and instead there is a busybox executable with, amongst other things, a tftp client built in. This may be a worthy approach: having tftp available as part of the init rd will allow fetching a rootfs to be done more cleanly. Also, there are hooks to put scripts in, and command line options to allow building initrd’s for nfs root or local root. If only I had targeted Debian instead of RHEL 4 to start.

Update2: The Redhat initrd does not have a tftp client in it. I added one in by hand, added all of the libraries it needed (ldd bin/tftp) and kicked off another PXE boot. Network unreachable. Interesting that it is supposed to be able to NFS mount root, but it seems unable to do a tftp fetch.

How to reset the root password on a GRUB based Linux boot

If you forget or somehow manage to change the root password on a machine running various flavors of glibc based security, and you are running a Linux kernel here are the steps to reset it.

  1.  Reboot the  machine.  This assume physical access, but reset the root password requires that anyway.
  2. At the GRUB prompt select the kernel you want and hit ‘e’ for edit.
  3. At the end of the kernel boot parameters add the word ‘single’.  This means boot into single user mode, and should bypass the need to type in a password.
  4. hit ‘b’ to boot.
  5. Once a Command prompt appears, use the passwd utility to reset the machine.
  6. Reboot.  Or, you can type ‘init 3’ or ‘init 5’ to complete the bot process.  Use 3 for servers, 5 for machines with graphical displays.