Debian Squeeze on a ThinkPad X201

Note: boot windows first and create the Rescue and Recovery Media immediately after unboxing..

Note #2: yes, there are Intel i915 video issues, but both the Debian Squeeze d-i graphical and text installers work fine with this video chipset, however, the screen is blank on first boot – either a) install the SSH Server task and log in via ssh for module and xorg.conf edits, or b) boot into single user mode on first boot with “i915.modeset=0” to make the edits.

Note #2 Update: linux-2.6 version 2.6.32-19 was uploaded to unstable 2010-08-05 – this kernel image is working well for me and none of the configuration changes to get vesa working should be necessary.

How not to start:

The very first thing I did, after opening the box, was boot the latest Debian Squeeze net install from USB and got to work – I had a heck of a time with R&R Media creation after the fact. R&R 4.3 is quite different than older versions, and I could not boot into it from the Grub bootloader – writing Grub to the master boot record, as I usually do, hosed booting to the Rescue and Recovery partition as well as using R&R fully from within Windows 7 for some reason. Attempting to reinstall R&R 4.3 fails while trying to write the MBR (which is IBM/Lenovo’s suggested fix to MBR problems..)

I finally got the media created on an 8GB USB flash disk, after some dreaded Windows MBR hacking only to find that the R&R USB key was not bootable, and I could not create the Recovery Media a second time – one attempt is all you get.. After mounting the R&R partition (label: Lenovo_Recovery) under linux and digging around, I found the simple edit of $MOUNT/factoryrecovery/service_done.ini from “DONE=1” to “DONE=0” allowed the factory reset Recovery Media to be written again. Nice. The trick to getting my USB key to be bootable was to completely zero out the boot blocks of the key, plug it in while running windows and quick format NTFS on it, and then go fire up R&R Rescue Media creation – the boot and data recovery media takes up ~6.5GB on the key. Now that I finally had bootable recovery media, the X201 got a factory reset so I could start over fresh.. all my previous day’s research and gave me some ideas on how I wanted to proceed.

Starting from unboxing the X201: 😉

Note: the goal here is to have a working ThinkVantage button to access the Lenovo Rescue and Recovery partition, as well as a fully functional Windows 7 and Debian Squeeze dual-boot. The key to this is to not touch the Windows/Lenovo MBR. Do not install Grub to the MBR!

Boot Windows 7 and run through the quick user setup stuff. 1) Create the Rescue and Recovery Factory Restore Media – I used an 8GB USB flash disk. (make sure the thing actually boots..) 2) Shrink the Windows7_OS volume from within Windows (Start – right-click on Computer – Manage, then something like storage or disks.. select the Windows partition and shrink it – the space used was about 22GB (sad as there is nothing but the OS, Lenovo tools, and an unlicensed MS Office installed..), so I gave it 40GB. (BTW, ntfsresize within d-i worked fine on my first install, but using the volume shrink within Windows to free up space was simple and certainly assured to be pleasing to windows..)

Boot the Debian Squeeze d-i installer and install as normally in the free space, but do not install Grub to the MBR. Install Grub to the /dev/sdaX device that you set up for the “/” filesystem (or “/boot” if you set up a separate boot partition). I usually use a 256MB USB flash disk with the netinst.iso and non-free firmware for installing on anything that I don’t PXE boot. This is not a d-i lesson – google how to do this.

It is probably possible to re-set the bootable bit on the Windows partition during install – d-i attempted to set the bootable bit on my “/” partition (it’s extended and actually won’t set it), removed the bootable bit from the Windows partition, and upon reboot after install, I got no bootable partitions found. A quick run back into Rescue Mode in d-i, and a toggle bootable on the Windows partition with fdisk is all that took – Windows booted back up fine as normal, the ThinkVantage button works fine, and all is well.. except no default Debian boot, yet.

So as not to screw up the killer ThinkPad feature of the blue ThinkVantage button, this means leaving the Lenovo-customized Windows 7 Master Boot Record intact. I decided to try to use the Windows bootloader to boot to grub on my Debian “/” partition. In my digging around on my Lenovo R&R access issues, I found a reference to EasyBCD by NeoSmart to manage dual-booting Windows versions – this little Windows utility manages the cryptic BCD (Boot Configuration Data database) to easily set up booting a multitude of operating systems. Bravo – trying to do this all by hand was miserable..

After installing EasyBCD, I added a Debian boot menu entry, set it as the default, set a timeout of 3 seconds under “Change Settings”, saved my changes, and rebooted.. Windows boot menu comes up, boots grub from my “/” partition, and everything looks great.. oh yeah, no video 🙂

Edit /etc/default/grub and set:

GRUB_CMDLINE_LINUX="i915.modeset=0"

run (as root):

update-grub

Edit /etc/modprobe.d/i915-kms.conf and set:

options i915 modeset=0

run (as root):

update-initramfs -u

Create /etc/X11/xorg.conf (as root) with:

# Minimal xorg.conf for the device driver
Section "Device"
	Identifier	"Default screen"
	Driver		"vesa"
EndSection

Reboot. Perfection. (until Intel gets their video driver support sorted out..)

By the way, this X201 is the type-model 3249-CTO – here’s the lspci output:

00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:16.3 Serial controller: Intel Corporation 5 Series/3400 Series Chipset KT Controller (rev 06)
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)
00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 06)
00:1c.4 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 (rev 06)
00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller (rev 06)
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
02:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 35)
ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)

