LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   help: best fix for faulty boot sector or ubuntu bootup file(s) (https://www.linuxquestions.org/questions/linux-software-2/help-best-fix-for-faulty-boot-sector-or-ubuntu-bootup-file-s-922511/)

maxreason 01-06-2012 07:54 PM

help: best fix for faulty boot sector or ubuntu bootup file(s)
 
My ubuntu linux computer stopped booting up last night. After futzing around trying to find a hardware problem, I decided to boot into ubunbu from the installation DVD.

That worked, meaning the motherboard, CPU and most everything is working okay. Once ubuntu was running from the DVD, I ran the file browser program (from Places -> Computer as I recall), and was able to see the directories on the 1TB seagate boot drive (and my attached 2TB USB drive), and I accessed a few text files just to make sure that worked.

This makes me guess that either the HDD boot sector or the linux OS somehow got trashed. The boot drive has only one huge partition with ubuntu linux --- so no dual boot issues.

I guess my question is... what are my options to try to get this drive working again?

frankbell 01-06-2012 08:11 PM

I cannot say for sure, but it might be that the MBR needs to be reformatted; that was the case when I had computer that refused to boot.

You can do that with dd; there are instructions here; it must be done carefully. If there's a mistake, an dd takes no prisoners. If you have an old DOS boot disk, you can do it from there with the fdisk /MBR command.

If you do this, you will likely have to reinstall Grub.

Back up any data on the hard drive before trying this.

syg00 01-06-2012 08:12 PM

Is that really Jaunty (9.04 ?).
From the boot DVD do you get an option to boot into disk system ?. If so try that. What does
Quote:

My ubuntu linux computer stopped booting up last night.
mean exactly. Do you see a boot menu, can you make a selection, ...
All black and nothing at all ?.

Should be reasonably easy to fix if it's just a grub error - unfortunately the Ubuntu page I was going to refer to has been taken down. Will update later - see above for similar.

maxreason 01-07-2012 04:04 AM

Quote:

Originally Posted by syg00 (Post 4568470)
Is that really Jaunty (9.04 ?).
From the boot DVD do you get an option to boot into disk system ?. If so try that. What does mean exactly. Do you see a boot menu, can you make a selection, ...
All black and nothing at all ?.

Should be reasonably easy to fix if it's just a grub error - unfortunately the Ubuntu page I was going to refer to has been taken down. Will update later - see above for similar.

The system displays the usual boot screen, then gets to the point where it beeps. Usually a moment after the beep an ubuntu startup screen appears, but now it just prints a single newline and a J character, then nothing further happens. This is version 10.4 of ubuntu.

Is there a way to fix just the master boot record?

frankbell 01-07-2012 08:23 PM

Did you read my post above about how to format the MBR?

maxreason 01-07-2012 10:30 PM

Quote:

Originally Posted by frankbell (Post 4569146)
Did you read my post above about how to format the MBR?

I did. But when I read the webpage you referenced, I still didn't understand how to replace a busted MBR with a working one. Maybe I just don't understand what he's saying in some way, but I don't see it. He's mostly talking about trying to move from a dual boot system to a single boot system... at least I think so.

RudyMartin 01-08-2012 07:30 AM

strange thing two threads with almost the same issue. if its really a corrupted mbr then your only option is to mount the partition using the live dvd, chroot and reinstall grub.

maxreason 01-08-2012 08:06 PM

Quote:

Originally Posted by RudyMartin (Post 4569399)
strange thing two threads with almost the same issue. if its really a corrupted mbr then your only option is to mount the partition using the live dvd, chroot and reinstall grub.

Yes, two slightly different questions about different aspects of the same problem. Sorry if that is confusing.

Here is my question about your suggestion. It appears that the "grub-install" command replaces the MBR. However, it is NOT clear to me whether "grub-install" only repaces the first 446 bytes. Immediately after the first 446 bytes is partition information, so if any more than 446 bytes are written or changed in the "grub-install" process, then my entire filesystem will be destroyed and I'll lose everything.

I have tried to find out whether "grub-install" does this correctly, but so far I haven't been able to find out. I guess I could try it on my new hard drive where I just installed a fresh new ubuntu, but I'm not sure I'd entirely trust that test unless I know for sure what "grub-install" does.

syg00 01-08-2012 09:22 PM

The various boot-loaders (fortunately) are much smarter than the people that write about them on the net. A few exceptions, but (again unfortunately) too few.
(re-)Installation updates the boot code. Only. This is contained in the first 446 bytes, but is not the only occupant. Care is take during the install to maintain flags and disk geometry information that also resides there.
Reinstall of boot-loader code is amongst the safest thing you can do to your system. Can be messed up by the user, but (extremely) rarely by the install itself.

I am yet to be fully convinced this is strictly a stage0 code issue - it may be, and the grub-install will do no damage if done correctly. May fix the issue, may not. Let us know how it goes.
BTW, don't even think of doing the dd command referenced in the link above.

maxreason 01-08-2012 09:40 PM

Quote:

Originally Posted by syg00 (Post 4569836)
The various boot-loaders (fortunately) are much smarter than the people that write about them on the net. A few exceptions, but (again unfortunately) too few.
(re-)Installation updates the boot code. Only. This is contained in the first 446 bytes, but is not the only occupant. Care is take during the install to maintain flags and disk geometry information that also resides there.
Reinstall of boot-loader code is amongst the safest thing you can do to your system. Can be messed up by the user, but (extremely) rarely by the install itself.

I am yet to be fully convinced this is strictly a stage0 code issue - it may be, and the grub-install will do no damage if done correctly. May fix the issue, may not. Let us know how it goes.
BTW, don't even think of doing the dd command referenced in the link above.


Hmmm. And I was just about to try the "dd" command. Okay, I won't.

So I guess you're saying I can safely run "grub-install" to fix the first 446 bytes in the MBR, correct?

As an aside, let me ask something about your "appendix" that says "don't do anything until you make a complete backup". Okay, how do I do that? I have this 1TB drive that won't boot but has everything working just the way I want. Now I have a new 3TB drive that has a fresh new ubuntu on it (both drives are ubuntu 10.4 LTS), but can be completely erased or overwritten because I have put nothing on it yet. Note: I can boot off the ubuntu installation DVD, and at the screen that lets me boot from the DVD, run a memtest, or boot from the hard disk drive, I ***can*** boot up the rest of the way successfully. The filesystem seems intact and everything I've tried seems to work.

So the question is, before I try to fix the MBR on this drive, how do I make that 3TB drive into an identical bootable copy of the 1TB drive in every way EXCEPT changing the partition information on the 3TB drive? Currently both drives have a /boot partition, a /backup partition, a / partition and a swap partition. I suppose even the partition information could change as long as the main/large partition remains nearly 3TB, not 1TB like the old drive. Obvious I want to do this before I try to fix the MBR, just in case something goes wrong. In case it matters, the new 3TB drive may have 4KB sectors, while the old 1TB drive probably has 512 byte sectors.

LATER: I just ran "sudo parted -l /dev/sda" and it printed out the logical/physical sector sizes of my two drives. They are as follows:

1: old 1TB drive with bad MBR: sector size (logical/physical): 512B/512B
2: new 3TB drive with new OS: sector size (logical/physical): 512B/4096B


I'm not sure the significance or rationale for having a smaller "logical sector size" than the "physical sector size", but... that's what it says. I sure hope they're not starting new files part way through existing/allocated physical sectors, but what do I know (just seems unwise).

maxreason 01-09-2012 03:22 AM

Update: I found an application called "boot-repair" and apparently it fixed my MBR. Unfortunately, it fixed my MBR when I had UN-checked both the "repair GRUB" and "restore MBR" options! Yikes! Here is my report about what happened when I ran this very cool little application: http://ubuntuforums.org/showthread.p...2#post11597852

Nonetheless, the drive now boots again, everything appears to still exist on the drive, and everything I tried to execute still worked.

I still figure I should create a backup of this whole drive. Any suggestions on how to do that?


All times are GMT -5. The time now is 04:25 AM.