【已解决】uefi下grub,启动分区换磁盘修复
Tofloor
poster avatar
deepinf
deepin
2019-03-13 21:57
Author
本帖最后由 deepinf 于 2019-3-15 13:37 编辑

写在前面:
在改动启动分区【ESP】的位置后,修复引导时将引导安装在新的硬盘【不是原先启动引导的那块硬盘】,这时需要需改deepin系统的/etc/fstab文件。我原先引导在sdb2,重装window 时sdb没有建立esp分区,所以把引导挪到了sda1
如图:

使用blkid命令列出各个分区的uuid号。找到需要需要安装引导的那块磁盘的esp分区的uuid号
如图:

将该uuid号替换到上图中的位置
最后,使用deepin Live重新修复引导。

求助:

前几天由于重装windwos导致grub丢失。安装wiki.deepin.org中【启动修复】词条中的“重装grub”教程操作,结果开机可以进入grub,grub主题也正常。但是却出现了如下图的错误,无法进入系统:

错误截图:

错误提示如下:
No Caching mode page foundAssuming drive cache: write through
You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemct1 default" or "exit"
to boot into default mode.

Cannot open access to console, the root account is locked.
See sulogin(8) man page for more details.

Press Enter to continue.

通过wiki执行的操作:
重装GRUB
  • 使用深度操作系统启动盘引导电脑启动,待进入安装界面后,按下Ctrl+Alt+F1,执行以下命令,稍等片刻,进入Live CD模式。

    $ sudo service lightdm stop  $ startx
  • 进入Live CD系统后打开终端,挂载需要修复系统的 / 挂载到/mnt,可以利用Gparted或者 sudo fdisk -l 命令查看,例如需要修复系统的/分区为/dev/sda1。

    执行以下命令:

    $ sudo mount /dev/sda1 /mnt

    如果需要修复系统的/boot单独分了出来(假设为/dev/sda2),也要挂上,终端执行:

    $ sudo mount /dev/sda2 /mnt/boot

    另外,将Live CD系统的/dev目录同时挂在/mnt下,终端执行:

    $ sudo mount --bind /dev /mnt/dev

    然后使用chroot命令,将Live CD的 / 设为以前的/,终端执行:

    $ sudo mount --bind /proc /mnt/proc$ sudo mount --bind /sys /mnt/sys$ sudo chroot /mnt

    安装并刷新GRUB设置(主板为BIOS引导),请终端执行:

    第一次没注意到(主板为BIOS),错误的执行了这一步,后面几次修复没有执行这一步。
    $ grub-probe -t device /boot/grub$ sudo grub-install /dev/sda$ sudo grub-install --recheck /dev/sda$ sudo update-grub

    安装并刷新GRUB设置(主板为UEFI引导):启动root shell后,检查您的EFI系统分区(最可能 /dev/sda1)是否安装在 /boot /efi 上:

    # mount /dev/sda1 /boot/efi

重新安装grub-efi包:

   # apt-get install --reinstall grub-efi

将debian引导加载程序放在 /boot/efi 中,并在计算机NVRAM中创建一个适当的条目:

   # grub-install /dev/sda

重新创建一个基于磁盘分区模式的grub配置文件:

   # update-grub
  • 挂载EFI分区到 /boot/efi,安装 grub-efi 包:

    # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Deepin# grub-mkconfig -o /boot/grub/grub.cfg
  • 修复完成,重启电脑生效。

最后在/dev/sda1/ esp分区下的EFI文件夹下建立了ubuntu文件夹,将EFI/deepin 中的grub.cfg 复制到了 EFI/ubuntu下

分区情况:/dev/sda1为esp分区
                /dev/sda2为deepin的根目录“/”,没有其他任何单独分区,所有目录均在“/”下

windows在/dev/sdb下,windows的启动文件在/dev/sda1中


磁盘均为gpt格式,系统只打开了uefi启动,安全启动已关闭。


最后:请求大佬指点迷津,小弟不胜感激!!!






Reply Favorite View the author
All Replies
avatar
186******03
deepin
2019-03-14 01:23
#1
如果可以进入windows系统的话,做一个Deepin Live系统启动U盘,然后从U盘启动用深度系统修复工具修复一下引导。
Reply View the author
avatar
deepinf
deepin
2019-03-14 06:12
#2
https://bbs.deepin.org/post/175497
如果可以进入windows系统的话,做一个Deepin Live系统启动U盘,然后从U盘启动用深度系统修复工具修复一下引 ...

你仔细看我的帖子了吗?我就是通过live U盘启动修复失败才来求助的。我是问我修复后启动失败,已经把失败的图贴了出来。请正面回答我的问题,谢谢。
Reply View the author
avatar
deepinf
deepin
2019-03-14 18:11
#3
顶一下,感觉目前deepin的修复grub的wiki教程已经失效。跪求官方大大解答!
Reply View the author
avatar
linux000
deepin
2019-03-14 18:56
#4
把efi中的deepin启动文件删掉,就deepin和ubantu文件夹两个,再次导入或者修复。试试看。。
Reply View the author
avatar
176******20
deepin
2019-03-14 23:44
#5
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Deepin --recheck

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

感觉也就这两个命令是重点。 我在笔记本上用这两条修复了启动,在台式机开机启动进入grub救援界面。

笔记本是用其他linux发行版修复的,在台式机是用deepin修复的。

唯一的不同点,笔记本安装 grub-efi-amd64 和 grub-efi-amd64-signed 是冲突的,在deepin却全安装上了。

卸载 grub-efi-amd64-signed ,在修复引导就成功了。

PS:  刚刚查看一下 grub-efi-amd64-signed,已经不在了。
Reply View the author
avatar
deepinf
deepin
2019-03-15 06:40
#6
linux000 发表于 2019-3-14 10:56
把efi中的deepin启动文件删掉,就deepin和ubantu文件夹两个,再次导入或者修复。试试看。。 ...

试过了,还是那个问题。启动不了,问题还是我贴出来的那张图。
Reply View the author
avatar
deepinf
deepin
2019-03-15 07:09
#7
https://bbs.deepin.org/post/175497
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Deepin --recheck

grub-mk ...

用u盘chroot后卸载了grub-efi-amd64-signed,重新修复后,还是启动不了,还是那个问题。
重新进入u盘,挂载,chroot,dpkg -s 检查了下,已经卸载了grub-efi-amd64-signed
Reply View the author
avatar
176******20
deepin
2019-03-15 16:56
#8
https://bbs.deepin.org/post/175497
用u盘chroot后卸载了grub-efi-amd64-signed,重新修复后,还是启动不了,还是那个问题。
重新进入u盘,挂 ...

你这应该是内核参数配置有问题啊
Reply View the author
avatar
rainyl
deepin
2019-03-15 17:28
#9
https://wiki.archlinux.org/index.php/GRUB_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%BC%95%E5%AF%BC%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F
Reply View the author
avatar
deepinf
deepin
2019-03-15 18:32
#10
https://bbs.deepin.org/post/175497
如果可以进入windows系统的话,做一个Deepin Live系统启动U盘,然后从U盘启动用深度系统修复工具修复一下引 ...

deepin Live系统确实是一种方法,谢谢你在第一时间回复我,我对没有仔细看你的回复,和对你的无端指责向你道歉。
我用u盘制作了deepin live系统,通过文件管理器找到原deepin的/boot/efi,右键进入终端,挂载/dev/sda1(esp分区)到./,然后运行引导修复。
重启后grub中出现了deepin,windows引导菜单。可是进入deepin后还是同样的问题。
Reply View the author
avatar
linux000
deepin
2019-03-15 22:16
#11
https://bbs.deepin.org/post/175497
试过了,还是那个问题。启动不了,问题还是我贴出来的那张图。

那可能是你主板BIOS的问题了。。。恢复BIOS默认配置,再修复一遍。
Reply View the author
avatar
deepinf
deepin
2019-03-16 00:15
#12
感谢大家的回复,问题已经解决。问题原因和解决办法已经写在前面,希望能对遇到我这种情况的人有所帮助。
Reply View the author