bloovis.com

10/19/2008 (6:54 am)

Reviving an old ThinkPad with TinyMe 2008

Filed under: linux, pclinuxos, software, thinkpad ::

I bought my first ThinkPad nine years ago, and now have five of them. Two of them (an A30p and a T40) are hopelessly broken, with system boards that either won’t power up or won’t stay powered up. The others are working pretty well, including the oldest one, a model called the 380Z, which despite the name, has no relation to Datsun sports cars.

The 380Z served me well for a couple of years. It was running Mandrake Linux practically from day one, and was a reliable, non-sleek tank. Recently I thought it might be fun to update it to a more recent Linux. But its specs are quite modest by today’s standards. Its power is about 1/10th that of a modern laptop in just about every area: 96 MB of RAM, a 233 MHz Pentium II processor, and a 4 GB hard disk. Nothing could be done about the RAM, and that’s the biggest problem, because most Linux GUIs these days (KDE being my favorite) require about 256 MB at a minimum if you want some memory left over for running a browser. The hard disk problem solved itself: when I powered the machine on yesterday for the first time in a year, the disk made terrible clunking and seeking noises and the BIOS reported it as dead. So I swapped in an 80 GB disk from the dead T40.

Now at least the machine could boot and presumably take a new OS installation. But what to install? I am a fan of PCLinuxOS, but it’s a bit on the heavy side for such a lightweight machine. So I tried a cut-down version of this OS called TinyMe 2008. This distro replaces the lovely but somewhat porky KDE GUI with a lightweight GUI based on various minimalist components (Openbox, LXPanel, Nitrogen, and iDesk).

I ran into a serious problem during installation having to do with the limited RAM on the 380Z. If a swap partition was not already available on the hard disk, then the live CD installer would eventually crash, apparently due to running out of RAM. My solution was to create a swap partition manually, enable it, and patch the installer so that it wouldn’t die when attempting to mount or unmount the swap partition.

The first step was to create the swap partition. This was accomplished by running the installer, and telling it to use the entire disk. The installer created three partitions, one of which was a swap, and then asked me to reboot the system. I did that, and when the login screen came up, I switched to a text console using Ctrl-Alt-F1, and logged in as root. I formatted and enabled the swap partition using mkswap /dev/hda5 and swapon -a. Then I switched back to the login screen using Ctrl-Alt-F7.

After logging in as root in the GUI, I launched a terminal (called Sakura) and edited two of the installer Perl scripts so that it wouldn’t die trying to mount or unmount the swap partition.

  • /usr/lib/libDrakX/fs/mount.pm: I edited the two lines containing syscall_('swapon',...) and syscall_('swapoff',...), changing the die calls to print.
  • /usr/lib/libDrakX/draklive-install: I commented out the line containing fs::mount::swapoff by prefixing it with a # character.

After these changes, the installer completed successfully without aborting or crashing the system. The resulting installation is a minimal Linux system that uses Opera as its web browser. This is certainly a decent alternative to Firefox, but I do miss the AdBlock Plus extension that makes browsing commercial, ad-laden sites more pleasant. The Orinoco-based wifi card (a Dell TrueMobile 1150 PCMCIA card) is supported and works perfectly with WEP (but probably won’t work with WPA, if past experience can be trusted).

The main post-installation problem was that sound didn’t work. The 380Z has an old Plug-And-Play Crystal Sound 423x device that pre-dates PCI. After a day of Google searching and experimentation, I determined that the ALSA driver (snd-cs4232) would not work, and that I needed to use the older OSS driver (cs4232). I edited /etc/modprobe.d/sound to look like this:

alias snd-card-0 cs4232
alias sound-slot-0 cs4232
options cs4232 io=530 irq=5 dma=0 dma2=0

I verified these settings by running the ThinkPad’s DOS-based configuration utility, PS2.EXE. I also found it necessary to run aumix after booting to bring up the speaker and PCM levels to audibility.

Another problem with the installation is that graphics acceleration was not enabled; this was very apparent when scrolling or moving windows. The solution was to run the PCLinuxOS Control Center, select “Hardware” and “Set up the graphical server”, and change the resolution bit depth from 24 bits to 16 bits. This is apparently required to work around a limitation of the NeoMagic graphics chip in the 380Z.

03/04/2008 (1:51 pm)

Printing to PDF from Firefox

Filed under: linux, pclinuxos, software ::

I recently needed to send my credit report to a landlord, and it seemed as if a PDF file would be the logical choice. So I needed a way to create a PDF file directly from Firefox, since the credit reporting agency didn’t provide an option for creating a PDF. Fortunately, there is a cups-pdf package that lets you do this. However, getting it to work in Firefox is not completely obvious. Here’s how to do it in PCLinuxOS 2007:

First, install the cups-pdf package in synaptic (the program labelled “Package Manager” in the toolbar).

Then, as root, restart cups using this command in a Konsole (or other terminal window): service cups restart. (This step may not be necessary, but it doesn’t hurt either.)

At this point, the KDE browser, Konqueror, will be able to see the “CUPS-PDF” printer in its Print dialog. But Konqueror has problems with rendering pages this way, so you’ll want to use Firefox instead. But Firefox won’t see the printer.

Back in Firefox, visit the CUPS configuration page. You’ll be asked to provide the root username and password. Click on the “Administration” tab. You should see the “Virtual PDF” printer under “New Printers Found”. Click the “Add This Printer” button. In the “Make/Manufacturer” page, select “Generic”. In the “Model/Driver” page select “Generic PostScript”.

Now Firefox should be able to see the CUPS-PDF printer in its Print dialog.

When you print a page using this pseudo-printer, the output goes to a PDF file on your desktop (the ~/Desktop directory). There’s no easy way to change the directory or filename that cups-pdf uses, so you’ll probably want to move or rename the file after it’s created.

02/29/2008 (6:04 pm)

Fixing jerky video in DVDs

Filed under: linux, mepis, pclinuxos, software ::

On my ThinkPad A30p, watching a DVD with Kaffeine often results in very uneven, jerky video. This has been a problem with both PCLinuxOS 2007 and Mepis 6.5. The cause appears to be an obscure kernel bug that disables DMA on the CD-ROM drive. The fix is to run the following command as root after Kaffeine has started:

hdparm -d1 /dev/cdrom

It doesn’t work to enable DMA before starting Kaffeine (it’s enabled by default when the system boots). It has to be done after Kaffeine has opened the DVD and started to display its menus, and it has to be done with each new DVD. It’s not a big nuisance, but you can create an icon on the desktop to make it a little easier:

  • As root, edit /etc/sudoers and add a line like the following:
    bloovis localhost = NOPASSWD: /sbin/hdparm
    Be sure to change bloovis to your actual user name.
  • Create a desktop “link to application”, where the command to run is:
    sudo hdparm -d1 /dev/cdrom

Curiously, this problem doesn’t occur on my other Thinkpads (A21m, T40) even when running the same versions of Linux.

02/16/2008 (12:13 pm)

Fixing DVD audio sync problem in Kaffeine

Filed under: linux, mepis, pclinuxos, software ::

Both PCLinuxOS 2006 and Mepis 6.5 come with a wonderful media player called Kaffeine. I especially like being able to customize the toolbars. I’ve added buttons to go backwards and forwards by 20 seconds, which is great for those times when you miss some important bit of dialog.

But Kaffeine, as shipped with these two older versions of Linux, has a serious problem when viewing DVDs: the sound is not synchronized with the video, and appears to be off by as much as a quarter of a second. There is a control for adjusting the sync, but it’s difficult to get just right and it requires fiddling with each new DVD.

After the usual poking about with Google, I discovered that the problem is due to a bug in the underlying video engine, Xine, and in particular, a library called libxine. The bug was present in version 1.14 of the library as shipped with these two distros, and fixed in version 1.16. So the solution was to download the source for the library and build it myself.

I found the source for libxine on the xine download page. The file I downloaded, xine-lib-1.1.4.tar.bz2, is no longer available, but I would guess that later versions would also work. The numbering scheme is confusing; version 1.1.4 of the source is used to build version 1.16 of the binary library.

Once I had the source code, I unpacked it and built and installed the library using the following commands:

tar xvfj xine-lib-1.1.4.tar.bz2
cd xine-lib-1.1.4
./configure --prefix=/usr
make
make install # run this as root

After that, the audio sync problem was gone.

On both of these systems, I had to install some X11 development packages (header files and libraries) before libxine would build.  I have forgotten exactly which packages these were, but clues can be gotten by looking at the compiler error messages, and seeing which header files are missing.  I installed these extra packages from synaptic, the standard package management program on both systems.