How to Preserve Mint's GRUB Through New OS Installations

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
EchoLynx
Level 3
Level 3
Posts: 158
Joined: Mon Jul 07, 2008 8:49 am
Contact:

How to Preserve Mint's GRUB Through New OS Installations

Post by EchoLynx »

[Problem]
I, like many others, like to jump between operating systems. The recent release of Karmic Koala prompted this question to finally be asked, but I would like a complete solution to all OSes so the (appropriately credited) solution(s) can be moved to this first post and this topic made sticky for future reference.

I really like mint's customized GRUB bootloader. Is there some way I can prevent it from being overwritten when I install another linux distribution? (Or move from XP to Win7, etc.)

[Solution]
Yet to be...

-Ian
Saturday August 9th, 2008: Acquired Technician-class Amateur Radio License. Assigned call KB3ROH.
February (?) 2010: Acquired General-class Amateur Radio License.
Image

User avatar
DrHu
Level 17
Level 17
Posts: 7525
Joined: Wed Jun 17, 2009 8:20 pm

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by DrHu »

The grub menu file is in /boot/grub, where the grub loader reads it when booting
  • The only file you need to protect is menu.1st in /boot/grub
If you prevent the automatic loading of an OS, being able to write into menu.1st, you will not see that menu selection when grub is loaded at boot
--if that is what you want, change the permissions on /boot/grub/menu.1st to no access
root has root & write, so make it read only or none
mint menu>Computer>boot/grub/menu.1st; open as root, change permissions as above (read only or none)

There is also the automatic backup of that menu.1st file created by grub when it does overwrite the file to add menu items, that is in the same location (/boot/grub/) and is named menu.lst~

Another choice is the save default option in grub..
http://www.gnu.org/software/grub/manual ... fault.html
http://www.gnu.org/software/grub/manual ... fault.html
http://www.gnu.org/software/grub/manual ... tem-robust

altair4
Level 19
Level 19
Posts: 9858
Joined: Tue Feb 03, 2009 10:27 am

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by altair4 »

EchoLynx wrote:I really like mint's customized GRUB bootloader. Is there some way I can prevent it from being overwritten when I install another linux distribution?
Yes I think you can. You can create a dedicated grub partition - that's to say a small partition that holds only grub. I don't have any experience in that since I don't use grub as my multibooter but I'm sure someone here does. It will require you to change the way you install all future linux os's however. When it gets to the part of the install process where it asks you where you want to install grub you tell it to install it into the same partition that you installed the base OS. Then you go into your dedicated grub partition and add the lines necessary to point it to that partition. You can do that now of course without the dedicated partition. The next linux you install should have grub placed into the root partition where you installed the OS itself. Then go to your Mint grub and add the lines necessary to boot into that partition. But then you can never get rid of Mint.
(Or move from XP to Win7, etc.)
No. A Windows install will always occupy the Master Boot Record and will overwrite anything ( including grub ) that is there. I don't know of any way around this one.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

EchoLynx
Level 3
Level 3
Posts: 158
Joined: Mon Jul 07, 2008 8:49 am
Contact:

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by EchoLynx »

@DrHu - Thank you for your reply. I am not exactly sure I follow what you are asking me to do, so please lend me some patience.

/boot/grub/menu.1st doesn't exist, but /boot/grub/menu.lst does. Is that what you're talking about?

Are you saying that making menu.lst readonly will prevent anything from overwriting it?

I thought mint's pretty graphics were stored in /boot/gfxmenu. Shouldn't I protect that? In fact, shouldn't I protect the whole /boot/grub folder?

setdefault looks like a nice feature (and I might implement it in the future) but that's not what I am looking for. I want to know how to prevent installing a OS in a new partition from causing GRUB to be overwritten.

@altair4 -

I'm not planning on getting rid of mint... but I might do a clean reinstall when LM8 comes out. Would that cause problems?

If I was to point an installer to /boot/grub, wouldn't it overwrite /boot/grub and replace everything with only what is required to boot the OS I am installing?

User avatar
DrHu
Level 17
Level 17
Posts: 7525
Joined: Wed Jun 17, 2009 8:20 pm

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by DrHu »

EchoLynx wrote:/boot/grub/menu.1st doesn't exist, but /boot/grub/menu.lst does. Is that what you're talking about?
..
Are you saying that making menu.lst readonly will prevent anything from overwriting it?
making menu.lst readonly will prevent anything..
YES, but the OS may not install correctly since it will not be able to write its grub boot text

but /boot/grub/menu.lst does. Is that what you're talking about?
YES, it is just a fonts selection issue, depends on where I paste from or if I simply type it in the text..
  • terminal cut and paste.. menu.lst
As altair4 indicated there are two ways of installing an OS
  • Method a) let the install proceed automatically
    --it will use the MBR (Master boot record) to enable a boot: unless you uncheck []Write to MBR
  • Method b) Uncheck the []Write to MBR, this prevents booting the boot menus for that new OS
    --you are then responsible for adding the changes made, which will appear in /boot/grub directory, not in the MBR
    --again there is a backed up file made by grub menu.lst~
    that file is now the original file before that OS was installed..
    So that new OS will not boot, until you edit grub to include its entry text (boot stanza)
I sometimes use the method b), if I only want to see what the OS will install as a boot entry

I can use chainload +1 to pick up other boot loaders, for example if I used Grub, I could add chainload +1 to pick up the windows OS boot manager (loader: NTLDR) to then boot with its own boot loader sequence..
EchoLynx wrote:I thought mint's pretty graphics were stored in /boot/gfxmenu. Shouldn't I protect that? In fact, shouldn't I protect the whole /boot/grub folder?
If you wanted to, but it isn't necessary, Mint's Grub will not be completely destroyed by another OS install, only the MBR record is being changed to enable that other OS to boot, that does change the grub text entries to locate the default boot entry, which will either be Mint or the other OS; Mint only adds them (other OS text entries in Grub after the last Mint OS stanzas (text entries), so nothing is really lost


Grub boot order, multi-booting Linux + Windows OS..
If you want another explanation about multi-booting (dual boot) with Linux + windows (Linux first or Windows + Linux (windows first), either these forums, forum user:Fred data on Grub or apcmac for the multiboot OS help
http://forums.linuxmint.com/search.php? ... boot+order
http://apcmag.com/the_definitive_dualbo ... bystep.htm
EchoLynx wrote:If I was to point an installer to /boot/grub, wouldn't it overwrite /boot/grub and replace everything with only what is required to boot the OS I am installing?
Depends on the installer application being used, I guess
  • but in this version of Grub, NO

User avatar
gees
Level 1
Level 1
Posts: 27
Joined: Sun Jul 05, 2009 2:19 pm

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by gees »

First, you'll need a separate boot-partition and then install your favourite theme there.

Then you can create as much partitions with multi-boot installs as you like without changing your initial GRUB on your separate boot-partition. Multi-boot with chainloading is the easiest way.

For all the info on multi-booting and GRUB look here:
http://www.justlinux.com/forum/showthread.php?t=144294
or other contributions of "saikee" in that forum.

I've done it that way and works fine. Good luck.
"The web was made for sharing ..."

reaZon
Level 2
Level 2
Posts: 60
Joined: Mon Oct 26, 2009 8:48 am
Location: Egypt

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by reaZon »

you don't have to worry about protecting grub files.but you may have to worry about getting grub itself to work correctly.
if you overwrite the MBR someway (Linux then Windows or the other way) you can always recover it.you can use

Code: Select all

fixmbr
or

Code: Select all

bootsect
to get your Windows MBR back or the find>root>setup grub command sequence to get grub back.

User avatar
DataMan
Level 6
Level 6
Posts: 1234
Joined: Thu Dec 04, 2008 6:47 am
Location: Carmel, Midwest USA at /var/www
Contact:

Re: How to Preserve Mint's GRUB Through New OS Installations

Post by DataMan »

If you do decide to go with a separate GRUB partition as has been suggested by a few responders, I have authored a small tech paper on my website detailing how I built mine.

http://www.boomerclan.info/techpaperslx.html

-DataMan
Linux'd since 2005 Linux ID 422356 Ubuntu ID 15015

Post Reply

Return to “Installation & Boot”