LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Choosing which disk to install MBR to? (https://www.linuxquestions.org/questions/debian-26/choosing-which-disk-to-install-mbr-to-934038/)

Nick_C 03-12-2012 08:23 AM

Choosing which disk to install MBR to?
 
Is there some way during the install procedure that I can choose which disk to write the boot loader to rather than have Debian just stomp all over the MBR of the first disk drive in the BIOS order?

In this case Debian is being installed to the third drive in the BIOS order and that is where I want the boot loader written to not to the MBR of the first drive. The first and second drives will at times be removed and used elsewhere.

All I want is to be able to point the BIOS boot order to the correct drive and have it boot from there without being dependent on other drives being present.

If I choose not to install the GRUB boot loader at install time is there an easy way I can install that later, preferably one which lets me choose where the boot loader is written.

Using Debian Wheezy.

TobiSGD 03-12-2012 09:13 AM

Try to install in expert mode, that should solve your problem.

Nick_C 03-12-2012 10:15 AM

Quote:

Originally Posted by TobiSGD (Post 4624784)
Try to install in expert mode, that should solve your problem.

Yep found it thanks. Install from Expert mode then answer No when questioned about writing MBR, that then allows boot loader to be written anywhere.

In my case I got the boot loader partition wrong so system won't boot. I have tried re-running the install but that does not allow reinstalling just grub. Is there some way that I can boot to a rescue prompt and reinstall grub from there?

Nick_C 03-12-2012 11:45 AM

Currently booted to Debian Rescue mode to reinstall Grub. I am trying to install Grub to a Partition not to the MBR. Problem is when I issue grub-install /dev/sdb5 I get the following error:
Quote:

# grub-install /dev/sdb5
/usr/sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea..
/usr/sbin/grub-setup: error: embedding is not possible, but this is required when the root device is on a RAID array or LVM volume.
Any suggestions?

Hungry ghost 03-12-2012 11:46 AM

Quote:

Originally Posted by Nick_C (Post 4624832)
In my case I got the boot loader partition wrong so system won't boot. I have tried re-running the install but that does not allow reinstalling just grub. Is there some way that I can boot to a rescue prompt and reinstall grub from there?

I think there is a way to install grub from the install CD, but I can't remember now. Anyway, if you have some live CD around, you can boot it and execute these commands as root:

Code:

mkdir /mnt/debian
mount /dev/sdXN /mnt/debian #substitute /dev/sdXN with the partition where you have debian Installed
mount -t proc none /mnt/debian/proc/
mount -o bind /dev /mnt/debian/dev/
mount -o bind /sys  /mnt/debian/sys
chroot /mnt/debian /bin/bash
grub-install /dev/sdX #substitute /dev/sdX with the actual drive you want grub installed to
update-grub

Hope it works.

Nick_C 03-12-2012 12:05 PM

odiseo77, looks like our previous messages crossed at almost the same time. I have found that I can get to a Debian Rescue prompt by selecting that option from the install CD. Problem is Grub will not install the bootloader to the partition I am trying to install it to.

Hungry ghost 03-12-2012 01:00 PM

Quote:

Originally Posted by Nick_C (Post 4624909)
odiseo77, looks like our previous messages crossed at almost the same time. I have found that I can get to a Debian Rescue prompt by selecting that option from the install CD. Problem is Grub will not install the bootloader to the partition I am trying to install it to.

Yes, I read your message right after I posted. Not sure why you're getting the last error, though. Did you try booting Debian even after this error? (I've read in other sites that in some cases grub is installed all the same and the OS can boot). Another option that might work, *if* you are completely sure that /dev/sdb5 is the partition where you installed Debian to, is to invoke grub-install with the --force option, but for this, I would strongly suggest to verify the disks first with fdisk -l (it will show you all your disks' partitions).

Regards.

yancek 03-12-2012 01:06 PM

You could try the methods at the link below for Ubuntu, should be the same on Debian. Section 12.1.2.

https://help.ubuntu.com/community/Grub2

If that doesn't work, try the method below from a terminal using the Debian CD. Make sure you change all entries below from sda4 to sdb5. If you do not have ext4 filesystem, change that. These are separate commands, hit the enter key after typing each line:

Quote:

sudo mkdir /mnt/sda4
sudo mount -t ext4 -o rw /dev/sda4 /mnt/sda4
sudo mount -t proc none /mnt/sda4/proc
sudo mount -o bind /dev /mnt/sda4/dev
sudo mount -o bind /sys /mnt/sda4/sys
sudo mount -t devpts devpts /mnt/sda4/dev/pts
sudo chroot /mnt/sda4
sudo grub-install --force --root-directory=/mnt/sda4 /dev/sda4
sudo update-grub

Nick_C 03-12-2012 03:12 PM

Could the problem be that I am trying to put the boot loader into a partition within an Extended partition. Can the boot loader be placed in an extended partition, also can the boot loader work within a LVM group?

I have tried booting the drive despite the error but it just boots to the old MBR.

widget 03-12-2012 03:39 PM

Your problem is that the MBR (Master Boot Record) is at the beginning of the drive, not on a partition.

Grub is already installed on your OS on that partition. It need to also be on the MBR (/dev/sdc for instance). This is just an instruction on the MBR as to where to look for the bootloader. Without that you will not boot.

TobiSGD 03-12-2012 04:27 PM

So actually what you are saying is that chainloading from a different bootloader to Debian's Grub 2 is not possible? I never tried that, but would be astonished if that would be the case.

yancek 03-12-2012 04:45 PM

You are not being very clear on what you are trying to accomplish. No, you can't install Grub on an Extended partition. You can install Grub on a formatted logical partition within an Extended partition but since you haven't posted any pertinent information on your partitions, it's pretty hard for members here to guess.

If you were able to install the Debian Grub to sdb5 where you want it, what bootloader are you going to use to boot it? What do you have on your first drive for an operating system/bootloader. If you get Debian Grub installed on sdb5 and have your sda drive set to first boot priority, you will then need to update the boot files on whatever bootloader you are using there.

You might try going to the site below and downloading and running the bootinfoscript, post the results.txt file here so members have some actual information to use to suggest a solution.

http://sourceforge.net/projects/bootinfoscript/

lithos 03-12-2012 06:10 PM

1 Attachment(s)
Hi everyone,

I'm sorry to 'hijack' this, but since I'm in a similar situation (Fedora 16 on an extended / logical boot partition)
I made a picture of disk layout and I wonder if it's possible to install grub /boot into my marked partition - it says sdc5, although I don't know how that's counted

Regards everyone

widget 03-12-2012 06:56 PM

Quote:

Originally Posted by TobiSGD (Post 4625126)
So actually what you are saying is that chainloading from a different bootloader to Debian's Grub 2 is not possible? I never tried that, but would be astonished if that would be the case.

No that is not what I am saying. To chainload you just need the bootloader installed on the OS. The bootloader that is handling the whole job needs install on the MBR for the chainloading from it to work.

There is nothing in the scanty informations provided to indicate anything but a single install on the drive in question that will be booted from that drive only if selected in bios.

I have 2 drives set up like that which have more than one install per drive. Works well and is how I want it.

I believe that is what the OP is after. A simple install on a drive that will be sellected from the bios drive menu. He/she will then need a boot loader on the MBR of that drive.

Chainloading works the same way in that it calls for a particular bootloader on a particular partition to act as the files for the foundation of booting all installs involved. Those files, in the case of bootloading, call for the files on a particular install to be used to boot that install.

MBR>base bootloader>individual install bootloader - as opposed to

MBR>base bootloader

Nick_C 03-13-2012 04:54 AM

Some further details of what else is on this drive:

Quote:

Win2008/Hyper-V - Primary1, NTFS
Win2003 - Primary2, NTFS
spare - Primary3, NTFS
Extended
vg_vmhost – 34Gb
/boot - 1Gb, ext3 + boot loader if possible
/ root - 3Gb, ext4
/tmp – 2Gb, ext4
/var – 2Gb, ext4
/usr – 2Gb, ext4
/usr/local – 2Gb, ext4
/srv – 2Gb, ext4
/opt – 2Gb, ext4
swap 20Gb
Extended2 - 250Gb, NTFS
/vm (virtual machines) - 250Gb, ext4
Extended4 - 50Gb – NTFS
/home - 50Gb, ext4



All times are GMT -5. The time now is 01:49 PM.