LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Error: attempt to read or write outside of disk 'hd0' (https://www.linuxquestions.org/questions/ubuntu-63/error-attempt-to-read-or-write-outside-of-disk-hd0-4175482243/)

Penpusher 10-26-2013 04:11 AM

Error: attempt to read or write outside of disk 'hd0'
 
Hi there, can you help?

I installed an update on by laptop last night and it asked me to restart so that the update could take place. On doing so I got the above message and the prompt "grub rescue>".

Ubuntu was installed on the laptop by a friend of my son when he was visiting us in Wales after our Windows drive crashed. I have absolutely no idea what he did and it is enough for me to turn the machine on everyday. What I am getting at is that unless the help comes in the form of "type this prompt" and then the prompt rather than assuming I know any programming language (which of course I don't) I will not have a clue. Sorry to be so pathetic. Can anyone help?

business_kid 10-26-2013 04:52 AM

Windows probably did a 'fdisk c: /mbr' on the disk, overwriting the master boot record

/cure
Provoke grub into reinstalling the mbr. I hesitate to be dogmatic but I think it's
grub setup (hd0)
where (hd0) is your disk location in grub speak. If not, info grub.

/prevention
The above is a Royal PITA. For these cases, I am inclined to run
dd if=/dev/sda of=/boot/sdambr bs=512 count=1
dd if=/dev/sda1 of=/boot/sdambr1 bs=512 count=1

and have these undocumented backups lying there ready for the next time windows pulls that stunt.

Penpusher 10-26-2013 05:02 AM

Thanks businesskid you do realise of course I have no idea what you are referring to. I know absolutely no programming language so what you have said is gobbledygook. :o
What do I need to type in?

I typed in /cure, /prevention and the message is 'Unknown command'
I typed in both "dd if=/dev/sda etc" and they came back as Unknown commaand 'dd' and Unknown command 'if=/dev/sda'
I'm obviously missing something if what you said should work. Any clues?

yancek 10-26-2013 09:19 AM

Boot your Ubuntu CD, wait until you are connected to the internet, go to the website at the link below and review the page. Open a terminal windows on your computer by holding down the Ctrl+Alt+t keys simultaneously. On the site below, go to the section 2nd Option and copy and paste the first line beginning with 'sudo' (grey box) in your terminal and hit the Enter key. After that completes, repeat the process for the second line. When that completes, scroll down to using Boot-Repair at the site below and follow the instructions. This will download and install the Boot-Repair software and you should be able to repair your bootloader. If this fails, make not of any messages you see on screen and post back.

https://help.ubuntu.com/community/Boot-Repair

Penpusher 10-26-2013 10:12 AM

Thanks yancek. One problem though I don't have a copy of the Ubuntu CD my son's friend downloaded an on-line copy (my bad?). Is there anything I can do from the prompt "grub rescue>". Incidentally, in layman's terms what is grub?

Penpusher 10-26-2013 10:29 AM

I followed your link and eventually got to someone who had the same problem. It was suggested to them that they type "ls /" which I did and this is what I got:
Quote:

Originally Posted by Penpusher (Post 5052719)
./ ../ lost+found/ etc/ media/ var/ bin/ boot/ dev/ home/ lib/ mnt/ opt/ proc/ root/ run/ sbin/ selinux/ srv/ sys/ tmp/ usr/ initrd.img initrd.img.old vmlinuz cdrom/ vmlinuz.old
grub rescue>

I don't understand what any of it means though but I'm posting it in case it offers any clue to the problem.

widget 10-26-2013 12:43 PM

Do you now have a working Live CD?

yancek 10-26-2013 11:44 PM

Quote:

Incidentally, in layman's terms what is grub?
GRand Unified Bootloader. A bootloader is needed and used by all operating systems to start the system.

You obviously have access to a computer. You could download and burn Ubuntu to a CD and boot it.

Penpusher 10-27-2013 07:13 AM

Yes I do have a CD, I've tried loading it in but I get the same message

yancek 10-27-2013 10:07 AM

Quote:

Yes I do have a CD, I've tried loading it in but I get the same message
You would have to change the boot priority in the BIOS to boot first from the CD drive if you are still getting the Grub prompt. When you boot the computer, you should see a message at the bottom of the screen for 3-5 seconds indicating which key you need to press to enter setup or the BIOS. When you do that, you should see a screen with several options and one should be Boot. Use the arrow keys on your keyboard to highlight boot, hit the enter key and your should see more options. The key varies, depending upon who the manufacturer of the system is.

business_kid 10-27-2013 11:34 AM

Sorry, I didn't lay my answer out very well. Let me try again. If you think you want to, try the suggested commands in boxes. The /cure and /prevention were for you, not for the pc :-/.

/cure
Provoke grub into reinstalling the mbr. I hesitate to be dogmatic but I think it's
Quote:

grub setup (hd0)
where (hd0) is your disk location in grub speak. If not, read the info grub page.
Quote:

info grub
/prevention
The above is a Royal PITA. For these cases, once things are right, I am inclined to run
Quote:

dd if=/dev/sda of=/boot/sdambr bs=512 count=1
dd if=/dev/sda1 of=/boot/sdambr1 bs=512 count=1
These commands back up your master boot record(sdambr) and the first partition (sdambr1).
Keep these undocumented backups lying there ready for the next time windows pulls that stunt.

Penpusher 10-28-2013 05:47 AM

Thanks again businesskid. I typed in "grub setup (hd0)" as suggested and it came back as Unknown command 'grub'. The other command came back as Unknown command 'info'. :-(

Penpusher 10-28-2013 06:01 AM

Yancek, first the good news! I booted the Ubuntu CD and when it asked whether I wanted to "Try" or "Install" Ubuntu I went for "Try" as I had some files on the PC and I didn't want to lose them. Next the bad news, I checked the files I had and they have all gone. Is there anyway I can recover them? If not is there anyway I can prevent this from happening again otherwise the PC is useless if I can't rely on the machine to keep safe files from one day to the next? I fee like it's 1 step forward and 2 back, urrgggh!

yancek 10-28-2013 09:36 AM

I'm not really sure what you did. If you booted the Ubuntu CD and created files on it and rebooted, they will be gone as the Live CD is read-only. Nothing is saved on reboot. If you are referring to files/directories you had on the computer with the installed Ubuntu previously, that is another matter.

Boot the Ubuntu CD, open a terminal by holding down the Ctrl+Alt+t keys simultaneously. Type in: sudo fdisk -l(Lower Case Letter L in the command) and post the output here. That should provide information on your drives/partitions so if you still have partitions on the drive they will show any someone will then be able to explain how you can mount the filesystems to access the data.

Penpusher 10-28-2013 10:13 AM

Yes Yancek I had already had Ubuntu before and it was on this that I had the files. As regards the CD when I turned on the machine I pressed F12 which took me to the Boot Option Menu. Of the 3 options 1) IDE 0: WDC WD3200BEVT-22ZCT0, 2) IDE 1: Slimtype DVD A DS8A4SH and 3) Network Boot: Atheros Boot Agent I chose option 2, simply because it said DVD and I didn't know what the others stood for.

After a few minutes the Ubuntu "Welcome" screen came up. As I said before rather than re-installing Ubuntu I pressed "Try Ubuntu".

When the main screen came up I typed the command you suggested and got this prompt: ubuntu@ubuntu:~$
I then typed in the command and got:
Quote:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x0007e3e6

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 616896511 308447232 83 Linux
/dev/sda2 616898558 625141759 4121601 5 Extended
/dev/sda5 616898560 625141759 4121600 82 Linux swap / Solaris
Obviously this means nothing to me so I need to ask.
Should I be re-installing ubuntu rather than pressing "Try"
If I do install will I see the files on my original copy.
I'm assuming not as I'm sure it will over-right the lot so...
If I can't get the files back will re-installing the disk mean that I don't have to keep going through the same rigmarole to start up.

Sorry to take up so much of your time. I just didn't realise it would be so complicated.


All times are GMT -5. The time now is 09:36 PM.