Skip to content

Commit a0f9cf2

Browse files
author
canwdev
committed
u
1 parent a4af018 commit a0f9cf2

9 files changed

Lines changed: 248 additions & 50 deletions

docs/Linux/ArchLinux_Manjaro/Arch Linux Btrfs 迁移指南.md renamed to docs/Linux/ArchLinux/Arch Linux Btrfs 迁移指南.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,37 @@
1212

1313
## 准备目标电脑 (Target)
1414

15-
在目标电脑上启动 LiveCD,联网,并对新硬盘进行分区。
15+
在目标电脑上启动 LiveCD,联网并配置国内镜像(参考 [[Arch Linux 安装指南]]),并对新硬盘进行分区。
1616

1717
```shell
18-
# 格式化分区
18+
# 查看分区
19+
lsblk -f
20+
# 或
21+
fdisk -l
22+
```
23+
24+
```shell
25+
# 识别并创建分区
26+
cfdisk /dev/nvme0n1
27+
28+
#使用上下键移动到显示为 "Free Space"(大小约 64G)的那一行。
29+
#左右键选择 [ New ],按回车。
30+
#提示输入大小时,默认会填满所有空闲空间,直接回车。
31+
#选择 [ Write ],输入 yes 确认。
32+
#选择 [ Quit ] 退出。
33+
#此时,你应该会多出一个设备节点,如 `/dev/nvme0n1p6`
34+
```
35+
36+
```shell
37+
# 格式化分区(根据实际情况!)
38+
# 输入以下命令回车后会立即格式化,谨慎操作!
39+
40+
# EFI分区
1941
mkfs.vfat -F32 /dev/nvme0n1p1
42+
# swap分区
2043
mkswap /dev/nvme0n1p2
2144
swapon /dev/nvme0n1p2
45+
# 系统分区(btrfs)
2246
mkfs.btrfs /dev/nvme0n1p3
2347

2448
# 挂载 Btrfs 根并创建接收路径
@@ -39,19 +63,20 @@ PermitRootLogin yes
3963
PasswordAuthentication yes
4064
```
4165

42-
启动 SSH 服务
43-
4466
```shell
67+
#启动 SSH 服务
4568
systemctl start sshd
69+
#设置root密码
70+
passwd
71+
#获取当前 IP 地址
72+
ip a
4673
```
4774

48-
获取当前 IP 地址:`ip a`
49-
5075
现在,你可以在另一台电脑上通过终端连接了:`ssh root@<你的IP地址>`
5176

5277
## 网络传输数据 (Source -> Target)
5378

54-
我们将利用 btrfs send/receive 通过 SSH 将子卷直接“流”向新电脑。这种方式比 rclone 更适合克隆整个系统。
79+
我们将利用 `btrfs send/receive` 通过 SSH 将子卷直接“流”向新电脑。这种方式比 `rclone` 更适合克隆整个系统。
5580

5681
在源电脑上: 首先为当前的子卷创建只读快照(这是 send 的前提):
5782

@@ -69,7 +94,7 @@ sync
6994
```
7095

7196

72-
在目标电脑上: 确保已安装 openssh 并临时允许 root 登录(或开启服务)。
97+
在目标电脑上: 确保已安装 `openssh` 并临时允许 root 登录(或开启服务)。
7398

7499
从源电脑发起传输:
75100

@@ -81,6 +106,11 @@ btrfs send /root_backup | ssh root@目标IP "btrfs receive /mnt"
81106
btrfs send /home_backup | ssh root@目标IP "btrfs receive /mnt"
82107
```
83108

109+
注意:
110+
- 传输过程中不会有任何提示,如果要看网速可以使用 `btop`
111+
- 中断后不能续传,如果你中断了任务,必须手动删除目标端那个失败的子卷,然后重新开始(在目标机器上执行 `btrfs subvolume delete /mnt/不完整的子卷名`)
112+
- 传输成功后程序会静默退出,没有任何提示
113+
84114
## 恢复子卷结构与清理
85115

86116
传输完成后,目标电脑的 /mnt 下会有 root_backup 和 home_backup。我们需要将它们重命名为原本的子卷名称。
@@ -96,10 +126,10 @@ btrfs subvolume snapshot /mnt/home_backup /mnt/@home
96126
btrfs subvolume delete /mnt/root_backup
97127
btrfs subvolume delete /mnt/home_backup
98128

99-
# 重新挂载到正确的位置
129+
# 重新挂载到正确的位置(注意替换成真实dev设备!)
100130
umount /mnt
101131
mount -o subvol=@ /dev/nvme0n1p3 /mnt
102-
mkdir /mnt/home
132+
#mkdir /mnt/home
103133
mount -o subvol=@home /dev/nvme0n1p3 /mnt/home
104134
mkdir -p /mnt/boot/efi
105135
mount /dev/nvme0n1p1 /mnt/boot/efi
@@ -130,7 +160,7 @@ arch-chroot /mnt
130160
```bash
131161
pacman -Syu linux linux-firmware
132162
```
133-
注意: 如果你使用的是其他内核(如 linux-lts 或 linux-zen),请替换相应包名。
163+
注意: 如果你使用的是其他内核(如 `linux-zen` 或 `linux-surface`),请替换相应包名。
134164

135165
执行完这一步后,/boot/vmlinuz-linux 就会出现
136166

@@ -145,7 +175,7 @@ pacman -Syu linux linux-firmware
145175
mkinitcpio -P
146176

147177
# 重新安装 GRUB 引导
148-
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
178+
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
149179

150180
# 重新生成 GRUB 配置
151181
grub-mkconfig -o /boot/grub/grub.cfg

docs/Linux/ArchLinux_Manjaro/Arch Linux 安装指南.md renamed to docs/Linux/ArchLinux/Arch Linux 安装指南.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Arch Linux 安装指南
22

33
日期:2025.12.22
4-
参考:https://github.com/SHORiN-KiWATA/ShorinArchExperience-ArchlinuxGuide/wiki
4+
参考: https://github.com/SHORiN-KiWATA/ShorinArchExperience-ArchlinuxGuide/wiki
55

66
## Live CD 准备
77

@@ -13,6 +13,11 @@ station wlan0 connect <SSID>
1313
<PASSOWD>
1414
```
1515

16+
```shell
17+
ip a #查看网络连接信息
18+
ping bilibili.com #确认网络正常
19+
```
20+
1621
配置国内镜像
1722

1823
```sh
File renamed without changes.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
在 Surface 设备上安装 Arch Linux 后,使用专用的 `linux-surface` 内核可以显著提升触控、手写笔、电源管理及各类传感器的支持。
2+
3+
以下是安装该内核并将其设为默认启动项的步骤:
4+
5+
## 1. 添加 linux-surface 仓库
6+
7+
为了方便后续更新,建议直接使用官方维护的二进制仓库,而不是从 AUR 手动编译(那会耗费极长时间)。
8+
9+
### 导入密钥
10+
11+
首先,需要信任该仓库的开发者密钥:
12+
13+
Bash
14+
15+
```
16+
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
17+
| sudo pacman-key --add -
18+
sudo pacman-key --lsign-key 56C372A9DA4211C51DB8466A895F09CD43CB3A40
19+
```
20+
21+
### 修改 pacman 配置
22+
23+
编辑 `/etc/pacman.conf` 文件:
24+
25+
Bash
26+
27+
```
28+
sudo nano /etc/pacman.conf
29+
```
30+
31+
在文件末尾添加以下内容:
32+
33+
Ini, TOML
34+
35+
```
36+
[linux-surface]
37+
Server = https://pkg.surfacelinux.com/arch/
38+
```
39+
40+
---
41+
42+
## 2. 安装内核及相关组件
43+
44+
同步仓库并安装内核及其配套固件:
45+
46+
Bash
47+
48+
```
49+
sudo pacman -Syu
50+
sudo pacman -S linux-surface linux-surface-headers surface-ipts-firmware
51+
```
52+
53+
- **linux-surface**: 核心内核。
54+
55+
- **surface-ipts-firmware**: 用于触控支持(适用于 Surface Pro 4 及更新机型)。
56+
57+
- **iptsd**: 如果你需要触控多点手势,建议也安装此守护进程:`sudo pacman -S iptsd` 并启用服务 `sudo systemctl enable iptsd`。
58+
59+
60+
---
61+
62+
## 3. 设置为默认内核
63+
64+
安装完成后,系统内会有两个内核:原生 `linux` 和 `linux-surface`。你需要调整引导程序(通常是 **GRUB**)来默认启动后者。
65+
66+
### 方案 A:自动记忆最后一次选择(推荐)
67+
68+
编辑 `/etc/default/grub`:
69+
70+
Bash
71+
72+
```
73+
sudo nano /etc/default/grub
74+
```
75+
76+
修改或确认以下两行:
77+
78+
Plaintext
79+
80+
```
81+
GRUB_DEFAULT=saved
82+
GRUB_SAVEDEFAULT=true
83+
```
84+
85+
这样,只要你手动选一次 Surface 内核,下次它就会自动进入。
86+
87+
### 方案 B:强制指定顺序
88+
89+
如果你想直接固定它,可以查看 `/boot/grub/grub.cfg` 中的菜单顺序,或者简单地在 `/etc/default/grub` 中设置:
90+
91+
Plaintext
92+
93+
```
94+
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux-surface"
95+
```
96+
97+
_(注意:具体名称可能因语言设置有所不同)_
98+
99+
### 更新 GRUB 配置
100+
101+
**这一步至关重要,否则修改不会生效:**
102+
103+
Bash
104+
105+
```
106+
sudo grub-mkconfig -o /boot/grub/grub.cfg
107+
```
108+
109+
---
110+
111+
## 4. 安装安全启动(Secure Boot)密钥 (可选)
112+
113+
如果你的 Surface 开启了 Secure Boot,内核可能无法加载。
114+
115+
1. 安装 `surface-control`:`sudo pacman -S surface-control`。
116+
117+
2. 按照 [Linux-Surface Wiki](https://www.google.com/search?q=https://github.com/linux-surface/linux-surface/wiki/Secure-Boot) 的说明导入 MOK 证书。
118+
119+
120+
> **建议:** 初学者可以先在 UEFI 设置中关闭 Secure Boot 以确保能正常进入系统,待内核跑通后再研究签名。
121+
122+
---
123+
124+
## 5. 重启并验证
125+
126+
重启设备,并在 GRUB 菜单中选择 `Arch Linux, with Linux linux-surface`。进入系统后运行:
127+
128+
Bash
129+
130+
```
131+
uname -a
132+
```
133+
134+
如果输出中包含 `-surface` 字样,恭喜你,安装成功了!
135+
File renamed without changes.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
如果在安装 Arch Linux 后,GRUB 菜单里没有出现 Windows 的选项,通常是因为 **os-prober**(系统探测工具)没有启用或未安装。
2+
3+
以下是修复步骤:
4+
## 1. 安装必要工具
5+
6+
你需要 `os-prober` 来自动识别硬盘上的其他操作系统,以及 `ntfs-3g` 来确保 Linux 能读取 Windows 的 NTFS 分区。
7+
8+
Bash
9+
10+
```
11+
sudo pacman -S os-prober ntfs-3g
12+
```
13+
14+
---
15+
16+
## 2. 启用 os-prober
17+
18+
出于安全考虑,新版本的 GRUB 默认禁用了自动探测。你需要手动开启它。
19+
20+
1. 编辑 GRUB 配置文件:
21+
22+
Bash
23+
24+
```
25+
sudo nano /etc/default/grub
26+
```
27+
28+
2. 在文件末尾添加(或取消注释)这一行:
29+
30+
Plaintext
31+
32+
```
33+
GRUB_DISABLE_OS_PROBER=false
34+
```
35+
36+
3. 保存并退出(Nano 中按 `Ctrl+O` 然后回车保存,`Ctrl+X` 退出)。
37+
38+
39+
---
40+
41+
## 3. 挂载 Windows 分区 (关键步骤)
42+
43+
如果 Windows 分区没有被挂载,`os-prober` 有时会跳过它。
44+
45+
- 你可以先通过 `lsblk` 确认 Windows 所在的 EFI 分区或系统分区。
46+
47+
- 手动挂载一下(或者直接重启,通常启用上述设置后即可识别)。
48+
49+
50+
---
51+
52+
## 4. 重新生成 GRUB 配置
53+
54+
这是最关键的一步,它会扫描所有驱动器并重新创建菜单。
55+
56+
Bash
57+
58+
```
59+
sudo grub-mkconfig -o /boot/grub/grub.cfg
60+
```
61+
62+
**检查输出:**
63+
64+
如果你在命令输出中看到类似 `Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi` 的字样,说明成功了!
File renamed without changes.

‎docs/硬件&刷机/SurfacePro7安装Linux指南.md‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,43 +42,7 @@ sudo dpkg -i iptsd_0.1-1_amd64.deb
4242

4343
## 2. 安装 Arch Linux / Manjaro
4444

45-
### 2.1 手动下载
46-
47-
在 [这里](https://pkg.surfacelinux.com/arch/) 可以直接下载 `zst` 文件,下载前需去除 `.blob` 后缀,如:`https://pkg.surfacelinux.com/arch/iptsd-0.1-1-x86_64.pkg.tar.zst`
48-
49-
需要下载这些包:
50-
51-
```
52-
linux-surface-headers linux-surface surface-ipts-firmware iptsd
53-
```
54-
55-
### 2.2 安装
56-
57-
如果直接安装,可能会提示签名错误,此时需要修改配置:`sudo vim /etc/pacman.conf`
58-
59-
```
60-
# SigLevel = Required DatabaseOptional
61-
SigLevel = Never
62-
# LocalFileSigLevel = Optional
63-
LocalFileSigLevel = Never
64-
```
65-
66-
然后就可以直接安装了:
67-
68-
```sh
69-
# 内核
70-
sudo pacman -U linux-surface-5.8.5.arch1-1-x86_64.pkg.tar.zst \
71-
linux-surface-headers-5.8.5.arch1-1-x86_64.pkg.tar.zst
72-
73-
# 驱动程序
74-
sudo pacman -U surface-ipts-firmware-20200402-1-any.pkg.tar.zst \
75-
iptsd-0.1-1-x86_64.pkg.tar.zst
76-
77-
# 额外的软件,来自 AUR,如果你装了 yay
78-
# 可能需要开启代理才能下载成功
79-
export ALL_PROXY=socks5://proxyAddress:port
80-
yay -S libwacom-surface surface-dtx-daemon surface-control
81-
```
45+
[[Archlinux 安装 linux-surface 并设为默认内核]]
8246

8347
## 3. 常见问题
8448

0 commit comments

Comments
 (0)