Grub 2 error 15, how to reinstal MBR?

Asked by Cushie

I installed 'Karmic DVD' to sdb1 on a dual boot with MS on sda1, I reformatted the partition which previously had 'Jaunty', it seemed to suggest to install Grub to sdb, but it rebooted and got as far as Grub stage 1.5 then error 15.

I reinstalled again without formatting and at the last page 'Advanced' set the boot to sdb1 which is where the '/' partition lies. The same error 15 again.

I could not boot into rescue mode from by usb stick as it is not recognised as a cd rom! (why should it need a cd rom? A netbook does not have one!)

I followed the hack https://wiki.ubuntu.com/Grub2 re error 15, using the live usb dvd, making sdb the boot partition again, but it still did gave the same error.

Can you advise on the solution? Should Grub be on sdb1?
It appears to a non expert that the MBR on either sda or sdb is not rewritten by grub to point to the boot sector on sdb1. I tried swapping the boot order in the bios but that did not help. If that is the problem how do I rewrite the MBR on drive one or drive 2 to suit Grub2 which which should be able to do it?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub2 Edit question
Assignee:
No assignee Edit question
Solved by:
peter b
Solved:
Last query:
Last reply:
Revision history for this message
peter b (b1pete) said :
#1

it is quite simple but I'd recommend first to get a bit more familiar with grub2's inner workings - a little reading that'll go a long way; both url's bellow explain v well grub2;

http://ubuntuforums.org/showthread.php?t=1195275
http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#GRUB_to_a_Partition

if I understand correctly your problem, your best bet is still

https://wiki.ubuntu.com/Grub2

after lecturing the two web pages above then follow directions under

Recover Grub 2 via LiveCD

heading.

Revision history for this message
Cushie (redhotwal) said :
#2

Thanks Peter, those references are are comprehensive, but at this stage I accept the advice not to tamper with the config file direct and let Grub2 do the work, it just misses out on the last vital part of the install.

I have given Grub2 several tries to install, twice through a full install and once using the https://wiki.ubuntu.com/Grub2 hack. None of these have resulted in getting past stage 1.5 and still produce Error 15. I could repeat the latter hack again, the instruction relatating to use of the space bar were not appropriate, (I had to use 'Enter' key instead) but I did get to a line in the config tool which asked me to choose the partition and I chose sdb (or sdb1). I assume that answer is correct.

The references you quoted cover reinstalling to the old Grub, is that necessary and a way out of my problem? I have had two sucessful installs of 9.10 on single drive dual boot machines without problems and I wonder if having two drives disrupts the installation. Is there a way to check and correct the MBR pointer, if that is the problem I am having.

Revision history for this message
peter b (b1pete) said :
#3

there is no stage 1.5 in grub2. just to clarify,

- do you have karmic installed ? if yes is it on sdb1 partition ? just boot off karmic Live CD, open a terminal and post here output of

sudo fdisk -l

command (l is lower L); you'll have to identify (see) the partition where karmic supposedly iives; then, all it takes, if that stands true, is to mount that/those partition/s then chroot into the INSTALLED karmic and basically reinstall grub to MBR. all these steps are v well described and shown on the web page that you have already said that was used.

pls post here also the output of

grub-install -v

that you should run AFTER the

sudo chroot /mnt

was run, that'll tell you whether you're working with grub legacy or grub2.

Revision history for this message
Cushie (redhotwal) said :
#4

Karmic Grub2 ; Boot error 15, Twin HDD's MS on sda, Ubuntu on sdb, Athlon3200 proc.

Thanks, Peter for your continued support and helping me through this problem. Here is my Terminal info booted up from the install Usb:

:~$ sudo fdisk -l

Disk /dev/sda: 360.1 GB, ### etc,

Device Boot Start End Blocks Id System
/dev/sda1 * 1 12748 102398278+ 7 HPFS/NTFS
/dev/sda2 12749 43777 249240442+ 7 HPFS/NTFS

