1

I'm trying to fix grub from a USB drive. I am not sure why the problem happened. I was running Ubuntu 20.04 and restarted normally and on the restart, I get grub-rescue screen. I don't have windows installed, just the Ubuntu. I am currently using usb to fix it. I ran Boot-repair but got below error

Error detected in grub_mkconfig

After rebooting, I was taken to grub screen. I am trying these solutions, but nothing worked.

I run the following:

sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt /dev/sda

I get the following error:

grub-probe: error: failed to get canonical path of /cow.

Even when running

sudo grub-mkconfig > /boot/grub/grub.cfg

or

update-grub

in chroot, I get the same error. Can someone explain the error, and explain how to solve it?

This is the result of running sudo fdisk /dev/sda command

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *          2048 1901873141 1901871094 906.9G 83 Linux
/dev/sda2       1901875198 1953523711   51648514  24.6G  5 Extended
/dev/sda5       1901875200 1937033215   35158016  16.8G 82 Linux swap / Solaris
/dev/sda6       1937035264 1953523711   16488448   7.9G 83 Linux

Edit: Pastebin link to the Bootinfo summary report: https://paste.ubuntu.com/p/sT23JKdBr8/ Pastebin link after peerforming boot repair:https://paste.ubuntu.com/p/nRf4Q29pfv/

earthmeLon
  • 11,247
newbie
  • 119
  • To be honest, the best thing to do, in my opinion, is to reinstall Ubuntu 20.04. DO you know if you can back up the system? Try running sudo rsync -a --info=progress2 --exclude="lost+found" --exclude=".cache" /home /path/to/disk/to/save/home/to – Logan Feb 15 '22 at 18:32
  • This should back up the /home directory. Make sure you have another external drive. – Logan Feb 15 '22 at 18:32
  • To back up, after reinstalling Ubuntu, run sudo rsync -a --info=progress2 --exclude="lost+found" /path/to/disk/to/save/home/to /home/ – Logan Feb 15 '22 at 18:34
  • I am going to put my comments as an answer – Logan Feb 15 '22 at 18:37
  • 1
    Please copy & paste the pastebin link to the Bootinfo summary report ( do not post report), do not run the auto fix till reviewed.Lets see details, use ppa version with your USB installer (2nd option) or any working install, not Boot-Repair ISO https://help.ubuntu.com/community/Boot-Repair
    https://sourceforge.net/p/boot-repair/home/Home/ The /cow means you were trying to update the live installer, not your install. But if you correctly chrooted into your install, you should have been able to fix it from there.
    – oldfred Feb 15 '22 at 18:54
  • https://paste.ubuntu.com/p/sT23JKdBr8/ here is the pastebin link – newbie Feb 15 '22 at 19:12
  • it looks your system is installed in biosmode. Are your live session also boot up in bios mode? for bios mode right place to reinstall grub is in MBR of the drive. this should do it https://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows – nobody Feb 23 '22 at 14:13
  • Also see https://askubuntu.com/questions/254491/failed-to-get-canonical-path-of-cow – Martin Zeitler Feb 23 '22 at 22:10
  • Before the crash did you make any changes to /etc/default/grub file? Can you list the file contents in your question? Changing some of the GRUB_CMDLINE_LINUX_DEFAULT options in the file *might* fix the error. – WinEunuuchs2Unix Feb 24 '22 at 11:31

2 Answers2

1

To be honest, the best thing to do, in my opinion, is to reinstall Ubuntu 20.04. DO you know if you can back up the system? Try running sudo rsync -a --info=progress2 --exclude="lost+found" --exclude=".cache" /home /path/to/disk/to/save/home/to

This should back up the /home directory. Make sure you have another external drive.

To back up, after reinstalling Ubuntu, run sudo rsync -a --info=progress2 --exclude="lost+found" /path/to/disk/to/save/home/to /home/

For more information, see this thread on AskUbuntu. It seems to be a very similar issue, and could have a better solution.

Logan
  • 472
1

When I wanted a simple grub repair (and couldn't figure out how to fix grub), I just did an additional install. I would make some space for a new partition (or use an unneeded partition) and install a new (small/minimal) instance of linux there. I would make sure I am installing the new bootloader over the old bootloader. Then let the install find my old install and add it to the menu. Then both installs were accessible on reboot. Basically I let the install fix the problems.

Edit: tested and updated with additional command.
If you cared to remove the NEW install, you can now log in the old OS and run sudo grub-install /dev/wherever-your-bootloader-is. Just to get a warm fuzzy I went into /etc/default/grub and made a subtle change to the "GRUB_TIMEOUT" (which I had set at 7 seconds. I changed it to 13 seconds to verify that I'm on the right track)... and then sudo update-grub. Rebooting right now brought me to the grub menu with my 13 second timeout, so I know I'm good for grub now configured by my old install. Logging back into the old system, now you are able to delete the NEW OS partition and run update-grub again... This will bring your grub menu back to just the original one install...

....in your specific case, I'd be a little careful. Your layout looks odd (to me 'personally')... You have a large 906G partition with the boot label, then a extended partition with a ton of swap and then a 7.9 gig partition inside that. I can't tell where your OS install is, so I'd be hesitant to tell you where to install without seeing df -h and knowing what you have on those partitions. You'd just want to make sure you're not installing over your existing OS or any data that you want to keep. You'd want to shrink one of those partitions and make a new one with the new space... You also may be able to get away with plugging in a usb drive or sd card and doing the small OS install there instead, while making sure you're designating the bootloader location to be on that drive that is currently named /dev/sda in your picture.

WU-TANG
  • 3,071