-1

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

grub>

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?

closed as off-topic by Pilot6, karel, Eric Carvalho, Ravexina, Zanna May 9 '17 at 8:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • help.ubuntu.com/community/Boot-Repair Make sure that you boot in UEFI-mode to perform the task. – mook765 May 1 '17 at 12:18
  • @mook765 I tried Boot-repair from a live USB. The window File system repair requires to unmount partitions. Please close your programs. and then close this window. appears repeatedly even though Boot-Repair is the only program open. It seems to repeat this in an endless circle.I don't get a link to a pastebin. Any suggestions? – Peter May 1 '17 at 12:44
  • Why the downvote? – Peter May 1 '17 at 12:52
  • Given that Peter was able to get into the installed system (I'm guessing with Super GRUB 2 Disk or something similar), it seems that the system transfer was mostly successful, but GRUB isn't working. As such, it should be recoverable, as described in my answer. That said, I hadn't noticed it was Ubuntu 15.10; technically, that makes it off-topic for this forum. Re-installing a newer version may be in order; or recovering 15.10 to a bootable state and then upgrading could be done. (One update will get to 16.04 LTS, which is supported for another three years.) – Rod Smith May 1 '17 at 13:21
2

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.

  • I'm trying GRUB via boot-repair first.It keeps saying File system repair requires to unmount partitions. Please close your programs. and then close this window. even though I have done that.sudo umount /dev/sda1 ... /dev/sda11 and then I check that there are no mounted partitions with mount |grep /dev/sda. I have no partitions mounted but it still complains and seems to go in an never-ending circle. Would you know how I can move past that dialogue box ? Boot-repair seems to mount drives at /mnt/boot-sav/dev/sdaX for some reason when it is launched. – Peter May 1 '17 at 15:13
  • It sounds like you've either run into a bug in Boot Repair or you're missing something, and I can't tell which from your description. (Although I'm familiar with Boot Repair in broad strokes, I'm not familiar with every detail of its operation.) Somebody else may be able to help you; or you may want to move on to the rEFInd approach. – Rod Smith May 3 '17 at 16:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.