SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 04:47 AM
DDave65
 
Posts: n/a
Default Bizarre Problem with GRUB

OK,
I'm having an issue and its driving me crazy. I have an external USB
drive. It is set up to dual boot into both extlinux and BartPE (pseudo-
Windows). I use GRUB as the bootloader to chain load the bootloaders
for each of the individual OSes. I make multiples of these drives to
run various systems and install software. Everything was working just
fine until last week. My supplier for these external USB drives
suddenly changed the drive inside from a PATA drive to a SATA drive.
Now, the BartPE side fails to boot. It gives me the error, "NTLDR not
found." Now, I know that's a Windows error and I posted a similar post
in a couple of Windows groups. The reason I'm posting here is that
I've narrowed it down to GRUB. I created a drive with JUST the BartPE
partition and it boots fine up until I install GRUB. I am installing
GRUB into the MBR. I am also installing it after the Windows partition
is in place.

I have booted into grub and entered the command-line, and did a "find /
ntldr" it found the file on (hd0,0) as I expected.

I know there are issues with GRUB and a combination of SATA drives and
PATA drives, but, the systems I'm currently booting don't have any
internal drives, just the external USB. And besides, it's a USB 2.0
drive. Its internal interface should be converting SATA messages to
USB and vice-versa. (right?)

I feel like, when I install GRUB, after the Windows partition is in
place, I'm over-writing the MBR that's there and, for some reason, it
no longer knows where to find ntldr. BUT, if that's the case, why did
it work with the internal PATA drives?

If anybody has any ideas, I would certainly welcome them. I'm at a
dead-end at the moment.

Respectfully,
Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-22-2008, 04:47 PM
Douglas Mayne
 
Posts: n/a
Default Re: Bizarre Problem with GRUB

On Thu, 21 Feb 2008 14:35:59 -0800, DDave65 wrote:

> OK,
> I'm having an issue and its driving me crazy. I have an external USB
> drive. It is set up to dual boot into both extlinux and BartPE (pseudo-
> Windows). I use GRUB as the bootloader to chain load the bootloaders
> for each of the individual OSes. I make multiples of these drives to
> run various systems and install software. Everything was working just
> fine until last week. My supplier for these external USB drives
> suddenly changed the drive inside from a PATA drive to a SATA drive.
> Now, the BartPE side fails to boot. It gives me the error, "NTLDR not
> found." Now, I know that's a Windows error and I posted a similar post
> in a couple of Windows groups. The reason I'm posting here is that
> I've narrowed it down to GRUB. I created a drive with JUST the BartPE
> partition and it boots fine up until I install GRUB. I am installing
> GRUB into the MBR. I am also installing it after the Windows partition
> is in place.
>
> I have booted into grub and entered the command-line, and did a "find /
> ntldr" it found the file on (hd0,0) as I expected.
>
> I know there are issues with GRUB and a combination of SATA drives and
> PATA drives, but, the systems I'm currently booting don't have any
> internal drives, just the external USB. And besides, it's a USB 2.0
> drive. Its internal interface should be converting SATA messages to
> USB and vice-versa. (right?)
>
> I feel like, when I install GRUB, after the Windows partition is in
> place, I'm over-writing the MBR that's there and, for some reason, it
> no longer knows where to find ntldr. BUT, if that's the case, why did
> it work with the internal PATA drives?
>
> If anybody has any ideas, I would certainly welcome them. I'm at a
> dead-end at the moment.
>
> Respectfully,
> Dave
>

Just to clarify what you are doing, let me ask you this:
Are you working with exact images which are "dd" onto the drive?

Perhaps, you have setup the drives using commands similar to these:

dd if=mbr.img of=/dev/sda
dd if=bartpe.img of=/dev/sda1
dd if=linux.img of=/dev/sda2

