0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntuのデュアルブートから1つ消去したらgrubが壊れた件

Posted at

始めに

これは、ubuntuの20.04と18.04そしてwindows10をデュアルブートにしていたものを18.04を削除したときにgrubの修復に少しはまったので、自分へのメモです。

参考サイト

このサイトのやり方はraidの修復だったので、このやり方のraid部分を抜いたものになります。
grub rescueで'grub_file_filters' not foundが出るときの対処方

必要なもの

  • ubuntu 20.04のインストールUSBメモリ(多分インストールCDでも行けると思います)

手順

  1. インストールUSBを立ち上げます。そして「Ubuntuを試す」を選択し、起動したら端末を開きます。基本rootの操作で面倒なので、rootになります。

2.次に復旧したいubuntu(この場合20.04)のデバイス名を確認します。今回はubuntn 20.04が/sdaに入っていることを想定します。つまり/dev/sda1がbootで/dev/sda2がrootになります。fdiskなどで確認します。

$ sudo su
# fdisk -l

3.utuntu 20.04が入っているディスクをマウントします。まずrootを/mntにマウントし、その後/mnt/bootにbootをマウンンとします。

# mount /dev/sda2 /mnt
# mount /dev/sda1 /mnt/boot

4.その他の疑似ファイルシステムをマウントします。(すみません、ここは受け売りです・・・。)そしてchrootします。

# cd /mnt
# mount -t proc proc /mnt/proc
# mount --rbind /sys sys/
# mount --rbind /dev/ dev/
# chroot /mnt /bin/bash

5.grubの再インストールをします。そして再起動するとgrubが立ち上がります。

# grub-install /dev/sda
# update-grub
# reboot

今回確かめられていないのですが、grub-installでsecure関係のエラーが出る場合は、uefiのsecure bootをオフして試してみてください。

終わりに

今回はメモのため、感想なしです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?