I use a lot of xterms – dozens of them, each one runs an ssh session. When I first started working for The Written Word, Inc. I used to start each xterm, manually place it on the screen on the desktop I wanted it on, type ‘exec ssh <host>‘ in each one, and start/resume a screen session. Whenever the connection dropped, I had to do it all over again. What a pain. So I scripted part of it.

The first thing I scripted was starting all those xterms and running exec ssh in each. If you start an xterm with the -ls argument, it starts a login shell in the terminal. So your login scripts will get run. Using this idea, I edited my login script (~/.bash_profile) and appended:

if test -n "${_SSH_HOST}"; then
exec ssh ${_SSH_HOST}
fi

Then I wrote a quickie “commute” script:

#!/bin/bash
: ${_SSH_HOSTS="every host that I wanted to connect to"}
for _SSH_HOST in ${_SSH_HOSTS}; do
export _SSH_HOST
xterm +sb -ls -geometry 79x25 -title $_SSH_HOST &
done

This script starts xterms with no scrollbar, running a login shell, 79 columns, 25 rows, and sets the window title to the host that the login script will exec ssh to. The strange geometry for the xterms is so that I can fit 12 terminals per virtual desktop. Using a more standard geometry would only allow 9, with a lot of unused space.

So things were improved, now I only had to manually place each xterm, and start the screen sessions in each one. For a little while I was ok, but then I thought to eliminate the manual screen session starting. Using expect I was able to easily record these actions, and edit the generated script. Now all I had to do in the event of a network timeout, or reboot etc was to manually place all these xterms in the correct location, on the correct desktop.

Of course, I wasn’t happy with that either, so I changed the -geometry argument to xterm to note the screen location. With each xterm being 479×349 pixels, it was easy to calculate where I wanted the next terminal to go. I had had to put in several “sleep” statements in my script previously to allow time for the terminals to actually appear on the screen etc. and some of these had to stay, but now all that was required to do manually was wait for the desktop to fill up with xterms, and click the mouse wheel to move to the next virtual desktop 4 or 5 times. Easy! :)

Last week, a switch decided it was time to die, dropping connections a couple of times a day, which meant I had connectivity problems for a couple of days until I discovered that it was the switch that was the problem and not the new router as I had assumed. This meant that I had to do the mouse wheel click to new desktop procedure 4 or 5 times over the course of two days. Doing it once a month or so was an acceptable imposition, but now it was again a pain.

At first, I installed the python bindings for libwnck and attempted to script the xterm window placement, however, I failed to get anything working as quickly as I had expected (would have been easier if I had found wnck_example.py). Another quick google search led me to devilspie. This seemed perfect. Now, at the beginning of my commute script, I generate a devilspie config file:

# Initialize variables
_workspace=2
_col=0
_row=0
# Create new empty config file
:> /home/pogma/pies
# populate config file
for _SSH_HOST in ${_SSH_HOSTS}; do
 echo "(if (matches (window_name) \"${_SSH_HOST}\")\
 (begin (geometry \"479x329+$((480*_row))+$((350*_col))\")\
 (set_workspace ${_workspace})))" >>/home/pogma/pies
 _col=$((_col+1))
 if test ${_col} -gt 2; then
   _col=0
   _row=$((_row+1))
 fi
 if test ${_row} -gt 3; then
   _row=0;
   _workspace=$((_workspace+1))
 fi
done
devilspie /home/pogma/pies >/dev/null 2>&1 &
# We'll kill devilspie later
_pid=$!
...
[snip rest of file to start xterms, start/resume screen sessions etc]

The geometry is a little odd because the window height does not include the title bar. Now, I can start my dozens of xterms, ssh to all those hosts, start the screen sessions if necessary, place the xterms properly, all with one script.

So, I have this old iBook, it has been doing nothing for a couple of years, so I decided to do something with it. not having any machine in the house with a BSD on it, I thought I would install NetBSD on it.

The iBook is old. The CD drive doesn’t work, the airport card doesn’t work, but it does have a largish HD and 640MB RAM. Because of the broken CD drive, I figured that I’d net install whatever I was going to install on it. Yes, I know there are other options, I could have put an install image on a firewire disk, booted into target disk mode, and installed something that way, etc. I guess I really just wanted to try net installing something :)

Reading the NetBSD docs that I could find made me think that I would need a TFTP server, NFS server, and to mess with my DHCP settings. So I installed TFTP on my Fedora 13 system, and went to my OpenWRT router and looked at changing the config for dnsmasq.

So I added to my /etc/config/dhcp:

config boot linux
option filename 'ofwboot.xcf'
option serveraddress '10.0.0.11'
option servername 'tw'

(tw is the hostname of my Fedora system).

Getting the DHCP options was harder, the openwrt docs suggested ‘list dhcp_option ‘, but that didn’t work, nor did any of the other things I tried until, after reading the shell scripts in /etc/init.d, I added
option 'dhcp_option' '17,/export/client/root 42,10.0.0.4 66,tw 67,ofwboot.xcf 128,10.0.0.11'
This seemed to work, with each space separated option being added to the dnsmasq command line (I was happy for /proc/[pid]/cmdline here – it made checking very easy).

Booted the iBook to openfirmware and tried to get it to boot the NetBSD installer kernel like this:
boot enet:0,\ofwboot.xcf

But that did not work, although the ofwboot.xcf boot loader loaded from TFTP, the netbsd kernel did not load from either TFTP or NFS. Eventually, after much messing about, I discovered that:
boot enet:0,\ofwboot.xcf enet:0,\/netbsd
caused the ofwboot.xcf boot loader to load from TFTP and the netbsd kernel to load from NFS (server 10.0.0.11, path /export/client/root, as specified with DHCP).

