LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-05-2011, 11:29 AM   #1
prudra
Member
 
Registered: Dec 2010
Location: Kolkata, India
Distribution: Now only Debian Stable Mate DE on laptop.
Posts: 68
Blog Entries: 1

Rep: Reputation: 8
GRUB2 Debian Squeeze change boot order?


//This post was pruned from http://www.linuxquestions.org/questi....php?p=4490802

I also have similar problem. As long as debian used what is now called grub-legacy (the lenny OS) as openSUSE-11.4 still uses I could edit the menu entries or change the order of booting (linux or windows) by making suitable changes in the /boot/grub/menu.lst file. In the present grub-2 version in debian-squeeze the changing of booting order could be effected by relative positioning of the present 20_linux and 30_otheros files in /etc/grub.d/ and then running #update-grub. But editing the menu-entry for the linux os has me baffled. And I could not locate a solution in the grub.html file.
I shall greatly appreciate help. Thanks.
P.Rudra.

___________________________________

Last edited by unSpawn; 10-05-2011 at 12:22 PM. Reason: //Pruned post
 
Old 10-05-2011, 12:45 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
Hello,

I am running openSuse 11.4 on my laptop, and I am able to change the boot order via /boot/grub/menu.1st; What is the exact issue you are running into? I have no problems on my end.

Cheers,

Josh
 
Old 10-05-2011, 01:00 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,072

Rep: Reputation: 955Reputation: 955Reputation: 955Reputation: 955Reputation: 955Reputation: 955Reputation: 955Reputation: 955
Quote:
Originally Posted by prudra View Post
In the present grub-2 version in debian-squeeze the changing of booting order could be effected by relative positioning of the present 20_linux and 30_otheros files in /etc/grub.d/ and then running #update-grub.
The link in your post doesn't work so I could not look up the other post for reference. You might want to recreate that link.

I assume you want to change the sequence in menus appearing in the GRUB menu, is that correct?

IIRC you cannot change the menu order of the various linux kernels. During building of the grub.cfg a script automagically loops through available kernels. Unless you change the program to traverse those kernel installation, the sequence doesn't change.

All other OS-es are detected in nn_something files in /etc/grub.d. The lower the sequence number of the nn_something, the earlier is appears in the list.

Additionally, you can change the default boot in /etc/default/grub.

jlinkels

Last edited by jlinkels; 10-05-2011 at 01:01 PM.
 
Old 10-05-2011, 08:53 PM   #4
prudra
Member
 
Registered: Dec 2010
Location: Kolkata, India
Distribution: Now only Debian Stable Mate DE on laptop.
Posts: 68
Blog Entries: 1

Original Poster
Rep: Reputation: 8
Quote:
Originally Posted by jlinkels View Post
The link in your post doesn't work so I could not look up the other post for reference. You might want to recreate that link.

I assume you want to change the sequence in menus appearing in the GRUB menu, is that correct?

IIRC you cannot change the menu order of the various linux kernels. During building of the grub.cfg a script automagically loops through available kernels. Unless you change the program to traverse those kernel installation, the sequence doesn't change.

All other OS-es are detected in nn_something files in /etc/grub.d. The lower the sequence number of the nn_something, the earlier is appears in the list.

Additionally, you can change the default boot in /etc/default/grub.

jlinkels
I actually want to edit the title in the menuentry like say

menuentry 'Ubuntu - Lucid, /cdots '

For Corp769: I already mentioned that openSUSE-11.4 has no problem because it still uses grub-legacy.
 
Old 10-05-2011, 09:19 PM   #5
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by prudra View Post
I actually want to edit the title in the menuentry like say

menuentry 'Ubuntu - Lucid, /cdots '

For Corp769: I already mentioned that openSUSE-11.4 has no problem because it still uses grub-legacy.
If you want to change how the title line if represented for the kernels in the main partition (the one that controls the MBR,) then you should edit the

/etc/grub.d/10_linux

file in this section:

Code:
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}"
  if ! ${recovery} ; then
      save_default_entry | sed -e "s/^/\t/"
  fi
If you want to change the title of kernels from partitions other than the main partition, then you want to edit the

/etc/grub.d/30_os-prober file

in this section:

Code:
    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})" --class gnu-linux --class gnu --class os {
EOF
 
1 members found this post helpful.
Old 10-06-2011, 05:48 AM   #6
prudra
Member
 
Registered: Dec 2010
Location: Kolkata, India
Distribution: Now only Debian Stable Mate DE on laptop.
Posts: 68
Blog Entries: 1

Original Poster
Rep: Reputation: 8
Quote:
Originally Posted by andrewthomas View Post
If you want to change how the title line if represented for the kernels in the main partition (the one that controls the MBR,) then you should edit the

/etc/grub.d/10_linux

file in this section:

Code:
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}"
  if ! ${recovery} ; then
      save_default_entry | sed -e "s/^/\t/"
  fi
If you want to change the title of kernels from partitions other than the main partition, then you want to edit the

/etc/grub.d/30_os-prober file

in this section:

Code:
    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})" --class gnu-linux --class gnu --class os {
EOF
There actually is my problem. Where exactly shall I insert the word 'Lucid' or any such epithet? I presume it is written in C+ of which I had a rudimentary acquaintance through Kernighan and Ritchie about 15 years ago.
Thanks.
P.Rudra.
 
Old 10-06-2011, 06:00 AM   #7
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
You have two options:

1) if you only have two different linux partitions, then you could change the $LLABEL variable in the 30_os-prober script of you grub-controlling partition.

2) if you have more than two different linux partitions, then you will have to change the $title variable in the 10_linux file on the Lucid partition
 
Old 10-06-2011, 09:30 PM   #8
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
An easier thing to do is to make a custom menu and disable the 10_linux script and those after it. This will speed up update-grub greatly to.

For all Debian based OS' this entry will work. It is a "symbolic" menu entry and will boot to the newest Debian based kernel in the defined partition. This will be true if you install a different Debian based OS on that partition and never touch the menu entry.
Code:
echo "Adding Squeezy on sda7" >&2 
cat << EOF
menuentry "Squeezy on sda7" {
    set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet splash
        initrd /initrd.img
}
EOF
The stuff between the "" marks is up to you, anything you want. The first is what you see when you run update-grub, the second what you see on your screen menu.

The stuff between the {}marks is what does the job. Make sure that the {} are in those exact positions.

Copy past that to your 40_custom file and save as 06_custom. Edit to match one of your installs. Make sure the permissions are for it to be executable. This will be at the top of your menu after you run as root;
Code:
update-grub
Reboot. Make sure it works. Assuming it does just copy it as many times as you need it, edit each, update-grub and never have to fool with it again.

If you want recovery mode entries replace "quiet splash" with "single" and edit the "title of OS" to indicate recovery.

I never put that in as hitting e when booting and editing the entry at that time is fine for the few times you ever need it.

After you are sure it all works disable all scripts starting with 10 and going up and update-grub again. You will notice that it is faster. You will also note that the grub.cfg file is a lot smaller and that the screen menu comes up faster because of that.
 
1 members found this post helpful.
Old 10-07-2011, 12:04 AM   #9
prudra
Member
 
Registered: Dec 2010
Location: Kolkata, India
Distribution: Now only Debian Stable Mate DE on laptop.
Posts: 68
Blog Entries: 1

Original Poster
Rep: Reputation: 8
Quote:
Originally Posted by widget View Post
An easier thing to do is to make a custom menu and disable the 10_linux script and those after it. This will speed up update-grub greatly to.

For all Debian based OS' this entry will work. It is a "symbolic" menu entry and will boot to the newest Debian based kernel in the defined partition. This will be true if you install a different Debian based OS on that partition and never touch the menu entry.
Code:
echo "Adding Squeezy on sda7" >&2 
cat << EOF
menuentry "Squeezy on sda7" {
    set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet splash
        initrd /initrd.img
}
EOF
The stuff between the "" marks is up to you, anything you want. The first is what you see when you run update-grub, the second what you see on your screen menu.

The stuff between the {}marks is what does the job. Make sure that the {} are in those exact positions.

Copy past that to your 40_custom file and save as 06_custom. Edit to match one of your installs. Make sure the permissions are for it to be executable. This will be at the top of your menu after you run as root;
Code:
update-grub
Reboot. Make sure it works. Assuming it does just copy it as many times as you need it, edit each, update-grub and never have to fool with it again.

If you want recovery mode entries replace "quiet splash" with "single" and edit the "title of OS" to indicate recovery.

I never put that in as hitting e when booting and editing the entry at that time is fine for the few times you ever need it.

After you are sure it all works disable all scripts starting with 10 and going up and update-grub again. You will notice that it is faster. You will also note that the grub.cfg file is a lot smaller and that the screen menu comes up faster because of that.
Thanks indeed. I think I have found an alternate way.
I just put the word Squeeze in the /etc/grub.d/10_linux file

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

It worked.
Thanks again. I did try meddling with 'quiet splash' in /etc/default/grub file by substituting 'quiet',
but then e option during booting did not help. Now I know that I have to put 'single'.
I'll try it now.
 
Old 10-07-2011, 12:21 AM   #10
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
Have FUN.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Messed UP Boot Order on dual-boot, don't know GRUB2, need help -- another's PC hilyard Linux - Newbie 4 06-25-2011 12:57 AM
[SOLVED] GRUB2 Read Error (Debian Squeeze) Dark_Wolf Linux - Software 36 03-07-2011 07:46 PM
Debian Squeeze Grub2 Problem -> error: out of partition michalng Debian 4 01-09-2011 02:41 AM
LXer: Debian Squeeze cleans up the grub2 wallpaper in desktop-base, and we're a bit closer to Stable LXer Syndicated Linux News 0 01-04-2011 11:01 PM
Need to change DEBIAN 5.0 & WINDOWS 2k/xp boot order on GRUB PC caf Debian 2 04-14-2009 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration