LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-28-2009, 06:35 AM   #1
guns90
LQ Newbie
 
Registered: Mar 2009
Posts: 27

Rep: Reputation: 0
Changing default OS in grub2.


Good Morning. I have Windows Vista on sda and Ubuntu 9.10 and Parsix 3.0 on sdb. I just don't understand how grub2 works. When booting, grub2 still gives me a page for ~10 seconds that shows all three OS's and allows me the opportuniy to arrow dow to one to boot into it, but it has Ubuntu set as the default OS, and my wife wants Vista as default. Gotta keep her happy, you know. How can I make Vista the default OS in grub2? Thanks.
 
Old 10-28-2009, 06:41 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
edit
Code:
/boot/grub/menu.lst
and change the default=0
to the number you want
0 is the first entry in the list

Quote:
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
 
Old 10-28-2009, 07:49 AM   #3
guns90
LQ Newbie
 
Registered: Mar 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Hi Repo. I thank you for information, but that doesn't work in this case. That is what I used to do in my older version of Ubuntu that used grub. This version of Ubuntu uses grub2. It doesn't have a menu.lst.
 
Old 10-28-2009, 07:53 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Take a look at
http://ubuntuforums.org/showthread.php?t=1195275
 
Old 10-28-2009, 08:34 AM   #5
aus9
LQ Addict
 
Registered: Oct 2003
Location: Australia
Distribution: MX 18/ TC64
Posts: 5,301

Rep: Reputation: Disabled
hi

default changes to set default x and still counts x from zero.

I think the preferred way is to edit /etc/grub.d/00_header in this section
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=(changethis) ; fi

using root powers and then run update-grub....then check /boot/grub/grub.cfg to see if it changed.

Make a backup of the etc file before changing it in case things go wrong pls
 
Old 10-28-2009, 10:04 AM   #6
guns90
LQ Newbie
 
Registered: Mar 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Thanks aus9. I appreciate your response, but I'm beginning to think that I need to just give up on linux. I had a stroke a while back and my memory took a major hit. Before the stroke, I think I would have understood your response, but its greek to me now. If my memory starts working better, maybe I'll give this another try, but for now, I just can't learn anything. Maybe I'll buy a Mac. Thanks again.
 
Old 10-28-2009, 06:27 PM   #7
aus9
LQ Addict
 
Registered: Oct 2003
Location: Australia
Distribution: MX 18/ TC64
Posts: 5,301

Rep: Reputation: Disabled
sorry for being geek.

simple solution...manually edit /boot/grub/grub.cfg to

add a line at top (or edit the line)

set default N...where n is counting from zero to reach your menuentry for ms

2) when you upgrade your kernel or grub2....you may need to manually edit as your scripts were not fixed.

3) Otherwise good luck.

On a personal note...I believe the human mind...if given puzzles to solve...games to play...it can repair itself but it takes time

good luck
 
Old 10-29-2009, 06:56 PM   #8
jimonyzangs
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
as long as you only have vista and ubuntu 9.10 installed you should be able to do this

"sudo gedit /etc/default/grub"

then edit the line -
GRUB_DEFAULT=0
to
GRUB_DEFAULT=4

save the file, then run
"sudo update-grub"


and hopefully vista will boot first :-)

**edit**
sorry i forgot that you have parsix as well
it depends on where parsix and vista are in your grub menu at boot up

change the number on GRUB_DEFAULT= to the line number of vista minus 1
for example vista is on the 5th line in my grub menu so that why i suggested 4 to you initially

i.e. my grub menu
ubuntu =0
ubuntu recover =1
memtest =2
another memtest =3
Vista =4

Last edited by jimonyzangs; 10-29-2009 at 07:20 PM.
 
Old 09-10-2010, 01:45 PM   #9
majic
LQ Newbie
 
Registered: Oct 2004
Location: UK
Distribution: Debian, sometimes Ubuntu
Posts: 11

Rep: Reputation: 0
I thought I'd share my thoughts - this way preserves Windows as the default without having to change much else (and will hopefully remain that way after performing various kernel upgrades)

Grub2 relies on a sequence of shell scripts to generate the grub.cfg file, the shell scripts are run in alphabetical order and are found in /etc/grub.d

Code:
majic@hephaestus:~$ cd /etc/grub.d
majic@hephaestus:/etc/grub.d$ ls
00_header        10_linux      30_os-prober  41_custom
05_debian_theme  20_linux_xen  40_custom     README
majic@hephaestus:/etc/grub.d$
By shuffling these around, you can make it generate the grub.cfg file in the order that you want. For me, I tend to use linux less commonly than windows, but I play a fair few games on windows that means it makes sense for me to use windows as my primary boot

Open a root terminal and cd /etc/grub.d

Code:
hephaestus:/etc/grub.d# mv 10_linux 20_linux
hephaestus:/etc/grub.d# mv 20_linux_xen 30_linux_xen
hephaestus:/etc/grub.d# mv 30_os-prober 10_os-prober
hephaestus:/etc/grub.d# ls
00_header	 10_os-prober  30_linux_xen  41_custom
05_debian_theme  20_linux      40_custom     README
finally execute the update-grub command

Code:
hephaestus:/etc/grub.d# update-grub
Generating grub.cfg ...
Found background image: moreblue-orbit-grub.png
Found Windows 7 (loader) on /dev/sda1
Found linux image: /boot/vmlinuz-2.6.35.4-majic
Found initrd image: /boot/initrd.img-2.6.35.4-majic
Found linux image: /boot/vmlinuz-2.6.26-2-amd64
Found initrd image: /boot/initrd.img-2.6.26-2-amd64
done
You should find that windows 7 now appears at the top of the list - hope this helps
 
Old 05-30-2012, 10:30 PM   #10
twaddler
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Thank you!

Quote:
Originally Posted by majic View Post
I thought I'd share my thoughts - this way preserves Windows as the default without having to change much else (and will hopefully remain that way after performing various kernel upgrades)

Grub2 relies on a sequence of shell scripts to generate the grub.cfg file, the shell scripts are run in alphabetical order and are found in /etc/grub.d

Code:
majic@hephaestus:~$ cd /etc/grub.d
majic@hephaestus:/etc/grub.d$ ls
00_header        10_linux      30_os-prober  41_custom
05_debian_theme  20_linux_xen  40_custom     README
majic@hephaestus:/etc/grub.d$
By shuffling these around, you can make it generate the grub.cfg file in the order that you want. For me, I tend to use linux less commonly than windows, but I play a fair few games on windows that means it makes sense for me to use windows as my primary boot

Open a root terminal and cd /etc/grub.d

Code:
hephaestus:/etc/grub.d# mv 10_linux 20_linux
hephaestus:/etc/grub.d# mv 20_linux_xen 30_linux_xen
hephaestus:/etc/grub.d# mv 30_os-prober 10_os-prober
hephaestus:/etc/grub.d# ls
00_header	 10_os-prober  30_linux_xen  41_custom
05_debian_theme  20_linux      40_custom     README
finally execute the update-grub command

Code:
hephaestus:/etc/grub.d# update-grub
Generating grub.cfg ...
Found background image: moreblue-orbit-grub.png
Found Windows 7 (loader) on /dev/sda1
Found linux image: /boot/vmlinuz-2.6.35.4-majic
Found initrd image: /boot/initrd.img-2.6.35.4-majic
Found linux image: /boot/vmlinuz-2.6.26-2-amd64
Found initrd image: /boot/initrd.img-2.6.26-2-amd64
done
You should find that windows 7 now appears at the top of the list - hope this helps
This worked for me after upgrading Ubuntu to newer version that included Grub2.
 
  


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
changing default to zero ramjgn Linux - Newbie 7 04-03-2009 11:20 PM
Changing default gateway rust8y Linux - Networking 2 12-18-2006 07:06 AM
Changing the default language... njschroe SUSE / openSUSE 5 04-24-2005 01:44 PM
Changing default Browser jgtg32a Mandriva 1 04-21-2005 04:14 PM
changing default WM pmh6310 Linux - Newbie 5 06-11-2003 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:43 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