16

I had formatted efi partition and installed windows again. I have dual boot Windows and Linux, then I installed the grub bootloader again from a live usb using these commands:

 mount /dev/sda* /mnt
 mount --bind /dev /mnt/dev
 mount --bind /proc /mnt/proc
 mount --bind /sys /mnt/sys
 mount /dev/sda* /mnt/boot/efi
 mount /mnt/hostrun
 mount --bind /run /mnt/hostrun
 chroot /mnt
 grub-install /dev/sda
 update-grub
 exit

Then I unmounted all of this again. When I tried to boot, I got this messages:

 [ TIME ] Timed out waiting for device dev-disk-by\x2duuid-C829\x2dC4C1.device.
 [DEPEND] Dependency failed for file system check on /dev/disk/by-uuid/C829-C4C1.
 [DEPEND] Dependency failed for /boot/efi.
 [DEPEND] Dependency failed for Local File System.

and it turns me into emergency mode. How can I solve this problem?

Mido Ahmed
  • 163
  • 1
  • 1
  • 7
  • 1
    Welcome , Check the UUID's in your `/etc/fstab` using `blkid` command. – GAD3R Sep 27 '18 at 17:39
  • I've experienced this sort of issue before. It's because when you reformat a file system its UUID changes and your /etc/fstab is using the old UUID. As a filesystem with the old UUID no longer exists udev fails to find it and you get this error. Update the UUID in /etc/fstab using blkid and your system will manage to correctly boot again as this error will be gone. – Josh Pinto Sep 28 '18 at 11:34
  • thanks, i checked it and it was with different UUID. now it's working – Mido Ahmed Sep 28 '18 at 15:42

1 Answers1

33

Windows formatted you EFI partition and thus its ID changed...
you need to add the UUID of the new partition to the one in your /etc/fstab.
if you enter maintenance mode or have a terminal which seems you do, do this...

sudo blkid

write down the UUID of the EFI partition then

sudo nano /etc/fstab

change the UUID of the old EFI partition to the one you wrote down.
if you don't know which is your EFI partition look in sudo blkid output. the should be a partition where it says type=efi...

JJD
  • 577
  • 3
  • 10
  • 27
NhlalukoG
  • 446
  • 4
  • 3
  • 1
    I am fighting with a [similar issue](https://unix.stackexchange.com/questions/496298/slow-boot-time-after-cloning-disk-and-resizing-partitions) - maybe you have an advice. – JJD Jan 24 '19 at 14:57
  • Great answer. I added a uuid to /etc/fstab because I was having issues with usb permissions. This was the wrong thing to do. When I rebooted, Ubuntu kept returning to emergency mode. I took your advice and opened fstab and removed the entry and Ubuntu works as expected. Thank you. @NhlalukoG – sectechguy May 17 '19 at 18:34
  • 1
    Great answer. I had a similar problem after reformatting my swap partition, advice worked. – ummw May 27 '19 at 11:45
  • What if there is no efi partition, only ntfs and ext4? Anyway, had a partition in my fstab that did not exist anymore, so there is that. – br4nnigan Apr 22 '21 at 18:51
  • You can also find the UUIDs of any partition, by using the ls -lha command in the /dev/disk/by-uuid folder – DrGregoryHouse Nov 08 '21 at 11:06
  • Very good answer, you're a lifesaver. Just a note for anyone else, the EFI partition might not have type=efi. In my case, the type was type=vfat. – Gamebuster19901 Aug 20 '22 at 00:43