Monday, December 3, 2012

Oh dear


I cannot imagine that the below is a good sign, when combined with a clunking sound coming from my hard drive, and long, long (seemingly random) delays:

[  113.164567] ata3.01: configured for UDMA/100
[  113.164584] sd 2:0:1:0: [sda] Unhandled sense code
[  113.164589] sd 2:0:1:0: [sda]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  113.164598] sd 2:0:1:0: [sda]  Sense Key : Medium Error [current] [descriptor]
[  113.164607] Descriptor sense data with sense descriptors (in hex):
[  113.164611]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 
[  113.164631]         00 5e 30 e8 
[  113.164639] sd 2:0:1:0: [sda]  Add. Sense: Unrecovered read error - auto reallocate failed
[  113.164649] sd 2:0:1:0: [sda] CDB: Read(10): 28 00 00 5e 30 e8 00 00 08 00
[  113.164668] end_request: I/O error, dev sda, sector 6172904
[  113.164692] ata3: EH complete

#sixyearoldlaptop #inappropriatehashtags

Saturday, October 13, 2012

Burning CD images from the command line

Example:

$ sudo wodim -v -dao speed=4 dev=/dev/sg0 ubuntu-12.04-desktop-amd64+mac.iso

Monday, August 20, 2012

"Replacing" DynDNS with Amazon Route 53

DynDNS used to have a free tier, which allowed a machine behind a dynamic IP to periodically update a DNS record with its current IP. (Some home routers bundled the functionality in, too.) DynDNS' free tier appears to have gone away.

If your home router is a regular linux box, though, you can easily use Amazon Route 53 to achieve the same thing. Route 53 isn't free, but for unpopular domains most of the cost is in the fixed per-zone cost (and subdomains are free anyway).

So, you can dedicate a subdomain of one of your existing domains for the purpose of keeping track of your home machine, essentially free.

I wrote a little script to do this: https://github.com/mjkelly/experiments/blob/master/dns/route53-update.py. It's still pretty rough, but it appears to work.

It is mostly self-contained, but requires libxml2 bindings for python. It takes all arguments on the command line. It could conceivably get the information other ways.

[Update, 2013-01-26: It no longer requires libxml2. I've also added a wrapper script to retrieve the machine's public IP address, if --ip=auto doesn't work (if the machine is behind NAT, for instance). It uses DynDNS's little IP-reporter server, ironically...]

(I could have used boto to do this much more concisely, but I was interested in doing the authentication bits myself. My official justification is that I was trying to keep dependencies minimal.)

Note: If you're running pfsense on your home router, you can use it (as of 2.1-RELEASE) to set your DNS name in Route53 as well. (It is not listed on doc.pfsense.org/index.php/Dynamic_DNS, but it is an option.)

Tuesday, June 26, 2012

Perl is a Disease

The quoted phrase "perl is a disease" currently has only one (1!) hit on Google.

While I don't feel particularly strongly about the Perl issue one way or another, I think the lack of hits needs to be remedied.

Wednesday, May 9, 2012

Ubuntu 12.04 on MacBook Install Notes

This is a follow-up to http://blog.michaelkelly.org/2010/05/ubuntu-1004-upgrade-notes.html.

