ArchLinux

Table of Contents

ArchLinux has the most up-to-date binary software.

You can back up configuration by:

1 TMP

1.1 useradd

The account will use the values on command line, plus the default value for system. A group will also be created by default.

  • -g GROUP: specify the initial login group. Typically just ignore this, the default value will be used.
  • -G group1,group2,...: additional groups. You might want: video, audio, wheel
  • -m: create home if it does not exists
  • -s SHELL: use this shell. Typically just ignore this, the system will choose for you.

1.2 small

  • install vlc in order to use EMMS
  • mpd and mpc for music playing

1.3 Install on Digital ocean droplet

Although digital ocean didn't provide a default arch distribution, you can easilly convert debian to arch.

https://github.com/gh2o/digitalocean-debian-to-arch

1.4 Kill Xorg

Kill all Xorg instances

pkill -15 Xorg

If using kill:

ps -ef | grep Xorg # find the pid
kill -9 <PID>

The xkill is not working properly, giving me "unable to find display" error.

2 Installation

Download the image (no need extra package files as the time of 2011 ..), and burn to USB.

The system will boot into the host OS.

2.1 Verify UEFI

Nowadays (start from 2017) Arch only supports 64 bits … and seems to prefer UEFI .. Fine

First, verify the boot mode to be UEFI by checking the following folder exists

ls /sys/firmware/efi/efivars

2.2 System clock

timedatectl set-ntp true

2.3 Partition

parted /dev/sda mklabel gpt
parted /dev/sda mkpart ESP fat32 1MiB 513MiB
parted /dev/sda set 1 boot on
parted /dev/sda mkpart primary linux-swap 513MiB 5GiB
parted /dev/sda mkpart primary ext4 5GiB 100%

This creates

sda1
/boot the EFI System Partition (ESP), swp, and a root
sda2
swap
sda3
/

Format:

mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda3

Mount

mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

2.4 Select mirror

look into /etc/pacman.d/mirrorlist and modify if necessary. The order matters. The file will be copied to new system.

2.5 Install base system

pacstrap /mnt base

2.6 chroot

genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt

2.7 Configure

Now we are in the new system.

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc

Uncomment en_US.UTF-8 UTF-8 inside /etc/locale.gen and run

locale-gen

Set LANG in /etc/locale.conf

LANG=en_US.UTF-8

Set hostname in /etc/hostname

myhostname

Set root password

passwd

Install grub

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=myarch
grub-mkconfig -o /boot/grub/grub.cfg

Before reboot, it is good to make sure the network will work, by installing some networking packages:

  • dialog
  • wpa_suppliant
  • iw

Now reboot

2.8 Config

Install the packages, and config the system using my scripts:

  • setup-quicklisp
  • setup-git

2.9 Dual boot with Windows

The only difference is that, you do not need to create the EFI boot partition, but use the existing one. Just mount it to boot. The rest is the same.

3 Wireless Networking

3.1 General DHCPCD

DHCP is not enabled by default. It is the philloshophy for Arch: installing a package will not enable any service. Enable it by;

systemctl enable dhcpcd

3.2 iw

  • iw dev: list dev
  • iw dev <interface> link: show status
  • ip link set <interface> up: up the interface
  • ip link show <interface>: if you see <UP> in the output, the interface is up
  • iw dev interface scan: scan for network
  • iw dev <interface> connect "SSID": connect to open network

3.3 wpasupplicant

iw can only connect to public network. This is used to connect WPA2/WEP encrypted network.

3.3.1 Configuration

The config file (e.g. /etc/wpa_supplicant/example.conf) can be generated in two ways: using wpa_cli or use wpa_passphrase. wpa_cli is interactive, and has commands scan, add_network, save_config.

wpa_passphrase MYSSID <passphrase> > /path/to/example.conf

Inside this file, there's a network section. The ssid is a quoted SSID name, while psk is unquoted encrypted phrase. The psk can also be quoted clear password. If the network is open, you can use key_mgmt=NONE in place of psk

3.3.2 Connect

wpa_supplicant -B -i <interface> -c <(wpa_passphrase <MYSSID> <passphrase>)

connect to a WPA/WEP protected network

  • -b: fork into background
  • -i interface
  • -c: path to configuration file.

Alternatively, you can use the config file

wpa_supplicant -B -i <interface> -c /path/to/example.conf

3.3.3 Obtain IP

After this, you need to get IP address by the "usual" way, e.g.

dhcpcd <interface>

It seems that we should enable the service:

  • wpasupplicant@<interface>
  • dhcpcd@<interface>

Also, dhcpcd has a hook that can launch wpasupplicant implicitly.

3.3.4 To Sum Up

Find the interface by iw dev. Say it is wlp4s0.

Create config file /etc/wpa_supplicant/wpa_supplicant-wlp4s0.conf:

network={
        ssid="MYSSID"
        psk="clear passwd"
        psk=fjiewjilajdsf8345j38osfj
}

network={
        ssid="2NDSSID"
        key_mgmt=NONE
}

