制作启动盘、进入并联网

参见 使用 ArchInstall 安装 Arch Linux 的“安装前准备”一节。

挂载分区、进入系统

如果不了解你的硬盘分区,可以执行以下命令:

1
2
3
4
# 列出硬盘分区
lsblk
# 备用命令
lsblk -o NAME,SIZE,TYPE,FSTYPE

先挂载根目录所在的分区:

1
2
# 非 BtrFS
mount /dev/[根分区] /mnt

如果根分区使用 BtrFS,需要知道子卷名。可以通过先挂载 BtrFS,然后通过 btrfs subvolume list /[挂载点] 查看子卷名。

1
2
# 如果你的根分区是 BtrFS,请执行以下命令
mount /dev/[根分区] -t btrfs -o subvol=[子卷名] /mnt

随后挂载其他分区:

1
2
3
4
5
6
# 挂载启动分区
mount /dev/[启动分区] /mnt/boot

# 查看先前的挂载方式,有助于你的回忆
cat /mnt/etc/fstab
# 如果回忆起有其他分区,请继续挂载

可以将此时的挂载方式写入原系统:

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

随后就可以进入原系统了。

1
arch-chroot /mnt

忘记密码

如果忘记 root 用户密码,可以执行以下命令:

1
passwd

修复引导

1
2
3
4
5
6
7
8
9
10
# 安装 linux 时会触发 mkinitcpio
pacman -S linux

# 如果使用 systemd-boot,请执行以下命令
bootctl install

# 如果使用 grub,请执行以下命令
grub-install
# 备用命令,也可以自行在网上搜索
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub

重启

1
reboot