About Adam Young

Once upon a time I was an Army Officer, but that was long ago. Now I work as a Software Engineer. I climb rocks, play saxophone, and spend way too much time in front of a computer.

A new outlook on some old activities

The time from Dec 24th until January 2nd was spent in New Hampshire with my family.  It was a real vacation, something I have not had in a long time.  Aside from the time off, I got outside for a few winter sports:  Cross Country Skiing, Sledding, and Snowshoeing.

Growing up, my family was all about downhill skiing, but the cost, plus the time away from my family meant that I had no drive to go.  Even with all of the great snow this past week.

For cross country, we went out the East Branch of the Pemigewasset  river by Lincol Woods.  The snow was so hard packed that many people were out hiking using just boots and simple crampons.

My folks had picked up a pair of snow shoes.  My wife and I tried them out and I fell instantly in love with the sport.  I have always loved the New England woods, especially the ability to wander aimlessly.  Snowshoeing opens up the woods in winter time.  With the snow covering all the entangling underbrush that hadn’t dies off in the fall, and the metal teeth biting in allowing you to navigate the steepest slope, the woods are open to a degree you don’t find any other time. Yes, snowshoeing is slower than hiking or skiing, but the mobility is amazing.  So now I have to do research to buy myself and my wife a pair.

My Dad has a tractor and an excavator, and I swear he never stops playing on them when we go to NH.  This year, he ignored our entreties not to tear up the meadow and used the excavator to build a sledding run.  The meadow was always a tough sled run, as the long line also was the crest of the hill, and it constantly wanted to throw you off into the flats or the underbrush.  He built a track right down the crest, augmented with a little shovel work.  The packed down snow soon became Ice.  A little Silicone lubricant applied to the bottom of the tubes made for one hell of a fast sled run.

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/libncurses.so.5 374024
  • /lib/libdl.so.2 14624
  • /lib/libc.so.6 1367432
  • /lib64/ld-linux-x86-64.so.2 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

4

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
Password:
$ sudo mount -o loop /tmp/ramdisk /mnt/ramdisk/
$ ls /mnt/ramdisk/
lost+found

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.

The Army Team’s The Pride and Dream…

In two hours I board a plane for Baltimore.  Tomorrow I will watch the Army-Navy Football Game live for the first time since I was a Cadet.  In November of 1992, Army beat Navy.  I lost my keys, and was the last person besides the cleaning staff in Veteran’s Memorial Stadium in Philadelphia. This year, I am meeting up with three other classmates for the weekend.  I know that Army has had a tough time the last several years.  I suspect it is easier for Navy to Recruit than it is for Army.  Still, anything can happen in this game.  I just hope it is interesting to watch.

Go ARMY!  Beat NAVY!

Back to BProc

The last check in to the BProc CVS repository on sourceforge happened 16 Months ago. I recently checked out the top of tree and found I was unable to build. Looks like what is there is a mix of 2.6.10 and something in the vicinity of 2.6.20 Linux code bases. I am starting again, this time with the code in the tarball. I’ve built this before and know it compiles. Here is my general plan forward:

1. Get a 2.6.9 Kernel with the BPRoc patch applied to boot on a RHEL4 System.

2. Build the BPRoc and VMADump Kernel modules and load them into the kernel.

3. Build the BPMaster and BPSlave binaries. Make sure BPMaster runs.

4. Build the beoboot code.

This is where it gets tricky. At Penguin we had our own PXE Server (Beoserv) that handled provisioning a compute node. Part of the Beoboot package there was creating the root file system and bring up the slave node binary. So here is a tentative plan instead.

1. Deploy the standard redhat PXE and DHCP servers on my head node. Ensure that the DHCP server only responds to requests from the subnet where the compute node resides. Probably best to unplug from the company network when I do this.

2. Set the PXE server to support the booting of a stripped down RHEL4 system. Really, all I want is to get as far as running init.

3. Replace the init in the PXE IMage with the beoboot binary. Have it bring up BPSlave and see if it can talk to BPMaster on the head node.

If I can get this far, I will consider it a great success.

Update 1: I built a 2.6.9 Linux Kernel with the bproc patch applied. makeoldconfig, selected BProc but none of the other options. Upon BootingI got a panic when it could not find device mapper. Looks like device-mapper got added in the 2.6.10 kernel. Since I have already built that kernel, I guess I’ll start by trying the tarball kernel module code against the 2.6.19 patch.

Update 2: Um, nope. TASK_ZOMBIE and mmlist_nr are showing up as undefined symbols. mmlist_nr seems to be acount of the number of memory managers out there. I suspect that this is something that changed between 2.6.9 and 2.6.10. Probably some better way to keep the ref counts was introduced. I Vaguly remember something about the TASK_ZOMBIE.

Update 3: This was bogus and I removed it.
Update 4: Replaced TASK_ZOMBIE with EXIT_ZOMBIE. Commented out the decrement as it seems like it has just been removed.

Update 5: Error accessing rlim in task_strcut. This is now in the signal struct:

– unsigned long gap = current->rlim[RLIMIT_STACK].rlim_cur;
+ unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;

Update 6: OK, back to the point I found before. THe hook for kill_pg_info is now kill_pgrp info, and the hook for kill_proc_info is now kill_pid info. This is a change in the patch, so I have to get the module code in line with the new function call parameters. Looks like the header has been changed, but the old function call names are using in kernel/signal.c. Changing, rebuilding, and redeploying kernel.

Update 7:  Success through building and running bpmaster.    I had to create a config directory, but other than that, nothing was too far out of the ordinary.