PDA

View Full Version : [SOLVED] grub 'no such device' with dual disk GPT/mbr setup



boolewinklegmail.
June 13th, 2016, 01:44 PM
Hello,


Background, I have a 2008 era bios-based machine that I want to upgrade/replace. It has a 500g drive.
I have just installed a 4TB disk, and am trying to install a more modern 64bit ubuntu on this disk.
Although grub has been installed on the new disk (about 10 times!), booting from the new disk
seems to actually boot from the old disk. More details:


The old disk (sda) has MBR partitioning, 4 partitions (one is windows).
The new disk (sdb) is setup with GPT partitioning, including

1M bios_grub
300M fat32 # not used/efi boot flag not set, reserved for future use (ambition to put the drive in a uefi machine)
20g ext4 / # gpt partion 3, /boot is here
15g swap
3TB /home


So, I have repeatedly done (when booted into the 64bit linux, and from a rescue disk)

sudo grub-install /dev/sdb
sudo update-grub


During the original install, I forgot to point it at /dev/sdb,
so booting /dev/sda now has an option to boot the new system as well as the old. It works.
However, I want to move away from dependence on the old drive, and just boot from the new.


When I boot from the new drive, it always gives
error: no such device: 4a096....

grub rescue>


Following a lot of web surfing, I got tho this bit of evidence:
grub rescue> set

grub rescue> ls

(hd0) (hd1) ... (hd1,gpt3) ...

prefix=(hd0,1)/grub

root=hd0,1
Here, (hd1,gpt3) is the newgpt partition that has /boot. (... means other irrelevant partitions).


However, I understand (correct?) that the root=hd0,1 is reporting that grub actually booted from the old drive,
EVEN THOUGH
1) I told it to boot from the new drive in the bios,
2) I know that the bios order has an effect because booting from the other drive actually works.
(As well, in a previous life of this upgrade drama, I was booting from the new drive successfully).


From the grub rescue menu, these commands successfully boot the new linux:
set prefix=(hd1,gpt3)/boot/grub

set root=(hd1,gpt3)

insmod normal

normal



So it seems like grub is initially looking at the gpt disk, then giving up and redirecting itself back to the mbr disk?

Another puzzle is that the "no such device" UUID 4a09...
is not one of the partitions on either disk - it is not in the output of "sudo blkid",
which shows all the partitions on both disks. Nor does this string "4a09..." appear
in the grub.cfg file on either drive.


I am a programmer, but not a linux or hardware expert, please keep your reply (if any) on the simple side!

oldfred
June 13th, 2016, 03:04 PM
Grub could be confused, but since it boots by UUID it still should work.

With multiple drives, your boot drive in BIOS is always hd0 in BIOS/grub.
I used to boot from sdc, then with another drive sdd. But had skipped a port on SATA port order. So flash drive was sde whne plugged in, but on reboot flash drive was sdb. I had skipped SATA1. System still booted ok, but I had some manual boot commands to boot ISO directly and often had to manually edit them as drive order changed.


May be best to see details:
Post the link to the Create BootInfo summary report. Is part of Boot-Repair:
https://help.ubuntu.com/community/Boot-Info

You mention you installed to drive that is now sda, best to update your install to have correct drive.
Grub remembers drive it installs into and on a major update will reinstall to that drive.


#To see what drive grub2 uses see this line - grub-pc/install_devices:
sudo debconf-show grub-pc # for BIOS with grub-pc
It will show drive model & serial number
to see similar drive info
sudo lshw -C Disk -short
sudo grub-probe -t device /boot/grub
#to get grub2 to remember where to reinstall on major updates
sudo dpkg-reconfigure grub-pc
#Enter thru first pages,tab to ok, spacebar to choose/unchoose drive, enter to accept, do not choose partitions
http://ubuntuforums.org/showthread.php?t=2189643

Dennis N
June 13th, 2016, 03:20 PM
During the original install, I forgot to point it at /dev/sdb,
so booting /dev/sda now has an option to boot the new system as well as the old. It works.

I assume this refers to the install on sdb? If this was never fixed, then even when you set sda as the 1st boot drive, you would actually boot into the grub menu of the OS installed on sdb (since you installed its grub to the MBR of the old disk sda - the MBR on sda directs the boot process to continue booting on sdb).

Fix this by booting to the OS on sda, then in it's terminal:


sudo grub-install /dev/sda
sudo update-grub

P.S. I've never mixed disks types like you have done: gpt and ms-dos partitioning, but I don't think that is a factor.

Dennis N
June 13th, 2016, 03:51 PM
Another puzzle is that the "no such device" UUID 4a09...
is not one of the partitions on either disk - it is not in the output of "sudo blkid"

It may have been there at one time. Did you delete any partitions?

Case in point: Once I deleted and recreated a swap partition. This changed the UUID of swap, and the boot process hung waiting for the old partition to be ready. Fixed by changing the UUID in /etc/fstab.

boolewinklegmail.
June 15th, 2016, 10:30 PM
Hello, thank you for the help.

Running the repair option of the BootRepar disk fixed it.

I now think it was because the original ubuntu installer/live disk usb was still in the machine when
grub-install was run, and grub found this usb disk as well as the two hard drives.
So (speculating) the 'no such device' was actually the usb disk.