# Arch Linux 安装指南

## 准备安装

### 下载镜像

从[官网 Download 页面](https://archlinux.org/download/)提供的镜像站下载。然后[验证镜像](https://wiki.archlinux.org/title/Installation_guide#Verify_signature)。

```bash
gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
```

### 制作启动盘

可能的 USB ID：usb-SMI_USB_DISK-0:0，不要在后面加上形似 -part1 的内容（[参考](https://wiki.archlinux.org/title/USB_flash_installation_medium#Using_basic_command_line_utilities)）。

```bash
cat path/to/archlinux-version-x86_64.iso > /dev/disk/by-id/usb-My_flash_drive
```

### 更改 BIOS 设置——关闭安全启动

不同主机进入 BIOS 界面的方式各不相同，我的是 HP 笔记本。此外，F9 是更改启动顺序。

按下开机键 -> 持续按 F10 直到出现 BIOS 设置页面

之后进行三项操作：

1. 启动虚拟化（要在主机创建虚拟机，不需要则不必开启）
2. 关闭安全启动
3. 修改 UEFI 模式下的启动顺序：让 USB 启动在前

### 启动烧录的系统，并验证启动方式为 UEFI

把烧录好系统的 U 盘，通过 USB 接口插到主机上，启动后会看到 Arch Linux 的安装界面。选择默认的第一个按下回车。接下来的所有过程都是通过命令行进行操作，而这正是 Arch Linux 富有魅力的地方。

```bash
cat /sys/firmware/efi/fw_platform_size
```

有输出，说明启动模式为 UEFI。

### 连接网络

有以下三个方法：

1. 有线连接
2. 无线 Wifi
3. 随身 Wifi USB 连接

以上方法，只有 2 需要在命令行通过 iwctl 命令配置，其他两个都是自动配置的（可参考这位的[命令](https://blog.yoitsu.moe/arch-linux/installing_arch_linux_for_complete_newbies.html#id33)）。

然后验证是否连接网络：

```bash
ping archlinux.org -c 3
```

0% packet loss 说明网络正常。

### 更新系统时间

在烧录系统中，一旦网络连接成功，时间会自动同步。所以，需要 `timedatectl` 命令查看时间是否正常。

### 分区

使用的是 fdisk。

```bash
# 查看硬盘信息
fdisk -l
# 固态硬盘分区，X 会因为插入硬盘类型不同，而变为不同字母，比如 /dev/sda
fdisk /dev/sdX
# 进入 fdisk 操作界面后，需要创建至少两个分区，一个是系统启动的引导分区（分区类型为 EFI System），一个是剩下的存储空间（分区类型为 Linux filesystem）。还可能有一个 swap 分区，用于物理内存不够时使用
```

以下是分区命令：

- m 查看命令帮助
- p 显示目标硬盘分区
- g 新建 GPT 分区表
- 创建 sdX1 分区，n 创建分区、分区序号、类型起始扇区默认，结束扇区 +1G。t 修改分区类型，1 为 EFI System，p 确认为 EFI System
- 创建 sdX2 分区，全部默认，分区类型为 Linux filesystem
- w 写入硬盘

分区结果：

```bash
Device      Start       End   Sectors  Size Type
/dev/sda1     2048    2099199    2097152     1G EFI System
/dev/sda2  2099200 1953523711 1951424512 930.5G Linux filesystem
```

### 硬盘格式化、新建文件系统

```bash
mkfs.fat -F32 /dev/sdX1
mkfs.ext4 /dev/sdX2
```

### 挂载分区

```bash
mount /dev/sdX2 /mnt
mkdir -p /mnt/boot
mount /dev/sdX1 /mnt/boot
```

## 安装

### 选择镜像源

从官网[地址](https://archlinux.org/mirrorlist/?country=CN&protocol=https&ip_version=4&use_mirror_status=on)可以看到，为中国用户设置的 Arch Linux 镜像地址。这是按照镜像得分进行排序的。

```bash
reflector --save /etc/pacman.d/mirrorlist --country CN --protocol https --latest 10 --sort rate
```

使用 reflector 将最近同步的中国镜像按速率排序，保存在配置文件中，使用的是加密的 HTTPS 协议。

### 安装关键包

```bash
# pacstrap 在安装上述包时会初始化根目录 /mnt，会在 /mnt 目录中创建 Linux 的文件目录
pacstrap -K /mnt base base-devel linux linux-firmware intel-ucode git vim
## bin/  boot/  dev/  etc/  home/  lib/  lib64/  mnt/  opt/  proc/  root/  run/  sbin/  srv/  sys/  tmp/  usr/  var/
```

- -K 的作用：不复制启动盘中的 pacman keyring，初始化空的 pacman keyring
- /mnt 就是新系统的所在
- base, base-devel, linux, linux-firmware 四个包基本是必装的；可能有想替换的，比如 linux-lts 作为 linux 的替代
- intel-ucode/amd-ucode 一些[微码](https://wiki.archlinux.org/title/Microcode)更新，根据 CPU 型号选择安装
- git, vim 前者用于编程代码维护，后者是基于命令行的文本编辑器

## 配置系统

### 生成挂载表

```bash
genfstab -U -p /mnt >> /mnt/etc/fstab
# 把第2块硬盘也挂载
vim /mnt/etc/fstab
## UUID=16519c74-08f6-4101-a9bd-9d23c2148aa5       /mnt/second-disk   ext4   rw,relatime     0 2
cat /mnt/etc/fstab
```

### 进入硬盘，而不在启动 U 盘

```bash
arch-chroot /mnt
```

### 时间

设置时区，同步时间：

```bash
ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
hwclock --systohc --utc
```

### 本地化（配置系统语言+安装字体、输入法）

```bash
# 在 locale.gen 中取消注释：en_US.UTF-8 UTF-8，zh_CN.UTF-8 UTF-8
vim /etc/locale.gen
# 生成配置
locale-gen
# 设置本地语言环境， LANG=en_US.UTF-8
vim /etc/locale.conf
# 字体
pacman -S noto-fonts noto-fonts-emoji noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts otf-monaspace-nerd nerd-fonts-fontconfig
fc-cache -fv
# 输入法
pacman -S fcitx5-im fcitx5-chinese-addons fcitx5-pinyin-zhwiki fcitx5-material-color fcitx5-rime rime-ice
```

添加对 gtk，qt 类（指通过 gtk、qt 编程得到的软件）软件的支持：

```bash
# /etc/profile
export XMODIFIERS="@im=fcitx5"
export GTK_IM_MODULE="fcitx5"
export QT_IM_MODULE="fcitx5"
```

Rime 配置（ =~/.local/share/fcitx5/rime/default.custom.yaml= ）：

```yaml
patch:
  schema_list:
    - schema: rime_ice
```

KDE 的字体设置要选择一个英文输入法和Rime，如果只有一个Rime输入法，那么F4键就不能作为显示/隐藏文件浏览器的命令行使用了。

#### KDE Font Viewer

在 Wayland 环境下无法使用（未来在 KDE Plasma 6 修复）。

https://ask.fedoraproject.org/t/problem-with-kde-font-viewer/13932

This major bug occurs when running under Wayland. A workaround is to set =QT_QPA_PLATFORM=xcb= before starting kfontview so that it runs under X11/XWayland, see [KDE bug 439470](https://bugs.kde.org/show_bug.cgi?id=439470).

在命令行使用 KDE Font Viewer：

```bash
QT_QPA_PLATFORM=xcb kfontview
```

### 网络配置

一、主机名

```bash
echo arch > /etc/hostname
```

二、Hosts

在 /etc/hosts 中添加以下内容：

```ini
127.0.0.1 localhost
::1 localhost
127.0.0.1 arch.localdomain arch
```

三、使用 NetworkManager 管理网络

```bash
pacman -S networkmanager
systemctl enable NetworkManager
```

### 用户相关

一、更改 root 密码

```bash
passwd
```

二、新建用户，设置用户密码

```bash
useradd -m -g users -G wheel -s /bin/bash archie
passwd archie
```

三、设置用户权限

```bash
EDITOR=vim visudo
```

取消注释：

```ini
## Uncomment to allow members of group wheel to execute any command

%wheel ALL=(ALL) ALL

## Same thing without a password

%wheel ALL=(ALL) NOPASSWD: ALL
```

### 安装引导程序

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

运行 grub-mkconfig 操作时，会出现警告： `Warning: os-prober will not be executed to detect other bootable partitions.` 。如果不是双系统，不用关注这个警告。

## 安装 KDE 桌面环境

### 返回 U 盘

```bash
exit
```

### 重启系统

```bash
umount -R /mnt
reboot
```

开机后改动 BIOS，配置「系统启动」后，拔掉 U 盘。普通用户 archie 登录。

### 安装 KDE

```bash
pacman -S plasma-meta konsole dolphin
systemctl enable sddm
```

### 隐藏 GRUB 加载

<https://www.reddit.com/r/linux4noobs/comments/5372gj/comment/d7qjh6s/>

```bash
vim /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
```

修改 `/etc/default/grub` ：

```diff
-GRUB_TIMEOUT=1
+GRUB_TIMEOUT=0
```

### Reflector 更新镜像

<https://wiki.archlinux.org/title/reflector>

一、开机自动执行

`/etc/xdg/reflector/reflector.conf` ：

```ini
--save /etc/pacman.d/mirrorlist
--country China
--protocol https
--latest 5
```

```bash
systemctl enable reflector
systemctl start reflector
vim /usr/lib/systemd/system/reflector.service
```

二、通过 Pacman hook 自动化以上步骤

这样每次升级软件包时，都会自动更新软件镜像。

`/etc/pacman.d/hooks/mirrorupgrade.hook` ：

```hook
[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist

[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /bin/sh -c 'systemctl start reflector.service; [ -f /etc/pacman.d/mirrorlist.pacnew ] && rm /etc/pacman.d/mirrorlist.pacnew'
```

### 蓝牙

```bash
systemctl enable --now bluetooth
```

无法添加蓝牙耳机

```log
# 来自 bluetooth.service 的 systemd log
# ConfigurationDirectory 'bluetooth' already exists but the mode is different. (File system: 755 ConfigurationDirectoryMode: 555)
# src/device.c:device_set_wake_support() Unable to set wake_support without RPA resolution
# src/adapter.c:set_device_privacy_complete() Set device flags return status: Invalid Parameters
```

经过搜索发现一些人遇到过[类似问题](https://bbs.archlinux.org/viewtopic.php?id=270465)。

```bash
# dmesg | grep Bluetooth 输出
[    2.357525] usb 1-8: Product: Bluetooth Radio
[    3.057353] Bluetooth: Core ver 2.22
[    3.057403] Bluetooth: HCI device and connection manager initialized
[    3.057410] Bluetooth: HCI socket layer initialized
[    3.057413] Bluetooth: L2CAP socket layer initialized
[    3.057420] Bluetooth: SCO socket layer initialized
[    3.716563] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
[    3.717200] Bluetooth: hci0: RTL: rom_version status=0 version=1
[    3.717204] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_fw.bin
[    3.722382] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_config.bin
[    3.723300] Bluetooth: hci0: RTL: cfg_sz 10, total sz 31990
[    4.174265] Bluetooth: hci0: RTL: fw version 0x829a7644
[    5.868007] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    5.868012] Bluetooth: BNEP filters: protocol multicast
[    5.868017] Bluetooth: BNEP socket layer initialized
[    6.136304] Bluetooth: hci0: Bad flag given (0x2) vs supported (0x1)
[   17.200632] Bluetooth: RFCOMM TTY layer initialized
[   17.200645] Bluetooth: RFCOMM socket layer initialized
[   17.200654] Bluetooth: RFCOMM ver 1.11
[   32.473238] Bluetooth: hci0: unexpected cc 0x0c7c length: 1 < 3
[  962.089278] Bluetooth: hci0: Bad flag given (0x2) vs supported (0x1)
[  971.016364] Bluetooth: hci0: unexpected cc 0x0c7c length: 1 < 3
```

之后按照[这里](https://bbs.archlinux.org/viewtopic.php?pid=2005851#p2005851)的说法，执行以下命令安装 bluedevil, bluez-utils, pulseaudio-bluetooth。重启之后问题解决了。

```bash
yay -Syyuu bluedevil bluez-utils pulseaudio-bluetooth
```

关于KDE的一些设置：

- 关闭进入桌面动画
- 更换锁屏主题
- 安装variety自动更换桌面壁纸
- 自启动一些app

## emacs

## vscode

## konsole

## 常用命令行工具

## Git

```bash
pacman -S openssh
wget -O ~/.gitconfig https://github.com/tianheg/dotfiles/raw/main/gitconfig
# 不要忘记 commit.gpgsign true

## SSH
chmod 400 ~/.ssh/id_ed25519
# 解决 sign_and_send_pubkey: signing failed for ED25519 "/home/user/.ssh/id_ed25519" from agent: agent refused operation; git@github.com: Permission denied (publickey).
```

### git-credential-oauth
https://github.com/hickford/git-credential-oauth

```bash
## way 1
export GCO_VERSION=0.7.0
wget -q https://github.com/hickford/git-credential-oauth/releases/download/v${GCO_VERSION}/git-credential-oauth_${GCO_VERSION}_linux_amd64.tar.gz -O - | tar -xz -C .
# three files: git-credential-oauth*  LICENSE.txt  README.md
sudo mv git-credential-oauth /usr/local/bin

## way 2
yay -S git-credential-oauth

### next step
echo url=https://github.com | git credential fill # complete the authentication process
```

## GPG

修改 =~*.gnupg*= 权限：

```bash
# https://superuser.com/a/954536 ; https://superuser.com/a/954639
# Set ownership to your own user and primary group
chown -R "$USER:$(id -gn)" ~/.gnupg
# Set permissions to read, write, execute for only yourself, no others
chmod 700 ~/.gnupg
# Set permissions to read, write for only yourself, no others
chmod 600 ~/.gnupg/*
```

这几条命令解决 `gpg: WARNING: unsafe permissions on homedir '/home/user/.gnupg'` 。

**把 =~/.gnupg= 文件夹保存在安全的地方** ，然后导入 GitHub(user + web-flow)公钥：

```bash
wget -O tianheg-pubkeys.txt https://github.com/tianheg.gpg
wget -O github-web-flow.txt https://github.com/web-flow.gpg
gpg --import tianheg-pubkeys.txt
gpg --import github-web-flow.txt
```

安装 seahorse 以防止每次 git commit 都要输入密码（不必麻烦，通过设置 =~/.gnupg/gpg-agent.conf= 可以延长密码时效）。

```ini
default-cache-ttl 28800
max-cache-ttl 28800
```

## 键盘映射——Swap left ctrl with Caps Lock(Emacs)

在 KDE 桌面环境下，有方便的系统设置菜单，可以设置键盘映射。

## 声音

<https://wiki.archlinux.org/title/Sound_system>

用到的软件：ALSA（驱动接口）、PipeWire & PulseAudio（声音服务器）

错误日志：

```log
vlcpulse audio output error: stream connection failure: Bad state
main audio output error: module not functional
main decoder error: failed to create audio output

pulse audio output error: overflow, flushing

pulseaudio[6402]: Failed to create sink input: sink is suspended.
```

我又试了一次下面的命令，竟然可以了！

```bash
pulseaudio -k
# Kill a running daemon
```

目前问题未解决，声音时有时无。

在 KDE 的音量设置界面，先设置成其他声卡输出，然后再设置成 Analog Stereo Duplex。可能有效果。

=~/.config/pulse/default.pa= ：

```pa
.include /etc/pulse/default.pa

set-default-source alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
set-card-profile alsa_card.pci-0000_00_1f.3 output:analog-stereo+input:analog-stereo
set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
```

根据 ArchWiki 进行上述配置。
### pulseaudio

问题：开机后播放音频没有声音

解决办法：

```bash
killall pulseaudio
```

refer <https://unix.stackexchange.com/a/171925>

## pacman

### 添加 archlinuxcn

添加库 `/etc/pacman.conf` ：

```ini
[archlinuxcn]
Server = https://repo.archlinuxcn.org/$arch
```

导入 PGP 公钥（为了验证 archlinuxcn 库）：

```bash
pacman-key --lsign-key "farseerfc@archlinux.org" # for error: ...is marginal trust
pacman -Syy && pacman -S archlinuxcn-keyring
```

### pacman 命令

```bash
## 常用
pacman -Qe # List all explicitly installed packages
pacman -Qet # list all packages explicitly installed and not required as dependencies
pacman -Qent # List all explicitly installed native packages (i.e. present in the sync database) that are not direct or optional dependencies
pacman -Qn # List all native packages (installed from the sync database(s))
pacman -Qm # List all foreign packages (typically manually downloaded and installed or packages removed from the repositories)
```

### 应该避免执行的 pacman 指令

```bash
pacman -Sy # never run!!!
pacman -Rdd package # never run!!!
```

在 Arch 中安装包时应避免没有升级系统就刷新包列表。这样做是为了避免出现依赖问题，比如，如果一个包被从官方仓库中移除，在进行包同步时就会报错。在实践中，不要执行 `pacman -Sy package_name` ，应该执行 `pacman -Syu package_name` 。

### 执行 pacman 命令过程中，遇到的信息/警告/错误

循环依赖：

```bash
warning: dependency cycle detected
```

执行 `sudo pacman -Syu` 时：

```bash
WARNING: Possibly missing firmware for module
```

这是一种警告。

参考：

1. <https://wiki.archlinux.org/title/Mkinitcpio#Possibly_missing_firmware_for_module_XXXX>
2. <https://arcolinuxforum.com/viewtopic.php?t=1174>

gpg: key 786C63F330D7CB92: no user ID for key signature packet of class
10

```bash
gpg: key 786C63F330D7CB92: no user ID for key signature packet of class 10
gpg: key 1EB2638FF56C0C53: no user ID for key signature packet of class 10
gpg: next trustdb check due at 2021-10-09
  -> Disabled 3 keys.

## try 1
# pacman-key --refresh-keys
# pacman -S archlinux-keyring archlinuxcn-keyring
## try 2
# rm -R /etc/pacman.d/gnupg/ # No such file or directory
# rm -rf /etc/pacman.d/gnupg/
# rm -R /root/.gnupg/
# rm -R /var/cache/pacman/pkg/
# gpg --refresh-keys
# pacman-key --init
# pacman-key --populate archlinux # still display `gpg: key xxx: no user ID for key signature packet of class 10`
# pacman-key --refresh-keys
# pacman -Syyu
```

warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew

/etc/mkinitcpio.d/linux.preset: 'default' and /etc/mkinitcpio.d/linux.preset: 'fallback'

第 X 个提示：ERROR: A182F28FA78F70601453137BCF82E29597321B63 could not be locally signed.

解决方法：

```bash
rm -rf /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux
pacman-key --populate archlinuxcn
```

参考：

1. [Installing and upgrading packages](https://wiki.archlinux.org/title/Arch_User_Repository#Installing_and_upgrading_packages)
2. [Is it possible that there is a major kernel update in the repository, and that some of the driver packages have not been updated?](https://wiki.archlinux.org/title/Frequently_asked_questions#Is_it_possible_that_there_is_a_major_kernel_update_in_the_repository,_and_that_some_of_the_driver_packages_have_not_been_updated?)
3. <https://wiki.archlinux.org/title/Pacman/Tips_and_tricks>
4. <https://wiki.archlinux.org/title/Pacman>
5. <https://wiki.archlinux.org/title/System_maintenance#Avoid_certain_pacman_commands>
6. <https://wiki.archlinux.org/title/Pacman/Rosetta>
7. <https://wiki.archlinux.org/title/Mkinitcpio>

## yay

Yet Another Yogurt: 又一个从 Arch User Repository 下载包的工具。

官方仓库：<https://github.com/Jguer/yay>

```bash
# pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
```

如果想通过 pacman 官方仓库里的 yay 包安装，在版本升级时可能会有滞后。可以在通过 pacman 安装 yay 后，运行命令：

```bash
yay -S yay
```

保证得到 yay 的最新版本。

## 常用命令行工具

### ohmyzsh

<https://github.com/ohmyzsh/ohmyzsh>

安装前提：

1. [Zsh](https://www.zsh.org/)： `pacman -S zsh`
2. `curl` / `wget` installed
3. `git` installed

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
## or
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

## plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
git clone https://gist.github.com/475ee7768efc03727f21.git ~/.oh-my-zsh/custom/plugins/git-auto-status
mkdir ~/.oh-my-zsh/custom/plugins/pnpm
wget -O- https://raw.githubusercontent.com/ntnyq/omz-plugin-pnpm/main/pnpm.plugin.zsh ~/.oh-my-zsh/custom/plugins/pnpm

## my configuration
cd ~/dotfiles
stow zsh
```

### z.lua

```bash
git clone https://github.com/skywind3000/z.lua.git ~/.z.lua
pacman -S lua
```

### eza

A modern replacement for `ls` (List directory contents) <https://the.exa.website>

```bash
pacman -S eza

eza
eza --oneline # List files one per line
eza --all # List all files, including hidden files
eza --long --all # Long format list (permissions, ownership, size and modification date) of all files
eza --reverse --sort=size # List files with the largest at the top
eza --long --tree --level=3 # Display a tree of files, three levels deep
eza --long --sort=modified # List files sorted by modification date (oldest first)
eza --long --header --icons --git # List files with their headers, icons, and Git statuses
eza --git-ignore # Don't list files mentioned in `.gitignore`
```

### bat

<https://github.com/sharkdp/bat>

cat 的替代

```bash
pacman -S bat bat-extras
```

### tldr

```bash
pacman -S tldr
```

在 =~/.zshrc= 中加入以下内容：

```ini
export TLDR_CACHE_ENABLED=1
export TLDR_CACHE_MAX_AGE=720
export TLDR_PAGES_SOURCE_LOCATION="https://raw.githubusercontent.com/tldr-pages/tldr/master/pages"
export TLDR_DOWNLOAD_CACHE_LOCATION="https://tldr-pages.github.io/assets/tldr.zip"
```

## GitHub 的CLI

```bash
pacman -S gh
```

## 系统状态

```bash
pacman -S btop
```

## 系统信息查看

```bash
pacman -S fastfetch
```

### netstat

查看网络接口的占用情况

```bash
pacman -S net-tools
```

## rm 替代

```bash
pacman -S trash-cli
```

## dotfiles

- https://farseerfc.me/zhs/using-gnu-stow-to-manage-your-dotfiles.html
- https://wiki.archlinux.org/title/Dotfiles
- http://dotshare.it/
- https://dotfiles.github.io/
- https://github.com/webpro/awesome-dotfiles
- [GNU stow](https://www.gnu.org/software/stow/manual/html_node/index.html)

```bash
pacman -S stow
```

<https://github.com/tianheg/dotfiles>

@farseerfc 邮件跟我说过，还可以试试 [chezmoi](https://www.chezmoi.io/)，系统级别的配置和同步可以用 [Ansible](https://www.ansible.com/)。

## 系统优化
### earlyoom

如果是为了避免系统卡死，可以安装并使用 earlyoom。

该软件默认将在空余内存、空余 swap 两者均低于 10% 时，结束 oom_score 值最高的进程，避免系统内存耗尽卡死。

```bash
# after install
systemctl enable --now earlyoom
```

## gThumb

<https://wiki.gnome.org/action/show/Apps/Gthumb>

gThumb is an image viewer and browser for the GNOME Desktop. It also includes an importer tool for transferring photos from cameras.

```bash
pacman -S gthumb
```

## 浏览器

```bash
pacman -S firefox-developer-edition
## aur
yay -S google-chrome
```

## 密码管理

<https://keepassxc.org/>

```bash
pacman -S keepassxc
# 可以通过浏览器插件访问密码库
```

## 截图

<https://apps.kde.org/spectacle/>

## 播放器
在装 KDE 的时候会装 mpv。

### 如何使用mpv

管理脚本 @mpv-easy/mpsm，[源码](https://github.com/mpv-easy/mpv-easy/tree/main/mpv-mpsm)

listenbrainz插件在dotfiles仓库

## 软件安装列表

| 名字                      | 说明                                                                                                                               |
| --- | --- |
| wl-clipboard              | Wayland clipboard utilities                                                                                                        |
| spectacle                 | KDE 开发的截图软件                                                                                                                 |
| net-tools                 | 提供 netstat 命令                                                                                                                  |
| chromium                  | 开源浏览器（基于 Blink 渲染引擎）                                                                                                  |
| google-chrome             | 浏览器                                                                                                                             |
| firefox-developer-edition | 具有开发者定制功能的 Firefox 浏览器                                                                                                |
| pulseaudio                | A featureful, general-purpose sound server                                                                                         |
| kmix                      | 修复 Firefox 没有声音                                                                                                              |
| profile-cleaner           | Simple script to vacuum and reindex sqlite databases used by browsers 用于对浏览器使用的 sqlite 数据库进行清理和重新索引的简单脚本 |
| visual-studio-code-bin    | Visual Studio Code                                                                                                                 |
| proxychains-ng            | 终端内科学上网代理工具                                                                                                             |
| vlc                       | 强大的多媒体播放工具                                                                                                               |
| telegram-desktop          | 客户端开源的加密聊天工具                                                                                                           |
| gthumb                    | 图片浏览工具，可简单编辑图片，可清除照片元数据                                                                                     |
| inkscape                  | 强大的矢量图形编辑软件                                                                                                             |
| yt-dlp                    | YouTube 视频下载工具                                                                                                               |
| glances                   | terminal monitoring tool                                                                                                           |
| keepassxc                 | password manager                                                                                                                   |
| hugo                      | static site generator                                                                                                              |
| informant                 | arch news reader and pacman hook                                                                                                   |
| dnsutils                  | provide `dig` command                                                                                                              |
| dnsmasq                   | 使用国外 DNS 造成国内网站访问慢的解决方法                                                                                          |
| tldr                      | Collaborative cheatsheets for console commands                                                                                     |
| virtualbox                | Virtual Machine                                                                                                                    |
| qemu                      | A generic and open source machine emulator and virtualizer                                                                         |
| earlyoom                  | Early OOM Daemon for Linux                                                                                                         |
| gtk2/3/4                  | GObject-based multi-platform GUI toolkit                                                                                           |
| lsb-release               | LSB version query program                                                                                                          |
| eza                       | A modern replacement for ls (List directory contents)                                                                              |
| sagemath                  | Open Source Mathematics Software free alternative to Magma Maple Mathematica and Matlab Matlab dkms Dynamic Kernel Modules System  |
| cmdpxl                    | a totally practical command-line image editor 一个在命令行里画画的程序                                                             |
| octave(GUI)               | A high-level language, primarily intended for numerical computations.                                                              |
| asciiquarium              | An aquarium/sea animation in ASCII art                                                                                             |
| arch-wiki-man(aur)        | The Arch Wiki as linux man pages                                                                                                   |
| konsole                   | KDE terminal emulator                                                                                                              |
| python-pipenv             | Sacred Marriage of Pipfile, Pip, & Virtualenv.                                                                                     |
| safeeyes(aur)             | Protect your eyes from eye strain using this simple and beautiful, yet extensible break reminder                                   |
| bat                       | A cat(1) clone with wings                                                                                                          |
| htop                      | Interactive process viewer                                                                                                         |
| prettyping                | A ping wrapper making the output prettier, more colorful, more compact, and easier to read                                         |
| dbeaver                   | Free universal SQL Client for developers and database administrators (community edition)                                           |
| sqlitebrowser             | SQLite Database browser is a light GUI editor for SQLite databases, built on top of Qt                                             |
| adminer(aur)              | Adminer is available for MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, Elasticsearch, MongoDB and others via plugin          |
| rnote                     | A simple drawing application to create handwritten notes                                                                           |
| imv                       | a command line image viewer intended for use with tiling window managers                                                           |
| umlet                     | Free UML Tool for Fast UML Diagrams                                                                                                |
| speedtest-cli             | Command line interface for testing internet bandwidth using speedtest.net                                                          |
| rslsync(aur)              | Resilio Sync (ex:BitTorrent Sync) - automatically sync files via secure, distributed technology                                    |
| peek                      | 录制 GIF 动图                                                                                                                      |
| obs-studio                | 录屏软件                                                                                                                           |
| pkgstats                  | Submit a list of installed packages to the Arch Linux project                                                                      |
| EtchDroid                 | ios2usb on android                                                                                                                 |
| archmage(aur)             | converts CHM files to HTML, plain text and PDF                                                                                     |
| kernel-modules-hook       | Keeps your system fully functional after a kernel upgrade                                                                          |
| wireshark-cli             |                                                                                                                                    |
| pdm                       | A modern Python package and dependency manager supporting the latest PEP standards                                                 |
| onlyoffice-bin(aur)       | Office                                                                                                                             |
| trash-cli                 | replace rm                                                                                                                         |
| variety                   | 自动换壁纸                                                                                                                         |
| ddgr                      | DuckDuckGo in the Terminal                                                                                                         |
| appimagelauncher(aur)     | Helper for running and integrating AppImages                                                                                       |
|            Amberol               |                Small and simple sound and music player that is well integrated with GNOME                                                                                                                   |