WAG...
If you are using the above method, then you should be aware that there
can be problems, mostly with the loader and complaints about the
partition tables and specific partitions not ending on a cylinder
boundary. The images that you have rolled out in this way are
not corrupt because the image is written correctly using only LBA mode
addressing, and is therefore consistent in spite of any old-style
addressing problems (C,H,S) and complaints. This could be caused by the
old disk using 256 heads, but your new disk specifies 16 heads. 256 is a
multiple of 16, so your actual partition size (in sectors) may not run
into the cylinder boundary problem (by sheer luck). In the general case
it is likely to be wrong and the "partition does not end on a cylinder
boundary" error is likely to be present.

BTW, if you have rolled out the entire disk as an image, say using one
large image, such as:

dd if=entire_disk.img of=/dev/sda

then you most likely would have had non-readable partitions at sda1 and
sda2. The start sector would be moved and the magic numbers would not be
correctly located. Again, there are more ways to do it wrong, than ways to
do it right.

You could possibly fix the loader and make sure your partition table is
correct (in sectors, I guess). If I were you, I would either redo the
images or not install a boot loader on these disks at all. You could
install the grub loader on either a cd or a bootable flash stick, for
example. If you expect others to use these disks, you'd probably be better
off fixing your images to match. There are surely other methods which
work, too.

--
Douglas Mayne
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 05:03 PM
DDave65
 
Posts: n/a
Default Re: Bizarre Problem with GRUB


> Are you working with exact images which are "dd" onto the drive?


No, I create each partition separately for the original drive, then
use an Open Source product called CloneZilla to clone the original
drive. The reason for this was that CloneZilla only copies used
sectors. The drive is 160GB, and the BartPE partition is 149GB of that
(with 70 GB actually used). A "dd" of that partition alone, across a
USB 2.0 bus, was taking 8-10 hours. CloneZilla does the whole drive in
55 minutes.

> You could possibly fix the loader and make sure your partition table is
> correct (in sectors, I guess). If I were you, I would either redo the
> images or not install a boot loader on these disks at all. You could
> install the grub loader on either a cd or a bootable flash stick, for
> example. If you expect others to use these disks, you'd probably be better
> off fixing your images to match. There are surely other methods which
> work, too.


I actually re-did the entire drive from scratch, checked the boot
loader and partitions, and I still have the issue. If I don't install
GRUB, the BartPE partition boots as the default, and it boots just as
expected. No problems. If I install GRUB, I can select the Linux
Partition, and it boots just as expected. However, after the GRUB
install, if I select the BartPE partition, it gives me the dreaded
"NTLDR not found" error, which can have a multitude of causes. I
booted directly into GRUB's command line and did a "find" for the
NTLDR file, and it found it on the correct drive and partition. The
"hand-off" between the two isn't occurring correctly. So, I've
narrowed it down to a GRUB issue on this new drive. I've seen some
chatter on various forums indicating that GRUB does a reset of the USB
bus in the middle of its stages, and this may be (but shouldn't be)
causing an issue. I have to admit ignorance of GRUB in how it goes
through its stage files.

Unfortunately, I can't put the bootloader on different media. I hand
off these drives to technicians to perform specific installs and
troubleshooting. The requirement from their end was that it be a
single drive. And, I had that solved for almost a year, until the
vendor delivered these new drives. Now, I've got the techs asking
where their new drives are, because they're about to do a big rollout
next week. So.....I'll continue onward.

Thanks for the help, though.
v/r,
Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 02:08 PM
Douglas Mayne
 
Posts: n/a
Default Re: Bizarre Problem with GRUB

On Wed, 27 Feb 2008 08:38:27 -0800, DDave65 wrote:

>
>> Are you working with exact images which are "dd" onto the drive?

>
> No, I create each partition separately for the original drive, then
> use an Open Source product called CloneZilla to clone the original
> drive. The reason for this was that CloneZilla only copies used
> sectors. The drive is 160GB, and the BartPE partition is 149GB of that
> (with 70 GB actually used). A "dd" of that partition alone, across a
> USB 2.0 bus, was taking 8-10 hours. CloneZilla does the whole drive in
> 55 minutes.
>

I haven't used CloneZilla, but another tool to consider using is
ntfsclone. I have used it to backup/restore partitions which are
formatted using NTFS. This does not attempt to get information about the
entire disk- just individual partitions.

Here is a command sequence which saves a partition in "special format"
# ntfsclone -s -o ~/sda1.sf.img /dev/sda1

Or use a compression stage to save space:
# ntfsclone -s -o - /dev/sda1 | gzip >~/sda1.sf.img.gz

Here is a command sequence which restores a "special format" image:

# ntfsclone -r -O /dev/sda1 ~/sda1.sf.img


Similarly, for an image which uses compression:

# cat ~/sda1.sf.img.gz | gzip -cd | ntfsclone -r -O /dev/sda1 -

Then this fixup may be required:

# ntfsresize /dev/sda1

The last command is necessary if the "volume size" of the saved image
is smaller than the target partition. It enlarges to final volume to
match the underlying partition size.
>
>> You could possibly fix the loader and make sure your partition table is
>> correct (in sectors, I guess). If I were you, I would either redo the
>> images or not install a boot loader on these disks at all. You could
>> install the grub loader on either a cd or a bootable flash stick, for
>> example. If you expect others to use these disks, you'd probably be
>> better off fixing your images to match. There are surely other methods
>> which work, too.

>
> I actually re-did the entire drive from scratch, checked the boot loader
> and partitions, and I still have the issue. If I don't install GRUB, the
> BartPE partition boots as the default, and it boots just as expected.
> No problems. If I install GRUB, I can select the Linux Partition, and it
> boots just as expected. However, after the GRUB install, if I select the
> BartPE partition, it gives me the dreaded "NTLDR not found" error, which
> can have a multitude of causes. I booted directly into GRUB's command
> line and did a "find" for the NTLDR file, and it found it on the correct
> drive and partition. The "hand-off" between the two isn't occurring
> correctly. So, I've narrowed it down to a GRUB issue on this new drive.
> I've seen some chatter on various forums indicating that GRUB does a
> reset of the USB bus in the middle of its stages, and this may be (but
> shouldn't be) causing an issue. I have to admit ignorance of GRUB in how
> it goes through its stage files.
>
> Unfortunately, I can't put the bootloader on different media. I hand off
> these drives to technicians to perform specific installs and
> troubleshooting. The requirement from their end was that it be a single
> drive. And, I had that solved for almost a year, until the vendor
> delivered these new drives. Now, I've got the techs asking where their
> new drives are, because they're about to do a big rollout next week.
> So.....I'll continue onward.
>
> Thanks for the help, though.
> v/r,
> Dave
>

I wouldn't be surprised if CloneZilla is part of the problem you are
having, but I could be wrong. IMO, working with individual partition
images is the way to go. Once you have restored each partition image
separately, then the last step is to fixup the grub loader. This
approach will automatically fixup various mismatches, which I alluded
to in my initial post. IMO, the hard-disk-upgrade mini howto is a good
starting point to begin learning about disk images.

Just for comparison, here are the steps I would follow to do something
similar..

Sequence:
0. Connect target USB device.
1. Use fdisk to setup the target partition layout. BartPE on partition 1,
I think.

2. Preformat linux partitions with the file system of your choice. IIRC,
avoid using ReiserFS. Primarily, I use XFS. It has some neat resize
features, etc.

3. Restore images.
3.a. For NTFS partitions, use ntfsclone. Example shown above.
3.b. For Linux partitions, use tar (tgz archives). Perhaps, using this
sequence:

cat sda2.tgz | gzip -cd | (cd /mnt/sda2 && tar -xvf - --numeric-owner)

4. Fix grub loader.

# grub --no-floppy
grub> geometry (hd1)
grub> root (hd1,1)
grub> setup (hd1)
grub> quit

Note: use geometry (or some other method) to verify how grub has "counted"
your usb disk. "Hit" the proper target.

5. Shutdown and test reboot with usb.

Disclaimers:
1. I hope I didn't make any blatant mistakes. Check my commands carefully
before using them.
2. There are also many assumptions built in to this explanation. Be sure
of any commands you use are appropriate for your system.
3. Understand what you are doing and the underlying principles (hardware,
software, nomenclature, etc.)
4.Practice using the tools which you have selected until you are
comfortable using them.

--
Douglas Mayne
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:52 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85