2020-12-02T21:11:32+01:00
Last week I bought a Honor MagicBook 14 laptop. This blog post documents setting up an Arch Linux system on this machine.
Tech specs for the Honor MagicBook 14 with 16GB RAM and a 512GB SDD:
Outputs produced by common diagnostic tools: lspci lscpu lsusb
Get an archlinux image (not the bootstrap image) from https://www.archlinux.org/download/
Calculate the checksum.
$ sha1sum archlinux-2020.12.01-x86_64.iso
aea95a15c9f034d10e665247cfe782bccb5b306e archlinux-2020.12.01-x86_64.iso
Copy image on a USB drive. This is surprisingly simple on a Linux system (be careful to specify the right device).
# cat archlinux-2020.12.01-x86_64.iso > /dev/sdg
Other methods are described here
After we are done, the USB drive can be restored with
wipefs --all /dev/sdX
fdisk /dev/sdX
# create a primary partition with code 'b'
mkfs.vfat /dev/sdX1
Enter the BIOS by pressing F1
, F2
, or
Del
(I pressed all these keys, don’t know which one
worked). Change settings to booting from USB device. Disable secure
boot. Restart.
https://wiki.archlinux.org/index.php/Installation_guide
loadkeys de-latin1
No idea why verifying the boot mode is important. I apparently booted in the UEFI mode. https://wiki.archlinux.org/index.php/Arch_boot_process
ls /sys/firmware/efi/efivars
iwctl
Connect by follwing this: https://wiki.archlinux.org/index.php/Iwd#Connect_to_a_network
Get rid of every partition except the EFI one.
fdisk -l
Repartition and create new file systems.
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 206847 204800 100M EFI System
/dev/nvme0n1p2 206848 33761279 33554432 16G Linux swap
/dev/nvme0n1p3 33761280 1000215182 966453903 460.8G Linux root (x86-64)
Mount root and swap, and pacstrap
with some additional
packages from https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/packages.x86_64
Set and generate locale. Save config to
/etc/locale.conf
Set keyboard layout in /ect/vconsole.conf
KEYMAP=us
Other layouts are listed here:
ls /usr/share/kbd/keymaps/**/*.map.gz
Install grub
and efibootmgr
packages.
Follow https://wiki.archlinux.org/index.php/GRUB for UEFI
systems.
https://wiki.archlinux.org/index.php/General_recommendations
Add a user.
useradd -m -G rfkill,wheel julian
Enable iwd.service
. Connect to a wireless network using
iwctl
. Enable DHCP feature of iwd
in the
config file /etc/iwd/main.conf
:
[General]
EnableNetworkConfiguration=true
[Network]
NameResolvingService=systemd
Finally:
systemctl enable --now systemd-resolved.service
Graphic card driver package: amdgpu
https://wiki.archlinux.org/index.php/AMDGPU
Display manager: None – just use .xinitrc
and
startx
Window manager package: i3-wm
According to the tech spec, the DPI of the display is 157. Xorg
doesn’t detect this automatically as can be seen from the
xpdyinfo
output
screen #0:
dimensions: 1920x1080 pixels (508x285 millimeters)
resolution: 96x96 dots per inch
There are many ways to set a DPI value. For example, using
.xinitrc
, we can do
xrandr --dpi 144
exec i3
Volume and mute keys work out-of-the-box. This is not the case for screen backlight hotkeys. See the “Power management” section.
dmenu
had a weird-looking fonts setting (huge distances
between letters). Following solution posted at https://www.reddit.com/r/i3wm/comments/fxz4hj/help_the_letter_spacing_in_my_dmenu_bar_is_weird/
Decided to try kitty
, after having some trouble with
fonts in urxtv.
Color themes can be cloned right into the config directory
git clone --depth 1 git@github.com:dexpota/kitty-themes.git ~/.config/kitty/kitty-themes
Also, to convince i3-sensible-terminal
to use
kitty
per default we need
export TERMINAL=kitty
Zenburn colors are not shipped as a part on any standard package. Do
git clone https://github.com/jnurmine/Zenburn.git
and copy
the colors
directory to ~/.vim/colors
to get
the scheme definition.
Here is my .vimrc file.
Generate ssh keys (for Github, Gitlab etc.) using
ssh-keygen -t ed25519 -C 'julian@wergieluk.com'
Append AddKeysToAgent yes
to .ssh/config
to
have the new keys managed by the ssh-agent
automatically. I
decided to start the ssh-agent using a user systemd service. Copied the
service file from https://wiki.archlinux.org/index.php/SSH_keys#Start_ssh-agent_with_systemd_user
Testing the connection:
ssh -T git@github.com
Is there a way to measure whether these settings bring anything?
options snd_hda_intel power_save=1
to
/etc/modprobe.d/audio-powersave.conf
to susspend sound card
if not used.Another recommended way to save power, is to blacklist modprobe
modules of unused devices. For that I created a file
/etc/modprobe.d/blacklist.conf
with a list of modules, and
included that file in the FILES
array of
/etc/mkinitcpio.conf
:
FILES=(/etc/modprobe.d/blacklist.conf)
Blacklisted modules:
ccp
for “[AMD] Family 17h (Models 10h-1fh) Platform
Security Processor”btusb
for bluetooth.xev
events when pressing the brightness-up and
brightness-down keys:
KeyRelease event, serial 35, synthetic NO, window 0x2200001,
root 0x6ab, subw 0x0, time 49258531, (-1,720), root:(963,742),
state 0x0, keycode 232 (keysym 0x1008ff03, XF86MonBrightnessDown), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 35, synthetic NO, window 0x2200001,
root 0x6ab, subw 0x0, time 49263961, (-1,720), root:(963,742),
state 0x0, keycode 233 (keysym 0x1008ff02, XF86MonBrightnessUp), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
Set user permissions to modify screen brightness:
gpasswd -a julian video
With these permissions in place, the backlight intensity can be set using
$ echo 100 > /sys/class/backlight/amdgpu_bl0/brightness
or a specialized utility listed on https://wiki.archlinux.org/index.php/backlight#Backlight_utilities
I ended up using brightnessctl
which is written in C and
has no dependencies. Wiring the brightnessctl
invocations
to keysyms listed above can be done in the i3 config file (note the
5%-
notation).
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
Works.
Sound works out-of-the-box after installing pulseaudio
and pulseaudio-alsa
.
Setting Arch Linux with a non-standard window manager like i3 clearly requires some effort and knowledge. I didn’t hit any major roadblocks like missing hardware drivers. Most of necessary steps are clearly described on the Arch wiki. I learned some interesting details about Xorg while working on this installation.