Saturday, November 22, 2008

When apt-get fails to reinstall a package

While experimenting with the Moin Moin Wiki, I got into some bother attempting to uninstall and reinstall it. The problem originated from me manually removing some configuration files. apt-get subsequently refused to reinstall those files. I eventually resolved by using dpkg.

I had initially followed the installation steps for Moin Moin on the Ubuntu Server Guide. So I had installed by doing
$ sudo apt-get install python-moinmoin
So to uninstall, I did
$ sudo apt-get remove python-moinmoin
I now know that that did not uninstall a base package, moinmoin-common, on which it depends. But I didn't notice that at first. All I saw was that some configuration files were still present in /etc/moin, so I rm -rf them.

And there began my trouble, because thereafter I could not get apt-get to delete or reinstall the configuration files to that dir.

I did various iterations of apt-get install, apt-get remove and apt-get purge for the moinmoin-common and python-moinmoin packages. But the remove operations never removed /etc/moin and the installs never installed the missing files.

I used dpkg-deb to inspect the moinmoin-common archive file in /var/cache/apt/archives. I could see the to files I wanted were in the archive. But I could not get them to unpack to /etc/moin.

A temporary workaround was to use dpkg-deb to extract the archive file to /tmp, which unpacked everything, and then manually copy the uninstallable files from there to /etc/moin. But I wanted to find the proper solution.

I found a thread on the Ubuntu Forums outlining an equivalent problem with an apache2 installation. The advice there was to use Synaptic to remove the package. I don't have that option as I am running a headless server and Synaptic is a GUI tool. But at least there was the suggestion of a solution. If it can be done in a Debian/Ubuntu GUI, then be sure it can be done on the command line too.

Then I found a good article at which explained how you can escalate from apt-get to dpkg to resolve package management problems.

So the happy ending was to do
$ sudo dpkg --purge moinmoin-common
This removed the troublesome files and the references to them that the package manager was evidently keeping. After that, I was able to cleanly reinstall Moin Moin.

Thursday, November 20, 2008

CUPS print server

I installed CUPS on my fit-PC mini Linux server to turn it into a USB print server.

Got a USB printer? Want to let several computers share it? Want to print to it wirelessly? Well you could buy a USB print server. Connect one of these to your router and your printer and you can share the printer on your network. If your router is wireless, you now have a wireless print server.

But since I already have an always-on mini Linux server, I can simply install CUPS on that and let it be my print server.

The setup
  • Fit-PC mini Linux server connected to my wireless router, as before.
  • USB laser printer (HP LaserJet 1010) connected to a USB port on the server.
  • CUPS installed and configured on the server to allow any PC connected to the router to use the printer.
  • Generic printer driver installed on Windows laptops so they can use the printer through the printer server.
So now I have a very handy wireless print server...
  • I can send stuff to the printer whenever I like.
  • The printer itself doesn't need to be turned on - just the server. Print jobs are spooled to the server.
  • When I want to collect printed pages, I just turn on the printer. The server detects it and sends the pending pages.
  • Pending print jobs are is written to disk, so even if you turn off the server, they are there when it restarts.
Installing and configuring CUPS on the server was straightforward.
$ sudo apt-get install cupsys
I Googled a bit for cupsys setup tips and made a few changes to /etc/cups/cupsd.conf.

For what it's worth, here's the diff between the default configuration (Ubuntu 8.04) and my current version.
$ diff /etc/cups/cupsd.conf.original /etc/cups/cupsd.conf
> Listen <my-server-ip-address>:631
< DefaultAuthType Basic
> DefaultAuthType None
< Order allow,deny
> Order deny,allow
> Deny From All
> Allow From
> Allow From 192.168.2.*
> Allow 192.168.2.*
> Allow 192.168.2.*
I think I had to restart the server once after installing cupsys, before I could access its web interface from my laptop. (Maybe apparmor related. I'm begining to think that reboot is required to allow any newly installed HTTP service available. Could be wrong there.)

Anyway, once it's setup right, you can point your browser to
to browse and manage the print server.

The setup on Windows laptops was very easy. I used "Add Printer" to add a network printer, specifying connect by URL, and a generic PostScript driver (I used Generic / MS Publisher ImageSetter).

There are of course many other ways to set it up, e.g. different printer driver options are covered here. But this is working out nicely for me.

Wednesday, November 12, 2008

Performance of SqueezeCenter on fit-PC Slim

Here is some data on the performance of SqueezeCenter on my fit-PC Slim.

Library rescan

4004 mp3 files

* Look for new & changed music - 1:50
* Clear library and rescan everything - 18:01

3987 flac files

* Clear library and rescan everything - 13:06

Power consumption was peaked at 9 watts during rescans compared to 7 watts for normal operation.

Web interface*

Full cold load^ of the interface - 15 secs
Warm load - 5 secs

*Firefox 2
^Clear browser cache and restart browser

Saturday, November 8, 2008

Some photos of the fit-PC

"For those who like that sort of thing, that is the sort of thing they like."

fit-PC and a AAA battery

fit-PC on the left next to the Linksys router

Squeezebox and fit-PC

Typical power consumption 7 watts

Thursday, November 6, 2008

SqueezeCenter on the fit-PC Slim

It's a few weeks since I installed SqueezeCenter 7.2 on my mini Linux server. I'm delighted to say that it's working out great.

Music playback on my Squeezebox player is flawless. The responsiveness of the player and web interface is just fine.

My server is the recently released fit-PC Slim (512MB RAM), which I ordered diskless and fitted with a 250GB disk. It's running a minimal server install of Ubuntu 8.04 with a few services including SqueezeCenter.

In its current configuration, my fit-PC draws just 7 watts.

I think that's pretty terrific. I expect to get the power consumption even lower whenever I get around to disabling the WIFI adapter in the BIOS.

I only have one Squeezebox, so can't comment on the ability to serve multiple clients, though I have played to the Squeezebox and my laptop simultaneously without glitches. Also, no problem streaming music while performing other background tasks, like copying on new music files and transcoding from FLAC to mp3.

I reckon the fit-PC is a really great fit for SqueezeCenter.

Saturday, November 1, 2008

Akasa HDD enclosure - remove the jumpers

I decommissioned my old server tonight and ripped out everything useful, including the 250GB IDE/PATA disk. I got an Akasa disk enclosure a few weeks ago specifically to recycle this disk. I had a couple of false starts, but they were resolved by removing the jumpers on the disk. (The Akasa manual says nothing about jumpers).

First off, with one jumper in the master/single position, Windows XP couldn't see the disk at all. Next, I misread the jumper diagram on the disk and put it in the "limit disk capacity" setting. Now Windows could see the disk, but only 33.8 GB of it. Same story connected to Linux. Finally, I removed the jumpers altogether. Now Linux and Windows can see the disk and its full capacity.

Formatting the disk with an NTFS partition now...