[Share Experiences] 如何用live系统修复引导
Tofloor
poster avatar
shy
deepin
2023-08-05 02:01
Author

1.制作live cd

找一个空u盘,在任意电脑(windows或linux均可)上安装ventoy

windows:https://www.lanzoui.com/b01bd54gb

linux:用包管理器

特殊:星火商店spk://store/tools/fydur-ventoy

然后打开,将ventoy安装到u盘里

接着找任意一个linux live(这里推荐archlinux,iso大小很小,而deepin的安装盘似乎没有live模式)

把xxx.iso复制进u盘里,不用解压

2.引导进u盘

不同主板不一样,可以自行搜索(装过deepin的应该都会..吧)

3.进入live系统

不出意外,你会看到一个选择菜单,菜单里有你要用的xxx.iso,选中回车

4.chroot

livecd 中运行(以下全部默认root账户运行,如果进去之后不是请输入sudo -i来进入root账户)

 fdisk -l

你会得到类似下面的输出:


Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: WDC WDS240G2G0A-
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 97B6BEC9-6F3E-4C61-9611-0197C28588CF

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    616447    614400   300M EFI System
/dev/sda2     616448   3762175   3145728   1.5G Linux filesystem
/dev/sda3    3762176  20162559  16400384   7.8G Linux filesystem
/dev/sda4   20162560 172806143 152643584  72.8G Linux filesystem
/dev/sda5  172806144 468858879 296052736 141.2G Linux filesystem



请找到你的efi分区,引导分区系统分区(我这里是/dev/sda1 /dev/sda2 /dev/sda3)引导分区可能没有

接下来挂载你的分区

mount /dev/sda3 /mnt ///这个是系统分区
mount /dev/sda2 /mnt/boot //这个是引导分区
如果没有就不用管
如果没有/mnt/boot就mkdir /mnt/boot
mount /dev/sda1 /mnt/boot/efi //这个是efi分区

最后chroot进你的系统

chroot /mnt

5.修复grub

注意,如果不知道自己到底是什么原因不能引导,请安装内核

例如deepin用户:

 apt search linux-image //找最新的安装,例如v23运行下面的
 apt install linux-image-deepin-hwe-amd64

然后修复grub

update-grub,如果没有这个命令运行  grub-mkconfig -o /boot/grub/grub.cfg

最后运行exit退出chroot

6.重启

先把前面mount的全部umount掉

例如这里应该运行

umount /mnt/boot/efi //这个是efi分区
umount /dev/sda2 /mnt/boot //这个是引导分区
如果没有就不用管
umount /dev/sda3 /mnt ///这个是系统分区


然后运行reboot重启

Reply Favorite View the author
All Replies
阿尼樱奈奈
Moderator
2023-08-05 02:04
#1

like

Reply View the author
忘记、过去
deepin
2023-08-05 02:17
#2

只 mount 根目录还不够吧

对于全盘安装的用户,另外还要手动 mount 数据盘所在位置,把里面的 /var 文件夹挂载到根目录的 var 下面;以及将 live 系统内的 dev proc sys 三个文件夹挂载到根目录下,否则的话大多数命令执行都会有报错的

Reply View the author
pzm9012
deepin
2023-08-05 02:37
#3

https://www.yuque.com/pzm9012/ct5ume/ihc99w#u7aGz

挂载的分区不够修复

Reply View the author
shy
deepin
2023-08-05 03:36
#4
忘记、过去

只 mount 根目录还不够吧

对于全盘安装的用户,另外还要手动 mount 数据盘所在位置,把里面的 /var 文件夹挂载到根目录的 var 下面;以及将 live 系统内的 dev proc sys 三个文件夹挂载到根目录下,否则的话大多数命令执行都会有报错的

这么麻烦吗。。我只是把别的发行版的经验带过来了,看来deepin复杂得多

Reply View the author
lyl
deepin
2023-08-05 03:46
#5

deepin-live不是可以傻瓜式的修复引导吗?

kissing_heart

Reply View the author
minchengan
deepin
2023-08-07 01:16
#6

以前的deepin安装iso可以以live方式运行的,新版不行了吗?

Reply View the author