LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-06-2012, 07:54 PM   #1
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Rep: Reputation: 17
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?
 
Old 01-06-2012, 08:11 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,342
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
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.
 
Old 01-06-2012, 08:12 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
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.

Last edited by syg00; 01-06-2012 at 08:14 PM. Reason: typo and strikeout
 
Old 01-07-2012, 04:04 AM   #4
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by syg00 View Post
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?

Last edited by maxreason; 01-07-2012 at 04:05 AM.
 
Old 01-07-2012, 08:23 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,342
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
Did you read my post above about how to format the MBR?
 
Old 01-07-2012, 10:30 PM   #6
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by frankbell View Post
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.
 
Old 01-08-2012, 07:30 AM   #7
RudyMartin
Member
 
Registered: Nov 2011
Location: Argentina
Distribution: Slackware, Debian
Posts: 40

Rep: Reputation: Disabled
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.
 
Old 01-08-2012, 08:06 PM   #8
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by RudyMartin View Post
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.
 
Old 01-08-2012, 09:22 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
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.
 
Old 01-08-2012, 09:40 PM   #10
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by syg00 View Post
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).

Last edited by maxreason; 01-08-2012 at 10:18 PM.
 
Old 01-09-2012, 03:22 AM   #11
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit linux mint v20
Posts: 259

Original Poster
Rep: Reputation: 17
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?

Last edited by maxreason; 01-09-2012 at 04:04 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Easy Fix for 'Ubuntu 11.04 Won't Boot After Restart' Issue LXer Syndicated Linux News 0 06-12-2011 10:11 PM
Live ubuntu cd trashes NTFS boot sector mfsc Linux - Desktop 9 05-05-2011 11:21 AM
[SOLVED] tried to do dual-boot in Ubuntu, won't load WinXP. How to fix MBR? kyleryner Linux - Newbie 26 12-03-2010 07:22 AM
Ubuntu freezing at boot on qemulator vhd-how to fix? linus72 Linux - Newbie 0 05-17-2009 08:41 PM
installed Ubuntu, can't boot, grub error 18, can I fix without a floppy drive? raymondvillain Linux - Newbie 8 05-23-2008 08:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration