RichardNeill.org

Update: There is now a Mandrake 11.0 (Mandriva 2006) page here. This page is left as an archive.


Installing Linux-Mandrake 9.1 on an IBM Thinkpad A22p

Last updated 2004-09-28

This is an IBM A22p, model TA2USUK, with 15" 1600x1200 display, PIII 1 GHz, and CD-RW. The RAM was upgraded from 128 MB to 512MB (Crucial RAM is cheaper than IBM and seems fine; 128 MB is a bit marginal for intensive use under Linux). Here is how I installed Mandrake 9.1 on it. [If you're looking for my Mandrake 8.0/8.1 page, you can find it here - it's obsolete, but there may be some useful advice for "newbies" there - as I was once (still am?) a newbie].

This Thinkpad is actually very Linux compatible. Although I haven't documented it here, I've run 8.0,8.1,8.2,9.0 and 9.1 on it. Basically everything works well, therefore, this is partly a quick run through the installer, partly a list of things I think are important/useful to change on a Linux system, and partly a memo-to-self about my preferences for the next install....

It is worth mentioning also: Linux-Laptop.net - Linux on laptops, Linux-Thinkpad.org - Linux on Thinkpads (and the mailing list), the Linux on Thinkpads webring and Knoppix - bootable Linux CD. Actually, I am becoming increasingly impressed with Knoppix: evey time something doesn't quite work in Mandrake, I boot Knoppix to see how it works! It's also a very useful demo/rescue CD.

Contents

For your delectation. In particular, I solved the following problems: getting full functionality from the trackpoint, making suspend work reliably, and fixing sound. There are also some useful scripts, binaries, and config files.

Pre-Installation

  1. Download the ISOs (Yes, I joined MandrakeClub). Burn to CD using cdrecord. Test using dd if=/dev/cdrom | md5sum (You can also buy the CDs from The Linux Emporium.)
  2. Backup everything (especially /home) on an external (1394) disk. Check it using diff -r. Unplug the disk. In the event, I didn't need the backup, but it is as well to have it - and it's certainly worth keeping a copy of the old /etc. (with hindsight, I should also have copied /etc onto /home, as my external disk wouldn't mount initially, and I needed to read /etc/fstab off it!)
  3. Write down my IP address and network settings (this is helpful for the install).
  4. Power off...take deep breath, get coffee...
  5. In the BIOS, make sure that all the devices are configured to be on, and that the hardware clock is set to GMT.

Installation

This went fine - no problems. Just a quick summary:

  1. At the boot prompt, I typed boot: expert. However, the standard install is very similar.
  2. Mouse = PS/2 (the default)
  3. Install (not upgrade), even though I had a 9.0 installation, I did actually want to start again.
  4. UK keyboard.
  5. High Security. (NB - don't choose paranoid - you can make your system almost unusable!)
  6. Partitions - I stayed with my old scheme and reformatted all but /home. This is:
    PartitionSizeMount pointFilesystem
    hda16.3 GB/ReiserFS
    hda5509 MBswapswap
    hda62.9 GB/backupReiserFS
    hda720 GB/homeReiserFS
  7. Package Selection: I selected all the package groups (this is a full install), then went to individual package selection. This takes time (there are a lot of packages), but it's usually worth it. The default choices are not bad. In particular, I added the following which were not included by default: X11R6-Contrib, alsamixer-gui, anacron, bash-completion, lyx, sane, shorewall, units, xfig (I also added: pg_access, php-cli).
    I removed bootsplash, since I prefer to see the boot-up message text on the screen.
    NOTE: DO NOT install lm_sensors (it can destroy some thinkpads - see linux-thinkpad.org). Mandrake do not include it by default - but it's worth making sure. This also means avoiding glms, ksensors, and not running sensors-detect.
    Note: Do not install tbp. (This is a "thinkpad button" monitor, and it displays the volume level on screen. It's very nice, but every time you adjust the volume while running 3D graphics/games, it crashes the machine!
  8. Choose yes to Install Servers.
  9. Add user rjn (this is the same as my old username on 9.0, and became associated with /home/rjn).
  10. At "Summary", I went through all the config options:
    • Timezone -> London, Hardware Clock = GMT, Use NTP
    • Printers - can add here, or after install.
    • GUI - Generic Flat Panel Display, 1600x1200, Rage 12 Mobility, XFree 4.3 with hardware acceleration, 16 bit per pixel. (Must choose 16 bpp to get hardware acceleration working.)
    • Network - Firewall off all but SSH.
    • Bootloader - enable ACPI for now (but see later).
    • Services - deactivated many of these. Leave acpi, devfsd, dm, linuxconf, ntp, partmon, shorewall, acpid, alsa, anacron, atd, crond, harddrake, irda, keytable, kheader, network, pcmcia, random, sound, syslog, xfs, xinetd, cups, httpd, iptables, sshd, postgresql.

Post-Installation

The system booted straight up - all seems well. Nevertheless, there is a lot left to do. This being Linux, there is a huge amount that can be configured....

Configuring SUDO

This is to save having to type the password each time I, the only user of the laptop, wish to become root. Add the 'rjn' line to /etc/sudoers under the currently existing 'root' line (where rjn is your login name):

# User privilege specification
root    ALL=(ALL) ALL
rjn     ALL=(ALL) NOPASSWD:ALL
Then add to .bashrc: alias "sud"="sudu su" So, you can now become root by simply typing "sud"

Configuring URPMI

If you've never used urpmi before, it is wonderful. All you do is "urpmi [packagename] and it will install it for you. But you have to set up some package sources first. It's possible to use urpmi.setup, but probably easier to visit: http://plf.zarb.org/~nanardon/urpmiweb.php. You can also add the plf GPG key by doing: lynx -source http://plf.zarb.org/plf.asc | gpg --import (see http://plf.zarb.org for this).
These are the Mandrake sources that you need:

  • Main = the 3 CDs you download. (Core distribution).
  • Contrib = packages built by other volunteers - over 2GB of useful stuff, but not officially in the main distribution.
  • PLF = "Penguin Liberation Front" - packages that might cause legal headaches in some countries - mainly multimedia.
You can also remove the 3 CDs as urpmi sources (urpmi.removemedia) if you'd rather download from ftp than use CD-ROM.

Then add packages to taste. In particular, I added: abiword, antiword, catdoc, checkinstall, dos2unix, faces-penguin, gscanbus, pine, nano, unix2dos, mandrake_doc-en

Also do Mandrake Update (in Mandrake Control Centre, or MandrakeUpdate as root) to get the latest bugfixes and security updates.

If rpm or urpmi break (symptom is that they just sit there doing nothing), this is probably because of a stale rpm lock file. This can be caused if rpm is somehow killed while running (eg by power failure, or a kill -9). These lock files usually serve to prevent more than one instance of rpm accessing the same database simultaneously, and are deleted after the rpm process terminates normally. This is what to do:
  1. Check rpm isn't currently running (use ps aux | grep rpm)
  2. Remove stale lock files by doing rm -f /var/lib/rpm/__db* as root.
  3. Rebuild the RPM database using rpm --rebuilddb

Configuring X

The default setup works OK, but is not ideal. Here's what I did: [ Trackpoint, Keyboard, Font Size (DPI), Antialiasing, Modes, 3D acceleration, External Display, XF86Config-4 file ]

  1. The Trackpoint is not very sensitive by default. Also, the middle button works as 'paste', not as 'scroll'. This can be changed as follows:

    1. First, fix the buttons - in the /etc/X11/XF86Config-4 file, change this part:
      Section "InputDevice"
          Identifier "Mouse1"
          Driver "mouse"
          Option "Protocol" "PS/2"
          Option "Device" "/dev/psaux"
          Option "Emulate3Buttons"
          Option "Emulate3Timeout" "50"
      EndSection
      
      to this:
      
      Section "InputDevice"
          Identifier "Mouse1"
          Driver "mouse"
          Option "Protocol" "PS/2"
          Option "Device" "/dev/psaux"
          Option "Emulate3Buttons" "on"
          Option "Emulate3Timeout" "50"
          Option "EmulateWheel" "on"
          Option "EmulateWheelButton" "2"
      EndSection
      
      The result is that the middle button can now be used like a mouse wheel, and you can do pastes etc (the usual 'middle button') by using the left and right buttons together - which, given their location, is easy on the Thinkpad! N.B. Save the old XF86Config-4 file. Also, save a copy of the new one, since, if you subsequently use the Mandrake Control Centre to change X, your modifications may be overwritten. See also the XF86 mouse page.

      Update from Joel Burton: On a T40, it's also necessary to add this line to get the Emulate-Wheel scroll to work:
      Option "YAxisMapping" "4 5"

      The above may need some explanation: here is a diagram of the trackpoint buttons:

      • On my thinkpad (an A22p), the buttons are arranged such that buttons 1,3 may be pressed together (at the green 'X') as if they were a middle button. This allows button 2 to be entirely dedicated to scrolling with no loss of functionality. (I also have the "press to select" disabled, since I otherwise tap it accidentally while typing).
      • BUT, on newer thinkpads, such as the T-series, IBM has (insanely, in my view), put the buttons in one line. This makes pressing 1,3 together with the same thumb rather hard! This is when tpscroll is really useful. This makes the button 2 act as a regular button 2 if pressed, but as a scroll-wheel while dragging. Nice :-) It might also be possible to do something clever with xmodmap to remap the buttons.


    2. Now, fix the trackpoint speed. Instead of using pointer acceleration in KDE (which makes it jerky), there's a much better way, thanks to tp4d, a wonderful daemon available from Till Straumann. Here is a very quick summary of what to do:
      1. Download the source code.
      2. Check that you have the following header files on your system: apm.h, XawInit.h, ThreeDP.h - you can use RpmDrake to search for the packages containing these files.
      3. Follow the instructions in the Readme. N.B. Don't worry that it exits with a failure: psctrl.c is known not to compile under kernel 2.4, but you don't need it.
      4. Play with xtp4 if you want to experiment with the settings. Or use mine below (max mouse sensitivity, press-to-select disabled)
      5. Move the tp4d executable into /usr/bin, and bzip2 the manpages and move them into /usr/share/man
      6. Put this at the end of /etc/rc.local to make it start on boot:
        #Start tp4d trackpoint daemon
        echo "Starting tp4d trackpoint daemon"
        tp4d -z -b -S 0xff -V 0xaf 
      7. If you don't want to compile it, here are my executables - they will probably only work on Mandrake 9.1.

      I haven't moved to Kernel 2.6 yet, but received this very useful tip from Bernhard Gruber (b dash gruber at gmx dot de), which I shall post here. Thanks, Bernhard!
      tp4d works just fine on my laptop with linux 2.6.3 now! However, this patch to the kernel must be made. I had problems with this in the beginning, but together with the author, we figured out a few bugs and that SMP-support MUST be disabled in the kernel! After installing the driver, the original /dev/psaux-device exists as also known in linux 2.4.X and the tp4d-utilities work just fine. Furthermore, any other mouse-device (touchscreens etc.) which has only drivers for linux 2.4 and not for 2.6 works then!

  2. The Keyboard:
    1. I have a dislike of CAPS-LOCK as it always seems to lurk in waiting on top of the tab key! You can either use the option in the KDE Control Panel under Accesibility ->Keyboard Layout: Make Caps Lock an Additional Control Key, or include the following in a ~/.kde/Autostart/kde-startup.sh file:
      #Get rid of Caps Lock and make it into an additional Control Key.
        xmodmap -e "remove Lock = Caps_Lock" \
                -e "keysym Caps_Lock = Control_L"    \
                -e "add Control = Control_L"
      
    2. If you don't know this, it's worth mentioning Alt-Gr. You can get many other symbols on the keyboard via Alt-Gr - treat it like an additional "shift" key. Also, accented characters may be entered using Alt-Gr and one of ;'#[] followed by the character to accent. (Alt-Gr is 'sticky'.)

  3. The fonts are too small. This is because most monitors are 75 dpi, whereas this one is actually 133 dpi. This requires two alterations. Firstly, add the DisplaySize line to /etc/X11/XF86Config-4
    Section "Monitor"
        Identifier "Generic|Generic Laptop Display Panel 1600x1200"
        VendorName "Generic"
        ModelName  "Unknown"
    #Added by rjn to sort out tiny fonts - these are width, height in mm
        DisplaySize 304 228
    
    Secondly change the line in /etc/X11/Xresources to
    Xft.dpi: 133
    where 133 is the value of
    xdpyinfo | grep resolution.
    Then, restart X and the xfont server (xfs), and log back into KDE. The fonts should all look better (and larger).

  4. Antialising. Mandrake 9.1 now has pervasive antialiasing of practically everything. Although I prefer the non-blurry version of fonts (which are "in focus", and don't cause eye-strain), it does look much better with antialiasing on. This is configured in KDE control centre. See also below.

  5. Modes. The default Mandrake setup gives only one mode (1600x1200) available. To allow different screen resolutions, change the Monitor part of XF86Config-4 from:
    Section "Monitor"
        Identifier "monitor1"
        VendorName "Generic"
        #HorizSync 31.5-90
        #VertRefresh 60
    to:
    Section "Monitor"
        Identifier "monitor1"
        VendorName "Generic"
        #HorizSync 31.5-90
        #VertRefresh 60
        #These large ranges are needed for low screen resolution.
        HorizSync 20-140
        VertRefresh 50-275
    This gives the following modes: 1600x1200, 1280x1024, 1024x768, 800x600, 640x480. You can switch between them using xvidtune. It's now possible to enjy games such as tuxracer/penguin command at full screensize, but without jerkiness.
    NB - these work fine for me on this high resolution LCD display (which has a fast pixel clock - 162 MHz) and therefore needs a fast sync rate for low resolution. BUT, but be warned that with external montors, especially old monitors (which are not protected from this), the monitor can catch fire with the wrong modeline and too fast sync!
    Note also:
    • Fn-F7 switches between LCD, LCD+CRT, CRT. But if you are in a virtual console, the LCD is blank in LCD+CRT mode. Under X, the LCD works as expected.
    • Switch on screen expansion in the BIOS.
    • LCDs look bad at non-native resolution. But it's much better for games - at last I can have tuxracer/penguin command at full screen without jerkiness :-)
    • In KDE, the system will start at 1600x1200, and the desktop will be that size. If the resolution is then reduced, you'll have a "viewport" onto this desktop - move the mouse to scroll.
    • Here is a quick resolution changing script: Use it as "chres XXXxYYY".
    • I acknowledge the contribution of Case Jones (philipjATNOSPAMPLEASEinterchangeDOTubcDOTca) for some of this - thank you!

  6. 3D acceleration. 3D acceleration just works on this ThinkPad under Mandrake, without any need to install binary drivers from ATI. (ATI only started being binary-only for 3D in their later cards). However, it is necessary to set the graphics to 16 bit color, as there is not sufficient memory for DRI at 24 bit color. You can test 3D acceleration by running the glxgears program.

  7. External Display and Presentations. The external display is normally a copy of the LCD (although it can be used as a dual-head setup - I've seen this in W98, and believe that it can be done using Xinerama). Fn-F7 cycles between {Internal LCD only, External CRT/Projector only, Both} - this takes about 3 seconds for the display to initialise. However, most projectors won't work at 1600x1200. This is what I did:
    1. Make sure that the modes (such as 1024x768 or 800x600) are working on the internal LCD.
    2. Plug in the projector, and use Fn-F7. If both LCD + Projector are enabled, there may be problems with timing errors. (Symptoms: Distortion/Flickering; LCD monitor may complain about timing frequencies, Projector may fail to display anything, or mis-sync giving a "sliced" image) This may be fixable, but I just dispense with the Autocue, print out the slides, and use external display only.
    3. NB. The presentation is usually given in fullscreen mode. For this, the above chres script is useless, since you then have a movable viewport onto 1/4 of your presentation! Use xrandr instead.
    4. xrandr (the X Resize, Rotate and Reflection extension) is used to change the size of the display. Using xrandr, you don't get a moveable viewport, and fullscreen mode does what you expect. See man xrandr.
    5. N.B. Using xrandr in KDE will lose the right and bottom of the desktop. So it's a good idea to have an xterm in the top left of the screen first. (and use Alt-Tab).
    6. I find it useful to start presentations with:
      xrandr -s 1024x768; /usr/lib/openoffice/program/simpress ~/mytalk.sxi ; xrandr -s 1600x1200
    7. Note to self about presentations: Prepare/Practice in advance. Text not too small. Test projector in advance. Take printout of notes. Check timing. Speak slowly - be calm/don't "gabble".

  8. There is a bug in the r128 driver which causes occasional lockups with 3D GL things. See below or here.

  9. The xev (XEvent) program is very useful to see what is going on - it prints keycodes/button press diagnostics the screen.

  10. My XF86Config-4 file is here. Good luck...

Fonts

These can be installed using the KDE Font installer (or the Mandrake one). Use KDE -> Control Centre -> System -> Font Installer. Basic mode seems sufficient.

  • Windows Fonts. Before wiping out Win98, I kept a tarball of C:\Windows\fonts\. Install the .ttf files, (but not the .fon) files. Alternatively, there are the Microsoft webfonts which are free, but not Free. However, you can get them from sourceforge.
  • Bitstream Vera fonts - kindly donated by Bitstream. Preview. Download.
  • GIMP free fonts: Download.
Apparently, "Good fonts don't need Antialiasing" - but others have a choice of being antialiased/smooth/out of focus or Non-AA/horridly spidery. Some fonts are designed for antialiasing, others are not. In general, a non-AA font looks poor when antialiased, and an AA font looks dreadful when not antialiased. The truetype (scalable) fonts do look fairly decent in KDE, provided antialiasing is turned on. Although the (non-scalable) 100dpi fonts show up in xfontsel, they cannot be chosen by any KDE applications. This is a pity, as they are the only fonts designed for not antialiasing. Mozilla, however, does get it right. One also tends to get accustomed to AA or non-AA after a few weeks. To conclude, in my view:
  1. Best: 100 dpi fonts - (designed to not be antialiased), and with antialiasing switched off. But this is not possible in KDE.
  2. OK: The best of the true type fonts, with antialiasing on. Careful choice of font face/size helps here.
  3. Poor: true type fonts with a-a turned off.
See also the Font De-Uglification HOWTO. Also, chkfontpath, xfontsel and xmag are helpful.

UPDATE and FIX - the problem with the 100 dpi fonts being unavailable to KDE is a bug in KFontInst. See KDE bugs 58823 and 55617. There is an simple fix, thanks to James Tyrer for the explanation:
[as root] Save a copy of the file: /etc/fonts/fonts.conf, and then open it in a text editor. Near the beginning of the file, you should see a list of directories with an XML tag at the start and end of each line. Something similar to this:
<dir>/usr/share/AbiSuite/fonts/</dir>
<dir>/usr/share/fonts/type1/greek/</dir>
<dir>/usr/share/fonts/ttf/western/</dir>
<dir>/usr/share/fonts/ttf/decoratives/</dir>
<dir>/usr/share/fonts/default/Type1/</dir>
<dir>/usr/X11R6/lib/X11/fonts/TTF/</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1/</dir>
(Yours will be different since this is from my system.) You should delete these. Also note that the first on might be missing a '\n' before it and might be on the end of the previous line. Then replace them with:
<dir>/usr/X11R6/lib/X11/fonts</dir>
<dir>/usr/share/fonts</dir>
<dir>~/.fonts</dir>
Save the file, make it read only so it won't happen again, make a copy of the file (e.g. fonts.conf.save) so it will be easier to fix if it happens again. Then open a Konsole and [as root] run: fc-cache -v again and see if it works. This will bring back, for instance adobe-helvetica.

External (1394) Disk

This is a 20GB Evergreen Fireline Hotdrive firewire drive, using an Evergreen PCMCIA firewire card. Detect the disc either by booting the computer with it powered on and plugged in, or by doing
rmmod sbp2; rmmod ohci1394; rmmod ieee1394; modprobe ieee1394; modprobe ohci1394; modprobe sbp2
Re-probing creates the entry for sda in /dev, BUT diskdrake wants you to format the disk before it will mount it! Calling Knoppix to the rescue, I retrieved my old configuration off the drive in question! Then, as root:
mkdir /mnt/1394 ; chmod 777 /mnt/1394
then add this to /etc/fstab:
/dev/sda1 /mnt/1394 reiserfs user,noauto,notail,noatime 1 2
Once working, if the disk is powered up at boot time, it will automatically appear. If it needs to be hot-plugged, then do:

  1. Power on the external drive.
  2. rmmod sbp2; rmmod ohci1394; rmmod iee1394; modprobe iee1394; modprobe ohci1394; modprobe sbp2
  3. mount /mnt/1394
  4. Use the drive.
To hot-unplug it, do:
  1. umount /mnt/1394
  2. rmmod sbp2
  3. Power off the drive.
To check the firewire bus, modprobe raw1394 and use gscanbus. It may also be worth investigating hotplug.

There'e another problem - if there are 2 removable devices, it isn't certain which will get /dev/sda and which gets /dev/sdb - this depends on the order in which they're plugged in - and this causes much unhappiness! I have exactly this problem (1 firewire disk, 1 microdrive)

UPDATE: I upgraded the Evergreen assembly to a 120GB disk - this simply required unscrewing the drive, changing the disk, and creating a ReiserFS partition with diskdrake

UPDATE 2 and FIX: I wrote a script which does all this: 1394mount. The modules stuff is a necessary, but ugly hack; the symlinks in /dev are (I think) The Right Thing to do. Also, change /etc/fstab to refer to /dev/1394da1

Sound

Sound works right away, but it is schizophrenic as to whether it uses the snd-cs46xx modules or the cs46xx modules. The correct driver is the snd-cs46xx, but Mandrake is "partly" configured to use the cs46xx driver. This default configuration works, but not well. Run draksound -> troubleshooting for useful advice, and lsmod to see which drivers are loaded.The fix is to change the line in /etc/modules.conf from:
alias sound-slot-0 cs46xx
to:
alias sound-slot-0 snd-cs46xx
and then reboot.
This fix also magically makes MIDI work (by creating /dev/sequencer), stops sound breaking on suspend-resume, and sometimes stops the volume from being zero on boot. (I still have alsactl restore appended to /etc/rc.local.)

Sound volumes are changed with alsamixergui (or kmix), and if required, can be manually saved/restored with alsactl. Note: alsamixer is better than aumix, because it gives you more options, such as 3d sound, and a 20dB mic boost, (which is needed to get the microphone to work properly). On this particular thinkpad, there is quite a lot of hiss - this can be cured by keeping all volumes below 90% (especially the pcm channel). [Note: the 'Master' volume in the mixer and the Hardware volume control (with the physical buttons) are not the same thing - they are in "series".]

Recording Sound: this isn't as straightforward as expected! You may find that even though you can get the mic to work through the speakers, you can't record from it! (This usually indicates that the ADC is disabled.) Here's what I had to do:

  • Start alsamixergui
  • Make sure that BOTH the Mic and ADC controls are set to capture. This means they will both have red 'lights'.
  • Mute the Mic input (the speaker icon should be greyed out). This prevents feedback.
  • Make sure that the Master and PCM volume controls are both below 90%. Otherwise, there is horrid interference if you enable Mic boost.
  • Optionally, enable the Mic boost (+20dB). This gives much greater sensitivity at the expense of some extra hiss.
  • It should now work. Try using the command: record -i mic and you should be able to see the left and right levels move up and down. If so, it's working!

  • Microphones: On my A22p, the internal Mic is dead. The external mic socket works fine with a moving coil-type microphone. (Even better, I have a small amplifier which takes the output from the 600 ohm moving coil mic, and uses a single BC109 transistor wired for emitter-degerated gain of 10). Note that some microphones (the electret type) require "Phantom power" which this laptop does not seem to provide. At a pinch, a pair of headphones can be used as a (bad) quasi coil microphone.

  • Mixers: alsamixergui, alsamixer, kmix all have the support for all the necessary controls, but the older, aumix mixer will not show the ADC and Mic Boost controls!
  • amixer is a very useful non-interactive command-line mixer control (usable in scripts etc). For example, to turn on the ADC above, do: amixer cset iface=MIXER,name='ADC Capture Switch' on

N.B. Some multimedia stuff requires packages from the plf. Here's a brief guide for multimedia:

File typeCD Audio.wav.mp3.oggvideoMIDI
Playerscdp, cdplay play xmms, mpg123 xmms, ogg123 mplayer,gmplayer kmidi, timidity

Printer, Scanner, Digital Camera

  • Printer. Use Mandrake Control Center -> hardware -> printers, or use KDE's excellent kups tool.
    • Epson Stylus Color 680 (inkjet). This was autodetected fine (as usual since Mandrake 8.0). I set up 5 different instances of it: bw_draft, bw_med, bw_fine, color_med, color_photo These are respectively: draft black/white, medium grayscale, very high quality grayscale, good colour, photo (glossy paper) colour. There's no need to have multiple instances, but it saves time when printing. (The lower quality printouts are much faster, and usually perfectly adequate.) Use the mtink program to check the ink levels. See also escputil and escputil-1.2 and linuxprinting.org
      N.B. This printer has a tendency to 'snatch' finished printouts back into the mechanism and mangle them...

    • Brother HL-1250 Laser (usb). Jams excepted, this works fine. It was autodetected and set up as per default (as laser_draft and laser_fine).

    • Note - CUPS should not be broadcasting on the network - edit /etc/cups/cupsd.conf and change '#Browsing On' to 'Browsing Off'.

    • Note - if a print job is cancelled at the GUI, it will usually finish printing the current page, and the next one.

    • If the printer goes beserk and starts printing out pages of gibberish - don't panic. This can be provoked by somehow getting the printer out of sync with the driver (eg by powering it off mid-job) - the printer then seems to interpret control instructions as text, to be printed out directly. This method is brute force, but at least it works. You need to be root:
      1. Power off the printer before it wastes any more paper. If particularly annoyed, pull out its power cable to stop it NOW.
      2. Stop CUPS using service cups stop.
      3. Delete the CUPS spool files: rm -r /var/spool/cups/*
      4. Recreate the CUPS temp directory: mkdir /var/spool/cups/tmp; chmod 777 /var/spool/cups/tmp; chown lp /var/spool/cups/tmp
      5. Kill all processes belonging to lp (use ps aux | grep lp and kill -9).
      6. With lp killed, you can now purge the parallel port buffer with rmmod lp; rmmod parport_pc; rmmod parport
      7. Restart CUPS: service cups start
      8. Turn on printer. Check that it doesn't start printing junk again.
      9. Resubmit print jobs

    • [I experienced a very weird error, in which kprinter/kups would both 'hang'. Strace-ing it showed the cause to be an error in /etc/hosts whereby my machine name (toffee-pecan.---.org) mapped to some random IP address! ]

  • Scanner: Canon CanoScan N670U (USB) now works perfectly. Even in 9.0, it was unsupported - the SANE backend was only written in January. When plugged in, an icon dynamically appears on the KDE desktop.

  • Digital Camera - I have a Nisis Quikpix QP3. This is a 'toy' digital camera, but it works straight off under 9.1. Use gphoto2 --auto-detect to identify it (as an Aiptek Pencam), then use gphoto2 -P to download images. (There are GUIs, but note that gphoto is now obsolete).

Compact Flash Card, Microdrive Reader

This is a SanDisk 6 in 1 usb reader, which I'm using for a 1 GB microdrive. If I remember correctly, this just worked. Plug in the usb cable, and use diskdrake, or add the following to /etc/fstab

/dev/microda1 /mnt/cf vfat rw,user,noauto 0 0
I wrote the cfmount script to deal with the conflict with the 1394 disk (see above) regarding which gets to have /dev/sda vs. /dev/sdb. It now works happily! Note:
  • Never remove the disk while it's mounted, or while the light is flashing. This can kernel panic the laptop, or corrupt the filestem. (It's also a bad idea to Ctrl-C the mount process!)
  • The CF card is probably best left as FAT16 for compatibility with digital cameras, and use for re-flashing a Zaurus. This means no symlinks, and no file permissions.
  • I haven't tested the 6 in 1 reader with any other media (yet).

Modem

  • This is a Lucent Technology "linmodem", however, it is well supported. See Christoph Hebeisen's page, or just download the LTmodem driver. To install, become root, and use urpmi. Then, follow the instructions and run the command /usr/share/doc/ltmodem-kv_2.4.21_0.13mdk-8.26a9/utils/checkout. This will automatically create the necessary things in /dev, i.e. /dev/modem and /dev/ttySLT0. (Alternatively, modprobe lt_serial, lt_modem each time the modem is required.)
  • If you are using shorewall (Mandrake's default firewall), then it's necessary to add the following line to the end of /etc/shorewall/interfaces, otherwise all traffic via the modem will be blocked:
    net ppp0 -
    Also, you must ifdown eth0 before dialing out on the modem, and then ifup eth0 again afterwards.
  • Then simply use kppp as the dialer, and /dev/modem as the device. A connect speed of 115200 is good here (this isn't the speed of the dialup connection, rather it is the speed at which the computer talks to the modem, and can exceed 56kbaud).
  • N.B. If you change the kernel (by installing an updated kernel, or a custom-compiled one), this driver will need updating too.

Mobile Phone - Samsung S300

I bought a Samsung S300 mobile phone. This can use IrDA, but the phone comes with a serial data cable (very nice!). It is just a regular serial modem, so, it's simply a case of plugging in the serial cable and setting the modem device to /dev/ttyS0 in kppp. See the note in the modem section about baud rate, shorewall, and ifdown eth0.

Power Management - APM/ACPI

Mandrake 9.1 nominally supports ACPI. You can choose which of APM or ACPI you use by enabling or disabling ACPI at bootup (Mandrake Control Center -> Boot -> LILO) If ACPI is disabled, you get APM. It's also necessary to decide which services (acpi,acpid/apmd) to run at boot. Here is what I found:

  • ACPI: If this is enabled at boot, then the kernel will create /proc/acpi. You can get status information by cat /proc/acpi/....., or by using acpi -V. Fn-F4, apm-s do nothing. Closing the lid merely turns off the LCD backlight. Fn-F3 is broken. You can suspend the laptop by doing echo 1 >/proc/acpi/sleep, but there is no way to wake it up again!! (Maybe a 2.5 series kernel will have better support, as ACPI is under development right now, but the default Mandrake kernel doesn't). These are the possible acpi states, which can be entered using echo X >/proc/acpi/sleep:
    XACPI StateWhat is should doWhat happens on the A22p
    1S1Monitor off/HDD spin downHDD spins down, monitor freezes, cannot wake
    2S2More power saving than S1Nothing happens
    3S3Suspend to RAMNothing happens
    4S4Hibernate to HDDNothing - but I don't have a hibernation partition
    5S5Instant power off(Not tried)


  • APM: Mandrake have re-written the apm scripts for 9.1. Nevertheless, as supplied, apm -s/ FN-F4 ("suspend to RAM") fails to resume properly about 1 time in 3. (I didn't keep a DOS hibernation partitions, so can't test Suspend to Disk). Here's what I did:
    • Make apm setuid root using: chmod +s /usr/bin/apm. This also allows KDE to suspend if the battery falls below 5% (Instead of a certain crash, it might resume.)
    • apm -s is perfectly reliable in runlevel 3 (init 3), which suggests that the problem is X-related. This can be tested using:
      for i in `seq 1 50`; do echo Attempt $i...; apm -s; echo [OK]; sleep 2; done
      Without X running, this works fine (although sound does not return).
    • The solution is this suspend_AND_resume script (Thanks to Michael Brown for help here.). This script should be owned by root, and setuid root (chmod u+s), and basically does the following:
      XPID=`/sbin/pidof X` ; kill -STOP $XPID ; apm -s ; kill -CONT $XPID.
      It also handles restarting ALSA (sound). By stopping and restarting the X-server either side of the suspend, it is prevented from crashing during it! When invoked, the script will change to VT 1, and after about 10 seconds, will suspend; the green crescent-moon LED will then turn on. Wake the laptop by pressing 'Fn'. It is also useful to change the line in /etc/sysconfig/suspend to LOCK_XFREE="no". Using this suspend_AND_resume script, everything has been reliable so far. (This script doesn't replace any other file, but it should be used where you would issue the apm -s command. I put it in /home/rjn/bin/ so it's in my $PATH.)

IrDA - Infrared

  • This basically works straight off once the right device is set. Edit etc/sysconfig/irda and change the device to /dev/ttyS1 (not ttyS2). The IR should also be enabled in the BIOS if necessary. Then using service irda start|stop will work - and will also handle kernel module loading, starting irattach, and some things in /dev i.e. irlpt0, irlpt1, irnet. The /dev entires don't appear until after a reboot - although there's probably a more elegant way around. You should also see the network device irda0 via ifconfig. (N.B. Firewall). The thinkpad has a 4 Mbit/sec FIR (Fast IR) port, although it can also do SIR (Standard IR, 115 kbps)

  • Tests: as root, do irdadump - this shows the raw packets - and should show up reflections from the thinkpad's own transmissions. Also, cat /proc/net/irda/discovery - should show up other devices, and give addresses. You can ping other devices using: irdaping <daddr> where <daddr> is the value 0xsomethingorother from irdadump. This may take a few seconds to respond. You can also see IR directly using a CCD videocamera or a phototransistor.

  • Other things: I've not investigated (yet!), but IR networking, file transfer, IR-remote control via lircd are all possible.

  • See also the Infrared-HOWTO.

Other tweaks

  1. Java - The system already has Kaffe included, but SUN also make a Linux version of their 'official' Java.
    1. Download the file from Sun. Get the RPM, install using urpmi.
    2. Remove the symlink in /usr/bin/java (which currently points to /etc/alternatives/java and thence to kaffe.)
    3. Recreate the symlink: ln -s /usr/java/j2re1.4.1_02/bin/java /usr/bin/java.
    4. Configure Konqueror: - path to java executable is: /usr/bin/java. Test by browsing some examples.
    5. Mozilla: - in the mozilla plugins directory, do ln -s /usr/java/j2re1.4.1_02/plugin/i386/ns610/libjavaplugin_oji.so. Then test.

  2. hdparm allows you to check the operation of the hard disc. N.B. This can damage the disk if misused - read the manual. On this system, everything is OK by default, but this check has found trouble on another machine.
    1. hdparm -v /dev/hda - gives information (and you can check that DMA is working)
    2. time hdparm -t -T /dev/hda - gives data transfer rate and cpu usage.

  3. /etc/hosts I transport this laptop between two networks. On one, (using DHCP), it is told to be 192.168.---.---, whereas on the other (using static IP), it is 131.111.---.---. I always want the machine name to be toffee-pecan. (Our network pcs are named after ice-cream flavours!) To prevent confusion, some names are defined in /etc/hosts. N.B. If errors occur in this file, it can cause all sorts of weirdness. My /etc/hosts:
    127.0.0.1               localhost toffee-pecan.---.org.uk toffee-pecan
    131.111.1---.---         rn214.---.---.uk rn214

  4. ntp Set up the Network time protocol using Mandrake Control Centre -> Server Configuration -> Time Wizard. [See also here.]

  5. Login Manager - use KDM - it's much nicer than MdkKDM. Firstly, use Mandrake Control Center -> Hardware -> Display Manager Chooser -> KDM. Then use KDE Control Center -> System -> Login Manager to set it up. (KDE will prompt for the root password as required). If you've installed faces-penguin from Contribs, you can now change the user icons to the old-style penguins.

  6. Shorewall - this is Mandrake's firewall. It's very easy to configure in Mandrake Control Center (or at install time). I chose to firewall off all but SSH. However, this also prevents the machine from being "pingable". The fix is to add this line to the end of /etc/shorewall/rules:
    ACCEPT net fw icmp -
    and then restart Shorewall (service shorewall restart). NB - if you run DrakFirewall again, this change will get overwritten. You can test the firewall at GRC.com's "Shields Up".
  7. Look and Feel - Personally, I prefer the old KDE Classic Icons (KDE Control Centre again), and also some new wallpaper from kde-look.org. Linux is about choice!

  8. Single clicks - Don't pretend to be Windows - use KDE Control Centre -> Peripherals -> Mouse, and choose single clicks. This is The Right Thing to do.

  9. Postfix - for email. This "just works". To read mail from the system daemons, it is sufficient to do: service postfix start, service postfix stop, then run pine. Also, specify the security administrator for msec, and edit /etc/aliases lines 79,80 from:
    # CHANGE THIS LINE to an account of a HUMAN
    root: postfix

    to
    root: rjn
    [N.B. For mail forwarding, add a .forward file in /home/rjn ;root's .forward won't work, use the /etc/aliases definition instead.]
    I don't want mail emitted directly from this machine! Firewalling off the ports, and setting a relayhost of null.example.com should do it ;-)

  10. .bashrc - I find these things useful in my /home/rjn/.bashrc file:
    export EDITOR=/usr/bin/pico     #Set the default editor to pico. Otherwise you'll get vi !
    alias grep="grep --color=auto"     #Turn on color in grep
    HISTIGNORE=l:ls:ll:la:cd:pwd     #Don't clog up .bash_history with useless commands
    if test "$DISPLAY"; then     #Set the shell name in Konsole - see below
         export PROMPT_COMMAND='echo -ne "\033]30;`basename "$PWD"`/ \007\033]31;\007"'
    fi
    The last one is so that the shell icons in KDE's konsole get a useful name - the current directory, as opposed to Shell 1, Shell 2, Shell 3 etc.
    In root's .bashrc, I have: 'echo -ne "\033]30;*`basename "$PWD"`/ \007\033]31;\007"'
    and on other machines (accessed by ssh), I have: 'echo -ne "\033]30;MACHINE-NAME:`basename "$PWD"`/ \007\033]31;\007"'

  11. Tab completion in bash: Firstly, install bash-completion which makes bash tab-completion more intelligent.
    If you aren't using Mandrake, you will find that when tab-completion would be ambiguous, the system just beeps. (unless you press tabtwice). Mandrake's behaviour is far more friendly - it gives the list of possible options. The way to do this is to edit /etc/inputrc and add:
    #Show all if ambiguous.
    set show-all-if-ambiguous on


  12. Voice over IP. Here's how I set up VoIP.

Other software (non-Mandrake)

  1. Adobe Acrobat Reader can be obtained from Adobe. Untar, install, and then
    ln -s /usr/local/Acrobat4/bin/acroread /usr/bin/acroread
    The symlink is easier than messing around with $PATH. Alternatively, pdfs can be viewed with ghostview (gv).
  2. Real Player can be downloaded from Real.com and installed with urpmi.
  3. Mozilla - the latest version can be obtained from Mozilla.org. I install this in my home directory because I tend to follow the latest version, and it avoids breaking the system-wide version. Mozilla's antialiasing may be changed by viewing "about:config" and editing it. To install Mozilla 1.4, do this:
    1. Back up ~/.mozilla. Download Mozilla 1.4, the spellchecker and the latest Java runtime (you must use 1.4.2)
    2. Read the release notes. Untar and install (in my case, in /home/rjn/mozilla1.4).
    3. Start mozilla, navigate to where the spellchecker.xpi is saved (using the file:// URL), and install it. Exit Mozilla.
    4. Install the J2RE: chmod +x the j2re-1_4_2-linux-i586.rpm.bin file, run it to create an rpm, then use urpmi. Then symlink /usr/java/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so in .mozilla/plugins/
    5. Now add to the KDE desktop (right click, create new link to application), drag to panel. (It may be worth using soundwrapper run-mozilla.sh rather than just run-mozilla.sh to make it use arts. However, it breaks suspending for me.)
    6. N.B. When moving a mozilla profile from one machine to another, or restoring from backup, the XXXX.slt part of the path is not the same. Unfortunately, these paths are give as absolute paths, not relative ones. Either:
      • Create a new profile; copy the old XXXX.slt into its directory; then replace the new XXXX2.slt directory, with a symlink to the old one. Or:
      • Follow these instructions at mozilla.org.
    7. Enjoy the new mozilla - it's really good, and a great improvement on the 0.8 series I first started to use on this laptop 2 years ago.
  4. Shockwave Flash can be downloaded from Macromedia, and comes with an install script which just works. (If run as non-root, it will install in ~/.mozilla/plugins.) N.B. Mandrake's own version of Mozilla already has flash installed. [If it doesn't appear when viewing Help->About Plug-ins, make sure that libstdc++2.10 is installed.]

Xscreensaver

The KDE screensaver is nowhere near as nice as the xscreensaver package. Install it using urpmi, and also install the really slick screensavers (urpmi rss_glx) and fireflies (urpmi fireflies). Then disable the KDE screensaver from starting automatically, and add the following into ~/.kde/Autostart/startup.sh:
kstart xscreensaver -nosplash 2>/dev/null &
Then configure to taste using xscreensaver-demo. Note the following:

  • The really slick screensavers/fireflies are not available to xscreensaver by default. You need to edit the .xscreensaver file to add them.
  • There's some information here, or you can use my ~/.xscreensaver file. Remember the "\n\" at the end of each line.
  • Do NOT use the euphoria/plasma screensavers. Euphoria will "reliably" crash the machine if invoked in cubism mode; plasma will sometimes do this. hufo_tunnel will lock the system if used in "fast" mode. Colorfire will also "reliably" lock up. This is probably specific to this ATI driver on this system with XFree86 4.3.5. (See this bug.)
(xpenguins -a -b is also fun - but you need to enable "Programs in desktop window" in KDE->Control Centre->Look and Feel->Behaviour.)

Wine

Wine is for running windows applications under Linux. It currently works rather well. As a rule of thumb, if it works under Win9x, it will probably work. I have used it successfully with a Forest Electronics Serial PIC Programmer.
Wine can be installed either via urpmi wine wine-utils or compiled from source (Just follow the README) and it works. It's also necessary to install X11R6-contrib. Wine can either be configured by editing ~/.wine/config or by using the wine-setup utility from www.codeweavers.com

Stopping it "rattling"

This laptop lives in the same room as me. So I'd rather it doesn't rattle the hard disc all the time when I'm not using it. Check for culprits using:
find / -mmin -2 -print | grep -v proc

  • The worst is mailman, so remove it with urpme mailman.
  • Uninstall process accounting - it's rather pointless on a single-owner laptop! It also causes disk writes every 15 seconds. Remove with: urpme psacct.
  • Shorewall should not write out the logfile to disk to often. Edit /etc/shorewall/shorewall.conf to have:
    LOGRATE=1/hour
    LOGBURST=5
  • Check for (and remove) spurious cron jobs.
  • sshd-restarter runs every 5 minutes by default. Change this to every 30 minutes in /etc/cron.d/sshd-monitor.
  • Stop CUPS regenerating it's certificate every 5 minutes: once every 2 hours will do! Change /etc/cups/cupsd.conf to have
    RootCertDuration 7200
  • Mozilla should not check for new messages more than about once per 5 minutes as that also causes disk activity.

SSH and keys

SSH (secure shell) is wonderful. If ssh and sshd are installed, it will "just work". So will scp. (These are secure replacements for telnet and ftp respectively). However, there are more clever things that can be done, to save having to enter passwords repeatedly.

  1. ssh-agent uses a public-private key pair together with a passphrase to authenticate without password entry, except for the first time you log in.
    1. Generate keys using:
      ssh-keygen -t rsa
      This generates a public/private key pair in ~/.ssh . Do set a passphase!
    2. Copy the public key to remote server(s). The public key is ~/.ssh/id_rsa.pub and should be appended to the file ~/.ssh/authorized_keys2 on the remote machine. (In newer versions of ssh, the file is authorized_keys without the 2.) N.B. Do not distribute your private key!
    3. Make sure that ssh-agent is running. It must be the parent of any process that wishes to use it, so log out of X and back in again. (Mandrake already has /etc/X11/Xsession suitably configured.)
    4. Do ssh-add to add the key/passphrase to ssh-agent. If the input is not a console (i.e. redirect from /dev/null), it will pop-up a dialog box. (ssh-askpass is probably needed.) I added the following line to my ~/.kde/Autostart/kde-startup.sh file:
      ssh-add < /dev/null
    5. For convenience, set up some aliases in ~/.bashrc eg alias sshfoo="ssh me@foo.bar.com".
    6. You now have to enter your passphrase once each time you start KDE, and that's it!

  2. ssh-agent is great, but it has a limit that the process using it must be a child of ssh-agent. This means, for example, that one cannot use passwordless scp in a cron job. The solution is to install keychain:
    1. Install it with urpmi keychain
    2. The entry in ~/.kde/Autostart/kde-startup.sh above is now redundant - remove it.
    3. Sort out process parentage. It may suffice to killall ssh-agent, and restart X, but I found it quicker to reboot than to investigate :-)
    4. To use keys in a script run by cron, simply source the file which is in ~/.keychain. For bash scripts, use:
      . /home/me/.keychain/machine_name-sh
    5. The passphrase will now persist until the machine is re-booted, and all applications can use it, if they have the necessary permissions.
    6. This page at IBM developerworks is very helpful, BUT, it refers to ~/.ssh-agent whereas Mandrake use the file ~/.keychain , so beware!
    7. See also keychain --help and note the option keychain --clear.
Also, see below for the Mandrake Security announcement mailing list.

ttySlog - Serial Port Logger

It isn't really relevant here, but I wrote this ttySlog script to log data from the serial port to a file. I think it's useful.

Shell Scripts

Here are a few useful (well, I think so) shell scripts I wrote. Warning: use at your own risk - you should probably read them first! Please send any bug reports to me.

  • Trashcan:
    • cn - a "trashCaN" script - meant to be used instead of "rm" to move files to the trashcan.
  • Backup:
    • Note: you need to read these scripts, and customise the first few lines to suit your own setup.
    • nightly-backup_rsync-ssh.sh - a backup script to save rotating snapshots of /home/rjn to another server. This works via ssh and rsync, and has the nice property of keeping 2 weeks' worth of complete archives without wasting space. It uses a clever trick with hard links, thanks to: Mike Rubel. I run this nightly from cron.
    • nightly-backup_firewire-hdd.sh - a backup script to create rotating snapshots of /home/rjn on an external firewire drive (based on the above)

Documentation

In addition to the links given above, I can also recommend the following:

To Do

Given time, I would also like to do the following:

  • Figure out how to use the S-Video input and output that the Thinkpad has.
  • Encrypt $HOME in case of theft.


Summary

This is a good laptop. It's my 3rd ThinkPad, and I shall soon buy a 4th. It works well under Mandrake, although it can still benefit from some configuring. 9.1 is Mandrake's best release yet - very polished, in almost all ways - and I've filed bugs in Mandrake/XF86 for the issues above. I'd be more than happy to help anyone else if I can. Please do contact me if you have any questions, would like help, or alternatively, if you want to point out a glaring error in the above!

Back to my Home Page


Linux on Thinkpads Webring

This site is a member of WebRing.
To browse visit Here.