Author Topic: Question about GRUB logic  (Read 1941 times)

Offline paul1149

  • Full Member
  • ***
  • Posts: 51
Question about GRUB logic
« on: February 14, 2011, 05:18:21 PM »
First, let me say that I am very impressed with PCLinux, both the distro and the smoothness of the install. And I've tried a few.

I'm putting an instance of PCL out on an external DD on a Win7 laptop. Everything was great until after I selected the external partition as the home for GRUB. The next screen asked my where I was booting from. This shocked me, because the only purpose I could see to the question was that GRUB, against my wishes, was going to write to my sda MBR after all - the one thing I was counting on keeping completely immune to the install. (I was going to go back and use EasyBCD to modify the Win7 BCD in the service partition afterward. I checked the Help file (nice that it's available there during the install), but it didn't go into this.

I decided to go ahead with the install, and to my surprise, GRUB did NOT write to sda's mbr. That's great, but I would like to know exactly what did take place as a result of that screen. Unless I'm missing the obvious, in which case I will gladly eat crow, I would also like to suggest that more clarity get built into the install routine at this point. If there is one thing that needs to be absolutely bulletproof, it is the install.

Thanks,
p.

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
Re: Question about GRUB logic
« Reply #1 on: February 14, 2011, 06:34:06 PM »
Welcome to the forum, paul1149! ;D Hope you have a great time here.

To answer your question, GRUB probably got written to the MBR of your external drive(sdb?). I'm not sure though, so you might do better to wait until a more knowledgeable person comes along. ;) Hope that clarifies any questions you may have :).

Offline paul1149

  • Full Member
  • ***
  • Posts: 51
Re: Question about GRUB logic
« Reply #2 on: February 14, 2011, 07:51:49 PM »
Thank you, Publius. I hope you are well.

You seem to be correct about sdb. I chose it to boot, via the BIOS ad hoc boot menu, and first a line came up saying no grub file, but then the grub menu came up properly.

Now here's the problem, and I don't know where this came from. Both this grub menu and the one I access via the Win7 BCD via chainloading will not load PCL. I get a "no such partition" error, even in failsafe, citing hd 2,1. That would make sense, since that is a windows storage partition, and PCL is on sdb2.

So I fired up the PCL live disk in order to access menu.lst, only to find that while the file manager shows it at 699 bytes, kwrite shows it empty. So I don't know how to get into that menu.lst, which I believe is a simple text file under Grub1, and change things.

To my original query, I really wish there was an option for grub not to write to ANY mbr, but that's not my immediate problem. I need to correct the partition spec, and I'd rather not run the install again, as I don't like the grub function here and this is my main machine.

bw,
p.

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
Re: Question about GRUB logic
« Reply #3 on: February 14, 2011, 08:23:22 PM »

So I fired up the PCL live disk in order to access menu.lst, only to find that while the file manager shows it at 699 bytes, kwrite shows it empty. So I don't know how to get into that menu.lst, which I believe is a simple text file under Grub1, and change things.


Did you try accessing it as root?


To my original query, I really wish there was an option for grub not to write to ANY mbr, but that's not my immediate problem. I need to correct the partition spec, and I'd rather not run the install again, as I don't like the grub function here and this is my main machine.


If there was an option for grub to not be installed at all, then you would not be able to boot, even by chainloading from windows' BCD, as chainloading simply calls up the grub for PCLOS. On the other hand, I do wish there was an option to install GRUB to the root of the partition, as that would allow PCLOS to be chainloaded, yet still not touch the MBR.

Offline paul1149

  • Full Member
  • ***
  • Posts: 51
Re: Question about GRUB logic
« Reply #4 on: February 14, 2011, 08:32:03 PM »
That is precisely the option I was hoping for - that the install would be self-contained within a partition. I can handle getting there, and I would much appreciate everyone keeping their hands off my mbr.

I'll try going in as root. I hadn't considered that from the Live disk.

Thanks,
p.

uncleV

  • Guest
Re: Question about GRUB logic
« Reply #5 on: February 15, 2011, 06:37:22 AM »
You can figure where GRUB was written to following this:
http://www.pclinuxos.com/forum/index.php/topic,62786.msg508062.html#msg508062

Pay attention to grub> find /boot/grub/stage2 command.

After that hope that old-polack would drop here. ;)

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Question about GRUB logic
« Reply #6 on: February 15, 2011, 06:51:30 AM »
The question I believe is to determine if you are installing Grub to the MBR of the boot device or to another device.

The device will be numbered differently if it is the first device or the second device .....  (hd0) or (hd1)

I would guess the answer then would determine the content of the menu.lst.

Please note I have not tested this, but it seems somewhat likely to me.

regards.

uncleV

  • Guest
Re: Question about GRUB logic
« Reply #7 on: February 15, 2011, 06:57:21 AM »
And some file managers show menu.lst empty if you open it as a regular user. Try as root.
« Last Edit: February 15, 2011, 07:05:25 AM by Unclius Pecelinuxus Blablus »

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Question about GRUB logic
« Reply #8 on: February 15, 2011, 07:01:15 AM »
That is precisely the option I was hoping for - that the install would be self-contained within a partition. I can handle getting there, and I would much appreciate everyone keeping their hands off my mbr.

I'll try going in as root. I hadn't considered that from the Live disk.

Thanks,
p.

Simply select the root partition of the installed OS for the Grub install .......  that makes it all self contained and allows that Grub to be called by a chainloader command from another instance of grub.

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 727
Re: Question about GRUB logic
« Reply #9 on: February 15, 2011, 08:31:08 AM »
Firstly, GRUB only writes the bootloader where YOU TELL IT TO. ;) ;)

On the install screen that says Set Up Boot System there is a field called Boot Device.
If you specify the device as /dev/sda or /dev/sdb or /dev/sdc etc. then the bootloader gets written to the MBR of the appropriate disk.
If you specify the device as /dev/sda2 or /dev/sdb2 or /dev/sdc2 etc. then the bootloader gets written to the start of the specified partition (in this case the second) on the chosen disk (NOT the MBR).  The problem with installing to anywhere other than the MBR of the boot drive is that you have  to "chainload" to this partition using some other bootloader (as you know).
Mostly, this works OK but you can run into disk numbering problems and need to check and edit the menu.lst file.

When you boot from the live CD to access the menu.lst file you have to make sure you mount the partition which holds the menu.lst file that you want to edit.  So assuming you installed PCLOS to /dev/sdb2 you need to open a terminal and then do:

Code: [Select]
su
<enter root password>
mkdir -p /mnt/temp
mount /dev/sdb2 /mnt/temp
dbus-launch kwrite /mnt/temp/boot/grub/menu.lst

When you find out what is in the menu.lst file we should be able to help further.  It would also be useful to know the output from the following commands:

Code: [Select]
fdisk -l
cat /mnt/temp/boot/grub/device.map

Sorry this is complicated, but most users just let GRUB install to the MBR which makes things a lot simpler  :)
Hope that helps (a bit)
Terry


« Last Edit: February 15, 2011, 09:31:21 AM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline paul1149

  • Full Member
  • ***
  • Posts: 51
Re: Question about GRUB logic
« Reply #10 on: February 15, 2011, 12:48:25 PM »
Thanks for all the input. I'd like to update the situation.

  • I used that trick to correct grub, and somehow managed to hose the Win7 mbr/bcd. 
  • I repaired that with the win7 repair disk, and then decided, after I cooled down, that it would be better to place PCL on my WinXP box - for safety's sake and so I could work at networking it with 7.
  • The install on the XP box went smoothly. This time I opted to use grub in the mbr of sda. It picked up both XP and an install of CentOS.

I wish I had a better memory or had taken a screenshot, but I don't believe that assigning the grub bootloader to a partition was an option on the DrakLive screen. I recall only two or three command buttons.  Maybe someone doing a fresh install would confirm this. I refer to the screen immediately after, and if, you choose to place the menu on the partition.

Basically, I'm up and running. I'm sure I'll have many questions, but for now two observations:

First, this is truly a gorgeous distro, and as far as I've used it (I played with it a few months ago for a while), it is easy and straightforward to use. I would think this would have a lot of appeal for refugees from Windows on both counts.

Second, the install is of utmost importance. I'm fairly technically adept, and this gave me aggravation. Where does that leave the typical user? I believe that when dual-booting linux becomes safer and easier, it will become more popular.

Thanks again,
p.

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
Re: Question about GRUB logic
« Reply #11 on: February 15, 2011, 12:55:28 PM »

Second, the install is of utmost importance. I'm fairly technically adept, and this gave me aggravation. Where does that leave the typical user? I believe that when dual-booting linux becomes safer and easier, it will become more popular.


But why would most people wish to boot Linux from Windows's bootloader anyway? Since GRUB is perfect at booting Windows, there is no need to leave the Windows bootloader as the default bootloader, and instead GRUB should be used to chainload to Windows. Many people install Linux, and specifically, PCLinuxOS, with no knowledge of partitions or bootloaders, and in fact, even a separate drive is not needed to install. For most people, all that needs to be done is boot up the LiveCD, launch the installer, and choose to "Install PCLinuxOS on the free space in a Windows partition". The amount of space allocated to each OS can be changed, and then the Windows partition is automatically shrunk and PCLinuxOS installed in the remaining space for you.

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 727
Re: Question about GRUB logic
« Reply #12 on: February 15, 2011, 01:00:04 PM »
Glad you got it working and we're not surprised you like it  :)

I wish I had a better memory or had taken a screenshot, but I don't believe that assigning the grub bootloader to a partition was an option on the DrakLive screen. I recall only two or three command buttons.  Maybe someone doing a fresh install would confirm this. I refer to the screen immediately after, and if, you choose to place the menu on the partition.

Well if you go into Control Centre (Configure Your Computer) and select "Boot" in the menu on the left it should take you through the same steps of installing the bootloader as the installer did (just don't click FINISH at the end if you don't want to write anything :)  )  You should find that the Boot Device field has a drop down box with lists the partitions.

Second, the install is of utmost importance. I'm fairly technically adept, and this gave me aggravation. Where does that leave the typical user? I believe that when dual-booting linux becomes safer and easier, it will become more popular.

Well, to be fair, most "newbies" would just elect to install to the MBR as you have done now, and so wouldn't have a problem.

Anyway, do enjoy the distro and do come back here if you have any further questions/problems.

Terry
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline paul1149

  • Full Member
  • ***
  • Posts: 51
Re: Question about GRUB logic
« Reply #13 on: February 15, 2011, 01:00:24 PM »
All good points. I preferred not to touch the windows mbr/bcd. And on the XP box I intend on adding 7 later on, and I'd prefer to work with the boot via EasyBCD. Now I will have to deal with grub, which I know little about.

I'm probably in the minority. But I think a way to install linux without touching the Win install would be a plus for many people.

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
Re: Question about GRUB logic
« Reply #14 on: February 15, 2011, 01:19:15 PM »
But I think a way to install linux without touching the Win install would be a plus for many people.


Which there is, as TerryN pointed out, right here:


Well if you go into Control Centre (Configure Your Computer) and select "Boot" in the menu on the left it should take you through the same steps of installing the bootloader as the installer did (just don't click FINISH at the end if you don't want to write anything :)  )  You should find that the Boot Device field has a drop down box with lists the partitions.



Here's a screenshot of the GRUB install: