背景

有点用腻了mbp的mac os系统的感觉,想换arch了.

因为总觉得mac系统里好乱, 好多感知不到的空间管理. 而且终究只是unix, 并不是linux.

但是嘛, 都用了一段时间之后回来想想, 最近我比较倾向于arch的原因主要是最近工作所需一直在用linux规范下的systemd控制下的CentOS, 用的比较熟悉了, 对目录结构比较清楚了, 而对于自己非常不熟悉的freeBSD基础的mac, 有种不在自己控制内的感觉...

现在想了想, 这其实不就是舒适区的问题吗? 学习一下mac的目录结构和日志排查等, 其实也并不会有多费事, 也并不会增加我记忆unix生态的混淆程度.

哎,但是看笔记本的品控上来说,可能还是mac os让人比较省心了. 至少售后给的新笔记本不会像xps那样经常出问题...

硬件

XPS(arch推荐比较多的是这个,但是因为品控问题不推荐的也是这个)

什么电流音之类的,决定还是不选这个了.

虽然好像XPS 7590 15寸或者13寸的直接支持hdmi 2.0接口,不过品控还是太让人担心了.

thinkpad x1c

emm, 似乎还行,但是触控板的体验还是比不上mac的应该

matebook

好像散热不行, 键盘部分会烫?

听说bios不太行?

安装踩坑

manjaro踩坑

bootloader一直没能正常使用

参照[^3]这个带图片的安装过程终于安装成了. 发现我直接选择第三种systemd-boot的引导,最后是看不到进入系统的东西的,可能兼容性上有问题? 最后我额外安装了Refind这套引导,终于进入桌面了.

arch安装

todo

大小写老师被自动切换了

似乎是vmware 15.5这个版本的缺陷

Temporary solution for Ubuntu guest which worked for me was just disabling the Caps Lock key all together with this

setxkbmap -option caps:none setxkbmap -option caps:none # (disable the caps lock key)

xdotool key Caps_Lock # (toggle caps lock) Caps Lock Issues With Upgrade - VMware Technology Network VMTN

禁用这个按钮倒也是个方案, 反正我基本也不用.

不过就怕他也影响宿主机, 那就很讨厌了.

为啥我安装的虚拟机鼠标放在Linux界面再挪出去,大小写键盘总是自动切换呢?用的vmware ubuntu.如图

为啥我安装的虚拟机鼠标放在Linux界面再挪出去,大小写键盘总_虚拟机吧_百度贴吧 VMware虚拟机中大小写不停切换的问题_helen2977的博客-CSDN博客 好像无解

vmware-tools安装运行

我之前应该是直接pacman -Syy open-vmware-tools

现在发现vmware-tools这个服务没能启动.

好像搜到说是

[SOLVED] Automating installation of vmware-tools

实际上我装的是open-vm-tools ### open-vm-tools vmtoolsd这个服务似乎可以工作

VMware中的Manjaro启用复制粘贴_darkula的博客-CSDN博客

Installation Install open-vm-tools. If the legacy vmhgfs shared folder module is desired, the open-vm-tools-dkmsAUR package must be installed (the new vmhgfs-fuse driver is included in open-vm-tools). Start and/or enable vmtoolsd.service and vmware-vmblock-fuse.service.

Try to install gtkmm3 manually if it does not work properly. To enable copy and paste between host and guest gtkmm3 is required.

VMware/Install Arch Linux as a guest - ArchWiki

不能复制粘贴的时候, 不知道为什么,执行下这个vmware-user就能用了.

Arch Linux / Manjaro 配置 VMware copy/paste

vim内没开全局剪切板, 无法向外复制. cat处理吧.

重点

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# 这里fdisk分区时, 及时将类型修改为EFI类型
# 否则会出现错误: cannot find a GRUB drive for

mount /dev/mapper/VG_0-root /mnt
mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot
swapon /dev/mapper/VG_0-swap

timedatectl set-ntp true
vim /​etc/​pacman.d/​mirrorlist
pacman -Syy
pacstrap /mnt base base-devel linux linux-firmware man-db man-pages iwd lvm2 dhcpcd vim systemd


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


arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

/etc/locale.conf
locale-gen

