liveCD在线等 --求修复启动

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
头像
赶集人
帖子: 67
注册时间: 2010-10-20 22:23

liveCD在线等 --求修复启动

#1

帖子 赶集人 » 2014-09-12 22:40

我现在U盘启动liveCD (MBR+GRUB4DOS启动)
在线等

ubuntu14.04在MBR模式下安装
win8.1在efi模式下安装
3个磁盘为GPT,grub4dos引导不了卡 :em20

现在完全进不了ubuntu(/dev/sdc3) :em20

liveCD因该可以修复才是卡 :em20
附件
/dev/sdc<br />gpt+efi<br />win8.1+ubuntu14.04
/dev/sdc
gpt+efi
win8.1+ubuntu14.04
/dev/sdb<br />gpt+efi
/dev/sdb
gpt+efi
头像
赶集人
帖子: 67
注册时间: 2010-10-20 22:23

Re: liveCD在线等 --求修复启动

#2

帖子 赶集人 » 2014-09-12 23:55

终于进入ubuntu系统了 :em05
在liveCD 使用 chroot修复
这是参考:(我一步步操作的)

---------------------------
Boot your computer with a live-usb/CD in UEFI mode. I had two boot options <flash_drive> and UEFI: <flash_drive>, the second is needed to expose the efi variables in /sys/firmware/efi/ so that efibootmgr don't fail later on. Booting with the first option gives me the following error:

Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.

modprobe efivars did'nt work for me.

chroot into the broken system (similar to the ubuntu grub2 help but with efi specificities):

sudo mount /dev/sda2 /mnt #sda2 is my root partition
sudo mount /dev/sda1 /mnt/boot/efi #sda1 is my efi partition
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc/ #makes the network available after chrooting
modprobe efivars # make sure this is loaded
sudo chroot /mnt


Depending on your linux distribution, you now do different things.

For Ubuntu/Debian:

apt-get install --reinstall grub-efi-amd64

or alternatively:
apt-get install --reinstall grub-efi
update-grub

should the above give you a grub, but not a bootable one

For Fedora (up to 16, may work for others):

yum reinstall grub-efi

In the following command, you have to replace sdX with the device which has the EFI partition you want to boot from. In --part Y you have to replace the Y with the number of the EFI partition (as in /dev/sdXY).

efibootmgr -c --disk /dev/sdX --part Y
efibootmgr -v # verify a new record called Linux is there

Now type Ctrl+D to exit chroot, unmount everything and reboot:

for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
sudo umount /mnt/boot/efi #please do this. corrupted efi partitions are not nice
sudo umount /mnt
sudo reboot
------------------------------------------
其实他还漏了一点!
grub-install --target=x86_64-efi --efi-directory=/dev/sdc1 --bootloader-id=grub --boot-directory=$esp/EFI --recheck --debug ($esp注意!!)
因为 apt-get install --reinstall grub-efi-amd64以后 不会自动安装到esp分区!! :em01
要手动安装到这个esp分区
最终的原理还是在于efibootmgr来操作

过程中我出了点错
modprobe efivars #出错了,开机看不到启动项(但是 开机按F11已经找到ubuntu)
(这是提示:efibootmgr -c -d /dev/sdc -p 1 -w -L ubuntu -l \EFI\ubuntu\grubx64.efi ,说明启动菜单没有安装上)

---------------------
重要参考:
https://wiki.archlinux.org/index.php/GR ... IdeaCentre

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="ubuntu" --recheck --debug
"grub-install /dev/sdc" 这种安装方法已经不行了
sunweinan
帖子: 31
注册时间: 2011-04-14 21:47

Re: liveCD在线等 --求修复启动

#3

帖子 sunweinan » 2014-09-17 23:37

我为了修复这个破grub2都快暴走了,终于在你这看到了解决方案,感谢!
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: liveCD在线等 --求修复启动

#5

帖子 poloshiao » 2014-09-18 21:27

modprobe efivars #出错了
http://askubuntu.com/questions/232364/m ... -not-exist
the efivars kernel module is now built into the kernel rather than installed as a module.
ubuntu 的 efivars 核心模組 已經 內建在 linux 核心 不需額外安裝 efivars 模組
回复