ThinkPad x230

Table of Contents

In February 2013, I got a new work laptop. It’s a Lenovo ThinkPad x230.

These are my installation notes.

specs

BIOS or UEFI

As I always use the latest Fedora (F18 at the time of this writing), and it supports both UEFI and Secure Boot just fine, both are enabled.

See these links for details on the difference between Secure Boot and Restricted Boot.

UEFI and PXE

Set up the PXE server to also deal with EFi clients as per the RHEL6 Installation Guide

The relevant config to PXE boot Fedora 18’s or RHEL 6.4’s installer are

$ cat /var/lib/tftpboot/efidefault 
default=0
timeout=30
#splashimage=(nd)/splash.xpm.gz
#hiddenmenu
#title Fedora
#        root (nd)
#        kernel /rawhide-i386/vmlinuz
#        initrd /rawhide-i386/initrd.img

title RHEL 6.4 x86_64 installer
  root (nd)
  kernel /images/rhel64-x86_64/vmlinuz repo=<URI>
  initrd /images/rhel64-x86_64/initrd.img

# I get to rescue, but wrong font used to draw boxes
title Fedora 18 x86_64 rescue
  root (nd)
  kernel /images/F18-x86_64/vmlinuz repo=<URI> ksdevice=bootif noipv6 lang=en_US.UTF-8 keymap=us rescue
  initrd /images/F18-x86_64/initrd.img

# this works
title Fedora 18 x86_64 install
  root (nd)
  kernel /images/F18-x86_64/vmlinuz repo=<URI>
  initrd /images/F18-x86_64/initrd.img

# this does not work
title Memtest-86+ 4.20
  root (nd)
  kernel /images/memtest/memtest86+-4.20

Intel Rapid Start Technology

This works as follows; you suspend to RAM (S3) normally. After a timeout (which you set in the BIOS/EFI), the machine will wake from S3, dump memory onto a special partition and then enter S4.

To make Intel Rapid Start Technology work with Linux, the x230 needs a special partition on the SSD, as per Intel’s docs.

Made a 16 GB parttition with the correct guid of D3BFE2DE-3DAF-11DF-BA40-E3A556D89593, then it could be enabled in x230’s firmware (under Power). See also F6F’s blog.

My disk is now set up as follows:

# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 488397168 sectors, 232.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): <GUID>
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 488397134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2349 sectors (1.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          411647   200.0 MiB   EF00  
   2          411648         1435647   500.0 MiB   0700  
   3         1435648        34990079   16.0 GiB    FFFF  
   4        34990080       488396799   216.2 GiB   0700  


# pvs
  PV                                       VG      Fmt  Attr PSize   PFree  
  /dev/mapper/luks-<UUID>                  vg_x230 lvm2 a--  216,20g 113,25g

# vgs
  VG      #PV #LV #SN Attr   VSize   VFree  
  vg_x230   1   6   0 wz--n- 216,20g 113,25g

Installing Fedora 18

Apart from the following niggles, everything I tried so far worked out of the box with Fedora 18 x86_64.

Problems:

  • mute button is not working. I do not even see an event with acpi_listen. Instead of wasting time chasing this down, as I have no use for the microphone, I switched it off in UEFI.
  • While I may just have operated F18’s anaconda disk section wrong, I ended up booting RHEL6 to set up my partitions the way I wanted them (small /boot, 16GB for the Rapid Start partition, rest used for a luks volume which is the PV to my VG and then some LVs in the VG but with free PE for future growing). RHBZ #928747 was filed.

battery saving

I used a slighly modified version of my old script, this notebook also supports WLAN power saving, the old one did not.

save_battery.bash

#!/bin/bash
#
# small shell script to set powersaving option
# c't 20/2011 page 150
# and
# https://lwn.net/Articles/496828/
#
# pcfe, 2011-09-12
# aded status and stop sections on 2012-07-28
# added power saving mode for wlan0 2013-04-03

logger got called as $0 $@

usage()
{
  echo "Usage: $0 { start | stop | status }"
  exit 1
}

start()
{
  # audio codec sleeps after 1 second
  echo 1 > /sys/module/snd_hda_intel/parameters/power_save

  # APLM (Aggressive Link Power Management) on all SATA ports
  # on x60 I am getting timeouts on amanda estimates and it is a bit sluggish
  # going from min popwer to med power
  # pcfe, 2011-09-21
  # trying with min power on x230
  # pcfe, 2013-04-02
  for i in /sys/class/scsi_host/host[012345]/link_power_management_policy ; do echo min_power > ${i};done
  #for i in /sys/class/scsi_host/host[012345]/link_power_management_policy ; do echo medium_power > ${i};done

  # PCI and i2c device automatic power mode
  find /sys/bus/{pci,i2c}/devices/*/power/control | while read LINE; do echo 'auto' > ${LINE}; done

  # auto-suspend for all USB devices
  # after boot this is on auto for most but not 1-1.4 (Bluetooth) 2-1.8.4 (no idea what that is) 3-4 (WWAN)
  for i in /sys/bus/usb/devices/*/power/control ; do echo auto > ${i};done

  # NMI watchdog off
  echo 0 > /proc/sys/kernel/nmi_watchdog

  # WOL (Wake on Lan) off
  ethtool -s eth0 wol d

  # change VM writeback timeout from 500 to 1500
  echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

  # Enable Laptop Mode - this one is a bonus
  echo "5" > /proc/sys/vm/laptop_mode

  # power saving mode for wlan0
  iwconfig wlan0 power on
}

stop()
{
  # audio codec sleep off
  echo 0 > /sys/module/snd_hda_intel/parameters/power_save

  # APLM (Aggressive Link Power Management) on all SATA ports to maximum performance
  for i in /sys/class/scsi_host/host[012345]/link_power_management_policy ; do echo max_performance > ${i};done

  # PCI device power status to on
  find /sys/bus/pci/devices/*/power/control | while read LINE; do echo 'on' > ${LINE}; done
  # i2c device power status to auto
  find /sys/bus/i2c/devices/*/power/control | while read LINE; do echo 'on' > ${LINE}; done

  # auto-suspend for all USB devices
  # after boot this is on auto for most but not 1-1.4 (Bluetooth) 2-1.8.4 (no idea what that is) 3-4 (WWAN)
  # so set back to on for just these three
  echo on > /sys/bus/usb/devices/1-1.4/power/control
  echo on > /sys/bus/usb/devices/2-1.8.4/power/control
  echo on > /sys/bus/usb/devices/3-4/power/control

  # NMI watchdog on
  echo 1 > /proc/sys/kernel/nmi_watchdog

  # WOL (Wake on Lan) Wake on MagicPacket™
  ethtool -s eth0 wol g

  # change VM writeback timeout back to  500
  echo 500 > /proc/sys/vm/dirty_writeback_centisecs

  # Enable Laptop Mode off again
  echo "0" > /proc/sys/vm/laptop_mode

  # power saving mode for wlan0 to off
  iwconfig wlan0 power off
}

status()
{
  # audio codec
  echo -n "/sys/module/snd_hda_intel/parameters/power_save "
  cat /sys/module/snd_hda_intel/parameters/power_save

  # APLM (Aggressive Link Power Management) status of SATA ports
  for i in /sys/class/scsi_host/host[012345]/link_power_management_policy ; do echo -n "${i} " ; cat ${i};done

  # Device power savings
  # way too much output to be quickly human-readable
  #find /sys/bus/{pci,i2c}/devices/*/power/control | while read LINE; do echo -n "${LINE} " ; cat ${LINE}; done

  # auto-suspend status on all USB devices
  # way too much output to be quickly human-readable
  for i in /sys/bus/usb/devices/*/power/control ; do echo -n "${i} " ; cat ${i};done

  # NMI watchdog
  echo -n "/proc/sys/kernel/nmi_watchdog "
  cat /proc/sys/kernel/nmi_watchdog

  # VM writeback timeout
  echo -n "/proc/sys/vm/dirty_writeback_centisecs "
  cat /proc/sys/vm/dirty_writeback_centisecs

  # Enable Laptop Mode
  echo -n "/proc/sys/vm/laptop_mode "
  cat /proc/sys/vm/laptop_mode

  # WOL (Wake on Lan) and opther options
  echo -n "Wired network WOL status: "
  ethtool eth0 2>/dev/null | grep ^[[:space:]]Wake-on
  echo
}

# command not found
RETVAL=127

case "$1" in
  start)
    start
    RETVAL=0
  ;;
  stop)
    stop
    RETVAL=0
  ;;
  status)
    status
    RETVAL=0
  ;;
  *)
    usage
    RETVAL=1
esac

exit $RETVAL

But, as has been rightly pointed out by bkruell, using tuned is much easier.

WWAN (aka UMTS, aka 3G)

On 2013-04-12 I received my Vodafone UltraCard.

The notebook’s build in UMTS modem works just fine with Fedora 18. Make sure the provider database is installed sudo yum install mobile-broadband-provider-info if you want the luxury of selecting your provider from a list in NetworkManager, instead of having to google for your APN name.

For Vodafone Mobile Connect Flat the APN is web.vodafone.de.

While I did play with SMS on the previous notebook, the SIM card in this one is not the UltraCard I have set up for SMS (the network only sends to one SIM).