Search My Blog

Thursday, March 17, 2011

Automatically adding other distributions to Fedora Grub using os-prober « Hedayat’s Blog

Automatically adding other distributions to Fedora Grub using os-prober

Posted February 25, 2011 by Hedayat in Computer, Fedora, Linux.
Recently I decided to play a little with Fedora's Grub2 to see how it works. Fedora Grub2 package does not replace Grub1 and adds itself to its menu, so it is safe to install.
It is clear that Fedora is not ready to switch to Grub2 currently (while it is not much work to do so), since the grub2 menu of it is not polished at all: a simple black background, and Fedora menu entries appear as "GNU/Linux, with Linux VERSION". Well, both are just a very simple polish work, one of them is tracked here.
I was surprised to see that other installed operating systems, like my Windows and the other installed Fedora was not added to Grub2′s menu. It is generally the task of grub2′s /etc/grub.d/30_os-prober script. I was surprised to find out that this script depends on os-prober for detecting other operating systems, which is a tool developed for Debian installer and is not available in Fedora. Therefore, I decided to package it and it is up for review here, waiting for someone to approve it! ;) Also, it is clear that grub2 package should depend on it, so a bug report is created for it too.
But there is nothing in os-prober to make it useful only for grub2. Fedora is currently using grub1 and there is no clear plans for migrating to grub2 currently, and there are people who are frustrated when find out that Fedora is unable to automatically detect and add other installed Linux distributions to its Grub menu, which is also reported here. So, I decided to modify grub2′s os_prober script to generate menu entries for Grub1, and the result is available here. If you've installed os-prober, you can run this script and it should generate grub1 menu entries for other operating systems installed on your system (Windows and other distribution installations). However, I'm not sure if it generates correct entries for all systems, specially as it currently depends on /boot/grub/ to convert Linux device names to grub names. The script outputs the results to standard output and doesn't't modify your grub.conf directly, so you can try it safely.
An example output of this script is like this:


I'll have to try os-prober out. It just may beat the old fashion way... Editing the /boot/grub/menu.lst file in Grub1 (or grub.conf in some of the older Fedora versions). Which is really pretty easy. It's a bit harder (or just different than what I'm use to) in Grub2. You have to edit /etc/default/grub (the grub file has no file extension, if I remember right). The commands are completely different, so there is a learning curve and I was not successful the first time I tried editing mine in a Ubuntu based install that I have since Reformatted to something different. I now have ArtistX (Ubuntu based) on one of my Computers and I need to Add a new WinXP install to it's Grub2 Menu now. I'll see if I can find os-prober in Synaptic and install it if it's not already there. Well see how it goes...


Update... I came across the same Problem in a new install of Dabian 6. I found out exactly how to install or check that os-prober is installed, as it is in Debian 6. But, the thing is, that it is not being used unless you add this line to your /etc/default/grub file...


Here's my new Post with all of the info and instructions on making grub2 Recognize your other OS's...

My brand new Debian 6 grub menu had no mention of WinXP:O

Automatically adding other distributions to Fedora Grub using os-prober
Automatically adding other distributions to Fedora Grub using os-prober « Hedayat's Blog
Bug 678442 – Review Request: os-prober - Probes disks on the system for installed operating systems

No comments: