This is a disorganized grouping of notes on how I set up my T420. It is configured to dual-boot Windows 7 and Linux. Windows can be safely started from within VirtualBox on Linux for quick tasks, or booted normally for extended tasks or high performance. I’d say mostly these notes are intended for myself (i.e. for the next time I hose my machine) and for other users of ThinkPad laptops like my T420. Lots of information came from the Arch Linux wiki.

Installing Windows

It’s best to install Windows before Linux. I assigned the first 80GB of my 240GB SSD to Windows, activated, applied all updates, and installed my normal suite of apps:

When applying updates, I had to blacklist KB3035583 to avoid the Windows 10 nag.

Installing Arch

After installing Windows and partitioning for Arch, my hard drive looked like this:

# sudo fdisk -l /dev/sda
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: dos
Disk identifier: 0x65c12669

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2          206848 167774207 167567360  79.9G  7 HPFS/NTFS/exFAT
/dev/sda3  *    167774208 468862127 301087920 143.6G 83 Linux

The install went something like this after partitioning and connecting to the internet within the installer environment:

# mount /dev/sda3 /mnt
# pacstrap -i /mnt base base-devel
# genfstab -U /mnt > /mnt/etc/fstab
# arch-chroot /mnt /bin/bash
# echo "en_US.UTF-8 UTF-8\n" > /etc/locale.gen
# locale-gen
# echo "LANG=en_US.UTF-8\n" > /etc/locale.conf
# ln -s /usr/share/zoneinfo/America/Detroit /etc/localtime
# hwclock --systohc --utc
# mkinitcpio -p linux
# pacman -S grub os-prober ifplugd iw wpa_actiond wpa_supplicant dialog dhcpcd
# grub-install --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
# echo "MYHOSTNAME" > /etc/hostname
# systemctl enable netctl-ifplugd@enp0s25.service
# systemctl enable netctl-auto@elp3s0.service
# passwd
# umount /mnt
# reboot

At some point afterwards, the following also occurs:

  • Create my daily user/group with special GID/UID
    • wheel membership for sudo
    • uucp membership for serial access
    • uucp membership for other hardware access (required for Arduino)
  • Set up any wifi profiles I need using the wifi-menu
  • Run rankmirrors
  • Enable multilib and ArchHaskell’s haskell-core repository
    • need to add key to keyring for the latter
  • Install standard console programs

    # pacman -S zip unzip rsync wget sshfs ntfs-3g
    # pacman -S zsh clang elinks tmux vim
    # pacman -S ghc texlive-most octave
  • Install and activate sshd

    # pacman -S openssh
    # systemctl enable sshd
  • Install and configure sudo

    # pacman -S sudo

    in the file /etc/sudoers:

    ## Uncomment to allow members of group wheel to execute any command
    %wheel ALL=(ALL) ALL
  • Install management tools: pkgfile, yaourt from the AUR
  • normal X programs: pacman -S gvim awesome rxvt-unicode urxvt-perls firefox flashplugin jre8-openjdk nemo vlc profont ttf-dejavu lxappearance
  • other stuff I use: pacman -S beet cmus qtcreator
  • Photography apps: pacman -S darktable hugin luminancehdr nomacs
  • 3D printing apps: pacman -S freecad slic3r openscad
  • Cross-compiling for Windows development: pacman -S mingw-w64-gcc
  • Install acpid and enable it
  • Configure /etc/sudoers to allow wheel group to sudo, i.e.

Video drivers

bumblebee 3.2.1-10 bbswitch module nvidia-340xx 340.96-2.1 nvidia-340xx-utils 340.96-1 opencl-nvidia-340xx 340.96-1

Audio setup

pulseaudio 7.1-1 pamixer 4-1

Volume keys

acpid systemctl enable acpid

Power management / battery life

cpupower 4.3-1 thinkfan 0.9.2-3 thinkfinger 0.3-8 upower 0.99.3-1 xorg-xset

Parts of this are specific to ThinkPads

# pacman -S tlp tp_smapi acpi_call
# systemctl enable tlp
# systemctl enable tlp-sleep
# systemctl disable systemd-rfkill@.service

tweaks to grub config for i915 /etc/default/grub

pcie_aspm=force i915.i915_enable_rc6=1 enable lower power state during Intel GPU idle UbuntuPowerSave. Side effects unknown. power savings unknown.

i915.i915_enable_fbc=1 framebuffer compression, as much as 0.6W saved UbuntuPowerSave. May cause graphic artifacts.

i915.lvds_downclock=1 reduce LVDS refresh rate (built-in screen). Side effect might be screen flickering if laptop does not support this option (but T420 does). Power savings around 0.1 watt. UbuntuPowerSave

Console font

/etc/vconsole.conf
FONT="ter-112n"

Other tweaks / preferences

Use nemo as a file manager without desktop icons

# gsettings set org.nemo.desktop show-desktop-icons false
# gsettings set org.cinnamon.desktop.default-applications.terminal exec urxvt

Disable beeping PC speaker:

Booting the Windows partition within VirtualBox

virtualbox 5.0.10-1 virtualbox-host-modules 5.0.10-2.1

  • create linear map device for the VM (fdisk -l gives the sizes for this)
  • use fdisk to set disk id the same as phy disk
  • install guest additions inside Windows
  • save product key to C:.txt for future activation needs

The fdisk output for this drive is

Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: dos
Disk identifier: 0x65c12669

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2          206848 167774207 167567360  79.9G  7 HPFS/NTFS/exFAT
/dev/sda3  *    167774208 468862127 301087920 143.6G 83 Linux

So the text file should be created as follows:

0 2048 linear /dev/loop0 0
2048 204800 linear /dev/sda1 0
206848 167567360 linear /dev/sda2 0

and the preparation script, run once per boot:

Ideas for the future

Turn one of my awesome tags into Windows, http://awesome.naquadah.org/wiki/Modal_Keybindings

Color calibration http://www.thinkwiki.org/wiki/Colour_profile

TODO fix the Bumblebee error in journalctl

Other stuff to incorporate

solaar - for Logitech unifying receiver devices

/etc/modprobe.d/alsa-base.conf

options snd-hda-intel model=thinkpad

Change /etc/modprobe.d/thinkpad-volume-fix.conf according to http://forum.thinkpads.com/viewtopic.php?t=99277, otherwise the volume controls on the keyboard will sometimes lock up

options thinkpad_acpi volume_control=1

mlocate

Battery life woes

Running fwts first

Trying http://lifepluslinux.blogspot.com/2015/09/the-infamous-battery-re-calibration-bug.html

Printing

cups and cups-pdf systemctl enable org.cups.cupsd.service