LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-16-2013, 03:51 PM   #1
edbarx
Member
 
Registered: Sep 2010
Distribution: Used Debian since Sarge. (~2005)
Posts: 373

Rep: Reputation: 21
grub-setup is failing to write the primary boot loader to the MBR


I am trying to install grub-pc's primary boot loader to the MBR and I am repeatedly failing even though I am using the right command syntax. For some weird reason, update-grub is creating repeated menu items pointing at the same installation.

Before I run grub-setup, I mounted the partition containing the /boot/grub directory. This was mounted on /mnt/sda1. The command was this:
Code:
# grub-setup --directory=/mnt/sda1/boot/grub '(hd0)'
Does anyone know why grub-setup is failing? I am tempted to use dd on the MBR but I have no idea how the primary boot loader is 'wired' to load the correct sequence of sectors from the HD and somehow it must know, but how?

Last edited by edbarx; 06-16-2013 at 03:53 PM.
 
Old 06-16-2013, 09:38 PM   #2
fbianconi
Member
 
Registered: Apr 2008
Location: argentina
Distribution: Arch
Posts: 86

Rep: Reputation: 22
sorry, how do I delete a post?

I was suggesting to use the linux notation for device, but grub has changed that syntax across versions (distros did some changes too), so I'm not sure if that applies to you.

Last edited by fbianconi; 06-16-2013 at 09:53 PM.
 
Old 06-16-2013, 10:18 PM   #3
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
For some weird reason, update-grub is creating repeated menu items pointing at the same installation.
Is your system booting or is it dropping to a grub prompt.
If it is booting then are you having the same problem I'm experiencing? I added linuxmint to my grub menu & I now have 5 or 6 entries for linuxmint.
 
Old 06-17-2013, 12:13 AM   #4
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
Why are you using "grub-setup" to install grub on the MBR?

Try;
Code:
sudo grub-install /dev/sda

Last edited by widget; 06-17-2013 at 12:14 AM.
 
Old 06-17-2013, 01:25 AM   #5
edbarx
Member
 
Registered: Sep 2010
Distribution: Used Debian since Sarge. (~2005)
Posts: 373

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by widget View Post
Why are you using "grub-setup" to install grub on the MBR?

Try;
Code:
sudo grub-install /dev/sda
It is a matter of philosophy. I don't agree that a bootloader is modified by any installed OS because of its central importance on a computer. For me it doesn't make sense that an installed OS, in the event of an error, impacts the bootability of an entire multiboot system: it simply doesn't make sense.

I cannot use the given command because that command assumes that I am linking grub with the currently loaded OS. I am attempting to install grub to an ext2 15MB partition.

I used an ext2 filesystem because the file system is used only by the bootloader, hence, a journalling file-system is not necessary. I think, the fact that it is ext2 may be the cause why grub-setup fails.

Last edited by edbarx; 06-17-2013 at 04:09 AM.
 
Old 06-17-2013, 10:03 AM   #6
exsencon
Member
 
Registered: Feb 2008
Location: Belgium
Distribution: Ubuntu,LinuxMint,Slackware,Sabayon,Slax
Posts: 86

Rep: Reputation: 24
Quote:
Originally Posted by edbarx View Post
It is a matter of philosophy. I don't agree that a bootloader is modified by any installed OS because of its central importance on a computer. For me it doesn't make sense that an installed OS, in the event of an error, impacts the bootability of an entire multiboot system: it simply doesn't make sense.

I cannot use the given command because that command assumes that I am linking grub with the currently loaded OS. I am attempting to install grub to an ext2 15MB partition.

I used an ext2 filesystem because the file system is used only by the bootloader, hence, a journalling file-system is not necessary. I think, the fact that it is ext2 may be the cause why grub-setup fails.
Yes, you are probably right. Why won't you try a regular install with any Linux and just put the grub bootloader in the mbr when asked for it during the installation process? After install you can still change your bootloader sequence. That'what I do with my multiboot system and most of the time it works. Solaris is a tricky one (not a Linux) but I finally got that one too.
 
Old 06-17-2013, 01:40 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Take a look at the bottom of the page in the link below. The method for a standalone grub on a separate partition is basically the same except for Grub2, it should not be on a fat partition which should not be a problem as you state you already have an ext2 filesystem:

http://library.techguy.org/wiki/Inst...d_alone_system

Quote:
I don't agree that a bootloader is modified by any installed OS because of its central importance on a computer
Bootloaders are almost always modified by the OS but during installation (and sometimes during updates), you do have a choice, at least on Linux. Usually three options, install to mbr, install to partition or don't install a bootloader. However, it is obviously not necessary to modify the bootloader and that is the primary reason to have either a /boot partition or standalone grub partition so you are not dependent on the boot,grub files which are usually on the partition on which the primary OS is isntalled.

Last edited by yancek; 06-17-2013 at 01:42 PM.
 
Old 06-17-2013, 02:28 PM   #8
edbarx
Member
 
Registered: Sep 2010
Distribution: Used Debian since Sarge. (~2005)
Posts: 373

Original Poster
Rep: Reputation: 21
I enlarged the partition which contained the original bootloader so that it could fit a small (less than 1 GB) installation of Debian without a window manager or desktop. The installation created its own bootloader saving the primary bootloader to the MBR as I required.

I will not use this installation so that grub.cfg would not be changed.
 
  


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
HELP! MBR defunct, cannot boot anymore D: GRUB loader crashed HoBu Linux - Laptop and Netbook 10 09-12-2009 12:36 PM
Formatted my linux drive in a dual boot setup, now the GRUB loader hangs the system.. Dr_Horse Linux - General 4 12-04-2008 03:50 PM
making windows primary in grub loader olsonsam Linux - Desktop 5 09-03-2006 10:37 AM
Software RAID 1 setup on CentOS using Grub boot loader kumarsundaram Linux - Software 1 11-30-2005 12:57 PM
boot loader, MBR, redhat9 on primary slave, winxp on primary master samik Linux - Hardware 4 10-15-2003 08:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:58 PM.

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