3

I have installed a second Ubuntu on laptop that had already a MSFT Windows and a working version of Ubuntu 18.04. Upon rebooting, I realised grub did not show two but one Ubuntu. This new version would not let me log in. The boot is a EFI one and, after informing myself, it seems that the issue is that under the EFI partition only one /ubuntu directory is created. So the grub.cfg is overwritten. I would like as a first step to try to recuperate my standard Ubuntu OS. I have tried several things to that intent: 1- I installed rEFInd. It is indicated that rEFInd would find all OS, regardless that they are EFI bootable or not. rEFInd is now my boot manager but the entry that it did not restore the partition I am looking for magically.

2- I run the default and advanced options of boot repair to no avail.

3- I have tried to chroot How can I reinstall GRUB to the EFI partition? After following all the instructions from boot-repair live disk, I get a final error I did not managed to overcome after trying grub-isntall: /boot/grub no such device (did you mount /dev ? --which I did, according to instructions).

I am now trying to modify the grub.cfg directly to point to the old partition. There is a fs UUID instructions with root hd0,gpt3 there, that I would like to tweak but I am unclear how to do that.

Any help would be appreciated.

Best

fkraiem
  • 12,555
  • 4
  • 35
  • 40
  • We do not add "solved" to question titles here; if an answer solves your problem, you can accept it. – fkraiem Oct 22 '18 at 10:23

2 Answers2

0

When you boot it from live usb, run cfdisk, does it show 2 partitions or 1?

Reboot

Run from usb or cd

Choose to open instead of install.

Them do:

sudo apt install cfdisk

See if there are 2 ext* partitions

After you saw the name of the partition you can restart and go into safe mode.

This post explain what you need to do afterwards:

Boot drops to a (initramfs) prompts/busybox

Basically once in (initramfs) do exit It will show what is the problem with the boot

Now do

fsck /dev/sda* -y

Usually it will be sda1 or 2, check in initramfs to see which is.

Type reboot and it should work

EDIT:

For those with similar problems:

first, if you boot into grub> try doing ls

this will give you something similar to grub> ls (hd0) (hd0,msdos2) (hd0,msdos1)

From here, you have to know some things, first, what is your linux boot, you will be looking for EXT2, EXT3 and EXT4 formated devices. They will be named from sda1 and so on, example, ext4 /dev/sda1.

With this info there are a few things you can do:

If you boot from (initramfs)- you will have to wait long minutes to get to this prompt after the boot error, you can do the above steps on the unedited version of this response, otherwise if it does not work, follow the following:

After recognizing your boot table, name and partition, (which can be done with fdisk or cfdisk) you will need to boot into grub> and do ls, from the list it shows, you will need to figure out in which of the partitions your boot is, by doing: example cat (hd0,1)/etc/issue, do these for each of the outputs that will be similar to "(hd0) (hd0,msdos2) (hd0,msdos1)", from here you will be looking for the output, which will be something like your ubuntu version: "Ubuntu 14.04 LTS".

Once you fund in which partition you are in grub> you can try example:

set prefix=(hd0,1)*/boot/grub
set root=(hd0,1)*
insmod normal grub 
normal 
insmod linux grub
linux /boot/*
root=/dev/sda1* grub 
initrd /boot/*
boot

Substitute the * with your partition and boot path.

Hope this can help. links for full info:

If you have a BTRFS partition:

http://logan.tw/posts/2015/05/17/grub-install-and-btrfs-root-file-system/

https://wiki.archlinux.org/index.php/btrfs#Missing_root

Complete guide for grub rescue> and grub general:

https://www.linux.com/learn/how-rescue-non-booting-grub-2-linux%20%20

godspeed.

0

A lot of thanks to Pedro de Paula for keeping me in the right direction on several occasions.

I managed to recover my lost OS by chrooting. The reason why it failed on a previous attempt was that the file system is btrfs and it differs subtlely from extxxx.

The whole think is very well explained here:

http://logan.tw/posts/2015/05/17/grub-install-and-btrfs-root-file-system/ I strictly followed these instructions and it worked.

Hope it helps.

  • It seems that btrfs has a different structure than the ext fs. I think I found my partition but I cannot match the description in the link about how to repair grub. Here is the picture: https://www.dropbox.com/s/fm50k7w6zvnxiwy/20181021_214756.jpg?dl=0 – Cyril Godart Oct 21 '18 at 20:55
  • The issue for me was the missing subvol option when mounting the root filesystem. It was mounting under /mnt/@rootfs instead of /mnt and was causing this error for some reason. – pedroapero Jan 17 '23 at 14:00