Permalink
Switch branches/tags
Nothing to show
Find file Copy path
5f34963 Aug 22, 2017
1 contributor

Users who have contributed to this file

174 lines (147 sloc) 7.25 KB

Description of NixOS setup x1 carbon 5th 2017

Lenovo Thinkpad x1 carbon 5th

Introduction

I have this machine and want to share my experience installing NixOS on it. I’m a gnu/linux guy since 2004, but it is my first attempt to work with this distribution. After few weeks I’m still happy that I tried it.

Model: 20HRX004US i7-7600u, 16gb ram, 512gb ssd

Usefull links

Downsides

  • Most annoying thing that it is become hot very easily (as most ultrabooks),

keyboard still ok and it is not a real problem when you don’t put laptop on your knees.

  • It has a coil noise, but it’s not loud and appears rarely (dell xps 13

has extremly awful coil whine and in compare with it, x1 carbon is silent).

  • Once in few hours I can’t move cursors for few seconds.

In case I find any other issues will try to update this section.

Goals

Features to implementImplemented
Encrypted root+
Power saving+
USB-C dockstation+
WWAN+
Fingerprint reader- for now

Prepare bootable usb stick

  • Download NixOS iso image
  • Write it on usb stick using unetbootin
  • Change label of your usb stick to NIXOS_ISO, without it you can occur some issues when booting from usb
  • Reboot to BIOS setup: disable secure boot, enable CSM
  • Boot your live operating system
  • systemctl start display-manager

Setup encrypted root

Take a look at article about SSDs.

Resize or remove unnecessary partitions using gdisk or gparted, but keep in mind that EFI system partition is required, create it or keep existing one.

$ gdisk /dev/sda
  • o (create new empty partition table if necessary)
  • n (add partition if necessary, 500M, type ef00 EFI)
  • n (add partition, as big as you want, 300G, type 8300 Linux LVM)
  • w (write partition table and exit)

Suppose your big partition is /dev/sda2, your EFI system partition is /dev/sda1.

man cryptsetup lvm
cryptsetup luksFormat /dev/sda2
cryptsetup luksOpen /dev/sda2 lvmroot
# Init as lvm partition
pvcreate /dev/mapper/lvmroot
# Add volume group and root/swap partitions
vgcreate vg /dev/mapper/lvmroot
lvcreate -L 16G -n swap vg
lvcreate -l '100%FREE' -n root vg
# Init filesystems on partitions
mkfs.fat /dev/sda1
mkfs.ext4 -L root /dev/vg/root
mkswap -L swap /dev/vg/swap

Install NixOS

Mount all things.

mount /dev/vg/root /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/vg/swap

Connect to wifi somehow. It’s pretty easy if you use image mentioned above.

nixos-generate-config --root /mnt
blkid /dev/sda5
configuration.nix here
configuration-hardware.nix here
nixos-install

WWAN

My carbon doesn’t have a WWAN module inside, but it’s possible to buy and install it. There are some problems: NOWWAN version of carbon doesn’t have antennas installed, also there are many different modems across the network and all have different costs. I went hard way and bought cheapest one and updated firmware (it’s a little bit tricky). Antennas (not native) included in the package, work good enough, but installation requires patience and savvy. Cabel routing isn’t easy, but can be done pretty accurate.

If you don’t want to update firmware and afraid of installing non-native antennas you can find original parts, they can be easily installed and will work out of the box.

Topic about WWANs in russian on ixbt.

itemFRU
WWAN: Sierra Wireless AirPrime® EM745500JT547
Antennas for thinkpad x1 carbon01LV467

You can’t boot with modem, which has firmware different from original, cause modem with “wrong” vendor and product ids (413c and 81b6) can’t pass whitelist checks. But you can boot your OS and put your laptop to sleep, after that install a modem and voila, it works, but after reboot problem with whitelist will arise again. That is why it is necessary update firmware in case you buy “cheap” modem.

After installation of modem and resuming from sleep dmesg shows following lines:

[ 2004.118000] usb 1-6: New USB device found, idVendor=413c, idProduct=81b6
[ 2004.118002] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2004.118002] usb 1-6: Product: DW5811e Snapdragon™ X7 LTE
[ 2004.118003] usb 1-6: Manufacturer: Sierra Wireless, Incorporated
[ 2004.118003] usb 1-6: SerialNumber: LF63530082011014
[ 2004.141479] cdc_mbim 1-6:1.12: cdc-wdm0: USB WDM device
[ 2004.141628] cdc_mbim 1-6:1.12 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-6, CDC MBIM, 9a:61:ca:dd:73:0e
[ 2004.653384] cdc_mbim 1-6:1.12 wwp0s20f0u6i12: renamed from wwan0

You need two files to update firmware: SWI9X30C_02.05.07.00.cwe and 1102662_9905046_EM7455_02.05.07.00_00_Lenovo-Laptop_001.003_000.nvu

This files can be googled or found in https://download.lenovo.com/pccbbs/mobiles/r07ws07w.exe, maybe it will be necessary to work with 7z or similar tool to get them from this file. After you found them run two commands, first one is optional and needed only in rare cases:

#sudo qmi-firmware-update -b -d 413c:81b6
sudo qmi-firmware-update -u -d 413c:81b6 --device-open-mbim SWI9X30C_02.05.07.00.cwe 1102662_9905046_EM7455_02.05.07.00_00_Lenovo-Laptop_001.003_000.nvu

After firmware update you should get following lines (or very similar) in your dmesg.

[ 2536.465468] usb 1-6: New USB device found, idVendor=1199, idProduct=9079
[ 2536.465469] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2536.465470] usb 1-6: Product: Sierra Wireless EM7455 Qualcomm Snapdragon X7 LTE-A
[ 2536.465470] usb 1-6: Manufacturer: Sierra Wireless, Incorporated
[ 2536.465471] usb 1-6: SerialNumber: LF63530082011014
[ 2536.467090] qcserial 1-6:1.0: Qualcomm USB modem converter detected
[ 2536.467141] usb 1-6: Qualcomm USB modem converter now attached to ttyUSB0
[ 2536.467758] qcserial 1-6:1.2: Qualcomm USB modem converter detected
[ 2536.467795] usb 1-6: Qualcomm USB modem converter now attached to ttyUSB1
[ 2536.468466] qcserial 1-6:1.3: Qualcomm USB modem converter detected
[ 2536.468504] usb 1-6: Qualcomm USB modem converter now attached to ttyUSB2
[ 2536.491368] cdc_mbim 1-6:1.12: cdc-wdm0: USB WDM device
[ 2536.491532] cdc_mbim 1-6:1.12 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-6, CDC MBIM, 9a:61:ca:dd:73:0e
[ 2537.007018] cdc_mbim 1-6:1.12 wwp0s20f0u6i12: renamed from wwan0

Configuration

Battery life

TLP

PowerTOP

  • powertop –calibrate
  • powertop –autoblablabla