OFFSET偏移
← All articlesOFFSET / FIELD NOTESNO. 068

Swap, kernels, and troubleshooting on an Arch desktop

Retain full operational details for compressed swap, kernel switching, system cleanup, and common desktop problems.

English translation · Code and commands follow the Chinese original.

IN THESE READING PATHSArch Linux ↗
About 7 min readStart reading

This article is adapted from shorinkiwata/archlinuxinstall, preserving the original tutorial's operational detail while anonymizing it and correcting risk-related guidance. Package names, extensions, drivers, and interfaces may change with rolling updates. All commands below are examples for reading; they have not been executed or verified as part of this task.

Prerequisites for maintenance and deletion#

First confirm the currently running kernel, boot entries, fallback kernel, and backups. swapoff must move swapped-out pages back into other available memory/swap space; do not disable swap if there is insufficient memory. Before deleting a swap file, check for references in fstab, hibernation settings, and boot parameters.

Before deleting Linux partitions or ESP files, use Windows/recovery media to confirm that Windows can boot independently, and back up important data and encryption recovery materials. On a shared ESP, modify only directories confirmed to belong to Linux; do not delete Microsoft, OEM, or the entire partition. The DiskPart selection numbers below illustrate syntax only; verify the actual numbers again on the machine. Changing a partition type is not an “absolutely safe” way to delete it, either.

Performance tuning#

Dynamic power management for NVIDIA GPUs

sudo systemctl enable --now nvidia-powerd.service

Adjust GPU offsets with LACT

Swap space

On swap sizing: Swap - Manjaro --- Swap - Manjaro Power management/Suspend and hibernate - Arch Linux Chinese Wiki zswap - ArchWiki zram - ArchWiki Swap - ArchWiki Zram vs zswap vs swap? : r/archlinux Zswap or Zram: at this time, which one is more efficient? : r/archlinux Zram, zswap and hibernation - Support - Manjaro Linux Forum kernel - zram vs zswap vs zcache Ultimate guide: when to use which one - Ask Ubuntu zswap — The Linux Kernel documentation zram: Compressed RAM-based block devices — The Linux Kernel documentation

If you do not need hibernation

If you do not need hibernation, you can disable swap and then enable zram.

sudo swapoff /swap/swapfile
sudo rm /swap/swapfile
  • Edit fstab
sudo vim /etc/fstab
删除与swap相关的挂载

Memory compression with zram

sudo pacman -S zram-generator
sudo vim  /etc/systemd/zram-generator.conf
[zram0]
zram-size = ram * 0.5
compression-algorithm = zstd #重视cpu开销和速度选择lz4
  • Disable zswap
sudo vim /etc/default/grub
编辑GRUB_CMDLINE_LINUX_DEFAULT=""
写入zswap.enabled=0
  • Regenerate the grub configuration file
sudo grub-mkconfig -o /boot/grub/grub.cfg
  • reboot
  • Verify that zswap is disabled
cat /sys/module/zswap/parameters/enabled
  • Verify that zram is enabled
sudo zramctl
或者
swapon

Install the zen kernel

Changes in power consumption and responsiveness depend on the workload; compare them through actual testing.

  • Install the kernel
sudo pacman -S linux-zen linux-zen-headers
  • Choose the appropriate DKMS driver for your GPU generation and install matching headers for linux-zen
sudo pacman -S nvidia-open-dkms # 按 GPU 支持分支调整
  • Regenerate grub
sudo grub-mkconfig -o /boot/grub/grub.cfg
  • Reboot
reboot #重启时在grub的arch advance启动项里选择zen
  • Optional: Consider removing the original kernel only after confirming that the fallback recovery kernel, DKMS, and boot setup all work. Keeping a fallback kernel is usually safer.
sudo pacman -R linux linux-headers
  • Regenerate grub
sudo grub-mkconfig -o /boot/grub/grub.cfg

Remove Linux#

The following operations affect boot files and partitions. Do not assume that example disk 0/partition 1 is your target.

When sharing an efi partition with Windows

(Remade) Completely remove unused boot entries after uninstalling Linux - bilibili Press win+x and select Disk Management to identify the disk and partition containing efi. Press win+R, enter diskpart, and press Enter. Use select disk to select the disk containing the efi partition; numbering starts at 0, so the first disk is numbered 0.

select disk <VERIFIED_DISK_NUMBER>

Use select partition to select the efi partition; numbering starts at 1, so the first partition is numbered 1.

select partition <VERIFIED_ESP_PARTITION_NUMBER>

The commands above illustrate selection syntax only. Verify the actual disk/partition before assigning an unused drive letter.

assign letter p

Run Notepad as an administrator, press ctrl+s to open the Save dialog, select drive p, and delete the Linux boot-related files in it. Remove the drive letter afterward.

remove letter p

When using a separate EFI partition

Consider deleting this partition only after confirming that Windows does not depend on it at all and that recovery materials are available. The historical partition-type conversion command below is retained for explanation; it is not a necessary or generally recommended uninstall step: Original reference: Delete a separate EFI partition in Windows After selecting the efi partition in diskpart, enter:

 SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Converting the partition type may allow a tool to delete it later, but does not establish that deletion is safe. First determine whether the system still depends on that ESP, then use a trusted partition-management tool and confirm each item.

issues#

Incorrect time and Windows disk checks at startup

Synchronize time in a dual-boot system - CSDN Blog Open powershell as an administrator and run:

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

Create file symlinks in nautilus

Creating Symlinks in Files under Wayland : r/gnome Copy the file with ctrl+c, then press ctrl+m.

NAUTILUS cannot access smb shares

If your router or another device provides smb file sharing, installing gvfs-smb lets you access those files in nautilus.

sudo pacman -S gvfs-smb

Temporary failure in name resolution

Resolve the “Temporary Failure in Name Resolution” error in Ubuntu - CSDN Blog

sudo vim /etc/resolv.conf

If /etc/resolv.conf is managed by NetworkManager or systemd-resolved, configure DNS in the actual manager instead of overwriting the file directly. Use the following configuration structure only for a statically managed setup:

nameserver <DNS_SERVER_IP>
nameserver <SECONDARY_DNS_SERVER_IP>

Install custom fonts

  • Copy fonts into this directory (you can freely create subdirectories)
~/.local/share/fonts/
  • Refresh the font cache
fc-cache -fv

Expand the Windows efi partition

NIUBI partition Editor free edition

GRUB lag

Check the GRUB graphics mode, resolution, firmware, and relevant driver conditions. Save logs and observations before investigating further; do not attribute the issue directly to a particular brand.

Appendix#

Common pacman commands

  • -R removes packages, -s also removes dependencies that are no longer needed, and -n prevents managed configuration from being saved as .pacsave. Configuration in the user's home directory must be handled separately.
sudo pacman -Rns <PACKAGE>
  • Search for packages
pacman -Ss <KEYWORD>
  • List all installed packages
pacman -Qe # 列出显式安装的包;全部已安装包用 pacman -Q
  • List all installed dependencies
sudo pacman -Qd
  • Clean the package cache
sudo pacman -Sc
  • List orphaned dependency packages
sudo pacman -Qdt
  • Remove orphaned dependency packages
sudo pacman -Rns <CONFIRMED_ORPHAN_PACKAGE> # 先用 pacman -Qdt 检查

CPU resource priority

ananicy-cpp adjusts process scheduling priorities according to rules. Test benefits and effects against the current rules and actual workloads; do not treat historical individual cases as universal conclusions.

sudo pacman -S ananicy-cpp
sudo systemctl enable --now ananicy-cpp.service

TLP notes

sudo pacman -S tlp tlp-rdw
yay -S tlpui

For configuration instructions, consult the official documentation: Settings — TLP 1.8.0 documentation. The following reflects the original tutorial's configuration approach and must be adjusted for driver support and actual test results; it is not a universal configuration:

processor选项卡中

CPU DRIVER OPMODE
AC active
BAT active
# 是否适用取决于 CPU scaling driver,不是所有机器都有此选项

CPU SCALING GOVERNOR
AC <SUPPORTED_GOVERNOR>
BAT <SUPPORTED_GOVERNOR> # 先检查驱动支持列表

CPU ENERGY PERF POLICY
AC balance_performance
BAT power

CPU BOOST
AC on
BAT off

PLATFORM PROFILE
AC balanced
BAT low-power

MEM SLEEP
BAT deep
  • Enable the service
sudo systemctl enable --now tlp

Install alhp

