LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2008, 02:02 PM   #1
Ill-Phil
LQ Newbie
 
Registered: Oct 2008
Location: Switzerland
Distribution: Kubuntu
Posts: 6

Rep: Reputation: 0
GRUB trouble - installing to unbootable logic partition / other options


Hey everyone

I have some difficulties with my current boot/partition setup. To avoid any misunderstandings, I'll describe my (somewhat special) setup first:

I have two SATA HDDs, the first (sda) only contains one primary partition with Windows XP on it and an unchanged MBR, i.e. NTLDR on it. The second (sdb) contains one primary partition with Debian Sid's root filesystem (sdb1), a logical partition with Debian's /home (sdb5), a logical swap (sdb6) and a last logical partition with a fresh install of Ubuntu 8.10 64bit (sdb7).

In order to get GRUB starting by default, I changed the boot preference in the BIOS to try the second HDD first, but that also changed GRUB's numbering scheme: sda is now hd1 and sdb is hd0 - at least before booting. If I start a GRUB prompt in Debian, sdb1 is then hd1 (God knows why).


So, in order not to overwrite the MBR of sdb in any way, I chose not to install GRUB during my Ubuntu installation. Only problem being that this leaves me with an unbootable Ubuntu. At first I just wanted to add an entry to my menu.lst (in sdb1) to load the Ubuntu kernel, but that didn't work at all.
I'm really not an expert when it comes to GRUB, but I think that may be because it cannot boot a logical partition directly (don't kill me if I'm mistaken ).

So I looked up some things about GRUB and figured that somehow chainloading might work, which would even allow me to retain Ubuntu's automatic kernel list. But that means I'd need to install GRUB to the Ubuntu partition without affecting anything else. Unfortunately, both grub-install and grub> setup refused to work.

As you might have guessed, I'm pretty clueless on this matter. Can anyone enlighten me? All help is appreciated.
 
Old 12-11-2008, 02:38 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
welcome to LQ!!

I infer that you are able to boot into Debian (ie that's where you attempted the GRUB install). What I would do is install GRUB on the mbr of the Linux drive, and configure the BIOS to boot from that drive. With GRUB on the Linux drive, you can chainload to the Windows drive. All this allows you to keep the Windows loader in the MBR of the Windows drive.

If you cannot get into any of the installed Linux OSes, you can install GRUB from a live CD.

if GRUB is already installed, then you just need the correct entry for Ubuntu. Assuming that the BIOS has this drive as #1, then the menu.lst entry for Ubuntu will include:
root (hd0,6) ##the location of /boot for Ubuntu
in the kernel line, root=/dev/sda7

If you have to install GRUB from live CD, you need to take into account what the drive numbering WILL BE when the BIOS has the Linux drive as #1. Here's an example: From live CD, the Linux drive is seen as #2 (hd1 to GRUB), but it will be #1 when booted from the BIOS....and the desired /boot is on the first partition.
grub ##opens the GRUB shell
root (hd0,0) ##tells grub that **AFTER REBOOT** it will find /boot on the first partition of the first drive
setup (hd1) ##tells grub to put boot code in the MBR of what is **CURRENTLY** drive #2 (Will be #1 on reboot, but GRUB does not need to know that....)

Regardless of whether you follow all this, you may find the "booting" link--below in my sig--useful.
 
Old 12-11-2008, 03:03 PM   #3
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Huh - I'm not aware that ntldr can be installed to the MBR.

Anyway, to leave ntldr as your first bootloader:

1. Boot from a live CD

2. copy the partition record which has your Linux bootloader - if it's Grub in the MBR:
dd if=/dev/sdb of=grub.img bs=512 count=1

3. make a copy of that in your 'C:\' drive (or whatever MS named the boot drive)

4. edit the MS 'boot.ini' file to put in something like:
C:\grub.img="Linux"

Now ntldr should be able to chain to the Grub bootloader using the file 'grub.img'. Of course every time you update your bootloader you will need to update that file.
 
Old 12-11-2008, 03:07 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The semantics are maybe not 100% clear. The "Windows Boot Code" in the MBR calls NTLDR, which --IIRC-- starts in sector 2 (hence--I assume--the usage of "chainloader +1" when chaining from GRUB)
 
Old 12-11-2008, 03:34 PM   #5
Ill-Phil
LQ Newbie
 
Registered: Oct 2008
Location: Switzerland
Distribution: Kubuntu
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for the quick replies guys.
Quite obviously I failed to exactly describe my problem: Booting either Windows or a Debian kernel works absolutely fine (after I adjusted the GRUB settings to account for my special numbering case). I also have no intention to change anything on the Windows HDD, as I like to keep it in its original state, in case I once majorly screw up when experimenting on my Linux disk (which is why I left the Win code in the MBR and only installed GRUB to the Linux disk).

The current problem I have is getting Ubuntu running. As I mentioned, I tried simply putting the following into my menu.lst:
Code:
title           Ubuntu 8.10
root            (hd0,6)
kernel          /boot/vmlinuz-2.6.27-7-generic root=/dev/sdb7 ro quiet splash
initrd          /boot/initrd.img-2.6.27-7-generic
savedefault
boot
but then GRUB dies with:
Code:
Error 2: Bad file or directory type
Also, when I run
Code:
grub> find /vmlinuz
from a GRUB prompt before booting, it will not return the Ubuntu partition. It's like GRUB cannot really see the partition.

But when I run:
Code:
grub> root (hd0,6)
it returns:
Code:
Filesystem type is ext2fs, partition type 0x83
I tried with the boot flag both set and not set on that partition (probably shows how clueless I actually am ).

To make it even more complex, the GRUB prompt does return the location of vmlinuz in the Ubuntu partition when I run it inside Debian.


I have no idea, could this have anything to do with the fact it's a logical partition?


Btw, my current partition table, in case it's of interest:
Code:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf006f006

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       60800   488375968+   7  HPFS/NTFS

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2fd4ef9e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        8523    68460966   83  Linux
/dev/sdb2            8524       30407   175783230    5  Extended
/dev/sdb5            8524       24206   125973666   83  Linux
/dev/sdb6           24207       24328      979933+  82  Linux swap / Solaris
/dev/sdb7   *       24329       30407    48829536   83  Linux
 
Old 12-11-2008, 04:20 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You're on the right track, but if that new (root) system is ext3, the old Debian grub won't talk to it due to the change in inode size.
Best solution is to boot the Ubuntu CD, choose the (Ubuntu) disk and "boot" (i.e. chroot) into that. Do the grub-install from there. It'll need to go in the MBR. Add your Debian (and 'doze if you want to that) entries to that menu.lst - they won't be found automatically because that is a function of the distro installer, not grub itself.

BTW, grub can boot logical partitions fine - that not the problem.
 
Old 12-11-2008, 06:21 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Just had another thought - if you don't mind re-installing Ubuntu.
Do a mkfs on your Ubuntu partition from Debian. Then re-install using that partition without re-formatting. I don't know if you can do that from the normal install CD - I always use the "alternate" CD so I can do things like this.
You'll now have a partition the Debian grub will talk to.
 
Old 12-12-2008, 02:39 AM   #8
Ill-Phil
LQ Newbie
 
Registered: Oct 2008
Location: Switzerland
Distribution: Kubuntu
Posts: 6

Original Poster
Rep: Reputation: 0
So you're saying that Ubuntu 8.10 is basically too modern for my (older) Debian GRUB to read it properly, because the inode size is (apparently) 256 now and not 128? Pardon my ignorance, but I really don't have a clue about file systems, let alone "inode sizes".

Would there be a way to update my Debian GRUB to read the new format? As I really want to keep Debian as my main system and make use of its handy update-grub scripts, I only installed Ubuntu for the sake of playing around and getting to know it.
If not, would chainloading be an option or does that fail for exactly the same reason?
 
Old 12-12-2008, 03:06 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Yep.

Dunno - grub needs to be patched like Ubuntu did. You can't chainload it unless you did as I suggested in post #7.
 
Old 12-12-2008, 04:20 AM   #10
Ill-Phil
LQ Newbie
 
Registered: Oct 2008
Location: Switzerland
Distribution: Kubuntu
Posts: 6

Original Poster
Rep: Reputation: 0
Ok, thank you very much for clearing this up. You sure are big help.
I think what I'm going to do is install the new Ubuntu GRUB into the MBR and then either chainload Debian or experiment with the configfile method I stumbled upon accidentally.
 
  


Reply

Tags
grub, ubuntu



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble installing Grub jacatone Puppy 5 03-28-2007 07:59 AM
Trouble installing grub rastiazul Linux - Newbie 3 05-15-2006 05:06 PM
Unbootable stops with just short grub on screen TheBrick Linux - Newbie 4 03-16-2006 04:04 AM
Trouble booting new SATA partition with Grub ridensnow23 Linux - Hardware 9 05-29-2005 12:15 PM
Typo with GRUB caused Win98 to be unbootable wapcaplet Linux - Software 7 11-28-2003 08:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:51 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
Open Source Consulting | Domain Registration