Natenoms Wiki

Weil Teilen Spaß macht :)

User Tools

Site Tools


Sidebar

Translations of this page:

Navigation



Lizenz dieses Wikis
Über dieses Wiki
Feed des Wikis
Impressum


Was gerade in meinem Blog geschieht:

en:sammelsurium:arch_linux_on_leonovo_thinkpad_x201

ArchLinux on Lenovo Thinkpad x201

Using Arch Linux on a Lenovo Thinkpad x201 almost everything works out of the box but one needs to tweak the configuration a bit for some special cases…

Steps to get a running base system

Partition layout

/dev/sda1 boot 512 MiB
/dev/sda2 -> /dev/mapper/lvm

LVM

vgcrypt-system -> 25G
vgcrypt-swap -> 8G
vgcrypt-home -> 800G

Filesystems

  • Boot: ext3
  • System: ext4
  • Home: ext4

Basic installation process

Boot from an Arch Linux live system.

loadkeys de
fdisk /dev/sda
cryptsetup luksFormat /dev/sda2
cryptsetup luksOpen /dev/sda2 lvm
pvcreate /dev/mapper/lvm
vgcreate vgcrypt /dev/mapper/lvm
lvcreate -L 25G -n system vgcrypt
lvcreate -L 8G -n swap vgcrypt
lvcreate -L 800G -n home vgcrypt
mkswap /dev/mapper/vgcrypt-swap
mkfs.ext4 /dev/mapper/vgcrypt-system
mkfs.ext4 /dev/mapper/vgcrypt-home
mount /dev/mapper/vgcrypt-system /mnt

mkdir /mnt/home

mount /dev/mapper/vgcrypt-home /mnt/home
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
pacstrap /mnt base base-devel
pacstrap /mnt grub-bios
genfstab -p -U /mnt > /mnt/etc/fstab
echo "/dev/mapper/vgcrypt-swap        none    swap    defaults        0       2" >> /mnt/etc/fstab

Now edit /mnt/etc/fstab and replace “relatime” by “noatime”.

arch-chroot /mnt
vi /etc/locale.gen
locale-gen
echo LANG=en_GB.UTF-8 > /etc/locale.conf

Create the file /etc/vconsole.conf and edit:

KEYMAP="de"

Timezone:

ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
echo yourhostname > /etc/hostname

Edit /etc/mkinitcpio.conf and add “keymap”, “encrypt” and “lvm2” in this order before filesystems in HOOKS.

mkinitcpio -p linux
grub-install /dev/sda

Edit /etc/default/grub

GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:vgcrypt resume=/dev/mapper/vgcrypt-swap"
grub-mkconfig -o /boot/grub/grub.cfg
passwd
exit
umount /mnt/home
umount /mnt/boot
umount /mnt
sync
sync
reboot

Configuration of your base system

Install packages

pacman -S plasma-meta xorg-xinitrc mc firefox chromium FIXME
...

Install yaourt: https://wiki.archlinux.org/index.php/Yaourt

Mirrorselect

Configure network

systemctl enable NetworkManager
systemctl start NetworkManager

Spoof your mac address

Setup firewall

FIXME

eth0 settings

Create the following file in /etc/systemd/network/:

  • myeth.network
      [Match]
      Name=enp0s25
      [Network]
      DNS=192.168.0.1
      Address=192.168.0.100
      Gateway=192.168.0.1
  • Enable it…
    systemctl enable systemd-networkd

Disable IPv6

Does not work for me: <s>Use the “NetworkManager” methot from https://wiki.archlinux.org/index.php/IPv6#Disable_IPv6</s>

vim /etc/sysctl.d/50-disable-ipv6.conf:

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.enp0s25.disable_ipv6 = 1
net.ipv6.conf.wlp2s0.disable_ipv6 = 1

Or alternatively do not disable ipv6 and enable privacy extensions https://wiki.archlinux.org/index.php/IPv6#NetworkManager

SSH

Add to /etc/ssh/ssh_config:

ServerAliveInterval 5
ServerAliveCountMax 100

Technical background.

Systemd

Solve bug where systemd waits 1m 30s on shutdown

Add the following to /etc/systemd/system.conf:

DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s

Technical background

Drop caches once an hour

Disabled … :), because of https://www.kernel.org/doc/Documentation/sysctl/vm.txt

Use of this file can cause performance problems.  Since it discards cached
objects, it may cost a significant amount of I/O and CPU to recreate the
dropped objects, especially if they were under heavy use.  Because of this,
use outside of a testing or debugging environment is not recommended.

Create /etc/systemd/system/drop_caches.service: <source> [Unit] Description=Drop caches [Service] ExecStart=/usr/local/bin/drop_caches.sh [Install] WantedBy=multi-user.target </source> Create /etc/systemd/system/drop_caches.timer: <source> [Unit] Description=Drop caches once an hour [Timer] OnBootSec=30min OnUnitActiveSec=1h Unit=drop_caches.service [Install] WantedBy=timers.targe </source> systemctl enable drop_caches.timer systemctl start drop_caches.timer [https://wiki.archlinux.org/index.php/Systemd/Timers Information about timers in systemd]

Journald

Limit logging size

Show logs on tty12

Misc

S.M.A.R.T.

pacman -S smartmontools
systemctl start smartd
systemctl status smartd
systemctl enable smartd
journalctl -u smartd

Technical background

TRIM Support

Systemd timer to run fstrim once a week

The package “util-linux” contains a fstrim timer…

Enable and start it with:

systemctl enable --now fstrim.timer

It will run once a week and trim all supported filesystems (fstrim -a).

If you need to specify the exact time the timer has to start, you can do this with:

systemctl edit fstrim.timer

Paste:

  [Timer]                                                                                                                                                                                                                                                                       
  OnCalendar=Sun 19:00                                                                                                                                                                                                                                                          
  Persistent=false                                                                                                                                                                                                                                                              
  Unit=fstrim.service
systemctl restart fstrim.timer

And check with:

systemctl list-timers

Start script on boot

Create the file named startboot.service inside /etc/systemd/system/

[Unit]
Description=My script

[Service]
ExecStart=/usr/local/bin/startup.sh
#old /etc/rc.local script

[Install]
WantedBy=multi-user.target 

Enable it:

systemctl enable startboot.service

The script must contain “#!/bin/bash” in the first line.

Technical background

Miscellaneous

Microcode

Time

Enable time sync with:

timedatectl set-ntp true

https://wiki.archlinux.org/index.php/Systemd-timesyncd

KDE and GTK

pacman -Sy kde-gtk-config

ionice

The ionice binary is available in the package schedtool.

lower the mouse speed

In case you have a very fast mouse where even the lowest speed is too fast, use:

  Section "InputClass"
        Identifier "Mouse"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Option "ConstantDeceleration" "2.55"
  EndSection

Sound

Clementine

Clementine needs the old version of gstreamer.

Install:

pacman -Sy gstreamer0.10-plugins

Jack

Miscellaneous

Xorg

Configure touchpad

For KDE SC install kcm-touchpad|community and for Plasma 5 install kcm-touchpad-frameworks|community.

Suspend to disk

Disable blinking WLAN LED

In my case the filename is /etc/modprobe.d/wlan.conf

And the content is:

options iwlwifi led_mode=1

TLP

pacman -S acpi_call ethtool lsb-release tp_smapi x86_energy_perf_policy
systemctl enable tlp
systemctl start tlp
systemctl enable tlp-sleep
systemctl start tlp-sleep
systemctl disable systemd-rfkill
systemctl stop systemd-rfkill

WWAN aka UMTS card (Gobi2000)

WWAN and Bluetooth get enabled when starting Mumble

I use the following script to disable WWAN and Bluetooth again after starting Mumble:

#!/bin/bash
rfkill block $(/usr/bin/rfkill list | sed -r -n -e "s/([0-9]{1,2})\: tpacpi_wwan_sw.*/\1/p")
rfkill block $(/usr/bin/rfkill list | sed -r -n -e "s/([0-9]{1,2})\: tpacpi_bluetooth_sw.*/\1/p")

Use the rfkill list command to get the exact names for each device.

One can't just use static ids because they may change.

Use sudo to allow a user to run the script

In this example the user who needs to run the script is user.

Paste the code from above to a file named /usr/local/bin/disable_wwan_bluetooth.sh, install sudo and add the file /etc/sudoers.d/user with the following content:

user ALL=(root) NOPASSWD: /usr/local/bin/disable_wwan_bluetooth.sh ""

Now the user can execute the script without the need to enter a password:

sudo /usr/local/bin/disable_wwan_bluetooth.sh

Second monitor on the docking station

On my setup with KDE SC 4.x and the dockingstation KDE always ask how to configure the screen when attaching my laptop to the dockinstation. Instead of configuring this again and again I just press “No” and let a script configure my screen layout:

#!/bin/bash
/usr/bin/xrandr --output LVDS1 -s 1280x800
/usr/bin/xrandr --output HDMI1 -s 1980x1080
/usr/bin/xrandr --output HDMI1 --right-of LVDS1
/usr/bin/xrandr --output LVDS1 --primary

BTW: This works well on Plasma 5 without a helper script.

HDAPSD – Hard disk shock detection

Not needed anymore; I do have an SSD :)

This daemon has access to motion sensors and monitors the movement of your laptop. It it is too much it parks your hard drive. A tutorial can be found at https://wiki.archlinux.org/index.php/Hard_Drive_Active_Protection_System. But the configuration file there doesn't work for me because of the '-blp' parameters. Instead, my configuration file is: <source> [Service] ExecStart= ExecStart=/usr/bin/hdapsd –sensitivity=40 -l </source> The filename is '/etc/systemd/system/hdapsd@sda.service.d/override.conf'

ALSA restore

An alsactl restore is not always reliable, so another approach may be better; for example store files from /var/lib/alsa/asound.state. One for undocked and one for docked. Then save both files and restore from these files.

en/sammelsurium/arch_linux_on_leonovo_thinkpad_x201.txt · Last modified: 2017/03/06 12:01 by Natenom