Archive for the 'Linux' Category

Pope and Bacon a dangerous combo

Saturday, October 27th, 2007

After meeting Ubuntu zealots Alan Pope and Jono Bacon at Fosscamp this morning, I made the mistake of leaving my laptop screen unlocked within the range of these two dangerous characters while I went to the bathroom. What’s worse, I left a terminal window with a root prompt open on the desktop. (I don’t remember why– I think I was installing some software earlier.) When I got back, this so-called “Pope” had blown up the font size on my terminal window and added “rm -rf /” at the root prompt.

It was good for a laugh. Unfortunately, I didn’t have the poise to take a screenshot.

Later, it was revealed that the Bacon, not Pope, was the instigator, or so says Pope.

Note for the non-haX0rs in the audience (I guess that’s you, mom): “rm -rf /” is a command that recursively deletes all files in your filesystem. Incidentally, I did once execute that command on an OS X server that I was maintaining a few years ago. I needed to reinstall OS X for some reason, so I tried executing the legendary command. It was pretty sweet– various programs on the desktop crashed, services disappeared, and the machine was eventually rendered unbootable.

Anyway, I won’t make the mistake of leaving my laptop unprotected when Bacon is on this side of the Atlantic.

One other interesting note from Fosscamp– I talked to Ubuntu Linux founder Mark Shuttleworth for a few minutes after one of the morning sessions; he mentioned that the Dell Linux machines that I was so excited about a few months ago were actually Dell’s idea. I had assumed that the whole Dell Ideastorm business was more of a marketing exercise, while Dell and Canonical had actually been planning Dell PCs with Linux for a while. I guess I was wrong.

Python on the Gumstix Verdex

Sunday, July 22nd, 2007

Being both a Python zealot and an embedded systems zealot, I’ve been looking for an embedded system that I can program in Python. Most of the embedded code I write professionally I write in C. Having learned Python a few years ago, I’m finding C increasingly painful, approximately in proportion to my facility with Python.

Thus far, it seems that the Gumstix Verdex may be the answer I’ve been seeking. The Verdex is an embedded Linux board, about 1 inch by 3 inches, based around Marvell’s (previously, Intel’s) XScale PXA270, common in PDAs and cellphones. It uses around 1 W of power in its quiescent state (not suspended, but not at full processor load either).

I was able to compile a new binary image including the Linux kernel, various utilities, and Python 2.4.2 and upload it to the Verdex using the Gumstix’s console-vx serial interface board. (I seem to have hosed the ethernet interface at the same time, but I’ll worry about that later.)

The ultimate goal (well, for now) was to test on an embedded processor Pysolar, the Python sun-tracking code I’ve been writing. The Verdex I have, the XL6P, runs at 600 MHz. The Pysolar test suite executed in around 1.2 seconds. On my desktop Linux machine, the same test suite executes in 0.012 s. The fact that the times vary by a factor of precisely 100 makes me a little suspicious, but it doesn’t seem impossible that a desktop could beat an embedded computer by 100x.

Finally booting pre-installed Linux on an OEM PC

Sunday, June 3rd, 2007

The Dell XPS 410n that I ordered on May 24th arrived this Saturday. After 10 years of using Linux, I was finally able to order a prebuilt computer from a major OEM without paying anyone for an operating system that I would delete shortly after unboxing. Instead of devoting half of Saturday afternoon to installing Linux, I had a working Linux system 19 minutes after opening the box. I think I probably spent more time picking a desktop background from Flickr than configuring the machine.

Finally booting pre-installed Linux on an OEM PC

I didn’t spend any time installing the DVD drive into the case or washing thermal grease off my hands. I opened the case briefly to take a picture, but I don’t even know how many PCI slots I have. I can feel the freedom of blissful ignorance returning.

