I have an old system with P4 processor, 1.12gb ram, 40 gb hdd (of which maybe 10 gb is in bad sectors) which was running Windows XP. I wanted to experiment with it. So, I installed Ubuntu 13.04 on it and completely removed windows xp. According to the page of Ubuntu, I gather it must be able to work perfectly well.

It installed without problems. When I try to boot the pc, I get an error like this

error:attempt to read or write outside of disk hd0
grub rescue>

Please help. I am a complete beginner with Ubuntu. Thanks in advance!

Dani AI

Generated

Quick summary and practical plan. The grub message shown by @mishwar ("error: attempt to read or write outside of disk hd0 / grub rescue>") most often means GRUB cannot read the disk areas it needs — this can be caused by physical disk failure, a corrupted partition table/MBR, or an incomplete GRUB install. @Rik and are correct that the disk health is central; and rightly pointed at reinstall/boot-media fixes. The next steps below prioritize safe diagnosis, non‑destructive checks, and then controlled repair actions.

Check disk health and partition table (non‑destructive)
Boot a live environment and run a S.M.A.R.T. check to see whether the drive reports reallocated or pending sectors and to run a short self‑test:

sudo apt-get update
sudo apt-get install smartmontools
sudo smartctl -H /dev/sda
sudo smartctl -A /dev/sda | egrep -i 'reallocated|pending|offline'
sudo smartctl -t short /dev/sda
sudo smartctl -l selftest /dev/sda

If S.M.A.R.T. shows clear failures, replacement is the safest option. If it looks OK, inspect the partition table and try a conservative recovery with TestDisk (interactive) or fdisk -l to confirm partitions.

Repair GRUB from a live environment (when disk hardware looks usable)
Mount the real root partition, bind /dev,/proc,/sys, chroot and reinstall GRUB. Replace /dev/sdaX with the actual root partition and /dev/sda with the disk device:

sudo mount /dev/sdaX /mnt

for d in /dev /dev/pts /proc /sys; do sudo mount --bind $d /mnt$d; done
sudo chroot /mnt
grub-install /dev/sda
update-grub
exit

for d in /dev/pts /dev /proc /sys; do sudo umount /mnt$d; done
sudo umount /mnt

If the system boots but the desktop is blank after login (later in this thread), check session and X logs, disk space and file ownership from a tty (Ctrl+Alt+F1). Typical checks: df -h, recent lines of ~/.xsession-errors or /var/log/Xorg.0.log, and ownership of ~/.Xauthority. Restarting the display manager or reinstalling the desktop packages is a pragmatic next step if logs show desktop/WM failures.

If hardware proves unreliable, keep frequent backups and treat the drive as degraded. The safest long‑term fix for repeated bad sectors is disk replacement; the diagnostic steps above reveal whether recovery is feasible first.

Recommended Answers

All 7 Replies

Sounds like a partitioning problem...
I googled your error message and someone said that this solved their problem.

The bad sectors is most likely to be the cause. You need to replace that hard drive.

I'll try @Assembly GUy's link. @Rik from RCE, its an old system which I wont be working on regularly. So, replacing the hard drive is not my option. I guess I'll figure out the instructions in the link and try to get Ubuntu running.

try reinstalling again. And this time wait for it to fully install.

I reinstalled the OS this time with a partition of 10 gb and finally got Ubuntu running. After I login with my password which I set during the installation, the screen is totally blank with only the background and on right clicking I get several options like new folder and new document etc... So, I googled and found this link. I will try the steps there.

If you don't replace the drive, you first need to boot into a live cd/dvd/usb device and run the badblocks command on the first sectors of the disc. If the boot sector (first sector on disc) is bad, then you will have to replace the drive. If not, then format the drive and create your file systems with the live system, and then run "fsck -c" on the file system partitions, such as "fsck -c /dev/sda1". This will scan the file system on that partition for bad blocks, and map them out of use. Finally, you will be able to install the operating system, telling it which partitions to use - DON'T let it auto-partition the drive for you again. Usually you will create 3 partitions, 1 for /boot, 1 for swap, and 1 for /. You can use just two if you want /boot to reside directly in /, 1 for / and 1 for swap. I think Ubuntu usually does the latter (2 partitions), whereas Fedora and RHEL do the former (3 partitions).

this time get a pen drive. then install ubuntu on it make it bootable. then install ubuntu from it. i think there iş a problem with the Cd youve got. İ had the same problem and thats what i did and it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.