The Ubuntu netboot/network installers

The Ubuntu netboot (network) installers are fantastic, and for how good they are, they are hardly ever publicized.

The idea of just downloading your OS whenever and wherever you need to install it is kind of astounding. It makes the Windows/Mac experience of having to dig up some DVD and type in a 25-digit number seem positively archaic. It's the difference between walking across the street to buy bottled water, and turning on the tap and just having water appear. It completely changes the economics of the game when you no longer have to think of your operating system as a scarce resource.

As I understand it, there are three ways to do a netboot install. I've previously written about installing Ubuntu by booting from files downloaded to your hard disk. It's also easy to do a netboot install from either a CD or a USB key, and the procedures are very similar.

All three methods are nice because they have small initial downloads, about 10 MB; they then download the rest of your OS (and only the latest version of each package) at install time. It's a waste of time to download a ~700MB CD image if you're going to upgrade half of your packages right after installation. (Software is usually out of date by the time you install it! Especially during the development period for each release.) The installer is small enough that you can even burn it to one of those business card CDs.

The netboot installers are also versatile. They will install, at your request, any (or all!) of the following: Ubuntu desktop, Ubuntu server, Kubuntu desktop, Xubuntu desktop, Edubuntu desktop, and many more. They also support installing to encrypted LVM for full-disk encryption. (The netboot installers are based on the ncurses Debian installer.)

The hard disk method has the advantage that, of course, you don't need to use any external media. However, in my experience, the CD and USB key installers are a little less flaky. Unlike a hard disk installation, they also work even if you don't have Grub already installed.

For either the CD or USB key methods, you can find the appropriate files here:

http://archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/

(This is for Jaunty/i386. If you want a different release or have a different architecture, like amd64, adjust the URL accordingly.)

For CD installation: download mini.iso and burn it to your CD.

For USB media installation: download boot.img.gz and follow the instructions here. It will boil down to doing something like this:

# zcat boot.img.gz > /dev/sdX1
# aptitude install mbr
# install-mbr /dev/sdX

Then boot from your new media into the installer.

"Being Productive With Emacs" Redux

This past IAP I taught a short class on Emacs ("Being Productive With Emacs") at MIT. It was similar in content to the class that I taught in 2007, although I pared down the material a bit.

I've posted the slides online. You may use the slides under the terms of the GFDLv1.3+ or the GPLv3+.

(I made the slides using S5, which is pretty sweet. It lets you make moderately professional looking DHTML slides in a text editor without much pain.)

A command-line substitute for gitk

gitk is indispensable for viewing repo histories and understanding the relationships between different branches. However, using a GUI is a bit heavyweight if you are working remotely or only need to see the last few commits. Under these circumstances, git log --graph, introduced in git 1.5.6, is a pretty good fake.

My preferred invocation is

git log --graph --abbrev-commit --pretty=oneline --decorate

which I've aliased to gl in my shell.

The subsequent options, respectively: only show short commit names, for compactness; only display one line per commit, for compactness; and show where your branches are. Here's some sample output:

* f95f34e... (refs/remotes/origin/master, refs/heads/master) Acknowledge Alexey.
* c691bc7... Allow unmarking the marked commit.
* 7640638... Fixed visualization of marked commits
* c3830ed... Make it work better on Windows.  Thanks to Jeff Dik.
*   3433556... Merge commit 'fdr/sign-off'
|\  
| * 68344a2... Add signoff customization option
* |   3e29059... Merge commit 'cymacs/master'
|\ \  
| * | 45fb865... Fix incorrect diff hightlighting of lines beginning with "+" or "-".
| * | b7fe745... Disable undo in all magit-mode buffers.
| |/  
* | 10fe99a... Ambiguity in call to git log fixed
* | 3d34a7c... Make buffer saving behavior customizable.
* | 64b8265... Removed unused threshold machinery.
* | b430add... Make sure that point never ends up in an invisible region.
|/  
*   b30faeb... Merge commit 'voins/voins'
|\  
| * 7386af1... Use "medium" git log format when visiting commit
* | 5fb7327... Mention autogen.sh
* | f055b18... Typo.
|/  

One small step for freedom

Today, Apple announced that it is phasing out DRM in its music store. By the end of the quarter, Apple says that all songs in the iTunes music store will be DRM-free.

This is good news.

However, I hope that a victory for users in this battle does not lead people to believe that the war is over, or that DRM is just about music. Let's not pretend that this is the end of DRM at Apple. Let's not even pretend that this is the end of DRM in iTunes, as has been widely and erroneously reported.

I'm not holding my breath, but if I have a shred of optimism about this whole situation, it's because Steve Jobs has publicly disparaged DRM in music. DRM elsewhere is no less pernicious.

Disabling Firefox's yellow plugin bar

I hate Flash. But that is a rant for a different post.

I don't have Flash installed, and I don't want to have Flash installed. That means I get Firefox's yellow "Additional plugins are required to display all the media on this page" informational bar on many pages with Flash content. Here are instructions for disabling it in Firefox on Ubuntu 8.10.

[Update: much easier way to do this, apparently available on Firefox 3.0+: in Firefox, simply go to about:config and set plugins.hide_infobar_for_missing_plugin to true. Thanks, Rakhun!

The more complicated way I originally suggested doing this follows.]

In Firefox, go to about:config and set plugin.default_plugin_disabled to false. By itself, this suppresses the yellow plugin bar and replaces it with a dialog, which is even worse! In order to disable this dialog, you'll also need to delete the file /usr/lib/xulrunner-addons/plugins/libnullplugin.so.

(The "null plugin" or "default plugin" is responsible for rendering a blank box and prompting you whenever Firefox encounters content it doesn't have another plugin for.)

If you ever regret this decision, you could keep libnullplugin.so somewhere safe and just move it back to that directory—or, just reinstall xulrunner-1.9 with aptitude reinstall xulrunner-1.9.

On other systems, you can identify the location of the default plugin by setting plugin.expose_full_path to true. Then go to about:plugins and look for the "Default plugin". Firefox should show you the path to the plugin file. Delete that file.

A holiday plea

Shortly before the holidays I made donations to three organizations: the Free Software Foundation, Wikipedia, and Creative Commons. If you'll kindly indulge me for a minute, I'll explain why I think the work of these organizations is so important to an open internet and a free and properous society. Consider giving whatever you can spare (whenever you can spare it) to one of these groups.

1. So much of our everyday lives—both work and play—depends on the operation of software that we cannot really claim to be free people unless we are using free software. I'm donating to the Free Software Foundation both as thanks for the GNU operating system and in support of their campaigns. The GNU OS—from ls to emacs, and everything in between, and beyond—eclipses, in terms of power and productivity, pretty much any other OS you can buy. But peace of mind is even more valuable than technical power. As someone whose livelihood directly depends on software, it would be foolish in the extreme for me to compromise my autonomy and financial security by using proprietary software and "giving the keys to someone else."

The FSF also promotes awareness of a number of threats to freedom and innovation, like DRM (vile, vile stuff) and proprietary document formats (which are antithetical to the democratic idea of the free interchange of information).

2. I'd say that being able to learn about anything, anytime, on Wikipedia has been a pretty life-changing experience. I don't need to explain what this is like to most of you. But Wikipedia isn't valuable just because it satisfies my idle curiosities. One of the hats I wear is that of "teacher," and I love sharing knowledge. The dissemination of knowledge is one of the surest ways to produce prosperity. I'm donating to Wikipedia on behalf of children and other curious people everywhere.

3. Creative Commons is creating a body of actually useful creative works, as well as encouraging people to rethink copyright law. I feel like I've discovered a gem every time I find an ebook I can copy for offline reading, or music I can share with friends, or a comic or photo that I can put on my blog. What is perhaps more valuable is that CC is planting the idea in people's heads that maybe we can be more prosperous as a society if authors allow their work to be used in more ways rather than fewer.

Magit

Magit is a spectacular Emacs add-on for interacting with git. Magit was designed with git in mind (unlike VC mode, which is a more generic utility), so git commands map quite straightforwardly onto Magit commands. M-x magit-status tells you about the current state of your repo and gives you one-key access to many common git commands. However, what really sold me on Magit was its patch editor, which completely obsoletes my use of git add, git add --interactive, and git add --patch. If Magit had this patch editor and nothing else, I would still use it. That's how great this is.

M-x magit-status (which I've bound to C-c i) tells you about your working tree and the index, kind of like a combination of git diff, git diff --cached, and git status. It shows some number of sections (e.g. Staged changes, Unstaged changes, etc.); within each section you can see what files have been modified; within each file you can view the individual hunks. Within any of these containers you can press TAB to expand or collapse the heading. Moving your cursor into a file header or a diff hunk header selects the changes in that file or hunk, respectively. You can then press s to stage those changes, as shown in these before-and-after pictures:

Once you're satisfied with your staged changes, you can press c to commit, which prompts you for a log message. After you've typed a message, C-c C-c performs the actual commit.

This is already much faster than using git add --interactive or git add --patch to stage parts of a file. You just find the hunk you want rather than having git ask you yes/no about every hunk.

However, Magit also allows staging changes at an even finer granularity. If you highlight some lines in a hunk and then press s, Magit only stages the selected lines, as shown in these before-and-after pictures:

When in doubt, it's a good idea to make small commits rather than large commits. It's easy to revert (cherry-pick, explain, etc.) more than one commit, but hard to revert half a commit. Kudos to Magit for making small commits easier to create.

Finally, Magit comes with a fine manual, which you can read online.

Installing Magit

It doesn't get too much easier than this for external Emacs packages.

Check out Magit:

git clone git://gitorious.org/magit/mainline.git

Make sure that magit.el from that checkout, or a copy, is on your load path. For example:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))

Autoload Magit and bind magit-status:

(autoload 'magit-status "magit" nil t)
(global-set-key "\C-ci" 'magit-status)