Cody Mello – Student, Computer Geek, Francophile

Everything, IMHO.

Installing Gentoo on a ThinkPad W520

About a week ago, I received my brand spanking new ThinkPad W520, which I intend to use for school for the next 5 years. It came preinstalled with Windows 7 on it, which was okay, but really, that just doesn’t work for me. So, I decided that I wanted to replace it with Gentoo Linux. This was my second time configuring a Gentoo system, and it was more difficult than the previous one, since it involved a lot playing with the drivers. But, I have most things working now. I intend to document as much as I possibly can here, so as to help others.

Beginning

Before you do anything, you may want to burn Product Recovery discs, just in case. I believe that you can find the option for doing this under Lenovo ThinkVantage Toolbox. Also, of course, if you have any data that you want to back up, now is the time. I wiped out everything that came on the system. If you want to keep your Windows partition, you may want to read this first, if you were thinking about still using your Rescue and Recovery partition.

BIOS Settings

Currently, NVIDIA Optimus doesn’t work under Linux. There is a project called Bumblebee that has made considerable progress, but at this moment and to the extent of my knowledge, it’s not stable. Therefore, you must turn off Optimus. I switched over to discrete graphics. It uses more power than integrated, but that’s alright with me. I’ll only be discussing how to set up discrete. I might set up integrated if I get around to it. I’ll add that here when and if I do.

You may also want to set your back USB port (the yellow one) to always be on.

What will be covered

I won’t go over every nitty, gritty detail of the installation. That’s why the Gentoo Handbook exists. I will however tell you the parts that may not be so clear at first, which drivers to install for different devices, etc. I will also throw in my own personal choices here and there.

For a hardware comparison, here’s my lspci output:

00:00.0 Host bridge: Intel Corporation Device 0104 (rev 09)
00:01.0 PCI bridge: Intel Corporation Device 0101 (rev 09)
00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation Device 1502 (rev 04)
00:1a.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation Cougar Point High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 5 (rev b4)
00:1c.6 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 7 (rev b4)
00:1d.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation Device 1c4f (rev 04)
00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation Cougar Point SMBus Controller (rev 04)
01:00.0 VGA compatible controller: nVidia Corporation Device 0dfa (rev a1)
01:00.1 Audio device: nVidia Corporation Device 0bea (rev a1)
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. Device 8176 (rev 01)
0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 05)
0d:00.3 FireWire (IEEE 1394): Ricoh Co Ltd Device e832 (rev 04)
0e:00.0 USB Controller: NEC Corporation Device 0194 (rev 04)

Hard Drives And Filesystems

How you lay out your partitions is your choice. For reference, here’s mine:

atlas # fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xca48b3eb

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 124927 61440 83 Linux
/dev/sda2 124928 21096447 10485760 82 Linux swap / Solaris
/dev/sda3 21096448 125954047 52428800 83 Linux
/dev/sda4 125954048 250069679 62057816 83 Linux

And my /etc/fstab:

atlas # cat /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

#

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1 /boot ext4 defaults,noatime,discard1 2
/dev/sda3 / ext4 noatime,discard 0 1
/dev/sda4 /home ext4 noatime,discard 0 3
/dev/sda2 none swap sw 0 0
/dev/sr0 /mnt/dvd-rom auto auto,ro,user 0 0

proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0

You probably won’t need it, but it gives you an example.

If you have an SSD, read on. If you don’t, skip this. Note the discard options. If you have an SSD, and you want it to still be running optimally a year from now, you’ll need TRIM support. Check the linked Wikipedia article for filesystems that support TRIM. You’ll have to add the discard option to the proper fstab entries to make sure that TRIM is used. I used ext4. btrfs apparently uses it, but, in my opinion, btrfs isn’t quite ready for use on my main system. I honestly can’t wait till it is though.

Networking

Here’s the Ethernet controller:

00:19.0 Ethernet controller: Intel Corporation Device 1502 (rev 04)
Subsystem: Lenovo Device 21ce
Flags: bus master, fast devsel, latency 0, IRQ 42
Memory at d5400000 (32-bit, non-prefetchable) [size=128K]
Memory at d542b000 (32-bit, non-prefetchable) [size=4K]
I/O ports at 7040 [size=32]
Capabilities: [c8] Power Management version 2
Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [e0] PCI Advanced Features
Kernel driver in use: e1000e

As you can see from the last line, all you need is the e1000 driver.

Symbol: E1000E [=y]
│ Type : tristate
│ Prompt: Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support
│   Defined at drivers/net/Kconfig:2099
│   Depends on: NETDEVICES [=y] && NETDEV_1000 [=y] && PCI [=y] && (!SPARC32 || BROKEN [=n])
│   Location:
│     -> Device Drivers
│       -> Network device support (NETDEVICES [=y])
│         -> Ethernet (1000 Mbit) (NETDEV_1000 [=y])

Configuring the wireless was a bit more difficult for me, though. Perhaps it will be easier for you. Here’s the wireless card:


03:00.0 Network controller: Realtek Semiconductor Co., Ltd. Device 8176 (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. Device 8195
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at 5000 [size=256]
Memory at d5300000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00
Kernel driver in use: rtl8192ce
Kernel modules: rtl8192ce

As you may notice, I’m using the rtl8192ce driver. This is not the same one that is available for the kernel, though. Using that one, I couldn’t get the device to fully work. I used the drivers from the Realtek website, which are working rather well so far. You want the RTL8188CE driver download. Once compiled, you should be fine. As I type this, I am connected to my home WiFi network, which is encrypted using WPA.

You’ll need to do more than just install the drivers. Refer to the Gentoo Wireless Networking Guide for that.

In case you need it, here’s my /etc/conf.d/net contents:

atlas linux # cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /usr/share/doc/openrc/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

# Prefer wpa_supplpicant over wireless-tools
modules=( "wpa_supplicant" )

wpa_supplicant_eth0="-Dwext"

NVIDIA Quadro 1000M

Now for the real fun part. You may have the 2000M in your system, but I would imagine that this would work for both.

To use discrete graphics, I had to use the driver from the NVIDIA site. I’ve read that some people were able to get it working with the Nouveau drivers, but they didn’t play well with the card on my system. Download and install them. You may want to also read the README, which can be found under the “ADDITIONAL INFORMATION” tab on the driver page.

To install, simply:
atlas ~ # sh NVIDIA-Linux-x86_64-275.09.07.run
(Your file name may differ, of course.)

What’s annoying is that this is necessary to redo each time you compile your kernel. Which means that if you forget, you may boot up your system and wonder why X isn’t able to start.

You can now install X at your leisure, along with your preferred desktop environment (KDE for me.)

I recommend using the nvidia-xconfig tool to set up your xorg.conf file. Here’s what mine looks like, in case you need a comparison:

atlas ~ # cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 275.09.07 (buildmeister@swio-display-x86-rhel47-03.nvidia.com) Wed Jun 8 14:38:32 PDT 2011

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "Module"

# Load "dbe"
# Load "extmod"
# Load "glx"
# Load "freetype"
# Load "type1"
Load "glx"
EndSection

Section "InputDevice"

# generated from data in "/etc/conf.d/gpm"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "onboard"
EndSection

Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro 1000M"
BusID "PCI:1:0:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection

ThinkPad ACPI

Now, I haven’t finished setting up everything for this yet, and I would love to be able to give you more info, but I can’t at the moment. I plan to continue to update this as I set up my system, but this will have to do for now.

More information

I really recommend checking out thinkwiki.org. There are a variety of articles over there on how to install Linux on ThinkPads. Not a whole lot quite yet on the W520, but you can probably piece everything together.

Of course, you can always use Gentoo’s documentation. There are many great howto’s and other valuable pages.

And finally, there are always various forums, mailing lists, etc. You can also comment below, and I’ll try to help you as best as I can.

Wikipedia

Wikipedia

My favorite site? Most likely.

As I was doing some research to create a life summary for Francine Ouelette for one of my classes, I couldn’t help but particularly notice something, something that I have observed quite a lot, on many different occasions: Wikipedia is blatantly copied everywhere on the internet. Now, there isn’t too much wrong with this, if it weren’t for the fact that it is done in so much excess, and everywhere, with no credit given to or mention of Wikipedia. Does Wikipedia deserve credit? I don’t know. I’m no lawyer, and don’t understand the intricacies of how all those Creative Commons Licenses work, so maybe they’re required to, maybe not. But it seems to me that anyone who tries to take content from Wikipedia, and pass it off as their own original content on their own website is either:

  1. Really lazy.
  2. Really dumb. (It’s extremely obvious where it came from.)
  3. Really desperate to just add some content to their site.
  4. Underworked and lacking in anything to do other than copy and paste pages and pages of information from one place to another for different musicians, authors and other notable people, or
  5. The original author of the Wikipedia article.

But, considering that you aren’t referenced in a footnote on the wikipedia page, and multiple people most likely didn’t all create the same sentences separately and all post them on the internet, I assume that you didn’t originally write that paragraph.

I guess that where I’m going with this rant is: Don’t copy and paste without credit or references back to it. It’s just plain unethical and unprofessional. If you’re going to, you may as well do it from some really small website or paper that no one will recognize. Not Wikipedia, which almost everyone who comes across your page while researching a topic has already visited.

I’ll step off my soapbox now.

Western Digital

Well, how to start. I’ve needed a new external hard drive for some time, and what with the cheap prices of storage these days, I figured that I should look for something in the 1 TB+ range. So, I spent the past several weeks researching products in my spare time. I looked at a variety of names, Seagate, Western Digital, Hitachi, etc.

After looking at reviews on sites like newegg.com and Amazon, I decided that I was going to get the Western Digital Elements 1.5 TB external hard drive (link), since it seemed to have the least number of seriously negative reviews when compared to others.

You probably shouldn't buy this.

Well, it finally came in last Saturday, and I was as happy as a child on Christmas morning. I’d never held so much space in my hand. I quickly set to backing all of my data up on this drive, which was spread across several different places, and organizing it all. (Fortunately I didn’t delete the original sources.) Finally, at last, I had all of my data in one place.

Well, last Tuesday night, I was sitting there in front of my computer, idling away my time, pointlessly surfing the internet, when suddenly I get a message on my screen that said that S.M.A.R.T. was reporting failing sectors and that my drive was in danger of failing. I stared in horror at my screen. I tried to access the drive, only to get a message that it was “unmountable at this time.” I restarted my computer, only to discover that it wasn’t even being show as attached to the computer. At this point, the little white light on the front of the drive was flashing.

After some research on the internet, I removed the drive, and tried to connect it to a Windows system. I breathed more easily as Windows detected my drive. Only to not show it anywhere else but under device manager.

After much more screwing around, I finally came to a dreaded conclusion. My hard drive had failed entirely, and now I’m going to have to RMA it.

Are all Western Digital drives bad? Only their externals? Or just their Elements line? Who knows. Maybe it was just my bad luck. But, hopefully its replacement will last much longer than this one did.

Welcome to the new site!

I would like to take this chance to welcome everyone to the new site. To make things much more interactive, useful, and easier on me, I am now using WordPress to manage my content.

Throughout the next several days there should be many changes and additions to the site as I begin to figure out how I want things to look, feel and be on the main pages. If you have any thoughts, don’t hesitate to tell me them.