Hello everyone,
does anyone know how to update grub from another distro?
To be more clear. I have aptosid on sdc1 and grub is installed to sdc. I have another distro on sdb2 which I installed without grub as it is on the primary drive sdc. When I install a new kernel for the sdb2 distro how do I update grub without rebooting to aptosid?

Petr

_________________Petr

wofritz

Post subject:Posted: 07.07.2011, 05:09

Joined: 2010-09-11
Posts: 30
Location: Uetze/NDS/DE
Status: Offline

Hi Petr,

I am using a 2 stage boot:
My primary distri (aptosid) has grub in the MBR (sda), the secondary distris have grub installed in their root partitions. The primary grub has manual menue entries to start the secondary grubs.

Advantage:
If secondary distri updates its grub, it does not touch the primary grub.

Disadvantage:
Booting the secondary distris is a little bit slower because two grubs are involved.

Thank you for your replies.
I am aiming for a neater solution though A don't mind doing it manually but it would be nice to update the main grub from the second distro.

_________________Petr

arwa

Post subject:Posted: 07.07.2011, 12:10

Joined: 2010-09-11
Posts: 183

Status: Offline

If you use the chain loading than it works automatically already, but the entries will be updated for the grub in system2. So on boot you see:

1) grub menu of system1 that offers the chain loading menu entry for system2. (Also there will be direct boot links of the system2 kernels, but they are not updated automatically when upgrading system2.)

2) When choosing the entry for system2 you jump to the grub menu of system2. These entries will be updated when on upgrading system2.

If you really want to update the direct boot entries for system2 in the system1 grub menu, I think you have to write a small script that does this by using chroot automatically. (see the same page in the manual that I did send you a link for.) The question is, where to set this script into the upgrade-grub process of system2. Maybe there is a grup/update.d/ directory or something? Maybe it can be done by the scripts in /etc/grub.d/, but your script should not print out anything, because it will be set into grub menu config file of system2.

bfree

Post subject:Posted: 07.07.2011, 12:18

Team Member

Joined: 2010-08-26
Posts: 267

Status: Offline

If both systems were aptosid, or at least if the "second distro" was Debian sid, the you could probably use the chroot method as described in the manual to run update-grub in aptosid from the "second distro". The problem is that things like /run probably won't be the same right now between the two distros and there's always the scope for something to be different enough in the kernel and/or bind mounted filesystems for something to make a mess of it. So let's knock that idea on the head (unless distro #2 is sid).

So my idea for a plan B would be to add a custom file into /etc/grub.d/ on aptosid, and have it give you the option to launch a grub config file from your second distro. You probably won't want to use the actual normal grub config file from your second distro though, but instead you would probably want to cut it back so it only has the menu entries and as little else as you really need to launch your second distro. You might be able to just edit the /etc/grub.d on the second system to make it take care of producing a suitable sub-menu or you might find it easier to just maintain a minimal file manually with just the new entries you want. On top of that a menu entry to return to the main aptosid grub entry would be nice.

And then there is always plan C, just edit the /boot/grub/grub.cfg from aptosid manually to add your new entries. These will be preserved until you install a new grub or kernel in aptosid at which point os-prober should create the appropriate entires.

Finally I wouldn't use the chain loading method if your second distro uses grub2. Those complaints you would see about "reverting to blocklist" mode are troublesome and installing grub2 to a partition is strongly recommended against by the grub2 developers.

Tmtowtdi (the perl moto) is equally appropriate here, there is more then one way to do it.

arwa

Post subject:Posted: 07.07.2011, 12:52

Joined: 2010-09-11
Posts: 183

Status: Offline

bfree wrote:

The problem is that things like /run probably won't be the same ... So let's knock that idea on the head (unless distro #2 is sid).

Yes, I second this.

Quote:

So my idea for a plan B would be to add a custom file into /etc/grub.d/ on aptosid, and have it give you the option to launch a grub config file from your second distro.

This already should be the case already if I understand you right. This is done by the script /etc/grub.d/30_os-prober.

Quote:

And then there is always plan C, just edit the /boot/grub/grub.cfg from aptosid manually to add your new entries.

This should not be necessary. Because of the os-prober entry an update-grub should be enough.

Quote:

Finally I wouldn't use the chain loading method if your second distro uses grub2. Those complaints you would see about "reverting to blocklist" mode are troublesome and installing grub2 to a partition is strongly recommended against by the grub2 developers.

This is what I mentioned already. I do not know where the problems would occur. Does only the start of the grub menu of system2 not work? If this is the case you still could use the direct menu entries that were created by the os-prober.

If you have two hard drives you can install grub of system2 into the MBR of the second hard drive. With this the chain loading was not a problem at all.

Finally I wouldn't use the chain loading method if your second distro uses grub2. Those complaints you would see about "reverting to blocklist" mode are troublesome and installing grub2 to a partition is strongly recommended against by the grub2 developers.

Why is installing to a partition a problem at all? I don't understand.
Chainloading seems to be a reasonable way of using multiple distros There must be a lot of linux users who do it this way. Rebooting into a main distro everytime a kernel of the other distros is upgraded is a bit uncomfortable

However I can't make the chainloading to work
sdc is my main drive which I boot. There's aptosid on it and Grub in MBR.
sdb2 has aptosid xfce with Grub installed into its partition.
sdb3 has Fedora with Grub also installed into its partition.

Oh wow, you were right. That search line sorted it out I am so glad. Thank you very much.

_________________Petr

xetaprime

Post subject:Posted: 10.08.2011, 16:44

Joined: 2011-06-04
Posts: 81

Status: Offline

Out on a limb here. Install Remastersys a la 'Dragons' 'How to' or pm me... and use grub restore. You don't even have to use Remastersys. It's got me out of a few jams and jellies I tell ya. For future reference anyway.