Disk /dev/sdb: 250.1 GB, ###etc

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2439 19591236 83 Linux ###This is my Karmic /
/dev/sdb2 2440 12105 77642145 5 Extended
/dev/sdb3 12106 21033 71714160 83 Linux
/dev/sdb5 2440 7302 39062016 83 Linux ###This is spare
/dev/sdb6 7303 12043 38082051 83 Linux ###This is my old Jaunty /Home
/dev/sdb7 12044 12105 497983+ 82 Linux swap / Solaris

Disk /dev/sdc: 8168 MB,
Device Boot Start End Blocks Id System ### This is my Usb boot iso
/dev/sdc1 * 1 81821 7977471+ b W95 FAT32

# grub-install -v
grub-install (GNU GRUB 1.97~beta4) ### This is the Grub release

# dpkg-reconfigure grub-pc
sed: warning: failed to get security context of /tmp/grub.Wl60QHwDIs: No data availablesed: warning: failed to get security context of /tmp/grub.Wl60QHwDIs: No data availablesed: warning: failed to get security context of /tmp/grub.Wl60QHwDIs: No data availablesed: warning: failed to get security context of /tmp/grub.Wl60QHwDIs: No data availableReplacing config file /etc/default/grub with new version
sudo
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
grep: /proc/mounts: No such file or directory
Cannot find list of partitions! ### Is this a problem??
done

~$ sudo umount /mnt/dev
~$ sudo umount /mnt

When I reboot the Hdd I get,
"GRUB loading stage1.5."
"Grub loading, please wait..."
Error 15

Once more, the same error, somehow Grub 2 is not taking over the boot procedure. I hope you are able to gleen some pointers from this test. Your perseverance is most appreciated.

Revision history for this message
peter b (b1pete) said :
#5

yes, there is a linux partition sdb1 and, I rely on what you say, that karmic lives on sdb1; however, I did not see on last post (there are on your post other commands that are not conducive to fixing your problem - why were they run ? beats me)

sudo chroot /mnt

command and the previous and subsequent commands shown on

https://help.ubuntu.com/community/Grub2

under - and I quote -

Reinstalling from LiveCD

If you cannot boot from GRUB 2 review the section Boot Problems & Rescue Mode. If a reinstall becomes necessary follow these instructions:

   1. Boot to the 9.10 Karmic LiveCD Desktop.
   2.

      Open a terminal - Applications, Accessories, Terminal.
   3. Determine your normal system partition - (the switch is a lowercase "L")

      sudo fdisk -l
          * If you aren't sure, run

            df -Th. Look for the correct disk size and ext3 or ext4 format.
   4. Mount your normal system partition:
          * Substitute the correct partition: sda1, sdb5, etc.
          * GRUB 2 counts the first drive as "0", but the first partition as "1"

      sudo mount /dev/sdXX /mnt
   5.

      Only if you have a separate boot partition:
          * sdYY is the /boot partition designation (examply sdb3)
          *

            sudo mount /dev/sdYY /mnt/boot
   6. Mount devices:

      sudo mount --bind /dev/ /mnt/dev
   7. Chroot into your normal system device:

      sudo chroot /mnt
   8. Reinstall GRUB 2:
          *

            Substitute the correct device - sda, sdb, etc. Do not specify a partition number.

      sudo grub-install /dev/sdX
   9.

      Verify the install (use the correct device, for example sda. Do not specify a partition): sudo grub-install --recheck /dev/sdX
  10.

      Exit chroot: CTRL-D on keyboard
  11. Unmount devices:

      sudo umount /mnt/dev
          * If you mounted a separate /boot partition:

            sudo umount /mnt/boot
  12. Unmount last device:

      sudo umount /mnt
  13. Reboot.

      reboot

Once the user can boot to a working system, try to determine why the system failed to boot. The following commands may prove useful in locating and/or fixing the problem.

    *

      To refresh the available devices and settings in /boot/grub/grub.cfg
          o

            sudo update-grub
      To look for the bootloader location.
          o

            grub-probe -t device /boot/grub

      To install GRUB 2 to the sdX partition's MBR (sda, sdb, etc.)
          o

            sudo grub-install /dev/sdX
      To recheck the installation. (sda, sdb, etc.)
          o

            sudo grub-install --recheck /dev/sd''X''

- pls follow the above shown directions - this is absolutely necessary to be able to work and act on the INSTALLED karmic, that lives on sdb1 and needs attention; pls do not run any other additional commands. btw, what lives on sdb3 ? that's another linux partition the way I could see.

Revision history for this message
Cushie (redhotwal) said :
#6

Many thanks again for your support, I was following the instructions listed under "Karmic Grub error 15"
Here is the result of my later attempts from the script (Reinstalling from LiveCD) . Still no success.

Tried the additional commands under heading "Dual Boot" and ran grub-install again giving the same results, error 15 as previous.

Do the commands produce the correct replies, I am not certain if they have performed as expected?

Does it appear that the partitioning is suspect? This is my first attempt at ext4.

I am hoping the fins a way forward. I would be prepared to reformat the whole of sdb drive, reinstall MBR 'fixboot' MS bootloader and even use the cd rather than the dvd version?

Is the problem having two drives? I have always been reluctant to share the same drive if I don't have to do so.
I would value your further comments.

~$ sudo fdisk -l
Disk /dev/sda: 360.1 GB,
/dev/sda1 * /NTFS ### MS OS
/dev/sda2 /NTFS ### Data

Disk /dev/sdb: 250.1 GB, s ### Karmic / on second Hdd
Disk identifier: 0x000eccc2
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2439 19591236 83 Linux ### this is correct Karmic / partition
/dev/sdb2 2440 12105 77642145 5 Extended
/dev/sdb3 12106 21033 71714160 83 Linux ### This is spare partition
/dev/sdb5 2440 7302 39062016 83 Linux ### This is spare partition
/dev/sdb6 7303 12043 38082051 83 Linux ### This is /Home
/dev/sdb7 12044 12105 497983+ 82 Linux swap / Solaris

Disk /dev/sdc: 8168 MB, ### this is USB Live DVD
/dev/sdc1 * FAT32

ubuntu@ubuntu:~$ df -Th
Filesystem Type Size Used Avail Use% Mounted on
aufs aufs 494M 140M 329M 30% /
udev tmpfs 1007M 320K 1007M 1% /dev
/dev/sdc1 vfat 7.6G 4.4G 3.3G 58% /cdrom
/dev/loop0
squashfs 1.3G 1.3G 0 100% /rofs
none tmpfs 1007M 1.2M 1006M 1% /dev/shm
tmpfs tmpfs 1007M 20K 1007M 1% /tmp
none tmpfs 1007M 92K 1007M 1% /var/run
none tmpfs 1007M 0 1007M 0% /var/lock
none tmpfs 1007M 0 1007M 0% /lib/init/rw
/dev/sdb6 ext4 36G 19G 16G 54% /media/Home ### Correct /Home
/dev/sdb1 ext4 19G 2.4G 16G 14% /media/74e0961b-daeb-4d0d-bebc-c0e92b24c71a ###Karmic /
/dev/sdb3 ext4 68G 180M 64G 1% /media/Extra
/dev/sdb5 ext4 37G 176M 35G 1% /media/Spare
ubuntu@ubuntu:~$ sudo mount /dev/sdb1 /mnt
ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev
ubuntu@ubuntu:~$ sudo chroot /mnt
root@ubuntu:/# sudo grub-install /dev/sdb
sudo: unable to resolve host ubuntu
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc ### this looks oK to me

Dual-booting, advice in the same article

root@ubuntu:/# sudo apt-get install --reinstall libdebian-installer4
sudo: unable to resolve host ubuntu
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libdebian-installer4
0 upgraded, 1 newly installed, 0 to remove and 19 not upgraded.
Need to get 33.0kB of archives.
After this operation, 102kB of additional disk space will be used.
Get:1 http://gb.archive.ubuntu.com karmic/main libdebian-installer4 0.63ubuntu2 [33.0kB]
Fetched 33.0kB in 0s (103kB/s)
Can not write log, openpty() failed (/dev/pts not mounted?)
Selecting previously deselected package libdebian-installer4.
(Reading database ... 118651 files and directories currently installed.)
Unpacking libdebian-installer4 (from .../libdebian-installer4_0.63ubuntu2_i386.deb) ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up libdebian-installer4 (0.63ubuntu2) ...

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place ### does this look OK
root@ubuntu:/# sudo os-prober
sudo: unable to resolve host ubuntu
grep: /proc/mounts: No such file or directory
Cannot find list of partitions! ###is this important?

root@ubuntu:/# sudo update-grub
sudo: unable to resolve host ubuntu
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
grep: /proc/mounts: No such file or directory
Cannot find list of partitions! ### ditto this
done
root@ubuntu:/# sudo grub-install /dev/sdb
sudo: unable to resolve host ubuntu
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc ### looks OK

~$ sudo umount /mnt/dev
~$ sudo umount /mnt

Revision history for this message
Best peter b (b1pete) said :
#7

couple of things, first, does your win works/performs as you desire ? can you boot into it ? second,

at this stage of development grub2 is still v much a work in progress, however, one thing I can say is that it works v well for me having something like 7 lnux kernels present on my pc's and, I could see that it works v well on my colleagues' pc's that dual boot win xp, the old jaunty and the new karmic.

so, these being said and looking at your sdb partitions, history of those partitions as you mentioned, the history of various commands that were run trying to get karmic working as well as your willingness to 'start with a clean slate' so to speak on sdb hd, I would v much encourage the approach of getting sdb cleaned up of all existing partitions (wipe it clean would be probably best - gparted CD v good at it) and proceed with a new karmic install - very basic is good enough - that is a / and a swap.

ext4 partitions work ok for me - they should not affect grub2.

now, before proceeding, pls make sure that win works/boots cleanly - v important and mandatory before any other steps. two, save to other media any data that you care from sdb hd and advisable from sda as well. three, get hold of a karmic alternate CD; I use only alternate ubuntu CD installs on my PC's because they give me full control of the install process (probably download xxxx.iso file, check and burn to CD). you can use for install purposes also karmic Live CD.

then just pop in the CD created and proceed with the installation. I must draw your attention at the partitioner step during install (be it alternate or Live CD - they differ); if you've done that before then it should be easy, however, if you did not do it before I strongly recommend you get V V familiar with this CRUCIAL step before proceeding further; specifically, the partition creation mode and numbering, boot partition or MBR, etc. there are plenty of howto's around that explain the install process in detail.

I'd recommend, based on my colleagues' experience with dual booting xp and karmic, to just CAREFULLY install karmic to sdb and install grub to MBR that is sda. then we'll see what happens at first boot after kamic install done. just an additional measure of precaution, have a karmic Live CD handy just in case.

Revision history for this message
Cushie (redhotwal) said :
#8

Thanks again Peter, I follow well your suggestions, at present I must boot sda using supergrub disc (due to the grub error) and that OS it is still working OK.

The last point you make may point to the confusion. I have never been asked to indicate the 'where do you require the MBR'. When asked which drive I wish Grub to be installed, I naturally expected this to be the drive containing '/' partition, hence the location of the Boot/Grub config (ex-menu.lst) directories and files, I did not think that it was suggesting that 'Grub' was installed on the MBR (which is sda)! Your last comment suggests that it is the MBR location that it really should request. ( 'on which drive do you require the MBR installed' would be understood)

I guessed that the old MBR instructions (hence reference to stage 1.5) on sda are pointing to previous installations now deleted, and subsequent Grub installs have set up on sdb and are not accessed.

I shall 'fixboot' to get back the sda OS and the rerun the grub-install to sda as you suggest. ( Thereafter a complete sdb clearout!)

Your patience is most appreciated.

Revision history for this message
Cushie (redhotwal) said :
#9

Perfect install, step 8, 'Advanced' 'Install Boot loader' selected sda !
During install 'running grub-install sda'
Updated +restricted extras all in less than an hour.

Thank you so much for getting me back on track., (and the other OS is working fine too)
Kindest Regards.

Revision history for this message
Cushie (redhotwal) said :
#10

Thanks peter b, that solved my question.

Revision history for this message
peter b (b1pete) said :
#11

glad to see that the conversation helped and, most important that YOU have managed to bring the situation under control.

have a good day!