I half-expected Dell to screw up Ubuntu somehow– add idiotic icons to the desktop (offers to connect me to the internets, shortcuts to crippled versions of photo editing software, or similar). I’m happy to report that they seem to have gotten it right. The Ubuntu they delivered is difficult for me to distinguish from the Ubuntu I’ve been installing for the past few years. Synaptic is set up to use the ubuntu.com repositories. Compiz is disabled by default. The boot process seems faster, but that may be the new hardware. The 2.6.20-15 kernel was installed; Synaptic installed 2.6.20-16 during the first update.

Ubuntu wasn’t perfect– it did fail to identify my HP f2105 monitor’s maximum resolution of 1680 x 1050, and there was no way that a normal human would have been able to fix it. (I executed sudo dpkg-reconfigure -phigh xserver-xorg and selected the correct resolution to fix it.) Also, the option to enable the restricted Nvidia driver doesn’t work, but I haven’t gone beyond the normal-human level of effort yet.

(Update: after running a Synaptic update, I could enable the restricted Nvidia driver and turn on Compiz– no geek-level intervention necessary.)

Overall, I’m delighted with what Dell and the wealthy gentleman from Canonical have done. For me, 2007 is the year of the Linux on the desktop. I offer my sincere congratulations and thanks to the Ubuntu folks at Canonical and Dell.

Fixing X11 no more

Wednesday, May 30th, 2007

Last week, after building my own computers to run Linux for about 10 years, I ordered a computer from Dell with Ubuntu Linux pre-installed. Don’t get me wrong– I have enjoyed at least 80% of the hacking, crashing X11 repeatedly, trying to disable X11, giving up and using the terminal window at 640 x 480, crashing X11 repeatedly, and so on. In the last 2 or 3 years, Linux has become solid enough that I rarely need to perform tasks akin to surgery. With tested hardware from Dell, instead of hardware randomly selected from different (non-Belkin) vendors, I’m betting that I may not need to edit xorg.conf at all!

As I prepare to enter the realm of normal people, the realm of adults who buy computers to get work done, who don’t know about lolcats or frist psot, HTTP redirection or ARP cache poisoning, SSH or even RSS, it’s time for me to pass on what I sincerely hope will become useless tips.

When your GUI goes crazy, the screen starts cycling on and off, or just searching for inputs eternally:

1. Use Ctrl-Alt-Backspace to stop the X server and drop to a command prompt. Then you can try looking at /etc/X11/xorg.conf to see what’s wrong and restart X using the command startx.

2. Enable sshd as soon as you can, so that something goes horribly wrong, you can still ssh into the machine and execute commands.

3. Use Ctrl-Alt-F2 (or higher F-keys) to cycle to additional terminal windows if, as was generally the case, X is screwed up.

Those three tricks have kept me going for tens, or maybe even hundreds, of hours of debugging.

So, maybe I’ll need these skills again when the hard times come and production of new computers grinds to a halt, but until then, I’m turning my attention to higher level tasks, like implementing a sun-tracking algorithm in Python.

Exavault rsync script

Monday, May 28th, 2007

The company I work for recently started using a service called Exavault to back up our data. We have a server running Linux that logs into our NAS using ssh every night and rsyncs the data with a local directory. It also dumps our mediawiki database (well, used to– we’re using Socialtext now) and subversion repository.

All of this data gets synchronized with Exavault’s machines in Dublin, California.

This has been running with no known problems for about six months. Below are the bash scripts I wrote to do the synchronization.

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing chemp to Exavault, starting $(date +%FT%T)" >> $LOGFILE
echo "Dumping wiki database" >> $LOGFILE
mv /home/brandon/wiki_backup/wiki_dump /home/brandon/wiki_backup/wiki_dump.old
mysqldump --user=root --password=****** greenmountain > /home/brandon/wiki_backup/wiki_dump
rm /home/brandon/wiki_backup/wiki_dump.old
echo "Dumped wiki database" >> $LOGFILE
echo "Dumping Subversion repository" >> $LOGFILE
mv /home/brandon/svn_backup/svn_dump /home/brandon/svn_backup/svn_dump.old
svnadmin dump /home/brandon/svn/NCL2 > /home/brandon/svn_backup/svn_dump
rm -r /home/brandon/svn_backup/svn_dump.old
echo "Dumped Subversion repository" >> $LOGFILE
echo "Backing up files from Q, SVN, and wiki" >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/Q_backup/ greenmountain@greenmountain.exavault.com:backup-test/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/svn_backup/ greenmountain@greenmountain.exavault.com:backup-svn/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /home/brandon/wiki_backup/ greenmountain@greenmountain.exavault.com:backup-wikidb/ >> $LOGFILE
rsync -av --exclude-from=no_backup.txt --progress /var/www/wiki/ greenmountain@greenmountain.exavault.com:backup-wiki/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "----------------***-------------------" >> $LOGFILE

