In this article, I describe in what points my installation of Gentoo Linux on the Lenovo Thinkpad T530 2429-2UG differs from the official guide at http://www.gentoo.org/doc/en/handbook/. Some configs and scripts can be found in my T530 git repository at github.com.

Partitioning and SSD optimizations

As space on SSDs is expensive, I moved away from my usual habit to keep Windows (fresh install consumes 37GB) as a backup OS on the disk. To enable recovery, I made a backup of the three partitions using partimage and stored the images on a different host using NFS (partimage also has an own network protocol). Afterwards, I wiped the whole SSD using so-called secure erase (https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase). This way, all blocks should be marked as empty (see TRIM). As the BIOS issues the freeze command, one has to do a suspend-to-ram cycle before secure erase is possible. Because the Gentoo installation image does not support this, I used an Ubuntu image to issue the erase command.

If you understand german, there is also a collection of SSD-related articles on ubuntuusers.de.

To keep up with state of the art, I switched to GPT partitioning (and therefore grub2). For GPT, one simply uses gdisk instead of fdisk. This way, it also automatically handles proper sector alignment. As I was not exactly sure, how my final partitioning scheme will look like (e.g., I might encrypt some directories), I used LVM to allow new "partitions" or changing their size afterwards. For the beginning, I created two logical volumes for / and /home. As my T530 has 8 GB Ram and I have a SSD, I did not create a swap partition. For a LVM howto, see the Gentoo wiki. To pass-through TRIM commands, one has to enable the issue_discards option in the LVM config file.

Update: If you plan to boot with UEFI instead of BIOS, also create a small GPT partition with 200-500 MB. Booting with UEFI and grub2 works so far, but I didn't notice any improvements.

As filesystem, I chose the standard: ext4. To avoid write accesses, I mounted /tmp using tmpfs and mounted /var/tmp using -o bind to /tmp. Additionally, I linked ~/.thumbnails to /tmp/, deactivated the browser cache and configured Thunderbird to not store the emails on my disk. Usually, I always have a fast internet connection, so this is not a problem for me.

In order to keep /var/log/ in a tmpfs as well, I wrote a small initscript that will rsync chosen files at startup/shutdown with a permanent storage on the SSD. The script and instructions can be found here.

I am also experimenting with a reduced portage tree as described here. An actualized version of the script can be found in my T530 git repository. In my case, it reduced the portage size from 830MB to 124MB.

With the following command, IO accesses can be monitored: iotop -aobPq -d 4 . As I'm using LVM, all accesses to the actual hard disk should be accumulated in the lines with processes named like "[jbd2/dm-0-8]".

Kernel

As my T530 contains new devices, I directly started with the 3.4.5 gentoo-sources kernel. My kernel .config can be found in my T530 git repository.

Sound

Sound works out-of-the-box so far with the Intel HDA and Realtek module. However, if you're using a docking station, the headphone jack is not working automatically, yet. The model=thinkpad parameter seems to work for pre-IvyBridge models only. With hda-analyzer I found the required settings that can be set using the commandline with the hda-verb tool and following commands:

./hda-verb /dev/snd/hwC0D0 0x1b SET_PIN_WIDGET_CONTROL 0x40
./hda-verb /dev/snd/hwC0D0 0x1b SET_AMP_GAIN_MUTE 0xb000
./hda-verb /dev/snd/hwC0D0 0x1b SET_CONNECT_SEL 1

Probably this is true for other [TWX][45]30 models as well. A script can be found in my T530 git repository. If you hear a click during suspend/resume, this is caused by the laptop-mode-tools that put the device to sleep. This can be deactivated in the laptop-mode configs.

Update: Thanks to Takashi Iwai, the following kernel patches enable the jacks in the docking station and, if necessary, allow to force this settings using a model=lenovo-dock kernel parameter: Patch 1, Patch 2. They should be included in kernel version 3.6 or 3.7.

Update: Regarding DisplayPort/HDMI audio output see this part.

Network interfaces

Wired ethernet interface works out-of-the-box with the e1000e module.

For wireless connection, the iwlwifi module and the firmware in sys-firmware/iwl6005-ucode are required. If you plan to install Gentoo over WLAN, copy the firmware onto a USB stick and after booting into /lib/firmware. If your connection gets stuck with a 11n router, try adding iwlwifi.wd_disable=1 and/or iwlwifi.11n_disable=1 to your parameters until the bug is fixed in a new kernel version.

Graphics

My T530 contains the HD4000 GPU in the IvyBridge processor and a dedicated Nvidia NVS 5400M. Both work out-of-the-box. If the system freezes after booting the kernel try adding the nomodeset parameter to the kernel parameters. For now, I choose the integrated GPU when on batteries and the dedicated GPU in the docking station (the DVI port on the docking station is an internal DisplayPort interface, and all DisplayPorts are only connected to the dedicated GPU).

Update: I installed Bumblebee through portage and it seems to work so far, except that it looks like the current nouveau module does not support 3D acceleration on this card, yet. I will test again with a newer kernel. The installation is pretty easy, just unmask and install, add user to bumblebee group and start bumblebee and vgl during boot. For nouveau support, you have to build it as separate module, not builtin in the kernel.

Update: Displayport works out-of-the-box with my DP-2-HDMI cable. Only issue was the sound. Auto-detection of pulseaudio seems to have a bug and you have to manually configure the audio sinks as described in the ArchWiki. Afterwards, you just have to redirect the output of your application to the HDMI device (default is internal audio) using kmix, for example.

Other stuff

The webcam works with uvcvideo module. I added some lines to the actions file of the acpid in order to dynamically (un)load the module after pressing the function key.

Other things like the Cardbus slot and Firewire are untested, yet. As I never used Cardbus and Firewire so far, I deactivated both in the BIOS for security (I don't know if they still allow attached devices direct memory access).

Avahi-tray enables fast access on services announced by Avahi/MDNS using an application in the system tray. Users can set custom commands that are executed on certain events or if a certain service has been selected. With python-notify, certain events can also be reported to the user using libnotify.

Link: https://github.com/anyc/avahi-tray

With increasing code size, outdated stuff is easily forgotten in header files. I wrote a small script that compares the list of declared symbols with the list of symbols present in the symbol table of the final binary. The script lists declarations of symbols that are not required anymore.

Please note, this list may contain false positives and may be incomplete!

https://github.com/anyc/toolsnstuff/blob/master/unused_declarations.sh

I wrote a little ebuild that installs MatLab on a Gentoo Linux system. With the ebuild, the installed files are tracked by the package manager and do not pollute the filesystem.

The process is not fully automated, so please mount the ISO to a root-accessible path, e.g.,

fuseiso matlab.iso my_path/ -o allow_root

and provide the path using CDROM_ROOT environment variable, as well as the path to the license file in MATLAB_LICENSE_FILE and the key either using MATLAB_INSTALLATION_KEY or using MATLAB_INSTALLATION_KEY_FILE if the key is in a file.

A recent version of the ebuild can be found here.

Anhänge:
Diese Datei herunterladen (matlab-1012a.ebuild)matlab-1012a.ebuild[ ]2 KB

Ever tried to mount a partition that is inside an image with multiple partitions? With kpartx of the multipath-tools package, it's really easy. It scans the image and creates a individual device file for every partition using the device mapper.

Example in case of a KVM image: http://blog.piotrj.org/2009/03/mounting-raw-kvmqemu-image.html

First create a loop device for the image:

losetup -f /path/to/image

Then create a vmdk file for the resulting loop device:

VBoxManage internalcommands createrawvmdk -filename my_image.vmdk -rawdisk /dev/loop/0

This vmdk file can be used by Virtualbox as a hard disk.