error: attempt read-write outside of disk `hd0`

My problem

This problem has been plaguing my boot for a while, it happens about half the times I start up my computer.

Grub will load successfully, and wait ten seconds for me to choose which OS to boot into. When I choose ubuntu, I am (4/5 times) confronted with this error:

error: attempt to read or write outside of disk `hd0`.
error: you need to load the kernel first.

Press any key to continue...

or this one:

error: attempt to read or write outside of disk `hd0`.

Press any key to continue...

When it displays the first error, pressing enter will make it go back to the main menu.

But when it is displaying the second error, without you need to load the kernel first, pressing any key will result in loading ubuntu, and a kernel panic.

kernel panic - not syncing

This doesn't happen every time though. If I try enough times, it will work.

Debugging information

$ fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d0b78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    83886079    41942016    7  HPFS/NTFS/exFAT
/dev/sda2        83886080   234440703    75277312    5  Extended
/dev/sda5        83888128   109053951    12582912   83  Linux
/dev/sda6       109056000   234440703    62692352   83  Linux

$ sudo fsck -f /dev/sda5
fsck from util-linux 2.20.1
e2fsck 1.42 (29-Nov-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda5: 207541/786432 files (0.3% non-contiguous), 1389304/3145727 blocks

$ sudo fsck -f /dev/sda6
fsck from util-linux 2.20.1
e2fsck 1.42 (29-Nov-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
ubuntu-home: 194036/3923968 files (0.6% non-contiguous), 11943110/15673088 blocks

boot-info summary from boot-repair: http://paste.ubuntu.com/6886738/

Things I've tried

  • Running sudo update-grub
  • Running sudo grub-install /dev/sda
  • Using boot-repair (more than once). I used the options Purge grub before reinstalling it and Purge kernels then reinstall last kernel. I've also tried Reset extra space after MBR.

I also saw other questions asking around the same thing, but as far as I can tell they all were about getting the grub rescue prompt with this error, rather than after selecting ubuntu.


Solution 1:

It can be a BIOS problem. Your screenshot says:

Alienware M14xR1/M14xR1, BIOS A04

So I think this is the support page of your laptop. If you look under the BIOS sections you will see two available BIOS updates. (One of them (A08) is even marked as "Urgent", but I think it is only urgent for those who installed A07) You can also look at the A07 version of the BIOS under "previous versions", where it says:

Fixes & Enhancements: Modify SATA speed limit to SATA2

(So maybe there is some kind of SATA speed mismatch causing this problem for you, just guessing.)

So I would advise you to update you BIOS to the latest available (A08) and check the results.

Solution 2:

A computer does not operate random, so behavior which looks random is because either the input is different or the hardware is broken. Normally crashes appear random because the state of the computer is seldom the same with all programs running, but at the very early start random behavior is quite rare and are mostly due to hardware problems since there are not so many ways the input can differ with every boot.

The most common hardware problems which can remain undetected and unresolved are memory problems. Hard disk problems are normally being detected and the spots marked. Processor, cache and bus are constantly used by all programs so errors here would render a non-workable system or would only go wrong onces every hour or so, not repeatable at the same spot.

I would start by using a Ubuntu live cd to do a thorough memory test (couple of hours, different patterns) before spending too much time in software solutions. If a memory error pops up you can tell the kernel not to use that part of memory by passing badblock as boot parameter.

btw. The memory test is hidden now a days, see link