Avoiding Debian Headaches: Apt Pinning By Example

I use Virtualmin on my Linode VPS. When it Debian 6.0 was first released, Virtualmin only supported 5.0 (lenny), not unstable or 6.0 (squeeze). I was unwittingly auto-upgraded, hosing the Virtualmin install. Cleaning up the mess required a re-install, and these are some notes on my setup so I don’t get surprised by the apt package manager again in the future:


Make sure release codenames are named, like ‘lenny’ rather than ‘stable’, unless you’d like to be upgraded to the next dist without warning!

## main & security repositories
deb http://ftp.us.debian.org/debian/ lenny main
deb-src http://ftp.us.debian.org/debian/ lenny main
deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

#deb http://ftp.us.debian.org/debian/ lenny contrib
#deb-src http://ftp.us.debian.org/debian/ lenny contrib
#deb http://security.debian.org/ lenny/updates contrib
#deb-src http://security.debian.org/ lenny/updates contrib

#deb http://ftp.us.debian.org/debian/ lenny non-free
#deb-src http://ftp.us.debian.org/debian/ lenny non-free
#deb http://security.debian.org/ lenny/updates non-free
#deb-src http://security.debian.org/ lenny/updates non-free
deb http://software.virtualmin.com/gpl/debian/ virtualmin-lenny main
deb http://software.virtualmin.com/gpl/debian/ virtualmin-universal main

#DCL: backports
deb http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free
deb-src http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free

#DCL: unstable
deb http://ftp.us.debian.org/debian unstable main non-free contrib
deb-src http://ftp.us.debian.org/debian unstable main non-free contrib


Make sure you read the apt_preferences man page!

Package: *
Pin: release a=lenny
Pin-Priority: 700 

Package: *
Pin: release a=lenny-backports
Pin-Priority: 200 

Package: *
Pin: release a=unstable
Pin-Priority: -10 

How to use

To install from backports, aptitude -t lenny-backports <pkg-name>. It will then be auto-updated from lenny-backports in the future because of the 200 pin priority, as per the backports instructions.

To install from unstable, aptitude -t unstable <pkg-name>. The negative pin priority prevents it from being auto-updated. This is useful because it may otherwise drag the whole system up to the unstable versions.

The Best Way to Unclog Print Heads

I’ve had many inkjet print heads that eventually got dried up and started streaking when printing. These supposedly delicate parts consist of a very fine, narrow channel for ink of each color. The extremely narrow width allows them to position ink precisely, but it also means they can clog easily with dried ink.

Print head

The solution for clogged ink heads is pretty simple: Rinse with hot, hot water. Boiling water, in fact. I poured a small cup slowly over the print heads for about ten seconds, dried it off with a towel, and stuck it back into the printer. PRINTS LIKE NEW!

Many sites advise treating the print head much more carefully: make measured-out solutions of ammonia, soak a paper towel, and leave the print head resting on the towel overnight. But soaking for hours has never worked for me. Lesson learned: The print head is remarkably resilient.

I’ve tried this now with two printers: a Canon i560s and a Canon iP1800. Worked perfectly both times. The iP1800 has cartridges with built-in print heads, so I worried that water would enter and dilute the just-refilled cartridges. The cartridge would just be junk if I couldn’t get it working, though, so I gave it the scalding-hot treatment anyway. It worked!

Notes: Getting suEXEC execution for PHP under Virtualmin GPL

(On Debian 5.0. May be slightly different on other distros)

Create files in /etc/skel/:

$ cd /etc/skel
$ mkdir -P etc/php5
$ cp /etc/php5/apache2/php.ini /etc/skel/etc/php5/php.ini
$ mkdir fcgi-bin
$ vi fcgi-bin/php5.fcgi

Paste the following:


export PHPRC=$PWD/../etc/php5
umask 022
exec /usr/bin/php-cgi

Then, in Virtualmin > System Settings > Server Templates > Default Settings > Apache website > Directives and settings:

ServerName ${DOM}
ServerAlias www.${DOM}
DocumentRoot ${HOME}/public_html
ErrorLog /var/log/virtualmin/${DOM}_error_log
CustomLog /var/log/virtualmin/${DOM}_access_log combined
DirectoryIndex index.html index.htm index.php index.php4 index.php5

Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All

AddHandler fcgid-script .php
FCGIWrapper ${HOME}/fcgi-bin/php5.fcgi .php

AddHandler cgi-script cgi

Important notes:

  • ExecCGI is required! Otherwise, 403 Forbidden errors will occur.
  • The wrapper script and php files must not be group/world-writable!
  • Look in /var/log/apache2/suexec.log for hints if you’re having trouble.

Cryptic errors from mod_fcgid and Perl

For future reference, the cryptic error from mod_fcgid:

[Thu Feb 12 22:10:27 2009] [warn] (104)Connection reset by peer:
    mod_fcgid: read data from fastcgi server error.
[Thu Feb 12 22:10:27 2009] [error] [client X.X.X.X] Premature end of
    script headers: dispatch.fcgi

means that dispatch.fcgi failed to start. Possible reasons are:

  1. Missing Perl modules. Unfortunately, I don’t know where the stderr output ends up. Try running the script directly; e.g. perl dispatch.fcgi.
  2. Missing Perl modules that you installed locally (e.g. local::lib) but Apache doesn’t have it in $PERL5LIB.

Remember that the folder must not be group-writable, and that any executable must be run from the directory root that suEXEC was compiled for! These will fail with a more useful error though, complaining of “suexec policy violation: see suexec log for more details” (the log is at /var/log/httpd/suexec.log for CentOS systems).

How to Present – Notes from ISEF 2008

At the Intel International Science and Engineering Fair this year, I’ve learned a lot about presentation techniques. Thanks to Patrick for giving me some great suggestions, such as:

  • Posture: stand with feet pointed toward judge, lean forward slightly
  • Hands: use generous hand gestures, in front of chest, not lower
  • Use visual bullets when making lists. Hold up fingers for each item.
  • Intonation: Use emphasis on key phrases, and be sure to pause between clauses and sentences. Give the listener time to absorb information, and possibly ask questions.
  • Don’t use filler words like “uh”, simply pause and glance back at board if you forget what to say.

Here are some other notes about the judging process at ISEF experience:

  • Some judges are not interested in hearing a presentation, and will instead like to ask you questions about the board. They have all already read the board. This can be difficult if there is background information that needs to be explained as part of your presentation.
  • Other judges may want a 2-minute summary of your work. This means you should state the key points: the purpose, hypothesis, conclusion. In my case, I also showed my demonstration.
  • Judges are assigned based on your sub-category selection, so choose carefully.
  • Recognize types of judges:
    • Grand awards judges have blue ribbons, and a second ribbon corresponding to their category. Computer Science judges had yellow ribbons. These judges are written on the red card that is placed at your project. They have strict 15 minute periods for each project, and there is a warning bell when there are a couple minutes left.
    • Special awards judges have red ribbons. Their organization is written on their badge. Special awards judges will not always have time to hear the full presentation.

Question and Answer: Questions about the technical details of your project are easy to answer, because you have already researched the field for many months. The trickier questions are more general, and they apply to almost all projects. For example:

  • What were some of the biggest challenges in your project, and how did you overcome them?
  • What was something surprising that you learned, that you weren’t expecting to?
  • What is the significance of your results?
  • How did you learn about this?
  • Why did you want to do this project? How did you come up with this idea?
  • How does your work compare to existing research?
  • What makes this project better than the other projects here?
  • What would you do differently if you did this again?
  • What else would you like to explore in this project?