Reboot into the new system

Set the keyboard layout and Console fonts

If you have the 4K display, console fonts will be extremely small.

1
$ setfont sun12x22

Connect to the internet

1
2
3
nmcli device wifi list
nmcli device wifi connect TP-LINK_GZS password a3628436
ping baidu.com

Unofficial user repositories

1
sudo vim /etc/pacman.conf 
1
2
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

Adding unofficial keys

1
sudo pacman -Syy && sudo pacman -S archlinuxcn-keyring

Fonts

1
sudo pacman -S ttc-iosevka-slab noto-fonts noto-fonts-cjk noto-fonts-emoji tf-latinmodern-math ttf-inconsolata

Graphical user interface

Display server

1
sudo pacman -S xorg-server xorg-xrdb xorg-xbacklight

xorg-xrdb is using to loading a user-level configuration dotfile, typically located at ~/.Xresources.

They can be used to:

  • configure terminal preferences (e.g. terminal colors)
  • set DPI, anti-aliasing, hinting and other X font settings
  • change the Xcursor theme
  • theme XScreenSaver
  • configure low-level X applications like: xorg-xclock, xpdf, rxvt-unicode

Brightness can be set using the xorg-xbacklight package.

1
2
$ xbacklight -inc 10
$ xbacklight -dec 10

Optional:

1
sudo pacman -S  xorg-apps xorg-xinit xorg-xrandr xorg-xinput

Display drivers

1
2
lspci | grep -e VGA -e 3D
sudo pacman -S xf86-video-intel mesa nvidia-dkms nvidia-utils nvidia-settings 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
sudo pacman -S wget git
git clone https://aur.archlinux.org/yay.git
cd yay/
makepkg -si

sudo rm /etc/X11/xorg.conf.d/10-xorg.conf /etc/X11/xorg.conf.d/20-*

yay -S optimus-manager
optimus-manager --switch nvidia
systemctl enable optimus-manager.service
systemctl start optimus-manager.service

vim /etc/X11/xorg.conf.d/10-optimus-manager.conf 

systemctl status optimus-manager.service

Important notes :

  • Custom Xorg config : optimus-manager works by auto-generating a Xorg configuration file and putting it into /etc/X11/xorg.conf.d/. If you already have custom Xorg configuration files at that location or at /etc/X11/xorg.conf , it is strongly advised that you remove anything GPU-related from them to make sure that they do not interfere with the GPU switching process.
  • Bumblebee : optimus-manager is incompatible with Bumblebee since both tools would be trying to control GPU power switching at the same time. If Bumblebee is installed, you must disable its daemon (sudo systemctl disable bumblebeed.service, then reboot). This is particularly important for Manjaro users since Bumblebee is installed by default.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tree /etc/X11/
/etc/X11/
├── xinit
│   ├── xinitrc
│   ├── xinitrc.d
│   │   ├── 40-libcanberra-gtk-module.sh
│   │   └── 50-systemd-user.sh
│   └── xserverrc
└── xorg.conf.d
    └── 10-optimus-manager.conf

optimus-manager supported display managers are : SDDM, LightDM, GDM.

optimus-manager can also work with other display managers (or with no display manager at all) but you have to configure them manually.

1
sudo vim /etc/pacman.d/hooks/nvidia.hook
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia-dkms
Target=linux-lts
# Change the linux part above and in the Exec line if a different kernel is used

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux-lts) exit 0; esac; done; /usr/bin/mkinitcpio -P'

power management in optimus-manager

1
sudo pacman -S acpi_call-lts
1
sudo vim /etc/optimus-manager/optimus-manager.conf
1
2
3
4
5
[optimus]
switching=acpi_call
pci_power_control=no
pci_remove=no
pci_reset=no

usage

1
2
3
4
$ optimus-manager --switch intel    # Use Intel graphics
$ optimus-manager --switch nvidia   # Use NVIDIA graphics
$ optimus-manager --switch hybrid   # Use hybrid graphics (Requires a patch to xorg-server)
$ optimus-manager --switch auto     # Switch to different graphics (from what is used now)

Also specify which graphics to use on boot:

1
2
3
$ optimus-manager --set-startup intel
$ optimus-manager --set-startup nvidia
$ optimus-manager --switch hybrid   # Use hybrid graphics (Requires a patch to xorg-server)

Window managers

1
sudo pacman -S i3 rxvt-unicode rofi conky

i3wm missing/blank system dialogs solution:

1
2
3
4
floating_minimum_size 500 x 300
floating_maximum_size 2000 x 1500
for_window [class="chromium"] floating enable
for_window [class="typora"] floating enable

Display manager

1
2
sudo pacman -S lightdm lightdm-gtk-greeter
sudo systemctl enable lightdm
1
2
3
cp /data/Backup/ye/.Xresources .
vim ~/.Xresources 
sudo systemctl start lightdm

User directories

1
sudo pacman -S xdg-user-dirs
1
vim ~/.config/user-dirs.dirs
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
XDG_BIN_DIR="$HOME/bin"
XDG_CODE_DIR="$HOME/code"
XDG_COURSES_DIR="$HOME/courses"
XDG_CLOUDS_DIR="$HOME/clouds"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_SCREENSHOOTS_DIR="$HOME/pictures/screenshoots"
XDG_WALLPAPER_DIR="$HOME/pictures/wallpaper"
XDG_PHOTOGRAPHY_DIR="$HOME/pictures/photography/"
XDG_VIDEOS_DIR="$HOME/videos"
XDG_TMP_DIR="$HOME/various/tmp"
XDG_VM_DIR="$HOME/various/virtual_machines"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
├── bin                            scripts and executables
├── clouds
│   ├── OneDrive
│   ├── Google Drive
│   └── Dropbox
├── code                            
│   ├── opensource                 opensource projects
│   ├── personal                   personal projects
│   └── work                       company projects
│   └── practice                   personal practice code, not projects
│   └── examples                   downloaded example code files for books 
│   └── go                         set GOPATH to here
├── courses      
├── documents  
│   ├── personal                   long term archives
│   ├── work                       long term archives
│   ├── in_progress                active area: currently in progress documents
│   ├── tmp                        hold for a period time in case they are needed
│   └── trash                      recycle bin
├── ebooks
├── downloads
├── media
├── music
│   pictures
│   ├── screenshoots
│   ├── wallpaper
│   └── photography
├── various
│   ├── tmp
│   └── virtual_machines            virtual machines
└── videos

Most of these directories are symlinked from an HDD under /data.

1
2
3
4
5
6
7
8
9
$ ln -s /data/bin /home/ye/bin
$ ln -s /data/code /home/ye/code
$ ln -s /data/clouds /home/ye/clouds
$ ln -s /data/courses /home/ye/courses
$ ln -s /data/documents /home/ye/documents
$ ln -s /data/music /home/ye/music
$ ln -s /data/pictures /home/ye/pictures
$ ln -s /data/various /home/ye/various
$ ln -s /data/videos /home/ye/videos

Multimedia

Sound

1
sudo pacman -S alsa-utils

Test:

1
2
$ speaker-test -c 2
$ aplay -L | grep :CARD

Input method

1
sudo pacman -S fcitx fcitx-configtool fcitx-gtk2 fcitx-gtk3 fcitx-qt5

download fcitx-qt4 manually and install

1
$ sudo pacman -U fcitx-qt4-4.2.9.6-1-x86_64.pkg.tar.xz
1
sudo pacman -S fcitx-googlepinyin

Set environment variables for IM modules. LightDM checks and sources ~/.xprofile

1
vim ~/.xprofile
1
2
3
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

When the terminal cannot switch the Chinese input method, consider logging out and logging in again.

1
$ vim ~/.config/i3/config
1
exec --no-startup-id LANG="zh_CN.UTF-8" fcitx &

Networking

1
$ pacman -S network-manager-applet networkmanager-l2tp networkmanager-pptp

Software access point

1
$ sudo pacman -S create_ap

Input devices

Bluetooth

1
$ sudo pacman -S bluez bluez-utils blueman 
1
2
$ systemctl start bluetooth.service
$ systemctl enable bluetooth.service
1
$ vim /etc/bluetooth/main.conf
1
2
3
4
5
6
7
[General]
DiscoverableTimeout = 0
Discoverable=true
PairableTimeout = 0
Pairable=true
[Policy]
AutoEnable=true

Bluetooth keyboard pairing process

1
$ blueman-applet
1
$ blueman-manager

press search button in blueman-manager graphical settings panel, if your device is Filco, press Ctrl + Alt + Fn in keyboard.

after keyboard as found, pair it, trust it and connect to it.

Troubleshooting:

1
# bluetoothctl show
1
$ vim ~/.config/i3/config
1
2
# start Blueman
exec --no-startup-id blueman-applet

Useful packages

1
sudo pacman -S unzip openssh

Console improvements

1
$ echo $SHELL
1
$ sudo pacman -S zsh

To list all installed shells

1
$ chsh -l

And to set one as default for your user do:

1
$ sudo chsh -s /bin/zsh ye
1
2
$ yay -S oh-my-zsh-git
$ vim ~/.zshrc
1
LANGUAGE="en"

plugins:

  • 1
    
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
  • 1
    
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    
    1
    
    $ vim ~/.zshrc
    
    1
    
    plugins=( zsh-autosuggestions zsh-syntax-highlighting)
    

Bypass GFW

1
$ vim /etc/hosts
1
104.18.57.236  free-ss.site
1
sudo pacman -S chromium shadowsocks
1
$ cp /etc/shadowsocks/example.json /etc/shadowsocks/config.json

find available proxy in free-ss.site and modify in /etc/shadowsocks/config.json

1
$ sslocal -c /etc/shadowsocks/config.json
1
$ chromium --proxy-server=http://127.0.0.1:1080

SwitchyOmega settings restore from online, and update gfwlist list

Full system backup

1
2
$ sudo pacman -S rsync
$ mkdir -p /data/backup/initial_system_backup

Rsync will try to modify any previously backed up files on the target machine to match their current state at the source machine, with each incremental backup.

remember excluding data storage

1
$ sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/ye/.cache/*","/data/*"} / /data/backup/initial_system_backup

Restore a backup

If you wish to restore a backup, use the same rsync command that was executed but with the source and destination reversed.

References

  1. https://wiki.archlinux.org