# 修改
/etc/mkinitcpio.conf
HOOKS=(base systemd ... block sd-lvm2 filesystems)
#Initramfs
mkinitcpio -P


# 安装grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
# 注意要挂载/boot/efi,见上面挂载boot分区那步
grub-mkconfig -o /boot/grub/grub.cfg

这次
useradd -m -G wheel cc
passwd cc
nano /etc/sudoers
在 root ALL=(ALL) ALL 下面添加
用户名 ALL=(ALL) ALL
为你刚才创建的用户 添加sudo权限

pacman -S xorg-server
pacman -S i3-wm

# useradd的用户无法启动时, 安装一下这个, 创建一下自己这个用户的配置文件就好了.
pacman -S xorg-xinit

复制 /etc/X11/xinit/xinitrc 到~/.xinitrc。注释掉文件后面的最后的以下几行。

twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login

然后添加i3启动命令

exec i3

sudo pacman -S i3
sudo pacman -S wqy-microhei adobe-source-code-pro-fonts



# i3 Error: Status_command not found (exit 127) : linuxmint
[\(1\) i3 Error: Status\_command not found \(exit 127\) : linuxmint](https://www.reddit.com/r/linuxmint/comments/3f9k9s/i3_error_status_command_not_found_exit_127/)
pacman -S i3status

#HIDPI
[HiDPI \(简体中文\) \- ArchWiki](https://wiki.archlinux.org/index.php/HiDPI_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#%E9%9D%9E%E6%95%B4%E6%95%B0%E5%80%8D%E7%BC%A9%E6%94%BE%E4%B8%8B%E7%9A%84Bug)

Simplified appliance containg one one-liner

eval $(cvt 2220 1250 60 |sed 's/Modeline/xrandr --newmode /g'|sed -n '1!p')

as a proper result resolution screen size aspect ratio might be afterwards reevaluated/adjusted, therefore find out the created resolution by xrand command - appended in the end of output,

1) assign the resolution to a specific display -

xrandr --addmode VGA-1 "2224x1250_60.00"

2) output the desired resolution on the display

xrandr --output VGA-1 --mode "2224x1250_60.00"

To list all installed shells, run:

$ chsh -l
And to set one as default for your user do:

$ chsh -s full-path-to-shell

if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi

yay-git.git

makepkg -si

# 配置dhcpcd自动

systemctl enable dhcpcd

退出startx方式
win+shift+e退出桌面, 这个方式好像会卡住, 输入不来哦东西.



按照这个终于过了. Arch Linux (UEFI with GPT) 安装 | 沈煜的博客

ArchLinux图形界面安装与美化:i3+polybar_盐焗咸鱼的博客-CSDN博客_archlinux安装i3桌面

休眠

systemd-swap

Can we use this to enable hibernation? A: Nope as hibernation wants a persistent fs blocks and wants access to swap data directly from disk, this will not work on: swapfs

emm, 不能用这个来做休眠用的swap.

手动创建

1
2
3
4
5
6
7
8
9
10
fallocate -l 16G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

filefrag -v /swapfile
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=/dev/sda1 resume_offset=313344"
grub-mkconfig -o /boot/grub/grub.cfg
/etc/mkinitcpio.conf
mkinitcpio -P

Arch Linux 使用 Swap File 进行休眠 - xzOS ## 安装vmware

VMware (简体中文)/Installing Arch as a guest (简体中文) - ArchWiki

systemd-boot和 grub

systemd-boot和EFISTUB - 知乎 ### boot manager可以看到有我新建的grub, 但是EFI似乎没法直接从硬盘启动?

UEFI启动

/etc/locale.gen ### UEFI和 grub什么关系?

似乎我的/boot分区划分出问题了, efi无法找到s

并不是EFI分区, 导致bootctl无法识别了.

bootctl status可以帮助判定

[SOLVED] EFI partition not detected / Installation / Arch Linux Forums

grub-install --target=i386-pc /dev/sda 用legacy就尅引导了

用uefi的反而麻烦, 必须分区时gpt符合efi的

分区lvm

Installation guide - ArchWiki

lvm不能直接被引导?

boot分区独立分区的意义?

创建出来之后, 从哪里复制内容过来, 好像这个文档里都没有提啊s

Partitioning (简体中文) - ArchWiki

/boot分区里的内容在哪里呢?

使用过grub-config来往里面生成内容?

mkinitcpio -P 似乎也能生成新的initramfs

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

将已经存在的archlinux迁移到lvm - 知乎 #### initramfs选择?

LVM (简体中文) - ArchWiki archlinux安裝手记(Win10+Arch、GPT+UEFI、lvm) - 停止使用的账户 - 博客园

使用

1
2
3
4
5
6
7
8
9
10
sudo pacman-mirrors -c China
pacman -Syy
pacman -Syu
好像说是命令是pacman -Syyu
pacman -Qi linux
pacman -Qs 在已安装中查询
pacman -Ss 在仓库中查询
pacman -R 卸载
pacman -Ru 循环卸载系统里不依赖的东西

pacman 升级python, 似乎没删掉旧内容?

  • todo
    • 3.8升级到3.9, 看了下/usr/bin下的确只有新的python3.9了, 但是/usr/lib64/下还存在3.8的目录, 是不是之前pip装的东西没有被自动卸载或者移植?

这是一个疑问句 > 不要用 pip 管理 /usr 下的包,它会和 pacman 打架。要么建 venv 在里边用 pip,要么不用 pip 只用 pacman。

根据这个pacman 安装的python包无法识别 / 应用程序与桌面环境 / Arch Linux 中文论坛, 是建议通过venv来管理python依赖的.

更新python之后, i3-sensible-terminal无法工作了

TTY2执行了下i3-sensible-terminal, 结果发现是psutils这个库没了, 应该就是我刚才升级引起的了.

怎么让pacman来安装包呢?

1
2
pacman -Syy python-pip
pacman -Syy python-six
装完pip之后报没有six, 安装了下就能使用了.

执行terminator, 报You need to install gobject, gtk, pango to run Terminator

最后, 我也没找到怎么处理的办法, 就把python3.8里的库复制到了python3.9的里...

timeout

[Solved] Connection time-out on installation (curl / iPv6 problem) / Installation / Arch Linux Forums 捣鼓了半天, 最后是因为我在Arch里默认开了代理, 代理好像有问题了.

内核异常

卡在loading initial ramdisk

There was a kernel update, some element of your initramfs wasn't successfully built and copied to your bootloader. Generally the output of mkinitcpio shows errors, chroot in and make it again. 执行

1
2
mkinitcpio
# 就会报出initramfs的错误.
(1) Stuck on Loading initial ramdisk : archlinux

打开调试日志

1
2
3
vim /boot/grub/grub.cfg
# 去除quiet和设置log_level=7,rd.log=all
# 奇怪,怎么没生效呢?

通过增加set debug=allset ignore_log_level=all倒是生效了, 看到了一些代码的执行记录. 但是倒是没看到Error信息

General troubleshooting - ArchWiki

为其他不是当前正在运行的内核创建镜像,添加内核版本到命令行, 可以在/usr/lib/modules目录查看支持的内核版本.

1
2
# mkinitcpio -p linux
就会以当前安装的linux版本对/boot目录下的initramfs-linux.img进行再次生成了.
捣鼓了2天, 换了个稳定版的内核就正常开机了. #### 进入reach target basic system之前的shell 在linux16那行追加rd.break=pre-trigger

linux16这行追加rd.debug可以打出initrd中的dracut脚本的内容

周期内核升级

1
2
3
4
5
6
7
8
9
pacman -Sy linux-lts
# 下面这个似乎只生成当前运行的内核的initramfs, 如果要生成指定, 需要指定preset
mkinitcpio -P
# 指定内核版本生成?


grub-mkconfig -o /boot/grub/grub.cfg


terminal

i3-sensible-terminal

  • Mod+shift+q 退出程序

快捷键 shortcuts

不知道为什么alt+falt+b没办法快速在单词之间跳

这个快捷键是emulator的还是shell的呢?

bash默认是启动了emacs模式的.

哦, 好吧, 是Superkey覆盖掉了alt+f这个操作, 所以把Superkey换成command也就可以了.

(1) Can I completely swap the Alt and Super keys? : i3wm

set $mod Mod4

Archlabs-i3wm/config at master · alexandrebobkov/Archlabs-i3wm

主要是我之前生成的配置文件里居然都是直接Mod1 + Enter之类的, 而不是$mod + Enter, 导致我直接set $mod没有效果.

网络

systemd-networkd 禁用ipv6 net.ipv6.conf.all.disable_ipv6 = 1

输入法

kde最稳妥

可以和i3结合?

bspwm ## 文件系统只读问题 一般都是fstab被改坏了之类的.

桌面:i3wm

毫无疑问,我主要感兴趣的点就是能够尽量完全使用键盘来控制的方式.

$mod + Enter 启动虚拟终端 $mod + A 焦点转义到父窗口上

i3lock

歧义性好严重...没有看到输入密码的框, 原来是因为默认就处在接收密码的状态下, verifingwrong的状态就是密码验证的结果... ### 登录桌面[deprecated] 最后因为vmware里似乎X11的直接配置没能配置生效, 导致sddm始终分辨率都是800x600, 我最后还是选择使用.xinitrc来调用xrandr修改分辨率

1
2
3
4
5
6
7
8
9
10
11
pacman -S sddm
systemctl enable sddm #


vim /etc/sddm.conf.d/hidpi.conf
# 虽然我通过`pacman -Ql sddm`查到我装的位置是在`/usr/lib/sddm`里
[Wayland]
EnableHiDPI=true

[X11]
EnableHiDPI=true

urxvt

rxvt-unicode 不知道这个好不好用

(1) Which terminal simulator do you use with i3, and why? : i3wm

urxvt 要支持hidpi, 还需要一些特殊配置. 先这样用吧. 已经挺好了.

默认的复制粘贴

Ctrl+alt+c/v

unable to load base fontset

因为HiDPI, 所以增加了pixelsize的设置, 结果无法启动了.

看了下, 似乎是缺字体?

图片和壁纸 feh

feh

feh --bg-scale new.jpg

feh (简体中文) - ArchWiki

HiDPI[^7]

看起来多屏高分屏支持有点费事, 暂时还是不捣鼓了.

xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2

这个的scale 和那个~/.Xresources的Xft.dpi=192区别?

是不是xrandr修改了dpi之后, 修改指定程序的字体大小就行了?

xrandr --dpi这个好像是xft.dpi的更新的方案

这个设置了以后, 标题栏的确hidpi了, 但是应用程序并没有, 不管是Terminal还是chrome.

.Xresources[^8]

Xft.dpi: 141 xrdb ~/.Xresources xrdb -merge ~/.Xresources xrdb -query -all

最后成功版本[^9][^10]

最后其实还是按照wifi操作成功的.

我在 .xinitrc中添加xrandr --output Virtual-1 --mode 2560x1600 在.Xresources中添加

1
2
3
4
Xft.dpi:  256
export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
export QT_AUTO_SCREEN_SCALE_FACTOR=1
这次重启之后终于终端字体大小什么的都对了.

远程控制: x11远程和本地渲染不同?

我看到的窗口和颜色不太一样啊,vnc

manjaro

先用i3试试.

i3wm 使用

[^4]可以看. 不配置de还挺舒服的.

程序启动器

dmenu

dmenu-manjaro冲突

Wayland仍未成熟

目前来看,虽然Wayland还是在逐渐开发, 不过Xorg的成熟度还是远比其成熟, Wayland存在的问题稍多.

Sway

等价于i3wm的管理器,不过这个没能做到i3polybar的程度, 而且也始终是存在部分问题的. 所以如果要用arch, 还是继续Xorg下吧. ## 开关机 shutdown -h now

驱动

【openSUSE】软件源和软件搜索 --- 看了之后 受益匪浅 - 孙愚 - 博客园

Reference

  1. Installation guide - ArchWiki
  2. i3 (简体中文) - ArchWiki
  3. Manjaro-architect 安装指南_兴趣斗士的博客-CSDN博客_manjaro architect
  4. i3: i3 User’s Guide
  5. xps13(9370) Linux之路 · Kevin的笔记
  6. screen lock / verifying : i3wm
  7. Linux 下, hipdi 高分屏外接显示器显示怎么整啊? - V2EX
  8. 安装xdpyinfo在Linux Xresources中设置正确的屏幕DPI-教程-Linux系统学习
  9. HiDPI - ArchWiki
  10. Fixing HIDPI on a bare i3 install (in Arch Linux btw)