vuxu.org: Juno

Juno is an Lenovo X220i, Type 4290W1A with an i3-2310M (2.1GHz, 2 cores, hyperthreading, VT-x) 8GB RAM, 80GB SSD (SSDMAEMC08) and a 320GB harddisk500GB SSD (Samsung SSD 850 EVO).

The naming

Juno was an ancient Roman goddess, the protector and special counselor of the state.

Rough setup

  • Flash BIOS version 1.19. Get it here.

  • Enter BIOS by pressing ThinkVantage, then F1: enable “Fn and Ctrl Key swap”, disable “Keyboard beep”, enable “Virtualization technology”.

  • Boot archlinux-2011.08.19.

  • Since I wanted full disk encryption, shred the harddisk (here sda) with random data:

       shred -n1 -v /dev/sda
    

    We do not shred the SSD (sdb) because that would break the wear-leveling.

  • Partition scheme: I partitioned manually with fdisk, which automatically 2k-aligned the partitions.

       sdb1 128mb /boot ext2
       sdb2 rest dm-crypt named cryptssd, -c aes-xts-plain -y -s 512 --align-payload=8192
         lvm volume group "ssd"
           8g swap ssd-swap swap label swap
           20g / ssd-root ext4 label root
           rest /home ssd-home ext4 label home 
    
    
       sda1 128mb /altboot ext2
       sda2 rest dm_crypt named crypthdd, -c aes-xts-plain -y -s 512 --align-payload=8192
         lvm volume group "hdd"
           280g /data hdd-data ext4 label home
           rest free
    

    (The purpose of /altboot is to be able to quickly get a bootable system should the SSD ever break.)

Base configuration

  • grub.conf:

       kernel /vmlinuz-linux root=/dev/mapper/ssd-root resume=/dev/mapper/ssd-swap cryptdevice=/dev/sdb2:ssd printk.time=1 ro loglevel=6
    
  • Install suspend on lid shut, in /etc/acpi/handler.sh:

    button/lid)
        logger "ACPI lid switched $1 $2"
        if [ -n "`grep close /proc/acpi/button/lid/LID/state`" ]; then
            /usr/sbin/pm-suspend
            logger -s "ACPI lid closed";
        elif [ -n "`grep open /proc/acpi/button/lid/LID/state`" ]; then
            logger -s "ACPI lid opened"
        else
            logger -s "Couldn't detect Lid state"
        fi
    
  • Make ondemand default scheduler in /etc/conf.d/cpufreq.

  • Extend logrotate keep times.

  • In /etc/pacman.conf, make tar.gz packages instead of tar.xz. (I will directly install them mostly, the compression is a waste of time.)

  • Copy old passwd/group/shadow/gshadow.

  • Copy netcfg data and WPA certificates. Set up net-auto-* stuff in rc.conf.

  • Setup hooks in /etc/pm/sleep.d:

    #### /etc/pm/sleep.d/10mpd 
    !/bin/sh
    
    
    case $1 in
    hibernate)
        mpc pause
        ;;
    suspend)
        mpc pause
        ;;
    thaw)
        ;;
    resume)
        ;;
    *)  
        ;;
    esac
    
    
    #### /etc/pm/sleep.d/50net-auto-wireless 
    #!/bin/sh
    
    
    case $1 in
    hibernate)
        ;;
    suspend)
        ;;
    thaw)
        /etc/rc.d/net-auto-wireless restart
        ;;
    resume)
        /etc/rc.d/net-auto-wireless restart
        ;;
    *)  
        ;;
    esac
    
  • Copy postfix, dovecot, ntp configs from zorya.

  • Copy /var/lib/dovecot from zorya.

  • adduser, groups: adm,wheel,log,games,audio,video,power,scanner,plugdev

  • For two-finger scrolling, add to your .xinitrc:

    synclient EmulateTwoFingerMinW=20
    synclient EmulateTwoFingerMinZ=7
    
  • /etc/fstab: Add relatime to /, /home.

  • Add coretemp, acpi_cpufreq, pcrypt to MODULES.

  • Install laptop-mode-tools, pm-utils.

  • Install tp_smapi, hdapsd.

  • Install thinkfan, get a config from here, you need to enable fan control in /etc/modprobe.d/thinkpad.conf:

    options thinkpad_acpi fan_control=1
    
  • Install lots of stuff with packer --noconfirm. Bitch for broken PKGBUILDs.

Hacks

  • Thinkfinger doesn’t support the fingerprint reader, but libfprint-unstable with fingerprint-gui works, see the Arch wiki.

  • Mute microphone: works with xbindkeys:

    "amixer sset Capture toggle"
      m:0x0 + c:248
    
  • Suspend is broken by default because of iwlagn. Create a file /etc/pm/config.d/iwlagn with contents to unload it automatically:

    SUSPEND_MODULES="iwlagn"
    
  • To save more than 8W of power, configure laptop-mode tools and enable RC6:

    i915.i915_enable_rc6=1
    

    Some relevant laptop-mode settings:

    CONTROL_AC97_POWER="auto"
    ENABLE_AUTO_HIBERNATION=0
    ENABLE_BATTERY_LEVEL_POLLING=0
    CONTROL_BLUETOOTH=1
    BATT_ENABLE_BLUETOOTH=0
    CONTROL_CPU_FREQUENCY=0  # done with cpufreq
    CONTROL_DPMS_STANDBY=0
    CONTROL_ETHERNET=0  # dont fuck with my gigabit
    CONTROL_INTEL_HDA_POWER="auto"
    CONTROL_NMI_WATCHDOG="auto"
    CONTROL_RUNTIME_PM="auto"
    CONTROL_SCHED_MC_POWER_SAVINGS="auto"
    CONTROL_SCHED_SMT_POWER_SAVINGS="auto"
    CONTROL_USB_AUTOSUSPEND="auto"
    

Switching to Void Linux

I got a new SSD (Samsung SSD 850 EVO 500GB, €220.11 from hoh.de) to replace the HDD.

For copying, a USB-SATA adapter was used:

Bus 002 Device 003: ID 152d:2509 JMicron Technology Corp. / JMicron USA Technology Corp. JMS539 SuperSpeed SATA II 3.0G Bridge

Again, there is a boot partition (2G to fit a GRML iso and enough Void kernels).

/dev/sdc1  *       2048   4196351   4194304     2G 83 Linux
/dev/sdc2       4196352 976773167 972576816 463.8G 83 Linux

Installation is straight forward:

mkfs.ext2 -L vroot /dev/sdc1
cryptsetup luksFormat /dev/sdc2 -c aes-xts-plain64 -y -s 512 --align-payload=8192
cryptsetup luksOpen /dev/sdc2 vcrypt-pool
vgcreate evo /dev/mapper/vcrypt-pool
lvcreate -n vroot -L 30G evo
lvcreate -n vdata -L 400G evo
mkfs.ext4 -L vroot /dev/mapper/evo-vroot
mkfs.ext4 -L vdata -m0 /dev/mapper/evo-vdata

Install Void on LVM/LUKS.

ChangeLog

  • 15nov2011: Update to BIOS 1.24, using the same instructions as above.

  • 08feb2015: Switch to Void Linux/new SSD.

  • 12mar2015: Replaced the battery (Original Lenovo ThinkPad Battery 44+ for €46.90 at Jacob Elektronik). Previous one was down to 48% of its capactiy (lasted ~2h).