These are my notes from a clean install of Ubuntu 12.04 on a MacBook 2,1, in which I set it up to use Awesome WM. (I don't use the default Unity interface and associated daemons.)

Like last time, to get your Macbook version:

sudo dmidecode -s system-product-name
(It's "MacBook2,1" for me.)

Installation
If you're installing from a physical CD (and possibly otherwise), you need to use the "+mac" disk image from http://cdimage.ubuntu.com/releases/11.04/release/. The default amd64 image will not boot. (Otherwise you will get an unresponsive black screen with the text, "Select CD-ROM Boot Type : ".)

Window Manager
Ubuntu 12.04 uses lightdm, which thankfully still uses the .desktop files in /usr/share/xsessions/ to select which window manager to start. I created /usr/share/xsessions/xsession.desktop, with the following contents:

[Desktop Entry]
Encoding=UTF-8
Name=Xsession
Comment=Run ~/.xsession
Exec=/etc/X11/Xsession

I dropped in my existing rc.lua for Awesome.

Networking
gnome-network-manager and nm-applet work out of the box, and are fine in isolation. I use them.

Touchpad
I set up the touchpad to turn off "tapping" (clicking without pressing the trackpad button), enable two-finger vertical scrolling, and 3-finger middle-click with the following line in my .xsession:

synclient MaxTapTime=0 PalmDetect=1 \
    PalmMinWidth=85 PalmMinZ=17298 \
    VertEdgeScroll=0 ClickFinger3=2

Power Management
This was the trickiest part. In 10.04, I used gnome-power-manager to handle: (1) suspending when I closed the lid, (2) listening to the brightness up/down keys, (3) dimming the screen when I was on battery power, and (4) providing a nice systray applet to see battery level and whether I was on AC power. gnome-power-manager doesn't exist anymore in 12.04. There doesn't appear to be a drop-in replacement that isn't attached to large desktop manager or another. So:

For (1), I read a very helpful Arch Linux wiki page, https://wiki.archlinux.org/index.php/Acpid, and added a line to /etc/acpi/lid.sh. Right above the line that turns off the screen:

       . /usr/share/acpi-support/screenblank

I added:

     pm-suspend

Simple! (Once I knew where to go looking...)

Note: I've noticed a problem where, upon resuming after a suspend, xscreensaver sometimes will lock immediately after I have unlocked it. Sometimes I notice a message about throttling appear before I have unlocked the screen. I am operating under the assumption that there's something else that's locking the screen as well -- if I see the message about throttling while typing my password, the screen is already locked and trying to lock it again is harmless; otherwise, the screen will probably try to lock again in a couple seconds.

I am trying reversing the order of the "screenblank" and "pm-suspend" lines in lid.sh -- I originally (wrongly) had "pm-suspend" after "screenblank". As always, these are notes to myself and unlikely to help anyone else. -- Putting pm-suspend above the [...]/screenblank line makes it consistently work fine; I've updated the description.


For (2), I added lines to my Awesome config (rc.lua) to bind them to "xbacklight + 20"/"xbacklight - 20".

For (3) I just sucked it up and went without. I could also have added lines to /etc/acpi/power.sh, I believe.

For (4) I'm going to write a widget in rc.lua.

Customization
This wasn't necessary, but I thought it was nice:

echo "allow-guest=false" >>  /etc/lightdm/lightdm.conf


Friday, February 24, 2012

Migrating Off Google Reader, continued

It's been obvious, since Google Plus was released, that Reader can't possibly be long for this world, and everyone has to simply jump ship. (I'm saying this based solely on outside observation.)

Luckily for me, I didn't use most of the social features of Reader. It served basically as an online list of links I thought were cool, and an RSS reader.

For an online list of links, the obvious choice is del.icio.us. It's been working very well for me. The little bit of sociality I did use in Reader, following other people, has ported over nicely to del.icio.us as well.

For an online RSS reader, it's less obvious. Most of the options seem to have been decommissioned, have turned into awful "enterprise"-focused products, or simply don't work. After some searching, I found netvibes.com, which actually isn't a competitor to goodvibes.com.

I'll see how it goes. Luckily, it looks like Google Reader was completely replaceable.

[Edit, 2013-03-14: It's not paranoia if they really are out to get you.]

Tuesday, January 17, 2012

PIPA and SOPA

If you run a little backwater website (like a friend and I do) that still gets some viewers, take a moment and put up a banner noting your opposition to SOPA and PIPA. The superficial victories we've seen recently aren't permanent.

Reddit and Wikipedia are going dark on Jan 18th in protest. I think shutting off entirely is a move better suited to sites with clout, but it sure can't hurt for any site to put up a notice. It's better than just standing on the sidelines and cheering on Wikipedia and Reddit.

No one will see this post, because I fucked up my DNS entries when I changed DNS providers. But I know it's here.