ThinkPad:ArchLinux: Difference between revisions
m (→Battery/CPU) |
|||
Line 34: | Line 34: | ||
{{Console|1=yaourt -S tlp tp_smapi acpi_call|2=sudo systemctl enable tlp|3=sudo systemctl enable tlp-sleep}}<br/> | {{Console|1=yaourt -S tlp tp_smapi acpi_call|2=sudo systemctl enable tlp|3=sudo systemctl enable tlp-sleep}}<br/> | ||
{{Console|1=sudo systemctl mask NetworkManager.service|2=sudo systemctl mask systemd-rfkill.service|3=sudo systemctl mask systemd-rfkill.socket}} | {{Console|1=sudo systemctl mask NetworkManager.service|2=sudo systemctl mask systemd-rfkill.service|3=sudo systemctl mask systemd-rfkill.socket}} | ||
Then edit the tlp config file to setup your TLP profile. My current [//github.com/kyau/dotfiles/blob/master/etc/default/tlp tlp] config can be found on GitHub. | Then edit the tlp config file to setup your TLP profile. | ||
{{GitHub|My current [//github.com/kyau/dotfiles/blob/master/etc/default/tlp tlp] config can be found on GitHub.}} | |||
{{Console|1=sudo vim /etc/defaults/tlp}} | {{Console|1=sudo vim /etc/defaults/tlp}} | ||
TLP status can be shown with the following: | TLP status can be shown with the following: |
Revision as of 15:12, 18 July 2017
UNDER CONSTRUCTION: The document is currently being modified! |
This is a compilation of information I have scoured off the net in order to get my ThinkPad X220 running in the best possible configuration possible for my needs. If you need assistance installing Arch Linux, refer to the tutorial linked above.
LUKS Preparation
Begin by downloading the ThinkPad Drive Erase Utility, this is used for resetting cryptographic keys and erasing solid state drives. This utility is a must as all SSDs are put into the frozen state on boot due to Lenovo's BIOS. Then use El Torito to convert it into a bootable image file and dd it to your USB disk.
# geteltorito.pl -o securewipe.img 83fd04ww.iso # sudo dd if=securewipe.img of=/dev/sdX bs=10M |
WARNING: Using the disk erase will prompt you with a code to write down and then enter after a reboot. DO NOT skip this part. |
Customization
Keeping the Boot Log on TTY1
In order to stop Arch Linux from clearing the screen on boot we can add the i915 module to MODULES inside of /etc/mkinitcpio.conf and then regenerate our kernel images.
# sudo sed -i -r 's/^MODULES="([a-z0-9 _-]+)"/MODULES="\1 i915"/' /etc/mkinitcpio.conf # sudo mkinitcpio -p linux |
Then create a directory for getty overrides and create one with the following.
# sudo mkdir /etc/systemd/system/getty@tty1.service.d # sudo vim /etc/systemd/system/getty@tty1.service.d/noclear.conf |
[Service] TTYVTDisallocate=no |
Traditional Device Node Names
To translate the predictable device node names back into traditional ones, can create the following. You can use the vim command :r !cat /sys/class/net/wlp3s0/address, replacing the device node respectively, in order to get the MAC Address of each device.
# vim /etc/udev/rules.d/10-network.rules |
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC_ADDRESS_FOR_NIC", NAME="wired0" SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC_ADDRESS_FOR_WIFI", NAME="wifi0" |
Console Fonts
Everyone have their own opinion, you can pull up a list with ls /usr/share/kbd/consolefonts. To test out a font use setfont, issue the command by itself to return to the default. You can also issue showconsolefont to show a list of all available characters.
# setfont -m 8859-2 gr928-8x16-thin # showconsolefont |
We can set this at boot by adding it to /etc/vconsole.conf.
# echo -e "FONT=gr928-8x16-thin\nMAP=8859-2" | sudo tee --append /etc/vconsole.conf |
Hardware
Battery/CPU
Install TLP and related packages. Then enable it with systemd, don't forget to mask the required services (skip NetworkManager if you use this).
# yaourt -S tlp tp_smapi acpi_call # sudo systemctl enable tlp # sudo systemctl enable tlp-sleep |
# sudo systemctl mask NetworkManager.service # sudo systemctl mask systemd-rfkill.service # sudo systemctl mask systemd-rfkill.socket |
Then edit the tlp config file to setup your TLP profile.
GitHub: My current tlp config can be found on GitHub. |
# sudo vim /etc/defaults/tlp |
TLP status can be shown with the following:
# sudo tlp-stat |
It is also a good idea to install PowerTOP in order to monitor power usage.
# yaort -S powertop |
Fan Control
Install thinkfan, default configuration is installed into /usr/lib/modprobe.d/thinkpad_acpi.conf.
# yaourt -S acpi lm_sensors thinkfan |
Then detect the hardware monitors chips that are available. Then re-enable the thinkpad_acpi kernel module to update with the new config.
# sudo sensors-detect # sudo modprobe thinkpad_acpi |
To show the current thermal and cooling information use acpi.
# sudo acpi -V |
To show the current fan speed and level.
# sudo cat /proc/acpi/ibm/fan |
Make the changes to point it to the right temperature reading, you can use :r !sudo find /sys/devices -type f -name "temp*_input" in order to paste all the monitors into the file. My current thinkfan.conf can be found on GitHub.
# sudo vim /etc/thinkfan.conf |
You can verify the config is written correctly with the following command.
# sudo thinkfan -n |
Finally enable and start thinkfan.
# sudo systemctl enable thinkfan # sudo systemctl start thinkfan |
Kernel
For added power savings we can change a few kernel options. Enabling Intel i915 RC6 is a feature that allows the GPU to enter a lower power state during GPU idle. Enabling i915 framebuffer compression reduces the memory bandwidth on screen refreshes, reported to save ~0.6W on an X220. Finally the DRM vblank off delay reduces wakup events and theoretically saves power.
To enable all of these add the following to the options line in your /boot/EFI/BOOT/refind.conf file for Arch Linux.
i915.enable_rc6=1 i915.enable_fbc=1 drm.vblankoffdelay=1 i915.semaphores=1 |
SSD
First if you want to enable TRIM on boot, create a systemd service. Also create a systemd service for adjusting the governor on system boot-up.
# sudo vim /etc/systemd/system/ssd-trim.service |
[Unit] Description=Runs fstrim on the SSD Requires=multi-user.target After=multi-user.target [Service] Type=oneshot RemainAfterExit=no ExecStart=/usr/bin/fstrim -v / [Install] WantedBy=multi-user.target |
To monitor the HDD or SSD installed you need to install the smartmontools package.
# yaourt -S smartmontools |
You can view an overall health assessment with the following:
# sudo smartctl -H /dev/sdX |
Enable and start the smartd systemd service to enable SMART monitoring for all disks.
# sudo systemctl enable smartd |
We can also have SMART email us and run a script for notifications on SMART errors.
# sudo sed -i 's/^DEVICESCAN/DEVICESCAN -m address\@domain.com -M exec \/usr\/bin\/smartdnotify/' /etc/smartd.conf |
Then create the /usr/bin/smartdnotify script (replacing both instances of kyau with your username).
# sudo vim /usr/bin/smartdnotify |
#!/bin/sh sudo -u kyau DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/kyau/bus notify-send "S.M.A.R.T Error ($SMARTD_FAILTYPE)" "$SMARTD_MESSAGE" --icon=dialog-warning |
# sudo chmod +x /usr/bin/smartdnotify |
Then you can start the service.
# sudo systemctl start smartd |
Trackpoint
Considering I have the touchpad disabled in BIOS I tend to configure the trackpoint a bit more.
# sudo vim /etc/X11/xorg.conf.d/20-thinkpad.conf |
Section "InputClass" Identifier "Trackpoint Wheel Emulation" MatchProduct "TPPS/2 IBM TrackPoint" MatchDevicePath "/dev/input/event*" Option "EmulateWheel" "true" Option "EmulateWheelButton" "2" Option "Emulate3Buttons" "false" Option "XAxisMapping" "6 7" Option "YAxisMapping" "4 5" EndSection |
Video
To fix the Intel HD 3000 graphics showing tearing during video playback or other fast movement on the screen.
# echo -e 'Section "Device"\n Identifier "Intel HD 3000 Graphics"\n Driver "intel"\n Option "TearFree" "true"\nEndSection' | sudo tee /etc/X11/xorg.conf.d/20-intel.conf |
Applications
Personally, I keep a running backup of all of my dotfiles on GitHub along with a script to redo all the symbolic links. This makes the process as simple as: git clone https://github.com/kyau/dotfiles && cd dotfiles && ./setup.sh && logout |
The following is a re-paste from the script that is run from dotfiles, install-x220.sh after re-logging back into the machine.
You can find the most up-to-date version of this script on GitHub
# cli-apps sudo pacman -S irssi mpc mpd playerctl vim yaourt -S cli-visualizer htop-solarized ncmpcpp-git neofetch ranger-git wordgrinder # xorg-apps sudo pacman -S gimp lxappearance mirage nitrogen rofi rxvt-unicode rxvt-unicode-terminfo thunar truecrypt vapoursynth vapoursynth-plugin-mvtools w3m xorg-xfd yaourt -S compton-git discord google-chrome i3-gaps mpv-vapoursynth nerd-fonts-git numlockx polybar obs-studio sublime-text-dev unclutter-xfixes-git # misc sudo pacman -S imagemagick mediainfo ntp openssh perl-image-exiftool reflector sharutils sshfs unrar unzip youtube-dl # themes sudo pacman -S arc-gtk-theme arc-icon-theme ttf-dejavu yaourt -S ttf-font-awesome ttf-mplus # hardware sudo pacman -S alsa-utils i7z libva-intel-driver libvdpau-va-gl ntfs-3g ntp pulseaudio-alsa wireless_tools |