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!

FINALE: a falling block game

For my final AP Computer Science project in June 2008, I worked with Brandon Liu and Yuzhi Zheng to develop FINALE, a falling block game based on the PSP game Lumines. The object of the game is to match colored blocks into squares, which are cleared away when the “time bar” passes them. Clearing more squares in each pass of the time bar gives an exponentially larger number of points.

Here are some screenshots. (I’m happy to say our graphical presentation was spectacular, with all graphics, backgrounds, and game pieces custom designed in Inkscape.)

Continue reading

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.

Sony VAIO Power Management as a Limited User

I recently switched to running XP as a limited user after getting a virus. However, I soon realized that I couldn’t use my Sony VAIO S260’s power management features anymore. When I went into the VAIO Power Management tab, everything was grayed out. Logging in as Administrator, I could create profiles, but then I wouldn’t be able to see them in a regular user. Here’s the solution:

  1. Allow the limited user account (LUA) to change power options. This will let you change the Windows built-in options, but not the VAIO-specific options.
  2. Temporarily make your LUA administrator either manually (requires logout/login) or using MakeMeAdmin.
  3. Open up the Power Options control panel (powercfg.cpl).
  4. Set up your power profiles as you want them, using the VAIO Power Management tab. These will be visible since they’re created in your own user account, rather than Administrator’s.
  5. Now you’ll be able to switch between profiles without using MakeMeAdmin–just click the battery icon in the notification area. Changing the VAIO-specific options of profiles still requires MakeMeAdmin though.