I mistakenly deleted the /boot folder from my filesystem, rebooted, and all I get now is this:

error: file '/boot/grub/i368-pc/linux.mod' not found.

grub rescue>
  • 1
  • it's different, in this case, the /boot folder was completely deleted. not only some files from it, thanks. – Imad Nouari Jan 1 '15 at 18:34
  • I don't thing any of the answers on the other question are sufficient to fix this.. – Graeme Jan 1 '15 at 18:36
  • Fair enough, didn't really read all the answers. I would always suggest rebuilding the whole thing rather than fiddling about trying to work out what was missing so assumed someone there would have too. Takes half the time. – Cthulhu Tentacles Jan 1 '15 at 18:59
  • 7
    The far bigger mistake compared to deleting /boot is, of course, rebooting the system before this was fixed. – Anthon Jan 1 '15 at 19:26


Here's what to do:

  1. Boot a live distro. This can be your Ubuntu installation disc or another one such as Knoppix.

  2. Find the drive/partition where you have installed your root filesystem. To do this you can open a terminal and run either sudo parted -l or sudo fdisk -l. If you can't tell, then edit your question and add the output.

  3. Assuming that your root partition that you found from the last step is /dev/sdxy (x should be another letter and y should be a number), then run the following commands in a terminal:

    mkdir mnt
    sudo mount /dev/sdxy mnt
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
    sudo chroot mnt
  4. You will now be inside a chroot environment meaning that running commands here is equivalent to running them on your installed system. The first thing you want to do is reinstall GRUB2 to the device so that it copies the correct files into the /boot folder. To do this run the following with the drive that your root partition is on (ie /dev/sdxy with the number (y) removed):

    grub-install /dev/sdx
  5. You now want to find out which packages you have installed that have files in the boot directory and reinstall them. This will replace the kernel images that have been deleted among other things. The command to find the packages is:

    dpkg -S /boot

    And to reinstall them:

    apt-get --reinstall install ...

    Where ... is replaced with the names of packages from the first command. Do not include the commas, just have the package names with spaces to separate.

    This step will probably require internet access (unless the packages are already in the cache), so make sure you are connected if there is an problem.

  6. Since you will have deleted your kernels and reinstalled them, this should have triggered a GRUB2 update automatically. But just in case they haven't, you can run:

  7. Reboot and things should now be fixed. One issue that I had the last time I did something similar was that Windows installs where not found by update-grub when run in the chroot due to a bug in os-prober. If this is an issue, just run sudo update-grub again in the repaired system.

| improve this answer | |
  • @Olivier, thanks I originally had /dev/sdax everywhere then changed it to /dev/sdxy. – Graeme Jan 2 '15 at 9:12
  • Thanx for the great info - it saved me, with one addition. Since I have a software RAID, I had to also follow the instructions here: help.ubuntu.com/community/Grub2/Installing under the reinstall using chroot method to start mdadm and assemble the RAID members and do the mounts accordingly. Then, after chroot, reinstall the packages as described in this answer and all is well! – bitfiddler Jul 30 '15 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.