chkconfig, mysql

A crash today brought home a couple of things that I should have known before but didn’t, and now I do. I’m writing them here so I don’t forget, but also because google results were annoyingly useless without digging.

#1: chkconfig. That funny line in the init script that says something like “# chkconfig: 23456 88 22”. It’s easy to find out that the first batch of numbers is runlevels, but less easy to find out the meaning of the second set. They’re priorities; the higher the first number, the later in the boot process it starts. The higher the second number, the later in the shutdown process it’s killed. Also, if you change those numbers – this is obvious in retrospect, but I forgot – you need to re-run “chkconfig on servicename”.

This is apparently all defined in the LSB. Back in my day, there was no that thur LSB, never mind chkconfig. You just put scripts in /etc/rc.d and crossed your fingers.

#2: misamchk. This worked fairly well on my 72GB RAM server with a ~25GB database:

myisamchk --fast --update-state --force --sort_buffer_size=1G \
--key_buffer_size=2G --read_buffer_size=512M --write_buffer_size=512M \

The myisamchk manpage talks about “a lot of memory” being 512M so obviously it could use a bit of modernizing. That, or it really is MyFirstDatabase.

And this kind of stuff reminds me that while I need to keep my hand in, I’m just as happy to no longer be a sysadmin for a primary job duty.

(Edited Aug 2012 – neither should typing be, chkconfig on, not chkconfig start.)

Using Stow on a Mac

For various reasons, I build some utilities outside of things like MacPorts and Brew, mostly interpreters where I want to ensure that my environment is my environment. I need all of Python, Ruby, and Perl, and sometimes different versions of Ruby as well.

Normally I build with –prefix=$HOME/app/name-maj.min then link app to whatever version I want to be the default. In $HOME/bin I make links to $HOME/pkg/app/bin and mostly everything just works. Except then I started running into problems with man pages, and setting this environment up can be a pain in my login shells. So I went looking for something that automated this. There’s just no other sensible way to do this on a Unix system.

By the way, at (the University of) Waterloo we have a(n) (in)famously obtuse packaging / configuration management system called xhier. Any time I think about this, I wish I had the GOOD parts of said system available. It has lots of nifty toys to automate building, configuration, and managing links, as well as a utility called showpath that helps you to manage both your PATH and MANPATH variables. And I’ve often declared that anybody who thinks about automating, including things like Stow, is at risk of re-inventing xhier.

Stow is a bit of an annoyance in that it, itself, requires Perl. The entire reason I like having my own separate Perl instance, in particular, is because of a long history of CPAN screwing me over. So I put my own version aside, run CPAN, and no operating system update blows my stuff away, and no CPAN will touch my OS stuff. I tried the MacPorts version of Stow and just couldn’t make it cooperate in integrating into my above flow – it would make links just fine in $HOME/stow, but it wouldn’t remove apps.

What finally worked was using my own $HOME/pkg/perl CPAN utility to install Stow. Then I was able to:

cd ~/pkg
stow -t ~/stow ruby-1.9.3
stow -D -t ~/stow ruby-1.9.3

and everything seems to work as expected. The above did not, with the MacPorts version, but it’s still at 1.3 and perhaps there’s issues with the older version, I don’t know. I don’t really like Perl very much any more, so I’m not inclined to delve into the whats wherefores and whys. I thought about looking at how the MacPorts version differed (in configuration) from mine, but then I cracked another beer, drank it and a few more, then laid down for a while and the feeling passed.

(Edited to account for Giles’ grammar correction and general persnickitiness. Thanks, Giles!)

Dealing with MacOS extended file attributes

A year or so ago, I ran into a mysterious issue whereby I couldn’t add new machines to my .ssh/known_hosts file. A few days ago, after restoring from Time Machine “the wrong way” (copying some directories directly out of the filesystem on the Time Machine backup) I ran into them again.

Symptoms: I couldn’t add new host keys to my known hosts file, nor could I remove old ones.

Directory listing:

-rw-r--r--@ 1 me  staff  16588 10 Mar 20:59 .ssh/known_hosts

The trailing @ means the file has extended attributes. After some work with a search engine, I found out I wanted to use the xattr command, or perhaps “ls -lO@”. Either way, the attributes preventing me from modifying the files were:

Running the appropriate incantation of xattr -d on the affected files (it wasn’t just my known_hosts file) worked a treat.

Mein Name ist

My name is Mike Patterson. That’s almost what it says on my birth certificate; it actually says Michael. It also says Michael on my university ID card. There’s some other very similar variants on pieces of government ID, some include my middle initial or full name. Few people use Michael and fewer still even have reason to know my middle name. I’ve no real reason to use any other name, save for convenience – both my own, and for other people. Mike, as you might know, is a pretty common name, particularly amongst North American males, and doubly so amongst those of my generation.

Depending on context, I have a lot of other names to which I might respond. Depending on the context, I might also not respond, as they tend to be, well, contextual.

At work I’m usually just Mike, but I might be mpatters. That used to be my email address and it will still work, but I now tend to publish mike.patterson. I also use that for email addresses elsewhere, sometimes; my alumni forwarding account, for instance. Since my name is published in our directory as Michael though, some people do call me that, and I don’t bother correcting them. I might not immediately respond though.

On Twitter, I’m snowcrashmike, but nobody uses that anywhere else. Some very old IRC hands might know me as kraig, and I used that on MUDs. I also go by kraig on LiveJournal and Dreamwidth, and some people who met me first through those communities tend to use it as my name, even in voice conversations. In some web communities and games (Forumwarz, for example) I’m generally kraig or kraigu, but sometimes kraigus.

In the very long ago, I used to use BlackSpy as a BBS handle, but that was too overloaded when I switched to IRC. Nowadays on IRC networks I tend to use kraigu. My Steam name varies, I usually set it to earless wondercat, but I often play with it: earless wunderkatze, earless dyingcat (I do a lot of dying in online games), fearless wondercat, feared blundercat, beerless wondercat… well, you get the idea. But usually people call me just earless or wondercat in in-game voice chat, it makes things easier.

Sometimes, in certain circles, I might be just [. I don’t even remember what my FIDONet handle was.

I’m old enough that things like IRC were fairly new when I was coming of age, and young enough that identity is really a fairly slippery thing. I’m old enough to still value some privacy and think that for some people it matters quite a lot, young enough to realise that not using your real name doesn’t mean you can’t be found. I’m experienced enough to know that a middle ground is very difficult to find, wordly enough to know that different cultures approach “true names” in vastly different ways, and finally, practical enough to not really care what name it is that people actually prefer – I try to find out what it is, and use that.

I think realnameonly policies are unnecessarily invasive, don’t do what proponents claim they do, and insensitive. In short, I think they’re misguided at best, generally no better than security theatre, and at worst, just flat-out stupid. Nobody else has the right to tell me who I am, nor do they have the right to tell anybody else who they should be.

packetfu followup

I went back to packetfu today (see here for my first talk about it) for a large collection of pcaps I have (about 30GB worth) hoping to use it to help me quickly get an overview of what I’ve seen.

Fortunately, a lot of the hoops I had to jump through previously are now non-issues; using gem to install pcaprub and packetfu itself made it dead simple. Even more fortunately, I didn’t bother trying it on my Mac initially, guessing – correctly, as it turns out – that RAM usage would go through the roof. I ^C’ed my test ruby script, pasted from my first post on the subject, after it hit 7.5GB resident on my 8GB test machine. I have Ruby 1.9.1 on that box, so I don’t think there’s much more I can do to optimise. Sadly, I guess I’m stuck with tcpdump and looping shell scripts for the time being, and I’ll try to follow up with the author, although I don’t know what help I can provide.