X1 Linux Tweaks

From ThinkWiki
Revision as of 19:00, 16 January 2015 by Dalesaurus (Talk | contribs) (←Created page with 'These instructions are for the 1st Generation X1 carbon but should generally apply to the 2nd gen. The suggestions here were tested with a 3444-F9U to extend battery t...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

These instructions are for the 1st Generation X1 carbon but should generally apply to the 2nd gen. The suggestions here were tested with a 3444-F9U to extend battery to ~5 hours of normal use and a ~6 second boot time.

SSD Optimizations

General Information

Recommendations

  1. Install firmware updates from Lenovo, especially for Intel or Sandisk drives
  2. When partitioning your drive place your swap partition at the end of the volume. Make sure it is at least the size of your RAM (for hibernate).
  3. Setup and force TRIM in fstab with the following options in your /etc/fstab discard, noatime and commit=500 (Note: if you are concerned with possible data loss with commit, set it lower)
    #> vi /etc/fstab
    # <file system> <mount point> <type> <options> <dump> <pass>
    # !!!!!!!!!!!!!!!!!!!!!! THESE ARE EXAMPLES, DO NOT COPY TO YOUR OWN FSTAB !!!!!!!!!!!!!!!!!!!!!!
    /dev/mapper/lubuntu--vg-root / ext4 discard,noatime,commit=500,errors=remount-ro 0 1
    UUID=34340aba-22cf-4b42-bdf1-2ba70bd8fa44 /boot ext4 discard,noatime,commit=500,defaults 0 2
  4. Convert your /tmp directory to use RAM via tmpfs
    #> vi /etc/fstab
    tmpfs /tmp tmpfs defaults,noatime,mode=1777,nosuid 0 0
  5. SSDs work best with NOOP as the schedulers, this is set via Kernel Parameter in GRUB
    #vi /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
    and run:
    sudo update-grub


Getting Battery Life Under Control

After the initial install it can be quite disappointing to see that your new laptop only has 2.5h of available battery. Before you start making any tweaks install PowerTOP to measure what is consuming the most power. Several of these items were tested from the Ubuntu Power Saving Tweaks list.

  1. Disable any hardware you are not using in your BIOS
    Example: Fingerprint Scanner
    898 mW 100.0% Device USB device: Biometric Coprocessor (Auth)
  2. Install TLP. There is some debate on how necessary this is with more modern distributions but it will allow you to precisely configure your battery vs plugged-in CPU scaling which helps stretch your battery.
    1. Walk through the configuration guide to take advantage of all power saving options when on battery.
    2. You may not see the CPU scaling taking hold in older distributions (add a Resource Monitor to your Panel with current cpu freq to confirm). Sometimes you still have to set intel_pstate set unless TLP > 3.1.8 and Kernel 3.9+. See here and here.
      More thorough information on the above: http://linrunner.de/en/tlp/docs/tlp-faq.html#scaling
      Here is an example of forcing intel_pstate
      $> cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
      acpi-cpufreq
      $> sudo vi /etc/default/grub
      // Add “intel_pstate=enable”
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=enable"
      $> sudo update-grub; reboot
      $> cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
      intel_pstate
    3. Laptop Mode Tools has been widely suggested however the author was not able to see any difference with it in place. TLP provided a better suites of options to extend battery life.
  3. If you don't use Bluetooth regularly, turn it off at startup with rfkill
  4. Enable the i915 Sandybridge Framebuffer Compression (confirmed 475mw savings)
    vi /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_fbc=1"
    and run:
    sudo update-grub
  5. Don't bother with ALPM
    PowerTOP Testing:
    OFF - 12.02 Watts on Average with Standard Deviation 0.25
    ON - 12.37 Watts on Average with Standard Deviation 0.32

Other Tweaks

Make sure zRAM is enabled (Ubuntu 13.10 and up it is on by default)

$> sudo apt-get install zram-config
$> sudo service zram-config status
zram-config start/running


Repurpose the ThinkVantage Button

Using Xbindkeys: https://wiki.archlinux.org/index.php/Xbindkeys

Example to trigger hibernate (in .xbindkeysrc)

"sudo pm-hibernate"
    m:0x10 + c:156
    Mod2 + XF86Launch1

X1