ALHP is a third-party optimized repository. The following is a historical example of its configuration structure. Overriding official packages with repository packages changes the support and trust boundaries. Check current repository names, signatures, and CPU instruction-set compatibility rather than enabling it blindly. * Reference: ALHP: Optimize your Arch Linux performance - bilibili

  • Check CPU support and note the x86-64-v level shown in the output
/lib/ld-linux-x86-64.so.2 --help
  • Install the keyring and mirror list
yay -S alhp-keyring alhp-mirrorlist
  • Edit the configuration file
sudo vim /etc/pacman.conf
  • Search for core and add the following above it
   [core-x86-64-v4]
   Include = /etc/pacman.d/alhp-mirrorlist
   [extra-x86-64-v4]
   Include = /etc/pacman.d/alhp-mirrorlist
   [multilib-x86-64-v4]
   Include = /etc/pacman.d/alhp-mirrorlist
  • Refresh the repositories
sudo pacman -Syyu

ibus input methods

Choose an IBus setup to suit your typing habits. ibpinyin is a Chinese Pinyin input method, and anthy is a Japanese input method. Log out once, then find Keyboard in Settings and add an input source.

sudo pacman -S ibus ibus-pinyin
更好用的中文输入法:
sudo pacman -S ibus-rime
日语输入法:
yay -S ibus-mozc
  • Configure the input method: under General, enable candidate words and sort them by frequency; under Pinyin Mode, enable cloud input; under Dictionary, select the dictionaries; under User Data, clear all selections. * Log out and test whether input works correctly.

Preview images in ranger

sudo pacman -S python-pillow ranger kitty
vim ~/.config/ranger/rc.conf
set preview_images true
set preview_images_method kitty

Style kitty

Compatibility between the terminal and tiling extensions depends on their versions. If problems occur with multiple monitors, test the extensions individually.

sudo pacman -S kitty
# 下载配置文件 https://github.com/catppuccin/kitty
以frappe为例,下载frappe.conf,复制到~/.config/kitty/目录下,重命名为kitty.conf
# 编辑配置文件
写入:
linux_display_server x11 #修复kitty奇怪的刘海
hide_window_decorations yes #隐藏顶栏,隐藏后无法调整窗口大小,建议配合tiling shell扩展使用
background_opacity 0.8 #设置背景透明度
font_family 字体名
font_size 字体大小数字
# 如果波浪号在左上角,配置文件写入:
symbol_map U+007E Adwaita Mono
# 强制指定notosansmono字体,也可以选择别的
# 示例配置
hide_window_decorations yes
background_opacity 0.8
font_family Adwaita Mono
font_size 14
# 重启终端

Official verification resources#

ArchWiki: Swap.

ArchWiki: Zram.

ArchWiki: Dual boot with Windows.

ArchWiki: Domain name resolution.

zram-generator.conf(5).

References & further reading

  1. Original tutorial: shorinkiwata/archlinuxinstall ↗
  2. ArchWiki: Swap ↗
  3. ArchWiki: Zram ↗
  4. ArchWiki: Dual boot with Windows ↗
  5. ArchWiki: Domain name resolution ↗
  6. zram-generator.conf(5) ↗

Adapted from technical notes. Examples use generic names.

Continue along a reading path

Arch Linux

  1. 01Arch Linux philosophy and installation planning
  2. 02Kernel management, systemd-boot, and UKIs
  3. 03Pacman hooks, the AUR, and build security
  4. 04Btrfs subvolume layouts and Snapper snapshots
  5. 05Hardening with LUKS2, Secure Boot, and TPM2
  6. 06Performance choices and an everyday maintenance checklist
  7. 07Common Pacman commands and how to remember their flags
  8. 08Diagnosing slow Pacman downloads and choosing mirrors
  9. 09informant: Arch news and Pacman hooks
  10. 10Arch Linux with Btrfs: manual installation and archinstall
  11. 11Configuring GNOME, input methods, and snapshots
  12. 12GNOME laptop management and desktop customization
  13. 13KVM, GPU passthrough, and gaming on Arch Linux
  14. 14Swap, kernels, and troubleshooting on an Arch desktop
CONTINUE READING / NEXT ARTICLEValidating NixOS configuration with QEMU

From a minimal configuration to GNOME and Sway, distinguish VM declarations from persistent disk state.