Wednesday, June 30, 2010

Sendmail and broken DNS

An ISP I use recently switched DNS servers and this, it turns out, broke sendmail.  Running
echo 'check_mail cfsc-bounces@computingfrontiers.org' | sdmail -d8.20 -bt
gave
dns_getcanonname(computingfrontiers.org, trymx=1)
dns_getcanonname: trying computingfrontiers.org. (AAAA)
        NO: errno=0, h_errno=1
dns_getcanonname: trying computingfrontiers.org.mscd.edu (AAAA)
        NO: errno=0, h_errno=1
which is not good.  Adding
O ResolverOptions=WorkAroundBrokenAAAA
to sendmail.cf fixed things
dns_getcanonname(computingfrontiers.org, trymx=1)
dns_getcanonname: trying computingfrontiers.org. (AAAA)
        NO: errno=0, h_errno=4
dns_getcanonname: trying computingfrontiers.org. (A)
        YES
The sendmail change notes say
New ResolverOptions setting: WorkAroundBrokenAAAA.  When
attempting to canonify a hostname, some broken nameservers
will return SERVFAIL (a temporary failure) on T_AAAA (IPv6)
lookups.  If you want to excuse this behavior, use this new 
flag.  Suggested by Chris Foote of SE Network Access and 
Mark Roth of the University of Illinois at
Urbana-Champaign.
which means someone will have to fix the DNS server...

Macbook noisy USB

I have a nice little Total Bithead from Headroom (http://www.headphone.com/), whom by and large know what they're talking about.  The Total Bithead works great on computers other than my Macbook where there is a constant hiss (not a ground loop hum).  I hear this is a fairly well known issue with Mac laptops.  Sigh...

Monday, June 21, 2010

OS X, X11, and modifier keys

I had the strangest thing happen recently: when I fired up X11 in OS X (including wireshark, nomachine, etc.) and none of the modifier keys (control, and even shift!) would work.  I poked around and found that System Preferences, Language & Text, Input Sources, had a direct effect.  I had recently turned on Unicode Hex Input -- if one fires X11 up with this as the input source, the modifier keys won't work.  Choosing "US" solved the problem...  Hope this helps someone from beating their head against the monitor.

Monday, May 24, 2010

Strange Linux error message on static and DHCP

I was modifying a /etc/networking/interfaces file to alias one NIC to have both a static and a DHCP address. I received a strange message:
SIOCSIFFLAGS: Cannot assign requested address
Surfing didn't find the exact answer, but lead to finding it. One must always have the DHCP address first and attached to the non-aliased interface. Ergo, this works:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
and this does not:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth0:0
iface eth0:0 inet dhcp 
And because I didn't want the DHCP interface to the the default, I added the following to that interface:
up route del -net 0.0.0.0 dev eth0

Sunday, April 25, 2010

Character at a time in bash

I was goofing around with fixing html generate from W4W. I could have use perl or a hundred other things, but I wanted see if I could do in bash, for no particular reason. Here it is.
#! /bin/bash

# this script converts an html file so that all markup ('<'...'>')
# occurs on a line by itself with no embedded newlines.  all other
# characters are simply echoed.  all this requires forcing bash
# to read one character at a time.

in=false
IFS=

while true
do
    if read -n 1 c
    then
        # if newline, and we're inside of '<'...'>', just
        # echo a space.  otherwise echo a newline
        if [[ $c == '' ]]       
        then
            if $in
            then
                # if we're in '<...>', echo just a space
                echo -n ' '     
            else
                echo
            fi
        else
            # if '<', note it, echo a newline and '<'
            # else if '>', make it, and echo '>'
            # else echo character
            if [[ $c == '<' ]]
            then
                in=true
                echo
                echo -n "$c"
            elif [[ $c == '>' ]]
            then
                in=false
                echo "$c"
            else
                echo -n "$c"
            fi
        fi
    else
        break
    fi
done

Wednesday, February 10, 2010

Ubuntu raw lp printing

For some reason, it appears the default font size for a simple lp command is ~5 CPI and LPI. In order to make it reasonable (80x66), I had to set the CPI to 16.5 and the LPI to 6.5:

Friday, January 8, 2010

Removing previous ubuntu kernels

dpkg --list | grep '^ii.*linux-image'
sudo dpkg --remove linux-image-2.6.31-15-generic