Ubuntu: How to restore grub when moving an image from one computer to another [closed]


I had a computer from 2009 that stopped working. I had an image of the hard drive that I now want to restore to a new computer. I have managed to re-image the new computer but I can't get grub to work.

It stops at the grub> prompt every time I boot.

How can I restore grub so that it doesn't stop at the grub> prompt and boots to the normal login screen on the new computer?

The Ubuntu Desktop version is 15.10.

The settings in the Boot menu of my bios looks like this:

 +---------------------------+   | Boot Mode       | UEFI    |   | USB Boot        | Enabled |   | PXE Boot to LAN | Enabled |   | PXE IPV4 First  | Enabled |   +---------------------------+  

This is what my partitions looks like:

/dev/sda8 /usr /dev/sda9 /home /dev/sda10 / /dev/sda11 /usr/local

Partition 1-7 are related to Windows 10 that was installed prior to restoring the Ubuntu partitions.

So Windows 10 was installed first and it occupied the entire drive (1TB). I shrank the windows partition to ~300G and created the linux partitions on the remaining space.

I power up the computer and it stops at


Then I follow the instructions here: How to Rescue a Non-booting GRUB 2 on Linux

First I mount the / partition, set the kernel, initrd and then boot.

grub> set root=(hd0,10) grub> linux /boot/vmlinuz-4.2.0-34-generic root=/dev/sda10 grub> initrd /boot/initrd.img-4.2.0-34-generic grub> boot

This takes me to the linux prompt.

I then run

 root@lnx-R560>update-grub     Found linux image /boot/vmlinuz-4.2.0-34-generic    Found initrd image /boot/initrd.img-4.2.0-34-generic   [  279.358637] EXT4-fs (sda2): VFS Can't find ext4 filesystem   [  279.360540] EXT4-fs (sda2): VFS Can't find ext4 filesystem   [  279.362423] EXT4-fs (sda2): VFS Can't find ext4 filesystem   [  279.364298] FAT-fs (sda2): bogus number of reserved sectors   [  279.396817] FAT-fs (sda2): bogus number of reserved sectors   [  279.421858] qnx4: No qnx4 file system (no root dir)   [  279.423659] ufs:You didn't specify the type of tyour file system   [  279.423659]   [  279.423659] mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep   [  279.423659]   [  279.423659] >>>WARNING<<< Wrong ufstype may corrupt your filesystem,default is ufstype=old   [  279.426405] ufs: ufs_fill_super(): bad magic number     Found Windows Boot Manager on /dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi   Adding boot meny entry for EFI firmware configuration   done  

sda2 is a windows partition.

And then we install grub

 lnx-R540> grub-install /dev/sda     Installing for i386-pc platform   grub-install: warning: the GPT partition label contains no BIOS Boot  Partition; embedding won't be possible.   grub-install: warning: Embedding is not possible.GRUB can only installed in this setup by using blocklists. However blocklists are  UNRELIABLE and their use is discouraged.   grub-install: error:will nnot proceed with blocklists  

And then we reboot.

root@lnx-R540>reboot now

After reboot, the computer still ends up at the grub> prompt.

How can I restore grub so that it boots to the normal login prompt?


Some of your output indicates that Windows is installed in EFI/UEFI mode and uses the GUID Partition Table (GPT) on the disk. This means that you must install an EFI-mode boot loader for Linux. As your original computer was from 2009, though, it was probably a BIOS-only model, which means that the disk probably used the Master Boot Record (MBR) partition table and had a BIOS-mode boot loader installed on it. This explains the problems you're having with update-grub and grub-install; these commands, given the BIOS-mode GRUB packages you've got, are trying to update and install a BIOS-mode GRUB, which isn't working well on your GPT disk. Even if you created a BIOS Boot Partition on the disk, a BIOS-mode boot loader for Linux would not work well, since switching between boot modes is usually awkward and sometimes impossible.

There are quite a few EFI-mode boot loaders for Linux, as detailed on this page of mine. The two that are likely to be easiest to install are:

  • GRUB (via Boot Repair) -- The Boot Repair utility can install an EFI-mode version of GRUB and update your packages semi-automatically; however, you must boot the computer in EFI mode to do this. The usual way to do this is to boot using an Ubuntu installer in "try before installing" mode; but controlling the boot mode (EFI/UEFI vs. BIOS/CSM/legacy) can be tricky, as outlined on this page of mine. Another way to ensure an EFI-mode boot is to use rEFInd, as described next....
  • rEFInd -- My rEFInd boot manager is available as CD-R and USB flash drive images, as well as in Debian package and PPA forms. If you prepare a CD-R or USB flash drive from the matching image, you can boot with it in EFI mode. You can then install the Debian package or PPA to use rEFInd as the default OS; or run Boot Repair to install GRUB. One caveat is that the rEFInd USB flash drive and CD-R images I provide are not set up to support Secure Boot, which might or might not be active now. If you can't get rEFInd to start, disabling Secure Boot, at least temporarily, may be required. (rEFInd can work with Secure Boot active, but it requires jumping through some extra hoops; see the rEFInd documentation on Secure Boot for details.)

Note that you may need to update your /etc/fstab file after a disk transfer such as you describe. It sounds like you can at least force the system to boot, so your root (/) filesystem is probably configured correctly; but you may need to adjust others. In particular, mounting the EFI System Partition (ESP) at /boot/efi is advisable, since that's the default for Ubuntu.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »