LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I change default OS on grub system? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-change-default-os-on-grub-system-613758/)

Sifonelle 01-15-2008 01:01 PM

How can I change default OS on grub system?
 
Hi I installed both Windows XP and Linux Debian in my mother notebook and i setted linux as default as i wanted to learn to use it.
Now she got it back, but even if I tried I cannot change default OS; I looked for help in forums and online guides, but nothing I tried worked: it says "Permission Denied", and I was logged as root.
I also tried to reinstall XP, but obviously it doesn't change grub's settings...
Can u help me change it, or solve it someway?

Thanks a lot for attention

:scratch: :newbie:

jakefolger 01-15-2008 01:22 PM

I know that you can select which linux version you boot to in your grub.conf file. That file is located in /boot/grub. I'm not sure if this works with windows though.

Once you're in the grub.conf file I think it's as simple as changing the default=0 line.

Good luck, and let us know if that works out for you.

bigrigdriver 01-15-2008 01:36 PM

There are two ways to change the default; both involve editing /boot/grub/menu.lst.

Near the top of the file, there is a line: default 0. Since grub numbering begins with 0, that means that the first OS listed is the default. To change that default,
a) count down to the OS you want to be the default (counting from zero) and change the default line to that number.
b) cut and paste the one you want as default to the top of the list, and leave the default at 0.

You must be root to edit menu.lst, and the write permission bit must be set.

Sifonelle 01-16-2008 03:24 AM

permission denied... :(
 
Thx a lot for your answers :), I already tried to change in /boot/grub/menu.lst, after "su root" and psw, it changes user but then it says "permission denied"... maybe I did something wrong with command line?
How must I set write permission? Sorry for ignorance :confused: :)
and thx again!

jopu 01-16-2008 04:09 AM

use "su -l root"

for further info on su "man su" :)

Sifonelle 01-16-2008 05:13 AM

again
 
Thank you.
I tried, but "Permission denied" again...
:cry:

tfugnitti 01-16-2008 08:41 AM

I would really hate to be a simple minded person, but couldn't you just chmod the grub.conf file? since there is a link from the /boot/grub/menu.lst to the grub.conf file.

(00) 01-16-2008 08:56 AM

reply
 
depending on the distro you use....
I will usuall run

$sudo cp /boot/grub/menu.lst /home/*USERNAME*/Destop

this moves it to the desktop so you can edit it easily with gedit. Once your done run

$sudo cp /home/*USERNAME*/Destop/menu.lst /boot/grub/menu.lst

Note that if you are running fedora you will need add yourself to the sudoers list

Sifonelle 01-16-2008 11:41 AM

Quote:

Originally Posted by tfugnitti (Post 3024524)
I would really hate to be a simple minded person, but couldn't you just chmod the grub.conf file? since there is a link from the /boot/grub/menu.lst to the grub.conf file.

thx but as I said, I can't have access to /boot/grub/menu.lst, even if logged as root user...

Sifonelle 01-16-2008 11:42 AM

Quote:

Originally Posted by (00) (Post 3024542)
depending on the distro you use....
I will usuall run

$sudo cp /boot/grub/menu.lst /home/*USERNAME*/Destop

this moves it to the desktop so you can edit it easily with gedit. Once your done run

$sudo cp /home/*USERNAME*/Destop/menu.lst /boot/grub/menu.lst

Note that if you are running fedora you will need add yourself to the sudoers list

I run debian, I will try and tell you
thx a lot anyway :)

Emerson 01-16-2008 11:55 AM

Quote:

Originally Posted by Sifonelle (Post 3024744)
thx but as I said, I can't have access to /boot/grub/menu.lst, even if logged as root user...

Run 'ls -l /boot/grub/menu.lst' and post output for us.

Sifonelle 01-17-2008 09:01 AM

to (00):
I did as you suggested, it opened for me a *menu.lst [sola lettura] ( /Desktop) - gedit , reading only....
What should I do?

to Emerson:
output is
--rw-r--r 1 root root 4135 1988-01-02 21:26 /boot/grub/menu.lst

Emerson 01-17-2008 09:07 AM

Either your /boot partition (do you have separate /boot partition?) is mounted read-only or immutable flag is set.
Please show us output of 'lsattr /boot/grub/menu.lst'

(00) 01-18-2008 03:27 PM

edit the menu.lst file you have on the desktop, (hightlight the operating system you want the system to default to first as well as all of its settings, cut and paste it to the top of the list)

For example, if I wanted Windows on top, the section might look like this >

title Windows
rootnoverify (hd1,0)
chainloader +

(It might look different, just make sure to get the whole thing)
Once it looks the way you want, run >

sudo cp /home/*USERNAME*/Desktop/menu.lst /boot/grub/menu.lst

reboot to test.

Sifonelle 01-19-2008 11:39 AM

to Emerson:
------------------ /boot/grub/menu.lst

boot partitions should be separated, partion magic when I installed...

to (00)
I have after ## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.18-4-686
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/hda2 ro
initred /boot/initrd.img-2.6.18-4-686
savedefault

again for single user, then

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below
from the Debian
# ones.
title Other Operating Systems:
root


# This ebtry automatically added by the Debian installer for
a non-linux OS
# on /dev/hdal
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
makeactive
chainloader +1


Please tell me exactly what I should modify, could I copy and paste something so clearly set apart?
thx for the help...

Emerson 01-19-2008 11:54 AM

The method how you edit the file is irrelevant. You need write access to the file you want to alter and this is a must.
Since your /boot is a separate partition you have to check how it is mounted (or if it is mounted at all). Type mount and look at output, is /boot mounted rw?


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