Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Need Help With Chainloading


  • Please log in to reply
6 replies to this topic

#1 tb75252

tb75252

  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:07:08 AM

Posted 03 September 2011 - 08:47 PM

I have a desktop with Ubuntu 11.04 (32-bit) installed.
When I installed Ubuntu, I put its boot loader (GRUB 2) in the MBR. Ubuntu itself is installed in /dev/sda1 (root) and /dev/sda/5.

I have recently also installed Slackware 13.37. I put its boot loader (LILO) in the same partition where Slackware's root resides, i.e. /dev/sda3. The other partition used by Slackware is /dev/sda7 (/home).

Now I would like to insert a chainloader command in GRUB 2 so that I can start Slackware from its menu.

Here's what I've done (which obviously does not work!):

1) I inserted the following entries in file /etc/grub.d/40_custom (as root):

menuentry "Slackware" {
        set root=(hd0,3)
        chainloader (hd0,3)+1
}

2) I ran the following command (as root):
grub-mkconfig -o /boot/grub/grub.cfg 

The error that I get when I select "Slackware" from the GRUB 2 menu is "No such partition". Of course, I am 100% sure that Slackware's root (and LILO) reside on /dev/sda3!

So, how do I chainload this correctly? Please note that Ubuntu 11.04 uses GRUB 2, not GRUB legay!

BC AdBot (Login to Remove)

 


#2 stiltskin

stiltskin

  • Members
  • 238 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Western MO
  • Local time:07:08 AM

Posted 04 September 2011 - 08:40 AM

Try changing this:

set root=(hd0,3)
chainloader (hd0,3)+1


to this:

set root=(hd0,2)
chainloader (hd0,2)+1


I think that will do it, anyway. I haven't played with grub since it was new, and never did touch grub2.

Grub counts the first drive as 0, and the first partition of that drive is also 0. So /dev/sda3 = (hd0,2).

#3 pane-free

pane-free

  • Members
  • 117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Between the Mtns N of the Big River
  • Local time:05:08 AM

Posted 04 September 2011 - 11:57 AM

Should what stiltskin recommends not work, try eliminating the (0.2) from the chainloader line,
so that it reads

title Slackware
root noverify (0,2)
chainloader +1


EDIT -- Looked this up as the above is Legacy, I believe --

SOURCE:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

menuentry "System Rescue CD" {
set root=(hd0,10)
linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
initrd /sysrcd/initram.igz
}

Edited by pane-free, 04 September 2011 - 12:16 PM.

There comes a time in the affairs of man when he must take the bull by the tail and face the situation.
W. C. Fields

#4 tb75252

tb75252
  • Topic Starter

  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:07:08 AM

Posted 08 September 2011 - 03:39 PM

Well, so far I have not had any success...

To recap: I have been trying to find a way to insert a chainloader command in GRUB 2 custom file (called "40_custom" and available in the /etc/grub.d subdirectory of Ubuntu). The idea is to boot up the computer, GRUB 2 is diplayed, I get to choose whether I want to start up Ubuntu or Slackware. If I choose to start up Slackware, then GRUB 2 would invoke LILO and LILO would start up Slackware.

I have a desktop PC with two Linux distributions installed: Ubuntu 11.04 and Slackware 13.37. Both are 32-bit.

A few pieces of information:
* Ubuntu is installed on partitions /dev/sda1 (root) and /dev/sda5.
* Slackware is installed on partitions /dev/sda3 (root) and /dev/sda7.
* The boot loader installed is GRUB 2 (Ubuntu) and it is installed in the MBR of the hard drive (/dev/sda).
* The boot loader that comes with Slackware (LILO) is installed in the superblock of Slackware's root partition (/dev/sda3).

So far I have not been able to get this done. It is not a problem to start up Ubuntu but I get errors with the chainloading solutions that I have tried for Slackware. Partially because most of the examples that I could find on the Internet pertain to the syntax used in GRUB Legacy (the one that still uses file /boot/grub/menu.lst for customizations).

But I think that I might have a bigger problem to solve... As I said before, LILO is installed on the superblock of partition /dev/sda3. According to the Slackware Linux Essentials book (chapter 7.1) LILO loads only when it is installed on the first drive of the system. However, I am not sure that this means that it has to be installed in /dev/sda1 and that I do not stand a chance to chainload with the present configuration (because it is installed in /dev/sda3).

Anyhow, I really would like to leave GRUB 2 alone in the MBR and also I really do not want to re-install Ubuntu. I am looking for some sort of chainloading solution for Slackware as outlined above.

Does anyone know how to do it?

#5 stiltskin

stiltskin

  • Members
  • 238 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Western MO
  • Local time:07:08 AM

Posted 08 September 2011 - 08:23 PM

Try the first suggestion here. I'm assuming "right permissions" means executable by root.

It looks like grub2 requires the chainloader information in a different location from the older grub.

#6 tb75252

tb75252
  • Topic Starter

  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:07:08 AM

Posted 08 September 2011 - 11:45 PM

Try the first suggestion here. I'm assuming "right permissions" means executable by root.

It looks like grub2 requires the chainloader information in a different location from the older grub.

Thanks for your reply.
Let me make sure that I understand correctly. The entire text that I am quoting below needs to be inserted in file /etc/grub.d/40_custom, right?

#!/bin/bash

echo "Adding OpenIndiana" >&2
cat << EOF
menuentry "OpenIndiana system boot" {
set root=(hd0,2)
chainloader +1
boot
}

EOF

#7 stiltskin

stiltskin

  • Members
  • 238 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Western MO
  • Local time:07:08 AM

Posted 09 September 2011 - 07:13 AM

Actually, there are 3 lines you'll need to change:

echo "Adding OpenIndiana" >&2

If you dont change that, it won't matter. But what goes there is the name of what you're adding.

menuentry "OpenIndiana system boot" {

This would be what's displayed when you see the grub menu. Again, it won't make anything fail if you don't change it. But it will also not display the name of what you want it to. You probably want to change "OpenIndiana" to "Slackware" or something similar.

set root=(hd0,2)

In this case that would be correct. But for anything you add in the future, if it isn't on the same partition that Slackware is now on it will need to be changed to the correct partition.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users