In theprevious post, we’ve successfully booted into Arch linux from our encrypted root partition.
Let’s now configure it to our (my) liking.
Contents X11 and Window Manager: dwm Input: Trackpad gestures (libinput) Graphics: Nvidia and Bumblebee Debugging suspend/hibernation Locking screen on sleep Networking: netctl, Unbound Password Management: pass User management# Add new user $ useradd -m -G wheel saminiir # Uncomment wheel group $ grep wheel /etc/sudoers %wheel ALL=(ALL) ALL # %wheel ALL=(ALL) NOPASSWD: ALL # Harden the root pasword if necessary $ passwd
Arch User RepositoryThe Arch User Repository (AUR) contains community-driven packages. yaourt is a popular front-end for it. Enable it by:
$ pacman -S git $ git clone https://aur.archlinux.org/package-query.git $ cd package-query $ makepkg -si $ cd .. $ git clone https://aur.archlinux.org/yaourt.git $ cd yaourt $ makepkg -si $ cd ..
X11 and Window Manager: dwmDetermine your 3D card:
$ lspci | grep -e VGA -e 3D 01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2) # Install nvidia proprietary drivers (pulls in xorg as well) # Be sure to select nvidia and libinput if it prompts for the repo extras $ pacman -S nvidia $ pacman -S xorg-server-utils xorg-xinit $ pacman -S openssh slock terminus-font $ git clone https://github.com/saminiir/dotfiles.git $ ln -s ~/dotfiles/xorg/xinitrc .xinitrc $ ln -s ~/dotfiles/xorg/Xresources .XresourcesConfigure dwm to e.g. use xterm as terminal and change the modifier key to windows key ( Mod4Mask ):
$ git clone https://aur.archlinux.org/dwm-git.git $ cd dwm-git && makepkg $ grep "define MODKEY" src/dwm/config.h #define MODKEY Mod4Mask $ grep "char \*termcmd" src/dwm/config.h static const char *termcmd[] = { "xterm", NULL }; $ makepkg -fi $ startxdwm should start.
Terminal: xtermFor some reason, I’ve stuck on using xterm . Even its manual page says that it needs to be rewritten, so feel free to go find an alternative.
For the rest of us, at least the following tweaks are useful:
# Make bash auto-complete better $ pacman -S bash-completion # Install Google's `noto` font package $ pacman -S noto-fonts # For easy command-on-key binding $ pacman -S xbindkeys
Finally, use the .Xresources from my dotfiles:
$ git clone git@github.com:saminiir/dotfiles.git $ cd ~ && ln -s ~/dotfiles/xorg/Xresources .Xresources
Important things for me is that Caps Lock is mapped as a Control key, and that the Alt (or whatever is left of space bar) acts as Meta. These can be found from the dotfiles , but I’ll highlight them here too:
# No caps lock - Map it as ctrl instead $ setxkbmap -option ctrl:nocaps # Kill X11 with ctrl+alt+backspace $ setxkbmap -option terminate:ctrl_alt_bksp # Change keyboard layout on right shift setxkbmap -layout us,fi -option grp:rshift_toggle $ grep meta~/.Xresources xterm*metaSendsEscape: true
Furthermore, I like to have my tilde character lower on the keyboard, on the right side of left-shift:
$ grep tilde /usr/share/X11/xkb/symbols/pc key <LSGT> { [ grave, asciitilde, grave, asciitilde ] }; Input: Trackpad gestures (libinput)I chose to use libinput over synaptics for the touchpad driver.
$ pacman -S libinput xf86-input-libinput $ libinput-list-devices $ xinput list-props "DLL06E4:01 06CB:7A13 Touchpad" # Enable tap-click $ xinput set-prop "DLL06E4:01 06CB:7A13 Touchpad" "libinput Tapping Enabled" 1 # Increase pointer acceleration $ xinput set-prop "DLL06E4:01 06CB:7A13 Touchpad" "libinput Accel Speed" 1
These can be found from xutils in my dotfiles (described above).
SoundJust install alsa-utils , and use alsamixer to unmute the master channel. Should just work.
For keyboard hotkeys, add the following to xbindkeys configuration:
$ grep -A1 amixer ~/.xbindkeysrc "/usr/bin/amixer set Master 5%+" XF86AudioRaiseVolume -- "/usr/bin/amixer set Master 5%-" XF86AudioLowerVolume -- "/usr/bin/amixer set Master toggle" XF86AudioMute
Storage: NVMe SSDTrimming is an operation SSDs benefit greatly of. However, enabling it for encrypted drives is a security risk. The options are to enable trim and suffer the weakened security, or at regular intervals take maintainance on the drive.
One way of minimizing writes, which can especially wear down SSD, is to use the noatime or relatime in the drives mount options. For me, this was enabled by default:
$ grep relatime /etc/fstab .. relatime ..
Graphics: Nvidia and BumblebeeLet’s install bumblebee for smart workswitching for the integrated and dedicated graphics:
$ pacman -S bumblebee primus bbswitch # Should show the traditional 3D-accelerated gears $ primusrun glxgears # Reboot. After rebooting, you should see that bbswitch has disabled the card, # which is good for saving the battery on the laptop $ cat /proc/acpi/bbswitch 0000:01:00.0 OFF
Power Management Powertoppowertop is the best. Install it.
$ pacman -S powertop
Run calibration as many times as you like. Eventually, powertop will start to show accurate power consumption estimates. Additionally, run it also with --auto-tune :
$ powertop --calibrate $ powertop --auto-tune
Also, add a systemd service for autotuning on startup:
$ cat /etc/systemd/system/powertop.service [Unit] Description=Powertop tunings [Service] Type=oneshot ExecStart=/usr/bin/powertop --auto-tune [Install] WantedBy=multi-user.target $ systemctl enable powertop.service Battery statusI use the command acpi -b for checking battery status. You need the package acpi for it.
BacklightThe display’s backlight is a huge power drain, and it is often convenient to have a hotkey to adjust it.
$ pacman -S light
Now, add commands to xbindkeys for manipulating the backlight:
$ grep -A3 light ~/.xbindkeysrc "/usr/bin/light -U 5" m:0x0 + c:232 XF86MonBrightnessDown "/usr/bin/light -A 5" m:0x0 + c:233 XF86MonBrightnessUp
Laptop modeAlso, activate laptop-mode :
$ cat /etc/sysctl.d/laptop.conf vm.laptop_mode = 5
Suspend/hibernateAdd resume to Kernel parameters.
$ vi /boot/lodar/entries/arch-encrypted-lvm.conf options ... resume=/dev/mapper/MyVol-swap quiet rw
Add the resume hook to initramfs.
$ vi /etc/mkinitcpio.conf HOOKS="base ... lvm2 resume ..."
Note that the resume hook should be after lvm2 !
Then, regenerate the initramfs:
$ mkinitcpio -p linux
Debugging suspend/hibernationIf suspend/hibernation does not work at first, debug it by setting pm_test
$ cat /sys/power/pm_test none core processors platform devices freezer $ echo freezer | sudo /sys/power/pm_test $ systemctl suspend $ systemctl hybrid-sleep
Go through the different stages ( freezer , devices ..) and watch the output of journalctl -r for what goes wrong.
Locking screen on sleepI want to lock the screen ( slock ) whenever the system is put to sleep.
This can be achieved by setting systemd units that have the sleep.target activated. See more examples from dotfiles/systemd :
$ cat /etc/systemd/system/suspend@saminiir.service [Unit] Description=User suspend actions Before=sleep.target [Service] User=%I Type=simple Environment=DISPLAY=:0 ExecStart=/usr/bin/slock ExecStartPost=/usr/bin/sleep 1 [Install] WantedBy=sleep.target $ systemctl enable suspend@saminiir.service Networking: netctl, UnboundUse whatever network manager that rows your boat. I have experience in NetworkManager, but the default netctl in Arch Linux might be worth using too.
I’ve used dnsmasq in the past, but unbound seems like a cool caching DNS resolver that handles DNSSEC as well.
$ pacman -S expat unbound
See the documentation how to configure it. Most importantly your /etc/resolv.conf should point to 127.0.0.1 to use your own DNS program.
$ cat /etc/resolv.conf # Generated by resolvconf domain lan nameserver 127.0.0.1
Browser: FirefoxI use Firefox. With a high DPI screen, however, you should increase the pixel density. Go to about:config and set the layout.css.devPixelsPerPx to 2.
Backups: rsnapshotI use rsnapshot . TODO.
Password Management: passThis is kind of an extra section, since password management is pretty personal. I, however, have liked the utility pass , which is a simplistic bash script for linux utilities like pwgen .
$ pacman -S pass # Or if you have an existing pass-store, e.g. in a private cloud, symlink the folder ~/.password-store to it $ pass init
pass uses your gpg-keys for encrypting/decrypting the files by default. See my earlierblog post on how to establish GPG.
Then, synchronize the ~/.password-store between computers however you like.
Gaming: Steam/WineBecause Wine uses 32-bit libraries, you have to enable the multilib repo
# Uncomment multilib repo $ vi /etc/pacman.conf $ pacman -S wine lib32-alsa-lib lib32-alsa-plugins $ pacman -S wine-mono wine_gecko winetricks
Setup a 32-bit wine environment:
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg # Install .NET Framework 4.0, just for laughs $ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts
Then, use `winetricks to install Steam:
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks steam
You should be able to start Steam/Wine. Your mileage may vary.
$ WINEARCH=win32 WINEPREFIX=~/wine32 primusrun wine ~/wine32/drive_c/Program\ Files/Steam/Steam.exe
If you liked this post, you can share it with your followers and follow me on Twitter !
Sources