If you have 4+GB RAM and are using the i386 architecture, install linux-image-2.6-686-bigmem (I thought about installing x86_64, but I’m currently having to hack around day-to-day issues like using flash and enigmail on my 64-bit desktop install..). If you didn’t set up non-free firmware during install, then go do that. I have the Intel Centrino Ultimate-N 6300 wireless card, so d-i installed the firmware-iwlwifi package for me.

My Thunderbird 3 Fix-ups

I’ve been using the Mozilla Thunderbird email client for many years and found a few annoyances upgrading from v2 to v3 – here are my gotchas and fixes for it to fit my email habits.

While I’m sure it’s great for most people and cases, if you have the slightest bit of complexity in how you might connect to your mail server(s), the auto-account-creation wizard blows.. With one personal email account (on my own mail server), the account setup wizard worked out most of the settings pretty closely, however, my work account and a couple others went haywire and set up everything completely wrong. If you let the wizard run for any amount of time, it attempts to find servers by DNS and writes the account profile to disk in the wrong place just because some DNS name exists. The trick is to enter your Name and Email account in the very first window, then get ready to mash Stop immediately after continuing on to the next window. Then you can hit Manual Setup and add all the settings correctly and things are written to disk in the correct locations, etc.. There really needs to be a Manual Setup option on that first account creation window that bypasses the auto-account discovery, or a config setting to disable the discovery altogether. I like automagic things, but there always needs to be a sane manual option. Period.

Next up is the thread pane headers (thread, starred, sender, date, etc.).. In TB2, you set the headers in one view, and all folder views are the same. I can understand people wanting to have different views, but there is no option to set all views the same, so every single folder has to be modified.. This sucks when you have lots of folders and I have tons of them. There is a workaround – do not log into the account on the first prompt – set the thread pane headers you want on the Inbox, and most (not all) will inherit the Inbox view. Then log in later and fix the few incorrect views that remain (Drafts, Trash, etc.).

While you have the account created and have not logged in the first time, yet, you might want to dig through the account settings and decide if you want a few things changed – particularly under Synchronization & Storage.. no, I don’t want to keep all messages locally – I use IMAP – uncheck that box. I really don’t want to store gigs of messages locally by default – the whole point of IMAP is to keep the messages on the server. I also read some notes from people that use POP3 and (used to) “keep messages on server” – the default TB3 POP3 account creation pops all the messages off the server and deletes them from the server – be aware.. (and you should really be using IMAP, if you want this behavior anyway)

As of writing, the GPG/OpenPGP plugin, Enigmail, does not have a functional x86_64 Linux port for TB3 in the Add-Ons widget.. sigh.. There is a contributed port built on Arch Linux on the Enigmail download page that works for me. This should be fixed soon in the official Add-Ons widget, I suppose.