WooHoo, so I ran the installer, said it should take the whole disk, etc. And installed everything.

It did not boot.

I was sad, and then went to read the INSTALL docs from the NetBSD macppc page. Indeed, it was quite clearly noted that with open firmware version 3.0 or later NetBSD would install an unbootable system if you just chose the installer defaults. The docs that I found on how to do it properly involved using your Mac OS system to partition the disk and so on prior to installing NetBSD. Of course, I had just overwritten the Mac OS system with a non bootable NetBSD. I was now mad. Mad enough to install Linux on what was supposed to be my BSD system.

I first went to install Fedora (because I am used to it), but discovered that Red Hat and powerpc are no longer friends, not that I can blame them for not supporting the architecture, but it meant I had to keep looking. The ubuntu netinstall kernel etc from http://ports.ubuntu.com/ubuntu-ports/dists/maverick/main/installer-powerpc/current/images/powerpc/netboot/ did not boot (yaboot loaded, the kernel loaded, but did not run). So I tried debian. It booted (with the boot loader, kernel and other files all loading from TFTP, no need for an NFS server, or another argument for the boot loader. All that was required was
boot enet:0,yaboot

The installer did not ask me to set up the network (unlike the NetBSD installer), it got all the settings from DHCP. It seemed strange that both Open Firmware and the Debian installer was capable of getting my network settings from DHCP, but the NetBSD installer was not able to do so.

The Debian installer allowed me to partition my disk, and the resulting install booted. All in all it took me less than an hour to install a working debian system, where it had taken me significantly longer to install a non booting NetBSD. Still I did not give up. When installing debian I added a 2GB HFS+ partition, and left a large amount of free space. And I went to install NetBSD again.

This time, while carefully reading the INSTALL document, I was able to netboot the installer, mount an NFS directory with a pdisk binary, format the partitions I wanted, and eventually install NetBSD and have it boot.

Of course, X11 did not work. Why would it? “Working” and “NetBSD installation” don’t seem to be terms that go together. Yes, I was getting madder. However, rebooting the system into debian, installing kde, and running it, showed that X11 wasn’t all that happy on Linux either. Ok, so maybe that wasn’t NetBSD’s fault :) . A little google and a little guessing, led me to the following changes to my NetBSD 5.0.2 xorg.conf:

To the “Monitor” section, I added:

HorizSync 25-51
VertRefresh 43-60

To the “Device” section, I added:

Option "UseFBDev" "False"

and to the “Screen” section, I removed everything but:

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
EndSubSection
EndSection

And viola, working NetBSD install with working X11. Finally, happy, I wondered what on earth I was going to use it for. I still don’t know, but I’m sure I will think of something. Like maybe letting it sit idle for another couple of years.

The other day I wanted to know when I had done something in my shell history, I asked on irc, and dre^ answered -> fc -d for zsh

Now I find myself looking at fc -l -d even when I don’t really need timestamps :-)

% fc -l -d
[snip]
  356  14:56  vim sem.c
  357  18:09  gmake
  358  18:10  vim buffer.c

It is possible to get similar behavior with bash:

$ HISTTIMEFORMAT="%T " history 3
 1386  09:36:54 grep -rl afio .
 1387  09:37:55 vim ChangeLog
 1388  12:56:57 HISTTIMEFORMAT="%T " history 3

Where HISTTIMEFORMAT uses an strftime string.

Yet another useless bit of knowledge!

For nearly 9 years this site has been hosted at pair.com, and I have had no problems there. Any time I have contacted pair support, I have had excellent response, they host everything on FreeBSD, and have, in the past, made monetary contributions to the FreeBSD project. They seem to be very professional, and uptime has been fantastic.

I have become more and more unhappy with their pricing though. I have been using pairs Advanced account, which provides 1.5GB of disk space and 80GB/month bandwidth, and paying $20/month for it. A few years ago pair introduced a pairlite service which would have suited my needs better, but I had already been a customer for years, and moving was harder than doing nothing, so I did nothing :)

I kept an eye on webhost pricing though, and finally my stinginess exceeded my laziness, and I decided to move. I looked at dreamhost, tried a trial, liked it, but wanted more control, so I began to look for a VPS. Eventually I stumbled on Prgmr.com. I don’t care if uptime is a little lower than it has been, it’s only a blog, a collection of random crap, and email. Prgmr is cheap, dirt cheap. For my same $20, I get a VPS with 22GB of disk space, 1024MB of memory, and 160GB/month bandwidth. Of course, it is no longer managed hosting, it is entirely DIY hosting. And that’s just fine :)

Not everything is moved to prgmr yet, web site is moved, so is DNS, email not yet. Will move that in a few days, and then finally cancel my account with pair.

I released libtool 2.2.6b today. Yes, I have already taken flak for the stupid version numbering. I apologize.

The release has only 2 real patches from 2.2.6, both for libltdl. See the announcement for slightly more detail.

Some users may be stuck using an older libltdl for whatever reason, for those users the same changes are provided by this untested patch.

[Update 2009-11-21]
The change to libltdl to not search in the current working directory for modules when lt_dlopen() is called without an absolute path breaks at least mpg123. This patch should work around the problem until the mpg123 folks fix it.

[Update 2009-12-02]
This release was to fix the now published CVE-2009-3736. If you have not already updated, doing so soon is advisable.

« Older entries