The other script:

#!/bin/bash
LOGFILE=/var/log/GME_backup/GME_backups.log
echo "Syncing Q to Chemp, starting $(date +%FT%T)" >> $LOGFILE
rsync -a --exclude-from=no_backup.txt --progress root@192.168.2.4:/raid/WeatherPhenom/  /home/brandon/Q_backup/ >> $LOGFILE
echo "Finished at $(date +%FT%T)" >> $LOGFILE
echo "---------------------------------" >> $LOGFILE

Tormented by Mike Goelzer

Sunday, February 5th, 2006

A recent exchange with Mike that he has posted on my blog against my will:

From: Mike Goelzer
To: Brandon Stafford
Date: Jan 31, 2006 11:27 PM
Subject: State of the Union

What do you make of the fact that tonight’s State of the Union speech did not address the recent controversy over GPL v3? This is an issue that has divided the open source community, with Linus and Stallman practically at each other’s throats, and the president did not even mention it! Instead, he talked about issues like health care, which are only of interest to a small number of sick people who are probably still using the 0.11 kernel anyway.

This just goes to show how out of touch our politicians are with mainstream America. It’s outrageous and it disgusts me.

Mike W. Goelzer

P.S. This message is protected under the “GPL v2 or later.” In other words, if you have read this far, you need to send me all of your private signing keys. Please send me your blog password as well.

From: Brandon Stafford
To: Mike Goelzer
Date: Feb 1, 2006 7:10 AM
Subject: Re: State of the Union

For the love of Gahweb (GHWB), will you please stop over-simplifying the situation. You know damn well that Linus and Stallman are not at each other’s throats!

The reality is that Linus was at Stallman’s throat, Stallman was after Eben Moglen, and it was Moglen who was at the throat of Mr. Torvalds. Ooh, and there is Simon Phipps! Phipps drops the hammer on Moglen while the diminutive Red Sea pedestrian is laying into Helsinki’s finest. Out in the hallway, it’s Bob Sutor with Chris diBona in a headlock! Wait, is that Chris diBona? No, it’s Darl McBride wearing a Chris diBona mask! This could get ugly! Oh no, it’s William Leibzon mixing it up with Vixie! What are they doing here? The NANOG conference isn’t until April! Leibzon’s got a gun! Noooooooooo!!!! Vixie is dead.

Alright, I have to go eat breakfast. Damn you.

Brndn McBride

From: Mike Goelzer
To: Brandon Stafford
Date: Feb 1, 2006 11:32 PM
Subject: Re: State of the Union

How can you mention Darl McBride in the same digital breath as those other open source luminaries? McBride is like their antithesis; he is a black hole that absorbs the light emitted by the luminaries, thus paradoxically rendering them invisible. Have you ever wondered why it’s so hard to see Richard Stallman clearly, even in broad daylight? It’s because all he emits is Hawking radiation accounting for less than 1 x 10^-100 of his total luminosity.

(Notice how I put one over Googol there. Suckers!)

Seriously, though, remind me never again to challenge you on your own turf — “your stuff,” as some call it. I thought I was such an open source sophisticate because I knew that Linus had raised some objections to v3, but then you go and write back with a message listing a bunch of open source guys so fancy-pants that I’ve never even heard of them. I mean, Vixie, ok, fine, everyone knows that his name is on the crontab man page, but as for the rest of them… well, I guess I should stick to exchange-traded funds.

Mike

From: Brandon Stafford
To: Mike Goelzer
Date: Feb 2, 2006 7:58 AM
Subject: Re: State of the Union

OK, fine, have it your way, dude, but here’s my point. McBride was wearing a Chris diBona mask, suggesting that he was using subterfuge to infiltrate an open source cultists’ event. You know of subterfuge, no? Misdirection? Michael Milken? Hello?

I didn’t get your googol joke the first time I read it, as I had been set to evaluate all expressions, and my registers roll at 10^-64. Fortunately, it was flagged, and I got an SMS to my cello phane warning me of the error. Then I reread the joke, parsing it with evaluation turned off. Gahweb, that was a hilarious joke. I laughed all over the place. I Laughed Out Loud. Then I Read The Fucking Manual. Did I mention that I Am Not A Lawyer?

Brndn

From: Mike Goelzer
To: Brandon Stafford
Date: Feb 4, 2006 12:09 AM
Subject: Re: State of the Union

Oh, Mike Milken! Now I get it. You should have just used metaphors I can understand the first time around.

Also, nice one with the registers. I think this whole Googol joke thing is shaping up to be one of the funniest exchanges we’ve ever had. I may publish it; can you send me the admin password for your blog so I can get all the proper legal paperwork squared away to secure the copyrights? Thanks.

Mike

Gnubuntu

Sunday, November 27th, 2005

Mark Shuttleworth mentioned a few days ago on the Ubuntu mailing list that the Ubuntu folks were interested in developing a version of Ubuntu that contains only software deemed by the Free Software Foundation to be “free.” Shuttleworth mentions that they might collaborate with Ututo, an Argentinian Linux distribution that includes only free software (English description of project).

I was curious about how much non-free software was included in Ubuntu, so I installed the virtual Richard M. Stallman, or vrms (which sounds like a joke, but is not):

sudo apt-get install vrms

vrms took the liberty of not only installing, but also adding itself as a monthly cron job– reminds me of the real RMS: irritating but right.

It turns out that my Ubuntu server is pure– free software only– but my desktop machine has the Sun JDK, Opera, RAR, and XMame. The first three I don’t actually use, but with regards to XMame, I will confess that I like Zaxxon. In my defense, by the time I was old enough to have quarters, Zaxxon had been replaced by NBA Jams, or some other irritating business.

I suspect that vrms is not as particular as the real RMS, as I have installed the w32 codecs and the gstreamer mp3 decoder on my desktop machine. I *thought* those are both non-free. Maybe the iPodLinux people will get ogg working on generation 4 ipods soon. It’s believed to be possible, as the gen 4 has the faster PortalPlayer 5020 processor.

And the wireless is working . . .

Saturday, June 4th, 2005

After bungling around with wireless drivers, the wireless-tools package,
and Google for a few weeks, I had an interesting thought. I knew that a
guy named Carl in California had gotten his wireless working pretty
easily using Slackware, which I had tried earlier with the same error
symptoms as with Ubuntu. In all cases, it sounded like everything was
working correctly, but that my wireless card’s radio was turned off. At
one point, someone suggested that the screen brightness switch, labeled
“Mobile - Normal,” might also control the wireless card.

I thought, “Maybe there is *another* switch that controls the wireless
card.” I looked along the top row of function buttons. Hmm, what’s that
little antenna graphic? I pressed F1, and since then the wireless
has worked beautifully. I can even click the wireless on and off, and it
functions seamlessly– no difficulties bringing the connection back up.

Installing Mediawiki-1.4.4 on Ubuntu Warty

Monday, May 16th, 2005

I installed Mediawiki, the software that runs Wikipedia, on an Ubuntu
Warty machine yesterday. I issued an sudo -s command at the start so
that I didn’t have to type sudo repeatedly.

To get access to all the different package repositories, I uncommented
the warty universe lines in /etc/apt/sources.list and added one line so
that I had:

deb http://archive.ubuntu.com/ubuntu/ warty main restricted
deb http://archive.ubuntu.com/ubuntu/ warty universe
deb-src http://archive.ubuntu.com/ubuntu/ warty universe
deb ftp://ftp.debian.org/debian sarge main contrib non-free #

Then I installed a load of software:

apt-get install apache2-mpm-prefork apache2-prefork-dev
libapache2-mod-php4 php4-dev php4-mysql php4-pear

Untar Mediawiki in the default Apache directory:

cd /var/www
tar xzvf mediawiki-1.4.4.tar.gz

Ubuntu has a mechanism for Apache configuration that I don’t
understand. I used the commands below as a quick hack to relocate
Mediawiki so that Apache will find it:

mv apache2-default/ apache2-default_orig/
mv mediawiki-1.4.4/ apache2-default

Set the MySQL root password:

mysqladmin -u root password 'password'

I realized that I don’t really know how to use mysqladmin, so after
a few weak attempts, I figured PHPMyAdmin was a better solution.

apt-get install phpmyadmin

I used PHPMyAdmin, which showed up at http:///phpmyadmin. At that
address, I was able to log in as “root” with my MySQL root
password, set above.

Then the standard steps of the Mediawiki installation:

chmod a+w config/
mv LocalSettings.php ..
chmod ug-w config/

The wiki I am setting up needs to be able to display equations, which
requires the texvc extension to Mediawiki. Texvc parses Tex markup and
feeds it to ImageMagick, which generates .png files of the equations. I
needed gcc to compile the code.

apt-get install gcc ocaml imagemagick gs cjk-latex tetex-extra
php4-imagick

Compile the code:

cd /var/www/apache2-default/math/
make

Wikimedia’s site on running Mediawiki on Debian was quite useful.

Upgrading to SuSE 9.3 from 9.1

Tuesday, May 3rd, 2005

I just upgraded my desktop machine from SuSE Linux 9.1 Pro to 9.3 Pro.
It took a little over an hour, and nothing particularly horrible
happened, so far as I can tell.

I did run into two problems:

1. The Shuttle SS51G that I have uses the Intel 8×0 sound driver.
Since 9.1, the driver has dropped support for the “joystick”
parameter, but /etc/modprobe.d/sound still tried to set it to zero,
which gave me an error about no volume controls being present, as well
as a huge pile of errors in dmesg. A German website had the answer:
http://suse-linux-faq.koehntopp.de/q/q-suse93-snd_intel8×0.html

For those of us who don’t know German, the answer can be summarized
as “delete joystick=0 from /etc/modprobe.d/sound.”

2. The second problem I ran into is that like Red Hat, SuSE is worried
about getting sued by Fraunhofer, a German company that owns several
patents involved in mp3 encoding and decoding (licensed through Thomson
Multimedia in the US). As a result, they do not include software that
decodes mp3s in SuSE 9.3 Pro. However, SuSE does allow you to download
packages from their FTP site that add the ability to decode mp3s. I
don’t know whether they changed their minds after the CDs were
pressed or whether there is some legal difference between me downloading
the files from them directly instead of from a CD that they made.
Unfortunately, I was a coward when I started ripping my CDs a few years
ago, so I didn’t rip them to .ogg, which is similar in quality and
compression to mp3, but not encumbered by patents. On the other hand,
the ipod does not and may never support .ogg. On the third hand, at
least one of the mp3 patents expires in 2015.

SuSE 9.3 is pretty slick. An SVG icon theme is included, which is fun to
play with, even if the icons look like bitmaps once you stop stretching
them. Beagle, the new desktop search program is reasonably functional,
at least at first glance, although I have not figured out how to make it
index cached chats in Chatzilla (possibly because Chatzilla may not
cache chats).

So, with that done, I’m going back to counting down the days until
Firefox 1.1 is released with native SVG support sometime in June. Since
I don’t actually know when it will be released, I’ve decided to
count up instead.