Smokes your problems, coughs fresh air.

Tag: T61

Gentoo update: WiFi drivers (iwl4965)

When I got the Wireless working on this laptop (a Lenovo T61), I was using Linux kernel 2.6.25. I remember that it was quite a pain, because the iwlwifi stuff had only just stabilized enough to replace the (now deprecated) ipw stuff. One of the things I didn’t get working at the time was Monitor mode.

Now, I’m upgrading to kernel 2.6.29, and there have been some changes to the kernel configuration for the iwl4965 driver. CONFIG_IWL4965 is now a suboption of CONFIG_IWLAGN. The wireless didn’t work on the first boot however. eth0 didn’t work either. But, when I changed the wired driver from “Intel PRO/1000 Gigabit Ethernet” (CONFIG_E1000) to the same for PCI-express (CONFIG_E1000E), it did work on the next boot and the wireless magically started working too. πŸ˜•

I was surprised because I don’t see what the wired and the wireless driver have got to do with each other. Also, before, I’ve always successfully used the non-PCI-express driver for my wired Ethernet interface and I’m so old fashioned that I can’t imagine either way that my hardware uses something so modern as PCI-express. πŸ˜›

Anyway, it works now. I’ve gone from kernel 2.6.25 to 2.6.29 and everything seems to be working. I still have to find out how to get Monitor mode working though.

One final thing I noticed is that upgrading net-wireless/iwl4965-ucode created an extra entry in my world profile: net-wireless/iwl4965-ucode:0. I wonder what that is for.

Gentoo update: e2fsprogs blocks e2fsprogs

Yesterday evening, I dropped by at Wiebe‘s with my laptop to start updating our Gentoo systems together. I hadn’t updated this machine since first installing it in spring last year, so I expected quite a few problems. The first blockage that we both had to solve was caused by e2fsprogs.

Wiebe searched the forums for help and found an unfortunate abundance of it. Eventually, I decided to give one of the many contradictory tips a try, although it seemed risky.

$ emerge --unmerge --ask --verbose e2fsprogs

Until you reinstall e2fsprogs, you won’t have any of the ext2/3 utilities such as e2fsck. So, reinstall immediately:

$ emerge --oneshot --ask --verbose e2fsprogs

This will remove libcom_err and libss, and replace them with e2fsprogs-libs, thus solving the blockages.

Wiebe tried an alternative route by first unmerging com_err and ss, and then replacing e2fsprogs. This didn’t work as expected, probably because he had kerberos in his use flags. libkerberos used libcom_err, which broke wget. Scp’ing the distfiles to him didn’t work either (OpenSSH also has kerberos support). Neither did mounting an USB stick with the files. Luckily, Thunderbird still worked, so I emailed the distfiles and the problem was solved. We found it amusing to have to use e-mail while being in the same room. πŸ˜‰

The reason why this blockage occurred is not entirely clear to me. What I do understand is that com_err and ss were both provided by the e2fsprogs project and are now deprecated in favor of e2fsprogs-libs. Also, it’s clear that the new libraries are binary compatible with the old libraries or his system would have remained unusable, even after merging e2fsprogs-libs.

Before we tackled this problem, I had only updated portage and net-print/foomatic-db-ppds (also a blocking situation). Afterwards, I had just some motivation left to update krb5. Which leaves another 282 packages for the next get-together.

My quest for the ultimate Bash prompt

On my new laptop (a Lenovo T61) I was still using the default Gentoo prompt in Bash. This was kind of a shame since my last Gentoo installation (on what is now my sister’s Ubuntu machine) had a beautifully customized prompt. It was time to dig up the old escape codes.

The old

To recover my old prompt I didn’t even need to go rummaging through old files. All I had to do was to find an old forum post on the Gentoo forums. But, I noticed immediately that I didn’t like this old prompt so much anymore. It had too much stuff and it didn’t have very strong root warning signals.

My old Bash prompt

My old Bash prompt

My old Bash prompt as root

My old Bash prompt as root

The new

My new Bash prompt

My new Bash prompt

For my new prompt I used the PROMPT_COMMAND environment variable. The command in this environment variable is always run before the prompt is displayed. This means that, if you set the PS1 environment variable from this command, you can change your prompt depending on circumstances.

I pushed the dollar (or hash)-sign all the way to the left because I often type in very long commands. A little more space is used if there are background jobs, but only if there are background jobs.

My new Bash prompt with background jobs

My new Bash prompt with background jobs

You should never be root for too long, so I made being root very noticeable (and even slightly annoying):

My new Bash prompt as root (and with background jobs)

My new Bash prompt as root (and with background jobs)

The following is the code I use to create the prompt. Stick it wherever you want it (e.g. in your user’s bashrc or in the system-wide bashrc) and adjust it to look nice and play nice with the rest of your environment. The code isn’t pretty, but it does what it has to. πŸ˜‰

prompt_command {
  [ "$(jobs | head -c1)" ]; BGJOBS=" $BGJOBS_COLOR(bg:\j)";
  [[ ${EUID} == 0 ]] ; DOLLAR_COLOR="\[\e[1;31m\]";
  [[ ${EUID} == 0 ]]; USER_COLOR="\[\e[41;1;32m\]";
  PS1="$XTERM_TITLE$USER_COLOR\u\[\e[1;32m\]@\H:\[\e[m\] \[\e[1;34m\]\w\[\e[m\]\n\
$DOLLAR$BGJOBS \[\e[m\]"
} PROMPT_COMMAND=prompt_command

More info

If you want to learn more about customizing your prompt, there’s an article up at IBM’s website. From it, I stole this nice color table:

Console color codes table

Console color codes table

Another tip: you can type man console_codes for everything about … console codes.

Using Caps Lock as an extra Control key

With me mostly posting about computer stuff on this weblog, it might surprise you that, until May this year, I hadn’t owned a personal computer in years while the last one that I did own was a slow pig grown from some old parts of an even slower pig and some second-hand replacements. So, you can image my joy when I got a shiny, new Lenovo Thinkpad 61 this spring.

One of the joys of once more owning a personal computer is that I don’t have to live through PuTTY anymore. (I used to SSH to the local Debian server here if I wanted to get anything done.) I’ve reacquainted myself with Gentoo and I’m loving it. Of course, there’s a lot more to configure than with Ubuntu (which supports the T61 very neatly out of the box), but that’s the whole point; I want to be able to configure everything my way and I want to update my knowledge about how Linux systems are made up these days. Control.

On the topic of control, the Control key on the Lenovo keyboard, as with many laptop keyboards that I’ve encountered, is in a bit of an awkward position, squeezed to the right by the Function key. Since, I very much depend on the Control key for shortcuts (in just about anything, but especially in libreadline-based programs), I decided to change the Caps Lock key to be an extra Control key. I’ve never actually used the CapsLock key in my life, I probably never will, older keyboards used that very spot for the Control Key, and why not? It’s a much better spot, requiring less gymnastics for my little pinky to reach. Once I considered this I was actually puzzled about why I’ve always wasted such an well-accessible key position.


On to the configuration. I wanted this to work in both Console mode and in X. But first X. In the xorg.conf, I went to the InputDevice section for my keyboard and added ctrl:nocaps to XkbOptions. The full XkbOptions line now reads:

Option "XkbOptions" "ctrl:nocaps,altwin:menu,compose:ralt,eurosign:e"

That’s it. I had to take a few more steps to get it to work in the console also.


First, I created a file called “/etc/extra-key-conf” with the following contents:

keymaps 0-15
keycode 58 = Control

Then I added the following to /etc/conf.d/local.start. This is a Gentoo specific script that is loaded by /etc/init.d/local.

[ -z "$DISPLAY" -a -e /etc/extra-key-conf ];
        loadkeys /etc/extra-key-conf &>/dev/null

What this does is to check if the $DISPLAY variable isn’t set (of which we can be sure in this context, but may be useful if you plan to copy this snippet). It also checks if /etc/extra-key-conf exists. If both conditions are satisfied, loadkeys is called with that file as its argument.

In conclusion

I can really recommend this configuration even if your Control key is not awkwardly positioned on your keyboard. Do you use your Caps Lock key? Regularly? If you don’t, this will make your keyboard use more effective.


If you want to read into this more extensively, I recommend the Remap Caps Lock article from the Portland Pattern Repository.

My CD-RW drive can read everything it writes

The HL-DT-ST CD-RW/DVD drive in my Lenovo T61 laptop, has a certain peculiarity. I was burning an ISO image, wich exceeded the supported size of a standard 80 minute CD by 7 MB. (The image was 707 MB.) Using cdrecord with the -overburn option seemed to work, until I tried to mount the CD-ROM. It would inevitably—

# mount /dev/cdrom /mnt/cdrom -t iso9660
mount: block device /dev/sr0 is write-protected, mounting read-only

Well, that is unexpected! I was going to write that it would refuse with some errors in dmesg about trying to access data beyond some boundary. But I probably messed up something very trivial, because I just can’t seem to reproduce the error in any way as the mount result above shows.

Let’s backtrack everything I did to try to fix this problem.

First, after numerous attempts to mount the 700 MB sized CD, I gave up and asked my little sister to bring me my stack of 800 MB CDs next time she’d come. Of course, over a week went by without her remembering to take the CDs. But eventually, I picked them up myself.

Having retrieved the 800 meg CDs, it came time to test them. Burning went well. Then mounting… A failure with dmesg showing the familiar error (which I now can’t look up because I can’t reproduce the problem πŸ˜› ). Mounting it in the local server’s drive worked fine, though, leading me to think that my burner can’t read CD-ROMs it has written with overburn enabled.

Luckily, I was wrong. But I really don’t understand why I did get the errors at first. Sure, I did notice a faulty entry in my fstab, but I had also tried mounting it without relying on the fstab (i.e., with mount -t iso9660 /dev/cdrom /mnt/cdrom), which begot me the same error… Also, I had mounted plenty of CDs before this adventure.

All I can do to explain this is to concede that this is one of those problems where you usually call a geek friend telling them you can’t get something to work. They’ll reply by asking you have you tried this and that? Of course I have, at least twice, in the exact same sequence as you describe! Well, humour me then, and try it once more… Fuck! Fuck! Fuck! And why didn’t it work 10 minutes ago?! Don’t tell me you’ve never had this happen to you. Please?

In conclusion, after finding out that the 800 MB CD did work on my laptop, I reclaimed the 700 MB CD as well (which was now serving as a hawk-deflector in the coop) to find out that, even after being exposed to lots of rain and sun for over a week, this CD also mounted without hesitation.

© 2024 BigSmoke

Theme by Anders NorenUp ↑