LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-01-2007, 06:56 AM   #1
manoj111
LQ Newbie
 
Registered: Jan 2007
Location: delhi
Posts: 8

Rep: Reputation: 0
changing ubuntu from defalut os


Hi installed Ubuntu in my system from a cd that i got from shipit.com now it has two OS one windows XP and other Ubuntu.
Now when I switch on computer Ubuntu is the default OS. Since this system is in a public place and many other persons switches it on and they dont know what is showing at the boot menu they end up in ubuntu and is struck there.
So i want to change my default OS to windows on boot up.
How do i do that.?
manoj s
 
Old 04-01-2007, 07:26 AM   #2
jim_fields
Member
 
Registered: Nov 2006
Distribution: Slackware 11.0, Debian Lenny, testing
Posts: 32

Rep: Reputation: 16
In the file /etc/boot/menu.lst there is a line that says:
default = 0

Code:
default = 0

title           Ubuntu, kernel 2.6.17-11-generic
root            (hd1,0)
kernel          /boot/vmlinuz-2.6.17-11-generic root=/dev/sdb1 ro quiet splash
initrd          /boot/initrd.img-2.6.17-11-generic
quiet
savedefault
boot

title           Ubuntu, kernel 2.6.17-11-generic (recovery mode)
root            (hd1,0)
kernel          /boot/vmlinuz-2.6.17-11-generic root=/dev/sdb1 ro single
initrd          /boot/initrd.img-2.6.17-11-generic
boot
The first boot option (in this case "Ubuntu, kernel 2.6.17-11-generic") is zero, and the second (which would be " Ubuntu, kernel 2.6.17-11-generic (recovery mode)") is number one.
Just count each block of code that starts with "title" starting at 0 until you find what OS you want to boot and use that number as the "default=" value.
I haven't had my coffee yet so this is as clear as I can explain it
 
Old 04-03-2007, 10:46 AM   #3
manoj111
LQ Newbie
 
Registered: Jan 2007
Location: delhi
Posts: 8

Original Poster
Rep: Reputation: 0
but i cant save the changed file

Quote:
Originally Posted by jim_fields
In the file /etc/boot/menu.lst there is a line that says:
default = 0

Code:
default = 0

title           Ubuntu, kernel 2.6.17-11-generic
root            (hd1,0)
kernel          /boot/vmlinuz-2.6.17-11-generic root=/dev/sdb1 ro quiet splash
initrd          /boot/initrd.img-2.6.17-11-generic
quiet
savedefault
boot

title           Ubuntu, kernel 2.6.17-11-generic (recovery mode)
root            (hd1,0)
kernel          /boot/vmlinuz-2.6.17-11-generic root=/dev/sdb1 ro single
initrd          /boot/initrd.img-2.6.17-11-generic
boot
The first boot option (in this case "Ubuntu, kernel 2.6.17-11-generic") is zero, and the second (which would be " Ubuntu, kernel 2.6.17-11-generic (recovery mode)") is number one.
Just count each block of code that starts with "title" starting at 0 until you find what OS you want to boot and use that number as the "default=" value.
I haven't had my coffee yet so this is as clear as I can explain it
Hi thanks for the reply but the fact is that I am not able to save the file in the current location. It says that i dont have enough rights to perform this when I installed the Operating system I just created only one account called computer and I logged into that for doing this.
the file menu.lst was found in /usr/root/grub but this I was not able access from the terminal i did with the mouse(means by opening windows).
please help how to login as root and access the files and change it.
bye manoj s
 
Old 04-03-2007, 11:02 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Use sudo instead (I think the original file is in /boot/grub/menu.lst and the other one is a link to it, or something);
Code:
sudo gedit /boot/grub/menu.lst
it asks for your password (doesn't print it on screen while you type it) and after you give it launches GEdit text editor with the file in it. sudo means you want to run some command with root privileges (editing this file requires it), but it only works if it's configured to: on Ubuntu it's automatically configured to work for the user created during the setup (for the rest one needs to configure it manually). On Ubuntu, root account is by default locked (But can be unlocked using sudo).

I would recommend another way to do the job: setting the default value to a number is ok, but if you later add kernels (upgrade the system, for example) the list is rewritten and the default value might not point to the correct section anymore. Using savedefault to save Windows entry as default, and then using default saved makes it a bit nicer to the user: on the example below note the red parts..
Code:
default  saved

title           Ubuntu, kernel 2.6.17-11-generic
root            (hd1,0)
kernel          /boot/vmlinuz-2.6.17-11-generic root=/dev/sdb1 ro quiet splash
initrd          /boot/initrd.img-2.6.17-11-generic
quiet
boot

title           Windows XP
...<rest of the config lines for this XP section>
savedefault
Note here a couple of things:
- the Windows XP section does not have to be the topmost section in the config file, you may leave it to the end of the file, if it is there already (where it usually is)
- other boot sections (Ubuntu, ...) do not have the word savedefault in their sections
- Windows XP section in the config file does have the word savedefault in it (this is the "trick")
- Like above (written in red), the default value is set to saved which means that the entry that has savedefault option set, and was last booted (if there are multiple such entries, last booted is the one we're talking about), is booted. If you only have one section (Windows XP in your config) that has savedefault set, then after you boot it one time, GRUB always remembers to boot it no matter what other entries are later added to the list, or what other entries you've booted yourself, as long as they don't have savedefault set (or if they do, they are remembered after booting so in that case the last savedefault-set-entry that was booted is booted next time too).

There are reasons why I prefer this:
1) You don't have to move Windows section to the top of the list, and wonder where exactly it has to be (if it's too high, the file doesn't work all right -- some settings must be on top)
2) You can add more entries to the list and don't have to bother checking that either Windows section is still the topmost or that the default number points to the correct section

Last edited by b0uncer; 04-03-2007 at 11:07 AM.
 
  


Reply



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 Ubuntu App Symbol bjb_nyj101 Linux - Desktop 1 03-19-2007 01:26 AM
Ubuntu resolution not changing... phantom_cyph Linux - Newbie 15 02-13-2007 03:33 PM
changing a kubuntu to ubuntu for xgl lauriexgl Linux - Desktop 2 10-31-2006 04:03 PM
Changing Screen Resolution in Ubuntu 5.10 dohcacr Linux - Newbie 11 04-05-2006 06:12 PM
dpkg on ubuntu / changing languages bibilit Ubuntu 6 06-27-2005 02:22 PM

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

All times are GMT -5. The time now is 04:42 AM.

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
Open Source Consulting | Domain Registration