Page 1 of 1

How to Preserve Mint's GRUB Through New OS Installations

Posted: Fri Nov 06, 2009 10:06 am
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

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

Posted: Fri Nov 06, 2009 12:30 pm
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

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

Posted: Fri Nov 06, 2009 3:37 pm
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.

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

Posted: Fri Nov 06, 2009 6:38 pm
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?

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

Posted: Fri Nov 06, 2009 6:55 pm
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

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

Posted: Sun Nov 08, 2009 11:53 am
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.

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

Posted: Sun Nov 08, 2009 8:50 pm
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.

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

Posted: Tue Nov 10, 2009 8:54 am
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