Some of my about:config modifications for sane behavior (Edit – Preferences – Advanced – Config Editor):

  • mail.check_all_imap_folders_for_new; true
  • mail.operate_on_msgs_in_collapsed_threads; false
  • mail.tabs.autoHide; true
  • mailnews.display.prefer_plaintext; true
  • mailnews.nav_crosses_folders; 0

OK, it’s just about time to actually log in and fetch mail! A bit of IMAP header fetching and on to reading some mail, changing the toolbar buttons to small, and then I found the message header collapse is gone.. Ah, there is a nicely working add-on for that: CompactHeader by jmozmoz Thank you, thank you!

And on restart of TB3, I end up in whatever folder I was last viewing on shutdown.. and very odd behavior of password prompting, if it was a nested folder (duplicate login prompts..). And no where is there an option to configure “Start in my f’ing Inbox”. This is retarded, in my opinion – who asked for this “feature” anyway? Once again, there looks to be a sort-of-working plugin for this (and once again, this is a manual download/install, at the moment): Select Inbox by Bogdan Rechi This works ok in starting up in the default account Inbox, but the weird password prompts still remain – looking at the plugin code, this is run at start time – my suggestion for TB3 is for the plugin to switch to the default Inbox at shutdown, and let TB3 just start normally. When I start up TB3 after hitting my Inbox prior to shutdown, I don’t get the strange duplicate login prompts at startup.

The default “New Messages in Folder” text color (they dumped the little star..) and the basic highlighting on folder pane, thread pane, message pane selections and focus are crap – almost unreadable blue text on blue background for “New Messages” on the default Debian Gnome theme – blue selected folders look nearly identical to the blue selected+focus folders. The colors are essentially just pulled from the OS color theme, which is fine, but it is very difficult to differentiate where the focus is – I use this visual queue a lot when scrolling up/down with the keyboard while drilling through folders or message threads. The only way to configure this is by setting up custom CSS rules via userChrome.css. My ideas came from the Mozilla Folder Pane Color for New Mail notes and from this killer resource for TB mods – here is my custom userChrome.css:

/*  Tree Text Highlighting (folders, thread pane, address pane, etc.)
    Highlight focused items, but use black on lightgrey when not in focus */
    treechildren::-moz-tree-cell-text(selected) {
        background-color: lightgrey !important;
        color: black !important;
    }
    treechildren::-moz-tree-cell-text(selected, focus) {
        background-color: Highlight !important;
        color: white !important;
    }
    tree[selstyle="primary"] > treechildren::-moz-tree-row {
        border: none !important;
        background-color: transparent !important;
    }
    treechildren::-moz-tree-row(selected) {
        background-color: lightgrey !important;
    }
    treechildren::-moz-tree-row(selected, focus) {
        background-color: Highlight !important;
    }
/*  Folder Pane Color for New Mail */
    treechildren::-moz-tree-cell-text(folderNameCol, newMessages-true) {
        color: black !important;
    }
    treechildren::-moz-tree-cell-text(folderNameCol, newMessages-true, selected) {
        color: black !important;
    }
    treechildren::-moz-tree-cell-text(folderNameCol, newMessages-true, selected, focus) {
        color: white !important;
    }

That about covers my fixes for my Thunderbird 3 sanity – if I need to set it up again and remember any other changes, I’ll add them in.

Update: I added in the config option to disable the new brain-dead collapsed thread display – nice try, Mozilla, but you can’t actually expand it and navigate with the keyboard, so FAIL.. mail.operate_on_msgs_in_collapsed_threads; false

mplayer Video File Properties

I was looking for some native 1080/720p HD media files and also comparing some lower resolution files played back on a new HDTV. Many times you can get some quick info on media file properties with the ‘file’ utility:

mshuler@gaea:~$ file Life.Of.Brian.1979.avi
Life.Of.Brian.1979.avi: RIFF (little-endian) data, AVI, 640 x 336, 25.00 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

or not..:

mshuler@gaea:~$ file Three.Days.of.the.Condor.1975.mkv
Three.Days.of.the.Condor.1975.mkv: Matroska data

A quick look at the ‘mplayer’ man page gave me the options I needed to get all the properties without playback of the file:

mshuler@gaea:~$ mplayer -identify -frames 0 Three.Days.of.the.Condor.1975.mkv
MPlayer SVN-r30656 (C) 2000-2010 MPlayer Team
Playing Three.Days.of.the.Condor.1975.mkv.
ID_CHAPTER_ID=0
ID_CHAPTER_0_START=7000
ID_CHAPTER_0_NAME=The American Literary Historical Society
ID_CHAPTER_ID=1
ID_CHAPTER_1_START=557633
ID_CHAPTER_1_NAME=Out to Lunch
ID_CHAPTER_ID=2
ID_CHAPTER_2_START=1125799
ID_CHAPTER_2_NAME=Condor
ID_CHAPTER_ID=3
ID_CHAPTER_3_START=1649965
ID_CHAPTER_3_NAME=The Ansonia Hotel
ID_CHAPTER_ID=4
ID_CHAPTER_4_START=1990799
ID_CHAPTER_4_NAME=Still in Flight
ID_CHAPTER_ID=5
ID_CHAPTER_5_START=2430633
ID_CHAPTER_5_NAME=Some Safe Quiet Time
ID_CHAPTER_ID=6
ID_CHAPTER_6_START=3135166
ID_CHAPTER_6_NAME=Sam's Apartment
ID_CHAPTER_ID=7
ID_CHAPTER_7_START=3594665
ID_CHAPTER_7_NAME=Lonely Pictures
ID_CHAPTER_ID=8
ID_CHAPTER_8_START=4166199
ID_CHAPTER_8_NAME=The Mailman
ID_CHAPTER_ID=9
ID_CHAPTER_9_START=4772166
ID_CHAPTER_9_NAME=Sparrow Hawk
ID_CHAPTER_ID=10
ID_CHAPTER_10_START=5111499
ID_CHAPTER_10_NAME=The Suspicion Business
ID_CHAPTER_ID=11
ID_CHAPTER_11_START=5316665
ID_CHAPTER_11_NAME=Leonard Atwood
ID_CHAPTER_ID=12
ID_CHAPTER_12_START=5778032
ID_CHAPTER_12_NAME=Fine Qualities
ID_CHAPTER_ID=13
ID_CHAPTER_13_START=6068332
ID_CHAPTER_13_NAME=Oil Fields
ID_CHAPTER_ID=14
ID_CHAPTER_14_START=6338665
ID_CHAPTER_14_NAME=For that Day
ID_CHAPTER_ID=15
ID_CHAPTER_15_START=6653499
ID_CHAPTER_15_NAME=Telling Stories
ID_VIDEO_ID=0
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
ID_AUDIO_ID=0
ID_AID_0_LANG=eng
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang eng
ID_SUBTITLE_ID=0
ID_SID_0_LANG=eng
[mkv] Track ID 3: subtitles (S_VOBSUB), -sid 0, -slang eng
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [avc1]  704x352  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=Three.Days.of.the.Condor.1975.mkv
ID_DEMUXER=mkv
ID_VIDEO_FORMAT=avc1
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=704
ID_VIDEO_HEIGHT=352
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=2.3693
ID_AUDIO_FORMAT=8192
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_LENGTH=7032.90
ID_SEEKABLE=1
ID_CHAPTERS=16
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
ID_AUDIO_BITRATE=448000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=ffac3
Starting playback...
Exiting... (End of file)
ID_EXIT=EOF

MacReport.Net Media Publishing, Inc. <- IDIOTS..

Public notice to the idiots at MacReport.Net Media Publishing, Inc.:

For over a year, various morons at your organization have been sending email to my gmail.com address. Repeated replies requesting that the senders completely remove my email address from your organization’s contact lists have failed. Various forms of assuredly private information including profit/loss statements, merchandise invoice information, requests for payroll adjustments, insurance bills and quotes – stuff that I’m sure would be unfortunate to have publicly known – have been repeatedly sent to me.. This is my last reply in an attempt to address your incapacity to figure out who the hell you are sending email to. Today, I received two more emails from Patricia A. Phillips, so this is it..

If you cannot figure out how to manage your email and I receive future messages from your organization, I will simply publish each and every message, past and present, in a conspicuous place such as reddit.com for feedback from the public.

Thanks.