Modifier l'ordre de démarrage en multiboot sur Grub2

Bonjour,
J’ai trouvé quelques (et le mot est faible) posts traitant de ce même sujet mais je ne m’en sors toujours pas…
J’avais un vieux windows XP trainant sur une de mes partitions.
J’ai installé ma Debian 6 + le grub sur le MBR.
J’ai ensuite installé d’autres OS (ubuntu 11.04, openSuse puis Fedora), chacun sur une partition différente et sans écraser le grub.
De retour sur Debian, je fais un os-prober, et tous mes OS sont détectés. OK

Au boot, le grub m’affiche ceci :
Debian 2.6.32…
Debian + kernel (mode …)
Microsoft Windaube XP (on /dev/sda3)
openSuse 11.4 (on sda6)
Failsafe (sda6)
ubuntu 2.6.38 (sda7)
Ubuntu + kernel (mode…) (sda7)
Fedora 15 (on sda8)

Vu l’utilisation que je fais de mon PC, j’aimerais obtenir ceci :
Fedora 15 (on sda8)
ubuntu 2.6.38 (sda7)
openSuse 11.4 (on sda6)
Debian 2.6.32…
Microsoft Windaube XP (on /dev/sda3)

Avec la sélection faite par défaut sur Fedora (que je teste beaucoup en ce moment).

Sur ubuntu, j’ai testé grub-customizer mais je n’ai pas osé enregistrer mes changements (qui d’ailleurs ne me convenaient pas).

Sur debian, en regardant mon /etc/grub.d, j’ai ceci :

00_header

05_debian_theme

10_linux : (qui gère apparemment l’OS Debian)

#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix=/usr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib

export TEXTDOMAIN=grub
export TEXTDOMAINDIR=${prefix}/share/locale

CLASS="--class gnu-linux --class gnu --class os"

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
  OS=GNU/Linux
else
  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
  CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}"
fi

# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
  /dev/loop/*|/dev/loop[0-9])
    GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
  ;;
esac

if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
    || uses_abstraction "${GRUB_DEVICE}" lvm; then
  LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
  LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi

linux_entry ()
{
  os="$1"
  version="$2"
  recovery="$3"
  args="$4"
  if ${recovery} ; then
    title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
  else
    title="$(gettext_quoted "%s, with Linux %s")"
  fi
  printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
  save_default_entry | sed -e "s/^/\t/"

  # Use ELILO's generic "efifb" when it's known to be available.
  # FIXME: We need an interface to select vesafb in case efifb can't be used.
  if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ]; then
	  cat << EOF
	set gfxpayload=$GRUB_GFXPAYLOAD_LINUX
EOF
  fi

  if [ -z "${prepare_boot_cache}" ]; then
    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
  fi
  printf '%s\n' "${prepare_boot_cache}"
  message="$(gettext_printf "Loading Linux %s ..." ${version})"
  cat << EOF
	echo	'$message'
	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
  if test -n "${initrd}" ; then
    message="$(gettext_printf "Loading initial ramdisk ...")"
    cat << EOF
	echo	'$message'
	initrd	${rel_dirname}/${initrd}
EOF
  fi
  cat << EOF
}
EOF
}

list=`for i in /boot/vmlinu[zx]-* /vmlinu[zx]-* ; do
        if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
      done`
prepare_boot_cache=

while [ "x$list" != "x" ] ; do
  linux=`version_find_latest $list`
  echo "Found linux image: $linux" >&2
  basename=`basename $linux`
  dirname=`dirname $linux`
  rel_dirname=`make_system_path_relative_to_its_root $dirname`
  version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
  alt_version=`echo $version | sed -e "s,\.old$,,g"`
  linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"

  initrd=
  for i in "initrd.img-${version}" "initrd-${version}.img" \
	   "initrd-${version}" "initramfs-${version}.img" \
	   "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
	   "initrd-${alt_version}" "initramfs-${alt_version}.img"; do
    if test -e "${dirname}/${i}" ; then
      initrd="$i"
      break
    fi
  done
  if test -n "${initrd}" ; then
    echo "Found initrd image: ${dirname}/${initrd}" >&2
  else
    # "UUID=" magic is parsed by initrds.  Since there's no initrd, it can't work here.
    linux_root_device_thisversion=${GRUB_DEVICE}
  fi

  linux_entry "${OS}" "${version}" false \
      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
  if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
    linux_entry "${OS}" "${version}" true \
	"single ${GRUB_CMDLINE_LINUX}"
  fi

  list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done

20_linux_xen

30_os_prober : (qui gère, d’après ce que j’ai compris tous les autres OS)

#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib

. ${libdir}/grub/grub-mkconfig_lib

if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  exit 0
fi

if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
  # missing os-prober and/or linux-boot-prober
  exit 0
fi

OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
if [ -z "${OSPROBED}" ] ; then
  # empty os-prober output, nothing doing
  exit 0
fi

osx_entry() {
        cat << EOF
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
EOF
	save_default_entry | sed -e "s/^/\t/"
	prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
	cat << EOF
        load_video
        set do_resume=0
        if [ /var/vm/sleepimage -nt10 / ]; then
           if xnu_resume /var/vm/sleepimage; then
             set do_resume=1
           fi
        fi
        if [ \$do_resume = 0 ]; then
           xnu_uuid ${OSXUUID} uuid
           if [ -f /Extra/DSDT.aml ]; then
              acpi -e /Extra/DSDT.aml
           fi
           $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
           if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
              xnu_mkext /System/Library/Extensions.mkext
           else
              xnu_kextdir /System/Library/Extensions
           fi
           if [ -f /Extra/Extensions.mkext ]; then
              xnu_mkext /Extra/Extensions.mkext
           fi
           if [ -d /Extra/Extensions ]; then
              xnu_kextdir /Extra/Extensions
           fi
           if [ -f /Extra/devprop.bin ]; then
              xnu_devprop_load /Extra/devprop.bin
           fi
           if [ -f /Extra/splash.jpg ]; then
              insmod jpeg
              xnu_splash /Extra/splash.jpg
           fi
           if [ -f /Extra/splash.png ]; then
              insmod png
              xnu_splash /Extra/splash.png
           fi
           if [ -f /Extra/splash.tga ]; then
              insmod tga
              xnu_splash /Extra/splash.tga
           fi
        fi
}
EOF
}

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  echo "Found ${LONGNAME} on ${DEVICE}" >&2

  case ${BOOT} in
    chain)

      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
      save_default_entry | sed -e "s/^/\t/"
      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"

      case ${LONGNAME} in
	Windows\ Vista*|Windows\ 7*)
	;;
	*)
	  cat << EOF
	drivemap -s (hd0) \${root}
EOF
	;;
      esac

      cat <<EOF
	chainloader +1
}
EOF
    ;;
    linux)
      LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
      prepare_boot_cache=

      for LINUX in ${LINUXPROBED} ; do
        LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
        LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
        LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
        LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
        LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
        LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

        if [ -z "${LLABEL}" ] ; then
          LLABEL="${LONGNAME}"
        fi

	if [ "${LROOT}" != "${LBOOT}" ]; then
	  LKERNEL="${LKERNEL#/boot}"
	  LINITRD="${LINITRD#/boot}"
	fi

        cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" {
EOF
	save_default_entry | sed -e "s/^/\t/"
	if [ -z "${prepare_boot_cache}" ]; then
	  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
	fi
	printf '%s\n' "${prepare_boot_cache}"
	cat <<  EOF
	linux ${LKERNEL} ${LPARAMS}
EOF
        if [ -n "${LINITRD}" ] ; then
          cat << EOF
	initrd ${LINITRD}
EOF
        fi
        cat << EOF
}
EOF
      done
    ;;
    macosx)
      OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
      osx_entry xnu_kernel 32
      osx_entry xnu_kernel64 64
    ;;
    hurd)
      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
      save_default_entry | sed -e "s/^/\t/"
      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
      mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`"
      grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
      case "${grub_fs}" in
	*fs)	hurd_fs="${grub_fs}" ;;
	*)	hurd_fs="${grub_fs}fs" ;;
      esac
      cat << EOF
	multiboot /boot/gnumach.gz root=device:${mach_device}
	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
			--multiboot-command-line='\${kernel-command-line}' \\
			--host-priv-port='\${host-port}' \\
			--device-master-port='\${device-port}' \\
			--exec-server-task='\${exec-task}' -T typed '\${root}' \\
			'\$(task-create)' '\$(task-resume)'
	module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
}
EOF
    ;;
    *)
      echo "  ${LONGNAME} is not yet supported by grub-mkconfig." >&2
    ;;
  esac
done

40_custom

41_custom

et un fichier README

Le problème que j’ai rencontré avec grub-customizer est que je peux modifier l’ordre à l’intérieur d’un fichier, mais pas “intercaler” le 10_linux (Debian) à l’intérieur du 30_custom (entre openSuse et XP).

Voila si quelqu’un a une solution (par édition des fichiers de préférence) :unamused:

$ ls /etc/grub.d/*

/etc/grub.d/00_header /etc/grub.d/30_os-prober /etc/grub.d/05_debian_theme /etc/grub.d/40_custom /etc/grub.d/10_linux /etc/grub.d/41_custom /etc/grub.d/20_linux_xen /etc/grub.d/README

Crées un fichier /etc/grub.d/06_après_05_avant_10
contenant le nécessaire pour démarrer
Fedora 15 (on sda8)
ubuntu 2.6.38 (sda7)
openSuse 11.4 (on sda6)
( Repère et recopie les morceaux se rapportant à ces OS dans /boot/grub/grub.cfg au besoin)
Les entrées debian rétrograderont après la mise à jour de grub.

Alors, j’ai ajouté le fichier /etc/grub.d/06_modif, qui contient ceci :

#! /bin/sh
set -e

# modification de l'ordre au boot :

menuentry "Fedora release 15 (Lovelock) (on /dev/sda8)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos8)'
	search --no-floppy --fs-uuid --set 0ab42534-0e25-46b7-be14-3b3404b66c3d
	linux /boot/vmlinuz-2.6.38.6-26.rc1.fc15.i686.PAE root=/dev/sda8
	initrd /boot/initramfs-2.6.38.6-26.rc1.fc15.i686.PAE.img
}

menuentry "Ubuntu, avec Linux 2.6.38-8-generic (on /dev/sda7)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos7)'
	search --no-floppy --fs-uuid --set 01e4daf8-253f-45ab-9270-ecf57a38db4d
	linux /boot/vmlinuz-2.6.38-8-generic root=UUID=01e4daf8-253f-45ab-9270-ecf57a38db4d ro quiet splash vt.handoff=7
	initrd /boot/initrd.img-2.6.38-8-generic
}

menuentry "openSUSE 11.4 (on /dev/sda6)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set 52298ee6-6a95-4b04-86d1-da6621c8a83b
	linux /boot/vmlinuz-2.6.37.1-1.2-default root=/dev/disk/by-id/ata-Hitachi_HTS723216L9A360_080801FC1200NCG04BRC-part6 resume=/dev/disk/by-id/ata-Hitachi_HTS723216L9A360_080801FC1200NCG04BRC-part1 splash=silent quiet showopts vga=0x317
	initrd /boot/initrd-2.6.37.1-1.2-default
}

Mais un update-grub2 me retourne une erreur (06_modif : 6: menu entry not found)

et le grub.cfg n’a pas changé :

#
# 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='(hd0,msdos5)'
search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b
set locale_dir=($root)/boot/grub/locale
set lang=fr
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, avec Linux 2.6.32-5-686' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos5)'
	search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b
	echo	'Chargement de Linux 2.6.32-5-686 ...'
	linux	/boot/vmlinuz-2.6.32-5-686 root=UUID=6519be5b-2b3d-4053-97c0-757c3947868b ro  quiet
	echo	'Chargement du disque mémoire initial ...'
	initrd	/boot/initrd.img-2.6.32-5-686
}
menuentry 'Debian GNU/Linux, avec Linux 2.6.32-5-686 (mode de dépannage)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos5)'
	search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b
	echo	'Chargement de Linux 2.6.32-5-686 ...'
	linux	/boot/vmlinuz-2.6.32-5-686 root=UUID=6519be5b-2b3d-4053-97c0-757c3947868b ro single 
	echo	'Chargement du disque mémoire initial ...'
	initrd	/boot/initrd.img-2.6.32-5-686
}
### END /etc/grub.d/10_linux ###

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

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professionnel (on /dev/sda3)" {
	insmod part_msdos
	insmod ntfs
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set 94cce4facce4d80e
	drivemap -s (hd0) ${root}
	chainloader +1
}
menuentry "openSUSE 11.4 (on /dev/sda6)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set 52298ee6-6a95-4b04-86d1-da6621c8a83b
	linux /boot/vmlinuz-2.6.37.1-1.2-default root=/dev/disk/by-id/ata-Hitachi_HTS723216L9A360_080801FC1200NCG04BRC-part6 resume=/dev/disk/by-id/ata-Hitachi_HTS723216L9A360_080801FC1200NCG04BRC-part1 splash=silent quiet showopts vga=0x317
	initrd /boot/initrd-2.6.37.1-1.2-default
}
menuentry "Failsafe -- openSUSE 11.4 (on /dev/sda6)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set 52298ee6-6a95-4b04-86d1-da6621c8a83b
	linux /boot/vmlinuz-2.6.37.1-1.2-default root=/dev/disk/by-id/ata-Hitachi_HTS723216L9A360_080801FC1200NCG04BRC-part6 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x317
	initrd /boot/initrd-2.6.37.1-1.2-default
}
menuentry "Ubuntu, avec Linux 2.6.38-8-generic (on /dev/sda7)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos7)'
	search --no-floppy --fs-uuid --set 01e4daf8-253f-45ab-9270-ecf57a38db4d
	linux /boot/vmlinuz-2.6.38-8-generic root=UUID=01e4daf8-253f-45ab-9270-ecf57a38db4d ro quiet splash vt.handoff=7
	initrd /boot/initrd.img-2.6.38-8-generic
}
menuentry "Ubuntu, avec Linux 2.6.38-8-generic (mode de dépannage) (on /dev/sda7)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos7)'
	search --no-floppy --fs-uuid --set 01e4daf8-253f-45ab-9270-ecf57a38db4d
	linux /boot/vmlinuz-2.6.38-8-generic root=UUID=01e4daf8-253f-45ab-9270-ecf57a38db4d ro single
	initrd /boot/initrd.img-2.6.38-8-generic
}
menuentry "Fedora release 15 (Lovelock) (on /dev/sda8)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos8)'
	search --no-floppy --fs-uuid --set 0ab42534-0e25-46b7-be14-3b3404b66c3d
	linux /boot/vmlinuz-2.6.38.6-26.rc1.fc15.i686.PAE root=/dev/sda8
	initrd /boot/initramfs-2.6.38.6-26.rc1.fc15.i686.PAE.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.
### 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 ###

:confused:

Le fichier /etc/default/grub permet de changer certains paramètres de GRUB2. Ces paramètres sont ceux que l’on pouvait trouver dans l’en-tête de l’ancien menu.lst, avant les différentes entrées du menu de démarrage. Voici ce que l’on peut paraméter :

GRUB_DEFAULT=0

Permet de définir l’entrée par défaut dans le menu de démarrage. La valeur peut-être un nombre naturel (définissant la position) ou saved. Ce dernier indique que l’entrée choisie au dernier démarrage sera la prochaine entrée par défaut. Lorsque cette ligne est commentée, la valeur par défaut est 0.

etc …

Le début de ton fichier 06_modif

#! /bin/sh set -e
est comme celui de 30_os_prober, recopie le début de 40_custom comme indiqué

[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.[/code]

[quote=“etxeberrizahar”]Le début de ton fichier 06_modif

#! /bin/sh set -e
est comme celui de 30_os_prober, recopie le début de 40_custom comme indiqué

[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.[/code][/quote]

Merci j’essaierai ça.
Comment ça se passe lorsqu’un nouveau kernel, sur Debian par exemple, est mis à jour ?
Sera-t-il inséré à la suite de l’entrée “debian” existante ou bien en début/fin de liste ?
Par exemple :
Debian 2.7
Fedora

Debian 2.6
Windaube

Ou :
Fedora

Debian 2.6
Debian 2.7
Windaube

Lorsque tu lis grub.cfg, tu remarques l’ordre

BEGIN /etc/grub.d/10_linux

blablabla

END /etc/grub.d/10_linux

BEGIN /etc/grub.d/20_linux_xen

En vertu de ce que 06 passe avant 10,20,30,ou 40 ce qui se trouve en 06_modif passera toujours avant les entrées debian en 10_linux quels que soient les numéros de versions.
À l’intérieur de la section 10, la version la plus récente au numéro le plus haut sera en tête.

je dis peut-être une bétise mais j’aurais simplement essayé de renommer le 30_os_prober en 06_os_prober pour voir

Je suppose que remonter le 30_os_prober au dessus du 10_linux ne ferait que mettre debian en dernier… Moi je le veux en avant dernier (c’est sur je pourrais survivre sans ça mais bon 8) )

dans ce cas il ne te reste que la solution de tout customiser à la main
et ne pas utiliser os-prober

ou alors tu fais ton grub a partir de ta distro principale qui semble être fedora mais ce sera en grub1

C’est sûr qu’il faut y aller à la main …

Solution semi-automatisée : démarrer /vmlinuz de debian.
/vmlinuz est un lien vers le dernier noyau installé, tu n’as pas à t’occuper du numéro de version.
idem /initrd.img
Ajoute ça à la place que tu veux dans 06_modif

[code]
menuentry ‘Debian /vmlinuz je ne sais quelle version’ --class debian --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root=’(hd0,msdos5)'
search --no-floppy --fs-uuid --set 6519be5b-2b3d-4053-97c0-757c3947868b

linux /vmlinuz root=UUID=6519be5b-2b3d-4053-97c0-757c3947868b ro quiet
initrd /initrd.img
}[/code]

Avec 5 OS à gérer dont 4 GNU/Linux, vouloir gérer cela à partir d’un grub sur un des GNU/Linux est quasiment ingérable car à chaque Upgrade de kernel sur un des Linux il faudra upgrader les grubs sur tous les OS et en particulier l’OS dit “principal”. Cela tient de la “paranoia”.

Il serait beaucoup plus simple d’installer les Grub de chaque OS GNU/Linux sur leur partition système et d’utiliser un bootmanager sur le MBR comme GAG ou simplement celui de Windows.

C’est la 1ère fois que j’installe + de 2 OS (j’ai habituellement le vieux XP + un GNU/Linux) donc le fait “d’upgrader les grubs sur chaque OS” me parait un peu flou.
Les upgrades de Debian devraient être vu automatiquement dans Grub mais à chaque upgrade sur l’un des 3 autres OS, je devrai refaire un os-prober + update-grub2 sur Debian ?
En fait, je n’avais tout simplement pas pensé à ça :open_mouth: Il est vrai qu’installer le grub sur chaque partition aurait peut être été plus sage, mais j’imagine qu’il est trop tard maintenant…

Il n’est pas trop tard pour installer grub sur toutes les partitions et refaire l’installation de grub sur le MBR pour que Fedora gére grub en premier rideau.
Il faudra que tu interviennes sur chaque partition qui accueille un linux et démarres les grub en cascade.

Pour en revenir à la façon que je t’indiquais, non ce n’est pas automatique, il faut y aller à l’huile de coude et éditer à neuf 06_modif pour une version de noyau qui changerait dans Fedora/ubuntu/Suse.
C’est pas la mort, grâce à 30_os-prober le boulot est maché, il y a plus “paranoïaque” comme intervention

c’est le système du chainloader que je t’avais suggéré sur fedora-fr

On peut effectivement utiliser le chainloader mais il faudra dans ce cas neutraliser le script 30_os-prober sur chaque OS Gnu/linux

#Desactivation de os-prober avec la valeur true GRUB_DISABLE_OS_PROBER=true

et créer un 40_custom contenant les “chainloader” pour les différents autres OS Gnu/linux sur chacun des OS GNU/Linux et surtout pour le Grub du MBR

menuentry "Nom OS1" { set root=(hdx,y) chainloader +1 }

etc …

Merci pour tous vos conseils. Je pense opter pour la solution de figaro en installant le grub de chaque OS Gnu/linux sur la partition dédiée et GAG sur le MBR.
J’ai deja fait l’essai avec Debian et ça marche nickel.
Pour Fedora ça ne devrait pas poser de problème.
En revanche, sur Ubuntu et OpenSuse, je ne vois pas comment (lors de l’installation ou bien post-install) installer le grub ailleurs que sur le MBR.
Mais cela ne relève plus de ce forum… sauf si un expert Ubuntu et OpenSuse rode dans les parages :smiley:

Déplacer le grub depuis le MBR sur la partition système se fait d ela même façon pour Ubuntu et Opensuse que que pour Debian.

[quote]
Si Grub est installé dans le MBR, vous devrez l’installer sur la partition. Vous pourrez utiliser l’excellente procédure que m’a proposée cep :

Ouvrez un terminal puis :

sudo grub --batch

grub> find /boot/grub/stage1

Cette commande retourne le numéro de la partition sur laquelle est installée Ubuntu, de la forme (hd0,5). C’est utile pour connaître la bonne manière de désigner la partition, pour ne pas se tromper !

grub> root (hd?,?)

Renseignez ici la partition sur laquelle est installée Ubuntu, dans notre cas : root (hd0,5)

grub> setup (hd?,?)

C’est ici que vous déterminez où installer Grub :

setup (hd0) installe Grub dans le MBR
setup (hd0,4) installe Grub sur la première partition logique du disque 0 (hd0,4) que l'on nomme aussi hda5
setup (hd1,5) installe Grub sur la deuxième partition logique du disque 1. Utile seulement si Ubuntu est installée sur (hd1,5) que l'on nomme aussi hdb6

Vous choisirez setup (hd0,5) qui est, dans notre exemple, la partition contenant Ubuntu

grub> quit

Pour sortir de l’invite de Grub

exit

Pour fermer le terminal [/quote]

Nickel, et cela peu importe la version de grub (grub2 sur debian, ubuntu, grub1 ou grub legacy sur opensuse, et pour fedora… ben je ne sais pas :smiley: ) ?

Cela doit fonctionner aussi pour Fedora, Grub est indépendant de l’OS et à moins que les développeurs d’une distribution ne modifient grub ce dont je ne vois pas l’intérêt.
Ce qui compte c’est l’endroit où se trouve le fichier stage1 sur la bonne partition /boot/grub/stage1 vers laquelle on va faire pointer grub.

GRUB = GRand Unified Bootloader