Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
pumrelOffline
15 Post subject: (solved) Multiboot - how to update-grub  PostPosted: 06.07.2011, 21:44



Joined: 2010-09-14
Posts: 117
Location: Czech Republic
Status: Offline
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
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
wofritzOffline
Post subject:   PostPosted: 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.

Regards,
Wolfgang
 
 View user's profile Send private message  
Reply with quote Back to top
arwaOffline
Post subject:   PostPosted: 07.07.2011, 07:12



Joined: 2010-09-11
Posts: 183

Status: Offline
The manual configuration for this in grub2 (chain loading) is described here:
http://manual.aptosid.com/en/sys-admin- ... m#multi-os

Installing grub not in the MBR, but in the partition leads to a warning on update-grub that this is not reliable or something. But here it works fine on 2 PCs.
 
 View user's profile Send private message  
Reply with quote Back to top
pumrelOffline
Post subject:   PostPosted: 07.07.2011, 10:04



Joined: 2010-09-14
Posts: 117
Location: Czech Republic
Status: Offline
Thank you for your replies.
I am aiming for a neater solution though Sad A don't mind doing it manually but it would be nice to update the main grub from the second distro.

_________________
Petr
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
arwaOffline
Post subject:   PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
bfreeOffline
Post subject:   PostPosted: 07.07.2011, 12:18
Team Member


Joined: 2010-08-26
Posts: 258

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.
 
 View user's profile Send private message  
Reply with quote Back to top
arwaOffline
Post subject:   PostPosted: 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.

Greetins,
arwa
 
 View user's profile Send private message  
Reply with quote Back to top
pumrelOffline
Post subject:   PostPosted: 10.08.2011, 14:01



Joined: 2010-09-14
Posts: 117
Location: Czech Republic
Status: Offline
      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.

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 Smile 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 Sad

However I can't make the chainloading to work Sad
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.

This is my /etc/grub.d/40_custom file.
      Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "FEDORA" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd1,msdos3)'
chainloader +1
}

menuentry "APTOSID XFCE" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd1,msdos2)'
chainloader +1
}
 


This is my grub.cfg
      Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd2,msdos1)'
search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd2,msdos1)'
  search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
  set locale_dir=($root)/boot/grub/locale
  set lang=cs_CZ
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 3.0-1.slh.4-aptosid-amd64' --class debian --class gnu-linux --class gnu --class os {
   insmod gzio
   insmod part_msdos
   insmod ext2
   set root='(hd2,msdos1)'
   search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
   echo   'Loading Linux 3.0-1.slh.4-aptosid-amd64 ...'
   linux   /boot/vmlinuz-3.0-1.slh.4-aptosid-amd64 root=UUID=5caa4429-eda7-43a9-9efd-ff7a1b1a035a ro  quiet
   echo   'Loading initial ramdisk ...'
   initrd   /boot/initrd.img-3.0-1.slh.4-aptosid-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
   insmod part_msdos
   insmod ext2
   set root='(hd2,msdos1)'
   search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
   linux16   /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
   insmod part_msdos
   insmod ext2
   set root='(hd2,msdos1)'
   search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
   linux16   /boot/memtest86+.bin console=ttyS0,115200n8
}
menuentry "Memory test (memtest86+, experimental multiboot)" {
   insmod part_msdos
   insmod ext2
   set root='(hd2,msdos1)'
   search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
   multiboot   /boot/memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
   insmod part_msdos
   insmod ext2
   set root='(hd2,msdos1)'
   search --no-floppy --fs-uuid --set=root 5caa4429-eda7-43a9-9efd-ff7a1b1a035a
   multiboot   /boot/memtest86+_multiboot.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
   insmod part_msdos
   insmod ntfs
   set root='(hd0,msdos1)'
   search --no-floppy --fs-uuid --set=root 4CD67D9AD67D84CC
   chainloader +1
}
menuentry "Debian GNU/Linux, with Linux 3.0-1.slh.4-aptosid-amd64 (on /dev/sdc2)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos2)'
   search --no-floppy --fs-uuid --set=root 6a54eb49-c9ad-48c1-9213-491dd3eda08e
   linux /boot/vmlinuz-3.0-1.slh.4-aptosid-amd64 root=UUID=6a54eb49-c9ad-48c1-9213-491dd3eda08e ro quiet
   initrd /boot/initrd.img-3.0-1.slh.4-aptosid-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.39-3.slh.1-aptosid-amd64 (on /dev/sdc2)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos2)'
   search --no-floppy --fs-uuid --set=root 6a54eb49-c9ad-48c1-9213-491dd3eda08e
   linux /boot/vmlinuz-2.6.39-3.slh.1-aptosid-amd64 root=UUID=6a54eb49-c9ad-48c1-9213-491dd3eda08e ro quiet
   initrd /boot/initrd.img-2.6.39-3.slh.1-aptosid-amd64
}
menuentry "Fedora (2.6.40-4.fc15.x86_64) (on /dev/sdc3)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos3)'
   search --no-floppy --fs-uuid --set=root 331035bf-1529-42d9-a391-79185a2b9f35
   linux /boot/vmlinuz-2.6.40-4.fc15.x86_64 ro root=UUID=331035bf-1529-42d9-a391-79185a2b9f35 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=cz-us-qwertz nomodeset rhgb quiet
   initrd /boot/initramfs-2.6.40-4.fc15.x86_64.img
}
menuentry "Fedora (2.6.38.6-26.rc1.fc15.x86_64) (on /dev/sdc3)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos3)'
   search --no-floppy --fs-uuid --set=root 331035bf-1529-42d9-a391-79185a2b9f35
   linux /boot/vmlinuz-2.6.38.6-26.rc1.fc15.x86_64 ro root=UUID=331035bf-1529-42d9-a391-79185a2b9f35 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=cz-us-qwertz nomodeset rhgb quiet
   initrd /boot/initramfs-2.6.38.6-26.rc1.fc15.x86_64.img
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "FEDORA" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd1,msdos3)'
chainloader +1
}

menuentry "APTOSID XFCE" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd1,msdos2)'
chainloader +1
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


However, when I use the FEDORA entry it says that there is no such partition and when I use the APTOSID XFCE entry it says it can't find BOOTMGR.

What am I doing wrong?

_________________
Petr
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
bfreeOffline
Post subject:   PostPosted: 10.08.2011, 14:09
Team Member


Joined: 2010-08-26
Posts: 258

Status: Offline
I would presume '(hd1.msdos2)' and '(hd1,msdos3)' are wrong and is usually corrected by the search line so put the search line into your entries in your 40_custom files and try again.
 
 View user's profile Send private message  
Reply with quote Back to top
pumrelOffline
Post subject:   PostPosted: 10.08.2011, 14:38



Joined: 2010-09-14
Posts: 117
Location: Czech Republic
Status: Offline
Oh wow, you were right. That search line sorted it out Smile I am so glad. Thank you very much.

_________________
Petr
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
xetaprimeOffline
Post subject:   PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
piperOffline
Post subject:   PostPosted: 10.08.2011, 21:25
Moderator


Joined: 2010-09-11
Posts: 480
Location: cheektowaga, ny
Status: Offline
lol i an'tt touching that

_________________
debian sid | apt-get into it
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio