0

I messed up my partitions because I wanted to increase my Ubuntu disk space (I had a boot partition between the two partitions I wanted to merge, so tried to delete merge partitions and re-install grub2) I used gparted.

But I am not able to re-install grub2 facing errors

GRUB failed to install to the following devices: /dev/nvme0n1

I have/had dual-boot configuration with a partition for windows and Ubuntu (I took some space from Windows partition to increase Ubuntu partition)

➜  ~ sudo parted -l
Model: ATA TOSHIBA MQ01ACF0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name                  Flags
 1      1049kB  500GB  500GB               Basic data partition  msftdata


Model: PC300 NVMe SK hynix 256GB (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

I tried to purge/reinstall grub:

sudo apt-get purge grub grub-pc grub-common sudo apt-get install grub-common grub-pc

Tried to run Boot Repair

The problem is that GParted don't see any partition anymore :-/ so how can I create my bios-boot partition without damaging the other partitions ?

enter image description here

Disks how a little better view lol but my windows partition is detected as free space...

enter image description here

Thanks

  • 2
    When you said you deleted the Boot partition did you delete /boot partition which most desktops do not have, or the ESP - efi system partition which is required for UEFI boot. With gpt partitioning you have to either have the ESP (FAT32) or bios_grub partition (unformatted) for grub to install. Did you leave Windows fast start up on? Then Linux NTFS driver cannot see the NTFS partition(s). askubuntu.com/questions/743095/… If you left fast start up on, you may need to use your Windows repair disk first. – oldfred Jan 29 '19 at 16:38
  • Gparted works fine. You're looking at the wrong partition. If you click on the up-down arrow in the top right corner you should see the 32 GB partition. It looks like that you removed the EFS boot partition. First make a new 150MB FAT32 partition, then boot into Live Ubuntu and perform a Boot-Repair. – Paul Benson Jan 29 '19 at 16:45
  • @oldfred this what I shouldn't have done unix.stackexchange.com/questions/401002/… (the deleted partition was grub2 core.img). – rad Jan 29 '19 at 16:53
  • 1
    First edit question. Delete the blkid output and the purge grub image stuff. Start Terminal (ctrl+alt+t) and run sudo parted -l. Post up output from that. – Paul Benson Jan 29 '19 at 17:45
  • 1
    Boot-Repair does not create partitions, it assumes you have correct partition for version you are using, or an ESP for UEFI or bios_grub for BIOS boot mode. And if Windows issues, you must fix those first and cannot do that from Ubuntu. – oldfred Jan 29 '19 at 17:52
0

You want to avoid using apt purge or apt remove on packages involving GRUB since it can leave your system in an unbootable state. Instead, there are two commands that exist to resolve these kinds of problems:

  • sudo update-grub takes an already installed GRUB and updates it's configuration so that it can find bootable partitions and put them into menu, create separate menu entries for all the available kernels, etc.
  • grub-install some_disk will install GRUB into the provided disk and update the Master Boot Record (MBR) of the system.

To further complicate things Windows has a very nasty habit of not actually shutting down, but instead hibernating. This causes serious problems because you shut windows down, go into Ubuntu or some other operating system, make changes to the disk, then go back into Windows. However, since you never actually "shutdown" Windows it stayed in memory and when shutting down clobbered the disk overwriting the changes you've made to the partition layout.

I have also seen a bug with GParted where some changes made to the disk while the system was booted weren't reflected in GParted until after restarting.

My suggestion is use the System Rescue CD to resolve the problem. In specific it contains Test Disk which can help recover deleted partitions, which is effectively what has likely happened.

  • Thanks for your answer, I tried testdisk but it didn't see my disk (/dev/nvm0n1 it sees only /dev/sda). I also tried update-grub and grub-install which failed with the same error message: grub-install: error: cannot find a GRUB drive for /dev/nvme0n1p6. Check your device.map. – rad Jan 29 '19 at 16:09

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.