LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2011, 12:47 AM   #31
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649

@ENGINEERINGTECH there are many ways to accomplish your goal, you're being given good advice although they're all good solutions. I think that you should examine the different solutions & think of which would be easier for you to understand & carryout.
As to why grub is giving you a hard time it may just be that everything is in a Logical partition.
Keep in mind that you can have upto 4 primary partitions and you have only used 2.
If you create a space between sda1 & sda2 you can get a successful install & recovery all os'es
http://www.bleepingcomputer.com/tuto...52.html#livecd
 
Old 04-23-2011, 01:19 AM   #32
Erik_FL
Member
 
Registered: Sep 2005
Location: Boynton Beach, FL
Distribution: Slackware
Posts: 815

Rep: Reputation: 254Reputation: 254Reputation: 254
I have a few suggestions that should make installing grub easier. First, use the Legacy version of GRUB 0.97. The current GRUB 2 version is quite complicated. Second, create a GRUB boot floppy or CD-ROM to install GRUB.

GRUB has two different things that you "install". The files for GRUB can be placed in any partition, Primary or Logical. The boot sector for GRUB must be "installed" to the Master Boot Record or a Primary partition (not Logical). I recommend creating a Primary partition for the GRUB boot loader and Linux. Then install GRUB (files and boot sector) to the Primary partition.

Your problem with booting Linux is most likely because you are trying to install the GRUB boot sector into a Logical partition. Although you can install the GRUB files to a Logical partition, you then have to install the GRUB boot sector to the MBR. Boot loaders should only be installed into Primary partitions even though GRUB supports some exceptions to that rule.

To install GRUB you first need to make sure that you have the required files. You need a folder called "/boot/grub" containing the GRUB files.

Code:
ex2fs_stage1_5
fat_stage1_5
ffs_stage1_5
jfs_stage1_5
minix_stage1_5
reiserfs_stage1_5
stage1
stage2
stage2_eltorito
ufs2_stage1_5
vstafs_stage1_5
xfs_stage1_5
You only need the "stage1_5" files for the file-system where GRUB is located. It doesn't hurt to just copy all all the files. They are very small.

Create a "menu.lst" file in the "/boot/grub" folder with the correct information to load Linux.

Here's an example "menu.lst" loading Linux from the third Primary partition on the first hard disk.

Code:
default 0
timeout 5

title Linux
root (hd0,2)
kernel /boot/vmlinuz vga=791 root=/dev/sda3 ro vt.default_utf8=0
initrd /boot/initrd.gz
After all the files are present in "/boot/grub" then you can install GRUB (write the boot sector). First, boot GRUB from a floppy or CD and press the "C" key to get into command mode. Or, you can run GRUB from Linux by typing in "grub" at the command prompt in Linux.

Here are the two commands to install GRUB to the third Primary partition of the first hard disk. The GRUB boot block is also written to the third Primary partition.

root (hd0,2)
setup (hd0,2)


The first command "root" says that the GRUB files are located in the third partition. The second command "setup" says where to install the GRUB boot sector.

After installing GRUB you can create a boot sector file to use with "NTLDR" and "BOOT.INI".

dd if=/dev/sda3 of=/tmp/bootsect.lnx bs=512 count=1

You can replace "/tmp/bootsect.lnx" with the path and file name that you want to use for storing the boot sector file.

In your Windows XP "BOOT.INI" file you need to add a menu entry under the "[operating systems]" section.

Code:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP"
C:\BOOTSECT.LNX="Linux"
You must put the boot sector file (for example BOOTSECT.LNX") in the root directory containing the "NTLDR" and "BOOT.INI" files for Windows. You may need to copy the file somewhere else such as a thumb drive if Linux can't write to your NTFS partition.

You can download an ISO image of a Legacy GRUB boot CD from my web site here.

http://personalpages.bellsouth.net/e/r/erikfl/bootcd/

Download the file "bootcd.bin" and rename it to "bootcd.iso". Use CD burning software to write the ISO image to a CD. The CD will boot to a GRUB menu.

First, copy the required GRUB files. You can find them on the CD. Rename the files to lower-case if they do not end up being lower case! You can boot Linux from the CD if you have no other Linux. It is Slackware Linux.

To use the Linux on the CD, log in as root with no password.

Create some mount points and mount both your hard disk and the CD.

For example:

mkdir /mnt/hd
mkdir /mnt/cd
mount /dev/sda3 /mnt/hd
mount /dev/hdc /mnt/cd
mkdir /mnt/hd/boot/grub
cp /mnt/cd/*stage* /mnt/hd/boot/grub
cp /mnt/cd/*STAGE* /mnt/hd/boot/grub
umount /mnt/hd
umount /mnt/cd

You can shut off or restart the computer. Then, boot the CD again and press "C" to get a GRUB command prompt. Set up GRUB.

root (hd0,2)
setup (hd0,2)


GRUB command mode has a lot of useful commands. One that is really helpful is the "find" command.

find /boot/vmlinuz

That will display all the GRUB device names for partitions where the file "/boot/vmlinuz" was found. If you've only got one copy of Linux installed, that should print the device name to use in place of "(hd0,2)" when your Linux is not in the third partition of the first hard disk. You can also type in "root", "kernel" and "initrd" commands to load some Linux not listed in the "menu.lst" file. After typing the commands, use the "boot" command to actually boot the Linux that you loaded.
 
Old 04-23-2011, 02:54 AM   #33
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
that depends on where you actually installed grub itself(as many noted you not posted specific info).
Sorry it's hard to read fdisk output for me just run gparted on linuxlivecd to view actual partition sizes and see if linux partition(if you installed grub on it) out of 128Gb boundary.

Yes you can restore mbr via backup or from windows install disk in recovery console(winXP +) (as i remember fdisk /fixmbr) but restore backup is better as if you made custum tune to mbr it can be wiped to something default.

if you not booted to grub menu (and grub command line (it's more advanced then NTloader and reliable that's why it must be placed at top)) this probably means second stage load failed which have something to do with file placing. As i read GRUB2 manual i noted some info that grub can be installed to usb flash device this could be a good testing platform without harm for you.

If you saw - at disk load time maybe grub bootsector is installed in mbr but can't find second stage files.

Floppy drive never run? Maybe you not put it as boot option in bios? Usually newer bios support device boot option choice via F8 or F9(in some occasions F11) at boot time.

EDIT: if you use debian or ubuntu linux low-level disk operations require root(Admin) access just add "sudo " before command
EDIT2: usefull links installing grub2 on usb flash http://grub.enbug.org/Manual#head-14...5900940adc36ff

Last edited by sunnydrake; 04-23-2011 at 03:22 AM.
 
Old 04-23-2011, 12:33 PM   #34
Engineeringtech
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Original Poster
Rep: Reputation: 0
Erik FL,

Thank you. Very detailed answer! It's going to take me a while to digest all of this. I didn't know Grub couldn't be placed on a logical partition. When I had the SCSI array, I installed Ubuntu 9.04 to a logical partition and it worked fine (until the SCSI hardware failed for unrelated reasons).

JC

Last edited by Engineeringtech; 04-23-2011 at 01:29 PM.
 
Old 04-23-2011, 12:59 PM   #35
Engineeringtech
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sunnydrake View Post
.......

If you saw - at disk load time maybe grub bootsector is installed in mbr but can't find second stage files.

Floppy drive never run? Maybe you not put it as boot option in bios? Usually newer bios support device boot option choice via F8 or F9(in some occasions F11) at boot time.
Thanks for your reply Sunnydrake. If the bootsector WAS installed in the MBR, and couldn't find the second stage files, I have no idea how to fix that. Because of my repeated difficulties with Grub I'm going to give priority to finding an answer which doesn't require me to install Grub to the MBR, and depend on Grub booting all three OS's. I'm tired of resurrecting DOS and Windows, after failed Grub installs to the MBR. However, I'm going to mull over Erik's approach.

The floppy is designated as a boot option. Can you think of any other reason why directing Grub to /dev/fd0 would not work?

I'm pre-occupied with other things this weekend, and won't be able to get back to this till Monday or Tuesday.

Last edited by Engineeringtech; 04-23-2011 at 01:28 PM.
 
Old 04-23-2011, 05:09 PM   #36
Erik_FL
Member
 
Registered: Sep 2005
Location: Boynton Beach, FL
Distribution: Slackware
Posts: 815

Rep: Reputation: 254Reputation: 254Reputation: 254
Quote:
Originally Posted by Engineeringtech View Post
Because of my repeated difficulties with Grub I'm going to give priority to finding an answer which doesn't require me to install Grub to the MBR, and depend on Grub booting all three OS's.
To do that, you need to install GRUB's boot sector into a Primary partition. I recommend using your Linux partition. Then just copy the Linux partition's boot sector into the needed file for Windows and add that file to your "BOOT.INI" menu.

How you install GRUB's boot sector to the Linux partition depends on which version of GRUB you use. For GRUB 2 you have to edit a configuration file. For Legacy GRUB you use the "setup" command to specify where to write the boot sector. Ubuntu will install GRUB 2 by default, and you may have to choose advanced installation options in order to install to a partition boot sector rather than the MBR.

If you prefer to copy the GRUB boot sector to a file with Windows, you can use a program called "DSKPROBE" that comes with the Windows XP Service Pack 2 Support Tools. Open the disk device rather than a drive letter for read-only. Windows doesn't assign drive letters to Linux partitions. Read sector 0 (the MBR) and select the option to view the partition table. Select the Linux partition to display the information. Then click the button to "Go" to the first sector of the Linux partition. Set the display mode back to bytes. You should see "GRUB" somewhere in the ASCII text that is displayed. Use the option to save sectors to a file. It's easier if you save the file as the default extension and rename it after saving it. The file should be 512 bytes (one sector). The Linux "dd" command is a bit easier to use since it's just one command instead of multiple steps.
 
Old 04-23-2011, 05:40 PM   #37
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,869

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
In your post (#25) you indicate that you believe your dd output for the bootsect.lnx file is empty and assume that Ubuntu Grub is not installing to the partition.

In post 29, you indicate that you don't know how to examine the file so that you don't actually know if the command is working.
I have Ubuntu 10.10 installed on a partition on my computer. Ubuntu Grub is on the partition, not the mbr. When I run the dd command suggested in the link I provided, this is the output I get:

Code:
[root@localhost user]# dd if=/dev/sda7 of=bootsect.lnx count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 3.724e-05 s, 13.7 MB/s
To view the file, I use the following which is not really readable but note the last part "GRUB GeomHardDiskRead Error". You should have something very similar which tells you the dd command was successful. If you don't see anything, something went wrong. Have no idea what it would be. If you see something similar to the output below, then you need to copy it to the root of your DOS partition, sda1. If that still doesn't work, you at least know that Grub is on the partition where it should be and the problem lies elsewhere.

[root@localhost user]# cat bootsect.lnx
�c��K������u���t|1�؎м ��d|<�t��R��'t��}��|�tH�A��U�ZRr=��U�u7��t21�D@�D��D�f�\|f�f�`|f�\
�����}��f�ƈd�@f�D��������@�����f�f�`|f �uNf�\|f1�f�4��1�f�t;}7���0����Z�ƻp��1۸�r��`���1��������a�&Z|��}���}�4��}�.�▒��GRUB GeomHard DiskRead Error
����<u��U�

Last edited by yancek; 04-23-2011 at 05:43 PM.
 
Old 04-23-2011, 06:08 PM   #38
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello together,

I think the problem is quite clear. Look at the post #20, in the attachment there is shown that the extended partition on the disk is not a Linux-extended partition (id = 5) but a win98 one (id = f)

You should install Windows XP and Dos on primary partitions and then you are free to create an extended paritition for as many Linux-system as you want.

I can't even understand that it should be possible to create an extended Win98 partition on a 500GB drive.

Also I don't believe that grub can act on an old Windows extended partition.

Do the Following:
partition 1: primary Windwos XP 100GB
partition 2: primary Dos 200MB
partition 3: primary Fat16 for filesharing between Dos and Windows 200MB
partition 4: extended Linux (id = 5) the rest of the disk.
And then create logical partitions for Linux

Markus

Last edited by markush; 04-23-2011 at 06:10 PM.
 
1 members found this post helpful.
Old 04-23-2011, 06:17 PM   #39
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,504

Rep: Reputation: 325Reputation: 325Reputation: 325Reputation: 325
My advice (which probably isn't worth much more than you're paying for it), is to go with the 2nd option offered by Eddy1 in post #21, with grub installed into the mbr.
 
1 members found this post helpful.
Old 04-24-2011, 04:30 AM   #40
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
For further reading I suggest the following link: http://rute.2038bug.com/node22.html....00000000000000

One other point: it is not possible to install Windows on a Linux-extended partition!

Markus
 
1 members found this post helpful.
Old 04-24-2011, 04:52 AM   #41
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
@ markush
That book is always good reading.
Obviosly when I was reading it I really didn't get a real understanding of it.
Now I can actually grasp what it's saying.

Last edited by EDDY1; 04-24-2011 at 04:55 AM.
 
Old 04-24-2011, 05:01 AM   #42
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
a little working demo:
/dev/sdd - my flash stick
i decided to make my flash drive as grub booted device.
first at least one partition must be marked as bootable
Quote:
sunnydrake@main:~$ sudo fdisk -l /dev/sdd

Disk /dev/sdd: 8074 MB, 8074035200 bytes
249 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 15438 * 512 = 7904256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00053385

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 1021 7881068 c W95 FAT32 (LBA)
now put grub on it
Quote:
sunnydrake@main:~$ sudo grub-install /dev/sdd --root-directory=/media/5EF9-F1D1/
Probing devices to guess BIOS drives. This may take a long time.
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Unknown partition table signature
Installing GRUB to /dev/sdd as (hd2)...
Unknown partition table signature
Installation finished. No error reported.
This is the contents of the device map /media/5EF9-F1D1//boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdd
okay virtually we have grub now it's time to check it.
sudo dd if=/dev/sdd bs=512 count=2
so if we see grub messages in garbage it's in mbr!
next stage how to try it without reboot qemu - like vmware or virtualpc for W$ users
sudo qemu -hda /dev/sdd
and here we got grub with command line boot but i'd like to find actual partitions to boot so ill add
my raid hdd to qemu
sudo qemu -hda /dev/sdd -hdb /dev/mapper/nvidia_behfbfea
we can use "uuid" to view drives (or you can use find /boot/grub/stage1 to find grub'ed partitions)
note find in grub takes exactly filename with full path and wihout wildcards
my flash is (hd0,0) my linux / is (hd1,0)
we set boot to: root (hd1,0)
add kernel&initrd options(on your system filenames can be different mine is ubuntu):
kernel /vmlinuz
initrd /initrd.img
and :
boot
of course this reqire a little more tweaks to be usable but it explains process

Last edited by sunnydrake; 04-24-2011 at 05:13 AM.
 
1 members found this post helpful.
Old 04-25-2011, 10:04 AM   #43
Engineeringtech
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Original Poster
Rep: Reputation: 0
Erik_FL, Sunnydrake, and others.......

Thanks to everyone. I'm OK on the copying of blocks to files using the Linux command "DD". Have done it a dozen or more times, after each Linux installation or re-installation of Grub. But the file is always empty! At least when I view it with a text editor from DOS. That's why I don't think Grub is depositing a bootsector. (I don't know how to examine the bootsector without DD'ing the block into a file and examining it with a text editor.

I think it was Sunnydrake who first suggested to me that Linux could not put the Grub bootsector on an extended (logical) partition. Maybe that is the reason. (Some others, here and elsewhere have suggested otherwise however.) At any rate, I'm getting a lot of advice in the forum, and having a lot of trouble digesting it all. Plus I've been having health problems and working OT to boot, so I have had no time in front of the target machine to try anything. I don't even have a printer to print out this stuff. So please bear with me for a few days everyone.

Thanks again!

oops... forgot. I created all my partitions with a partitioning tool (Partition Commander 11 Pro). I don't know what the difference is between a Windows and Linux extended partition. All I know is DOS installed just fine to my primary partition, and Windows installed just fine to the first logical partition of my extended partition. This is all standard stuff for the installation of Microsoft OS's running from DOS to Windows 98.

Last edited by Engineeringtech; 04-25-2011 at 10:09 AM.
 
Old 04-25-2011, 02:46 PM   #44
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,869

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
I don't know how to examine the bootsector without DD'ing the block into a file and examining it with a text editor.
See the bottom of post 37. The output doesn't mean anything to me except the Grub part at the end but, it does show there is output. Use the cat command from your Ubuntu CD instead of a DOS text editor. It's an option and I don't really know if it will make any difference but it isn't going to hurt anything.

Quote:
I think it was Sunnydrake who first suggested to me that Linux could not put the Grub bootsector on an extended (logical) partition.
Not sure what he meant by that? There should be no problem booting Linux from a logical partition with Grub in the mbr. I have several distributions with which I do that. I've also booted Linux on a logical partition using the windows 7 bootloader.

I'd suggest using the cat command from your Ubuntu CD to see if you get output, if you do and you copy it to the root (C:\) of your DOS partition and it still doesn't work, it's some other problem.
 
Old 04-25-2011, 02:49 PM   #45
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello,

Linux has no problems with logical partitions, but they have to be Linux partitions. As I wrote, this will never work with a Win98-logical parition.

Markus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: How to Triple-Boot Your Mac with Windows and Linux, No Boot Camp Required LXer Syndicated Linux News 0 05-05-2010 10:30 AM
Installing goblinX in triple boot laptop... no boot in the other linux OS amalgam Linux - Newbie 2 02-14-2008 02:08 PM
Trying to triple boot 3 Linux OSes gnumantsc Linux - Newbie 2 09-27-2004 07:22 PM
Linux with triple boot hsani Linux - General 4 04-15-2004 09:34 AM
How to triple-boot...two linux and one XP cbjhawks Linux - General 4 01-20-2004 07:31 PM


All times are GMT -5. The time now is 09:56 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration