LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-24-2012, 06:00 AM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
grub and fedora and ubuntu


I have both Fedora 17 and Ubuntu 12.04 installed. Fedora was installed last. It rewrote the mbr or whatever that is called. It added the necessary lines to boot Windows and Ubuntu, taken from the actual grub.cfg in Ubuntu, I presume.
Problem is when I get a kernel update in Ubuntu. Ubuntu adds its updated configuration to the Ubuntu /boot/grub/grub.cfg which on boot is duly ignored by the grub installed by Fedora.
I can copy the new menuentry { blabla} from the Ubuntu /boot/grub.cfg into the Fedora /boot/grub2/grub.cfg and that is ok.
Can I somehow tell either Ubuntu or Fedora only to write updates to grub.cfg to just one grub.cfg, so that I do not have to copy the details over manually?? And of course tell grub to use only this config!
 
Old 07-24-2012, 06:10 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well if you just change /etc/fstab to reference the same partition for /boot then yes that would work as far as editing the boot line goes, however I'm not sure if that could cause other issues as well. Tentatively I'd say not, but I wouldn't count on it.

It's (almost) interesting to observe how /boot isn't really part of the operating system as such. there is no need to mount it at all, and outside of the grub phase serves no purpose at all. So it should really been seen to not belong to either OS in the first place really.
 
Old 07-24-2012, 08:44 AM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,541

Rep: Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496
Quote:
Problem is when I get a kernel update in Ubuntu. Ubuntu adds its updated configuration to the Ubuntu /boot/grub/grub.cfg which on boot is duly ignored by the grub installed by Fedora.
If you are chainloading Ubuntu from Fedora (which you said is in the mbr) then Fedora hands over booting to Ubuntu and you will then get the Ubuntu grub menu which should have the new entry. If you have a menuentry for Ubuntu in the Fedora grub.cfg which contains the linux and initrd lines, it is pointing to a specific kernel and Fedora would have no way of knowing a change was made. You need to do update-grub or grub-mkconfig from Fedora so it does a search and creates a new grub.cfg. The Fedora Grub would have no way of knowing Ubuntu got an update otherwise.

Below you indicate the new kernel is ignored in Fedora:

Quote:
Problem is when I get a kernel update in Ubuntu. Ubuntu adds its updated configuration to the Ubuntu /boot/grub/grub.cfg which on boot is duly ignored by the grub installed by Fedora.
Here you seem to be saying it write to both??

Quote:
Can I somehow tell either Ubuntu or Fedora only to write updates to grub.cfg to just one grub.cfg, so that I do not have to copy the details over manually??
Manually entering a new menuentry in the grub.cfg file will work until you run update-grub. If you want an entry permanently, you need to put in in /etc/grub.d/40_custom file.
 
Old 07-24-2012, 09:15 AM   #4
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
To clarify:
I don't know how the computer actually boots. What tells it which grub.cfg to look for?? If I knew that, I would be half way to solving the problem.
I have a grub.cfg in Ubuntu. I have a grub.cfg in Fedora.
If I update Fedora (/dev/sda6), and there is a kernel update, it, quite naturally, changes its grub.cfg
The same goes for Ubuntu (/dev/sda4).

Quote:
Here you seem to be saying it write to both??
NO!


On kernel update, whatever Linux I am using DOES NOT WRITE TO BOTH. That is natural. I wish it would!
Of course, Ubuntu does not change the Fedora grub.cfg, and Fedora does not touch the Ubuntu grub.cfg
I would like to make both Linices change one grub.cfg on kernel update.

In the past I tried putting an entry in /etc/grub.d/40_custom It did not work, for whatever reason, probably me. I did mess up grub completely once, and had to reinstall, so I tend to leave that alone.
I found, if I directly insert an entry in grub.cfg, it works, even though at the start of grub.cfg it says 'DO NOT EDIT THIS FILE', so I always do it this way.
 
Old 07-24-2012, 01:59 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,541

Rep: Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496
Quote:
I don't know how the computer actually boots.
According to your initial post, you installed Fedora last and installed the Fedora Grub2 to the master boot record. That means the BIOS goes to the mbr and then to the Fedora grub.cfg and boots whatever the default is. You should have had an entry for Ubuntu in your Fedora grub.cfg.

I don't use Fedora but, with Ubuntu you could update its grub.cfg file to include a new kernel for Fedora on the machine with: sudo update-grub. I would expect you would be able to use "update-grub" with Fedora, if not try the grub mkconfig command or google updating Grub2 in Fedora. Since you are using the Fedora Grub2 to boot, that would be the best option.

My experience with editing the grub.cfg file manually is that when update-grub is run on that OS, the entry disappears if it was not also in the 40_custom file.
 
Old 07-24-2012, 06:17 PM   #6
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Thanks for that. Do you mean: if I run 'sudo update-grub' in Fedora, or Ubuntu, it will find the new kernels and put them in grub.cfg?

Assume, I am using Ubuntu (/dev/sda4) and /devsda6 is not mounted by default. I open a terminal and run 'sudo update-grub' Will it look in /dev/sda6 (Fedora) for /etc/boot and add things from there??

Quote:
You should have had an entry for Ubuntu in your Fedora grub.cfg.
Yes, after installing Fedora, it looks for other OSs and puts and entry in its own grub.cfg But it only does this on install. If Ubuntu updates the kernel, Fedora does not see that. So I have to do that manually.

If I am running Fedora, will 'sudo update-grub' find the new Ubuntu kernel and add it to (Fedora)grub.cfg??

Last edited by Pedroski; 07-24-2012 at 06:22 PM.
 
Old 07-24-2012, 09:34 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
No.
No.
No and no.

Sorry, I lost track of which question I was answering there ...

Quote:
I would like to make both Linices change one grub.cfg on kernel update.
You definitely do not want this to happen. Else you tribulations will be longer and stronger.
*ONE* system must own the MBR - that system is the one for which you will see the boot menu. All other systems should install their bootloader to the partition boot record rather than over-write the MBR. They can then be chainloaded if desired - this saves having to continually rebuild the grub.cfg for the "MBR-owning" system for any other (kernel) upgrades. Not such a burden on a 2-system dual boot, but try 5 or 8.
Else simply update the "MBR-owning" systems grub.cfg - for F16 that is grub2-mkconfig (note that this is "non-standard"). It will go find the other updates. See the Fedora wiki for syntax.
"update-grub" will not work on Fedora - it is a Debianism. So whilst being even more "non-standard", is probably easier to work with. You might want to consider Ubuntu as the "MBR-owning" system. But Fedora will have to be re-configured else it will continue to (seemingly randomly) update the MBR. Depends a lot on which system you use more and want as the default boot.
 
Old 07-24-2012, 10:10 PM   #8
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Ok, thanks. At the mo, I use Ubuntu more. But Fedora 'owns' the mbr. How do I reverse that? Make Ubuntu the owner again? Short of reinstalling?

The reason I have two flavours of Linux is: this computer, Toshiba laptop C600D has a major, unresolved Linux problem: it crashes any and every time the dsl cable is unplugged. I have reported this to the bugzillas, and any and all forums I could reach. No one has an answer or solution, except 'update'. So I will continue to update, and hope and pray that some sunny day, this problem will vanish into /dev/none!
 
Old 07-24-2012, 11:23 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
There are two separate functions required - on both systems.
You'll need to do Ubuntu first - issue "grub-install" to the device node (/dev/sda say). That will over-write the MBR. Then run update-grub - that should populate grub.cfg and still allow you to select Fedora. Good Ubuntu article here.
Seems Ubuntu are pushing people to use "boot repair" - see mention here.
On reboot select Fedora and you need to issue "grub-install" on Fedora pointing to it's partition (/dev/sda2 or whatever), then do the grub2-mkconfig. Both commands are mentioned in the wiki article here.

Make sure you run the Ubuntu update-grub if new kernel get picked up by Fedora.

Last edited by syg00; 07-24-2012 at 11:25 PM.
 
Old 07-25-2012, 07:40 PM   #10
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Thanks! That did the trick!
I started Ubuntu, ran grub-install, so now I have Ubuntu in charge of the mbr.

To pick up any Fedora installation, the partition must be mounted. Otherwise grub does not see it. Mounting the Fedora partition in Ubuntu is just a click. Then run grub-update. Funnily enough, I did not have to mount the windows partition for it to be found! I wonder why?

So in future, if Fedora updates the kernel (they always seem to be a step ahead of Ubuntu) I just:
1) Start Ubuntu
2) Mount Fedora partition
3) Run grub-update, and problem solved, the new kernel is in grub.cfg

I see no reason why, if you had more systems, distros, that this should not work. So if you had 5 or 8 distros (why would you do that??), it should pick them up and put them all in one grub.cfg

So thanks again, great tip!

Thanks for the links!

How come I don't see the mbr in say gparted or disk utility?? Where is it??
 
Old 07-25-2012, 08:24 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Quote:
Originally Posted by Pedroski View Post
So if you had 5 or 8 distros (why would you do that??),
Partly so I can answer questions like this thread ....

I am interested in the technology, not the eye-candy.
The MBR is at the start of the disk - outside of any partition. Likewise the partition table. Wikipedia used to have a quite good explanation.
 
  


Reply



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
[SOLVED] old grub of ubuntu replaced by 0.97 of fedora dexter.gdv Linux - Software 4 02-05-2011 10:23 AM
GRUB 0.97 troubles (XP,ubuntu kk,fedora 12) symidran Linux - General 8 12-14-2009 08:13 PM
Fedora and Ubuntu with one independant GRUB momcilosystem Linux - Newbie 5 05-13-2009 01:29 AM
GRUB problem with fedora/ubuntu iAlta Linux - Distributions 6 09-15-2007 02:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:19 AM.

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