Enable wpa_supplicant@wlp4s0 and dhcpcd@wlp4s0 (or just dhcpcd)

To change another wifi, kill the server and use another one

sudo killall wpa_supplicant
wpa_supplicant -B -i wlp4s0 -c /path/to/wifi.conf

4 Trouble shooting

  • After booting stumpwm, sbcl cannot be executed.

4.1 auto expansion error for latex font

when compiling latex using acmart template, auto expansion error is reported.

Solution:

mktexlsr # texhash
updmap-sys

Reference: https://github.com/borisveytsman/acmart/issues/95

5 Pacman

Option

S
sync, a.k.a install
Q
query

Parameter:

s
search
y
fetch new package list. Usually use with u
u
update all packages
i
more information
l
location of files

Typical usage:

Syu
update whole system
S
install package
R
remove package
Rs
remove package and its unused dependencies
Ss
search package
Qi
show description of a package
–noconfirm
use in script
–needed
do not install the installed again

Pacman will store all previously downloaded packages. So when you find your /var/cache/pacman so big, consider clean them up using:

paccache -rk 1

6 AUR

Have to search through its web interface. Find the git download link and clone it. It is pullable.

Go into the folder and

makepkg -si

-s alone will build it, with i to install it after build. The dependencies are automatically installed if can be found by pacman. If it is also on AUR, you have to install manually.

The md5sum line can be skipped for some package. Just replace the md5sum value inside the quotes with 'SKIP'.

7 Setup

Although I set the right timezone (check by timedatectl), the clock is still incorrect. To fix that, install ntp package and run

sudo ntpd -qg

8 Packages

8.1 libraries

  • base-devel
  • cmake
  • pugixml
  • ninja
  • gtest
  • antlr2
  • rapidjson
  • libxslt

8.2 Xorg

Actually xorg group seems to contain all of them, except:

  • xorg-xinit

Common xorg packages:

  • xorg-server
  • xorg-xinit
  • xterm
  • rxvt-unicode
  • xorg-xinput
  • xorg-xdm
  • xorg-xconsole
  • openbox: just in case stumpwm stops working

To make the default startx work:

  • xorg-twm
  • xorg-xterm
  • xorg-xclock
  • xorg-xkill
  • xorg-xeyes
  • xorg-xcalc
  • xorg-xconsole

for nvidia-xconfig to work:

  • xorg-server-devel

8.3 utils

  • ghostscript (for ps2pdf)
  • sbcl
  • bc
  • git
  • curl
  • mlocate
  • bash-completion
  • ctags
  • thesilversearcher
  • python
  • python2
  • python-pip
  • ipython
  • ispell
  • aspell
  • aspell-en
  • feh
  • tidy
  • unzip
  • cloc
  • svn
  • ntfs-3g
  • openssh
  • clojure
  • r
  • youtube-dl
  • spice # the command is remove-viewer
  • virt-viewer
  • ruby
  • markdown
  • dosfstools: for mkfs.vfat, used for raspberry pi
  • pavucontrol
  • pulseaudio
  • alsa-utils
  • pulseaudio-alsa
  • racket
  • racket-docs
  • swi-prolog

8.4 Not so important

  • doxygen
  • gperftools
  • valgrind

8.5 App

  • emacs
  • tmux
  • mplayer
  • chromium
  • firefox (do not install if I only want to use chromium)
  • mpd
  • cantata (mpd GUI client, requires pretty much dependencies, based on qt)

8.6 Large ones

  • texlive-most (including texlive-core)
  • clang
  • llvm
  • clang-tools-extra
  • boost

8.7 fonts

  • wqy-zenhei
  • adobe-source-han-sans-cn-fonts
  • adobe-source-code-pro-fonts

8.8 For Helium

  • zeromq
  • memcached libmemcached

8.9 Undecided

  • acpi: battery
  • acpid: power management daemon

8.10 for Pdf Tools

  • libzip
  • poppler-glib
  • imagemagick

8.11 Nvidia driver

  • nvidia
  • nvidia-settings

To activate nvidia card, run nvidia-xconfig, and reboot (to restart xorg-server).

8.12 Install using AUR (in order!)

  • cl-ppcre
  • clx-git
  • cl-alexandria
  • stumpwm-git
  • quicklisp
    • On arch, after install quicklisp via AUR, it prompts: to load quicklisp etc/default/quicklisp into ~.sbclrc.
  • translate-shell
  • acpilight
  • rtags-git
  • plantuml
  • leiningen2-git

8.13 Racket packages

Install using raco pkg install <pkg>

  • c-utils

9 TP25

This is something I went through during setup my thinkpad 25.

9.1 backlight

The xorg-xbacklight is not working. The drop-in replacement acpilight (aur) does.

To setup for video group users to adjust backlight, place a file /etc/udev/rules.d/90-backlight.rules

SUBSYSTEM=="backlight", ACTION=="add", \
  RUN+="/bin/chgrp video %S%p/brightness", \
  RUN+="/bin/chmod g+w %S%p/brightness"

The command is still xbacklight.

Author: Hebi Li

Created: 2017-12-03 Sun 21:39

Validate