Linux: grub修復


修復

在liveCD下先掛載相應分區,然后使用grub-install進行修復。

注意:如果系統是使用systemd的,修復環境也要是基於systemd的(直接搞個ubuntu的livecd好了),否則grub-install可能會失敗(提示 cannot read 'boot/efi': Is a folder)

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot/efi
mount -B /sys /mnt/sys
mount -B /dev /mnt/dev
mount -t proc /proc /mnt/proc
chroot /mnt
grub-mkconfig -o /boot/grub/grub.cfg  # 雙系統注意觀察grub-probe輸出是否有windows字樣
grub-install /boot/efi  (這是efi的,如果是mbr則是 grub-install /dev/sda1)

修改默認啟動項

默認的GRUB_DEFAULT為0,改為需要的即可,然后執行 grub-update 更新grub.cfg文件。(或grub-mkconfig -o /boot/grub/grub.cfg)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM