2

Was trying to tweak a menu entry and in an effort to get it to work I deleted all contents of /etc/grub.d. Is there a way I can easily restore it? This question has to be a duplicate by now so if someone can redirect me to an answer that too would be great. :)

  • Although technically a duplicate of: https://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows the answer I posted below is a lot easier in your situation of only missing the /etc/grub.d directory and not missing all of grub. – WinEunuuchs2Unix Aug 26 '18 at 18:10

1 Answers1

0

Boot with your Live USB / DVD.

Open Nautilus in root mode using:

sudo -H nautilus

Then navigate to your /etc directory and copy the grub.d directory.

While still in nautilus root mode navigate to your real /etc directory on your hard drive SSD and paste the grub.d directory into it.

Note: You may have to mount your real Ubuntu first if nautilus doesn't see it on the hard drive / SSD: How to mount a partition from live usb

  • 1
    Right, so I did what you suggested, and updated grub by chrooting to where I mounted the partition that had grub installed from the live USB. It only detected Windows though, not Ubuntu. – Hugeblank Aug 28 '18 at 01:42
  • Um... you don't use chroot. Only mount it so you can copy to it. You should still be rooted to Live USB... – WinEunuuchs2Unix Aug 28 '18 at 01:44
  • Offtopic: running into another issue: “failed to get canonical path of `/cow'. The solutions given to me by looking at other stackexchange threads aren’t working. Looking into more solutions – Hugeblank Aug 28 '18 at 02:01
  • Um "CoW" means Copy On Write (deals with dirty disk buffers or something). "COW" can also mean "Cow-Say" which is a gimmic CLI program and probably not that. Don't really know sorry. – WinEunuuchs2Unix Aug 28 '18 at 02:02
  • Found nothing of use. I really don’t understand what’s going wrong, /etc/grub.d has 10_linux so there’s no reason why only the os prober should work. – Hugeblank Aug 28 '18 at 02:38
  • Besides 10_linux there should be 05_debian, 30_osprober and a few others. – WinEunuuchs2Unix Aug 28 '18 at 02:46
  • Oh there is, there’s a whole host of other things in there with number prefixes. But only os_prober seems to be functional – Hugeblank Aug 28 '18 at 02:54
  • After you run sudo update-grub you can view /boot/grub/grub.cfg and see the other modules are included in between # lines. ie ### BEGIN /etc/grub.d/05_debian_theme ### and ### END /etc/grub.d/05_debian_theme ### – WinEunuuchs2Unix Aug 28 '18 at 02:58
  • I don't have grub.d, it's missing, I cannot copy it. grub.cfg, and device.map were also missing, but I managed to regenerate device.map only. – Quidam May 02 '20 at 09:13
  • @Quidam If you've found a new way of solving the problem consider posting an answer to help others. – WinEunuuchs2Unix May 02 '20 at 13:59
  • I don't have a new way, I have the same problem. – Quidam May 02 '20 at 14:59