View previous topic :: View next topic |
Author |
Message |
Karsten1973 Guru
Joined: 17 Dec 2004 Posts: 303 Location: Berlin, Germany
|
Posted: Thu Dec 23, 2004 8:58 am Post subject: Reboot into Windows |
|
|
When I started trying out Linux (with a Suse 8.0) Suse somehow managed that you could shut-down Suse Linux and reboot into windows without seeing the bootmanager.
How can I do that with Gentoo and kde? _________________ I could be arguing on my own time. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 23, 2004 9:13 am Post subject: |
|
|
You can write a small script that sets the default= line in grub.conf, which will be honored on the next boot.
GRUB itself has support for this as well, but you specifically mentioned "without seeing the boot screen", so that would be it. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
Karsten1973 Guru
Joined: 17 Dec 2004 Posts: 303 Location: Berlin, Germany
|
Posted: Thu Dec 23, 2004 9:17 am Post subject: |
|
|
Okay. I wouldn't know how to do that Anyway, at least its explained
Merry Christmas to all of you! _________________ I could be arguing on my own time. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 23, 2004 9:31 am Post subject: |
|
|
Make two versions of grub.conf, both identical except for the OS you boot as default.
Name them grub.windows and grub.gentoo.
Then you can put this somewhere in your PATH (/usr/bin for example):
Code: | #!/bin/bash
# bootos - small script to change the OS to boot in grub.conf
mount /boot
rm /boot/grub/grub.conf
cp /boot/grub/grub.$1 /boot/grub/grub.conf
umount /boot |
Now you can call this script with
Code: | bootos [gentoo|windows] |
and the appropriate grub.conf will be used. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
mnxAlpha Apprentice
Joined: 15 Sep 2004 Posts: 210
|
Posted: Thu Dec 23, 2004 10:46 am Post subject: |
|
|
Slight problem there. What if I boot into Windows? I can't change back to the Linux version of the GRUB config file from Windows, so I wouldn't be able to get back into Linux. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 23, 2004 11:09 am Post subject: |
|
|
Absolutely - but the OP never mentioned getting back from Windows into Gentoo
The best way to do it is use the inbuilt function of GRUB to remember the setting you last booted with.
Or you can even specify which OS you would like to boot once the following boot.
A combination of these will do what he wants. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
c0balt Guru
Joined: 04 Jul 2004 Posts: 441 Location: Germany
|
Posted: Mon Dec 27, 2004 2:38 pm Post subject: |
|
|
adaptr wrote: | The best way to do it is use the inbuilt function of GRUB to remember the setting you last booted with.
Or you can even specify which OS you would like to boot once the following boot.
A combination of these will do what he wants. |
Could you explain how this is done exactly? I havent found anything regarding this in the Grub Docs. |
|
Back to top |
|
|
gentsquash l33t
Joined: 03 Nov 2004 Posts: 753 Location: Still a Gentoo beginner.
|
Posted: Tue Dec 28, 2004 8:59 pm Post subject: |
|
|
adaptr wrote: | Make two versions of grub.conf, both identical except for the OS you boot as default.
Name them grub.windows and grub.gentoo. ...
Code: | #!/bin/bash
# bootos - small script to change the OS to boot in grub.conf
mount /boot
rm /boot/grub/grub.conf
cp /boot/grub/grub.$1 /boot/grub/grub.conf
umount /boot |
|
Clever idea. In place of the `rm'+`cp', you could alter a
symlink, eg. [untested]
Code: |
\cd /boot/grub/
/bin/ln -sf grub.$1 grub.conf
|
(Being a beginner, I am cautious about scripts that I alter that have
an `rm' in them...) _________________ Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Wed Dec 29, 2004 9:54 am Post subject: |
|
|
Oh certainly - you can tell I come from a DOS world when I don't use symlinks where anything else is overkill or inappropriate
I would, though - for your aforementioned safety - use absolute paths in the ln command:
Code: | mount /boot
/bin/ln -sf /boot/grub/grub.$1 /boot/grub/grub.conf
umount /boot |
And do check for the presence of a correct parameter, since cp will fail if it doesn't exist, but ln will dutifully create a dead link , leaving you unable to boot - at all
That is always a good idea if you write system-wide or reusable scripts, since you can not know how the script will be used 3 years from now, and it's never smart to assume... _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Wed Dec 29, 2004 10:27 am Post subject: |
|
|
The problem with this is that you still need to upgrade the MBR using "install-grub"...
And, you will still see the boot screen as long as there is a waiting period in the grub.conf file. Timeout will need to be set to 0 in your grub.conf.
I too, haven't seen anything in the GRUB manual.
So, how SuSE does it, I don't know. BUT, you may want to use Grub for windows to change the MBR on startup. Then, add the commands to boot grub into whatever you had before (either the dual boot setup or just GNU/Linux). Note that this setup has NOT been tested, but it may work...
Aside from recompiling GRUB (or LILO) with the functionality you mentioned, I don't see how SuSE did it though... _________________ This sig intentionally left blank |
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Wed Dec 29, 2004 10:51 am Post subject: |
|
|
Okay, I think I figured out how they did it. This hasn't been tested, so you may need to test and/or modify it. Repeat: this may not work: have a boot floppy ready.
Make two grub.conf files. One will be simply grub.linux, and it will be whatever you use to boot GNU/Linux (or dual boot). The other will be grub.conf, and will be whatever you use to boot Micro$oft Windoze. The script previously given to you should be modifed to the following:
Code: |
#!/bin/bash
# bootos - small script to change the OS to boot in grub.conf
mount /boot
grub-install
umount /boot
|
In grub.conf, you will need to have something that boots windows using the chainloader with a timeout of 0. BUT, first, use the Install command right before the root (or rootnoverify) command to set GRUB to modify the MBR so it boots GNU/Linux (therefore using grub.linux) in the future. _________________ This sig intentionally left blank |
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Wed Dec 29, 2004 10:52 am Post subject: |
|
|
One last note. It would be advantagious to emerge sudo and then configure it so you can run the script that boots windows as a normal user. _________________ This sig intentionally left blank |
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Wed Dec 29, 2004 11:23 am Post subject: |
|
|
Sorry for the 8 gazillion postings, but I realized that using the install command was virtually impossible. Thus, here is some code, using an alternative approach. Again, have a boot floppy ready. To make a boot floppy (or 2, actually), see here.
Anyhow, first mount your /boot partition. Your old grub.conf should go to /boot/grub/grub.linux. Assuming your windows partition is on (hd0,0) (replace it with what it is if otherwise), use the following for /boot/grub/grub.win (modified version from the GRUB documentation:
Code: |
default 0
timeout 0
title Windows
#First, make GRUB boot Windows in the future
root (hd0,2) #replace with boot partition
setup (hd0)
#Next, boot windows
root (hd0,0)
makeactive
chainloader +1
|
As for the script to boot Windows, replace it with:
Code: |
#!/bin/bash
mount /boot
cp /boot/grub/grub.win /boot/grub.conf
grub-install
rm /boot/grub/grub.conf
cp /boot/grub/grub.linux /boot/grub/grub.conf
umount /boot
|
Not entirely sure this will work, but should give you some ideas. _________________ This sig intentionally left blank |
|
Back to top |
|
|
gentsquash l33t
Joined: 03 Nov 2004 Posts: 753 Location: Still a Gentoo beginner.
|
Posted: Wed Dec 29, 2004 3:24 pm Post subject: |
|
|
adaptr wrote: | ...
Code: | mount /boot
/bin/ln -sf /boot/grub/grub.$1 /boot/grub/grub.conf
umount /boot |
And do check for the presence of a correct parameter, since cp will fail if it doesn't exist, but ln will dutifully create a dead link , leaving you unable to boot - at all |
Good point; thank you. _________________ Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Wed Dec 29, 2004 3:55 pm Post subject: |
|
|
cfaun, I'm not sure what you're getting at here.
You should know that the entire configuration for GRUB is in the grub.conf file, with the sole exception of one parameter only, namely the location of that file.
So what you're talking about simply cannot work, since installing or re-installing the GRUB MBR does - nothing.
With one exception: maintain 2 boot partitions depending on which OS you want to load the next next time.
Or maybe GRUB has the option of booting from different grub directories, so you would only need one boot partition (saves shuffling around with bootable bits and such..) and copy everything except the menu into the second directory, say /boot/grub2.
Point the MBR to the next boot instance, and load up the current one.
This could easily be handled in its entirety from within GRUB, so no editing or such is needed...
You could make menu entries on each boot config for loading an OS and returning to this boot partition next time, or loading an OS and rebooting into the other partition, therefore setting different defaults.
Let me think on this and I'll get back with a full solution.
Nice _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Wed Dec 29, 2004 4:17 pm Post subject: |
|
|
In my ignorance, I fail to understand why it should not work, as the contents of the grub.conf are manipulated by the script. But okay... _________________ This sig intentionally left blank |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 30, 2004 10:57 am Post subject: |
|
|
cfaun wrote: | In my ignorance, I fail to understand why it should not work, as the contents of the grub.conf are manipulated by the script. But okay... |
Now, I had prepared to post this humongous rationalisation of why I am right and you make no sense - until I saw that you made a simple yet suicidal typo
Code: | #First, make GRUB boot Windows in the future
root (hd0,2) #replace with boot partition |
Noooooo!
Boot Gentoo in the future - dude!
Then it makes sense. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 30, 2004 11:07 am Post subject: |
|
|
Oh boy this is getting annoying
Sorry cfaun, but I still don't see it.
Examining your shell script:
Code: | #!/bin/bash
mount /boot
cp /boot/grub/grub.win /boot/grub.conf |
Copy the grub.conf you posted above to be the actual grub.conf, okay.
Install GRUB in the MBR.
Again, you should note that this does in no way depend on what is in grub.conf - it is neither read nor stored anywhere.
Code: | rm /boot/grub/grub.conf |
Remove current grub.conf, okay.
Code: | cp /boot/grub/grub.linux /boot/grub/grub.conf |
And copy the original grub.conf for Gentoo back to the current one.
The net result of this is - exactly nothing.
Whatever is in the last file copied to be grub.cof - that is what gets used on the next boot.
I'll look into a method of using two grub.conf files with a custom install and get back to y'all later.
Because it can be done. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
meyerm Veteran
Joined: 27 Jun 2002 Posts: 1311 Location: Munich / Germany
|
Posted: Thu Dec 30, 2004 1:19 pm Post subject: |
|
|
Hi,
I guess you need "savedefault". Please search in the forums or google for this grub keyword. With it you can reboot another entry (windows) than your default (linux) once without having to interfere with the bootloader. After rebooting the second OS you get back into the default one.
HTH
Marcel |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Thu Dec 30, 2004 2:58 pm Post subject: |
|
|
Well, you wouldn't if the name of the option is anything to go by...
I assume it just changes the default - half of the solution, at least. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6053 Location: Removed by Neddy
|
Posted: Thu Dec 30, 2004 3:13 pm Post subject: |
|
|
Errr? this will mean you wont be able to boot back to linux since windows cant re-change the script
One thing I have wanted is for me to wire a DPST switch to the serial port (via a d-type) and the position of the switch iwll determine what OS is loaded.
But the problem is GRUB at boot does not rad any other input bar the keyboard AND when it reads the input it stops the counter.
I would like GRUB to start up. If switch is in position 1, select OS 1 (unkless keyboard interation)
If switch is in position 2 load OS 2 (unless keyboard interaction) _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
cfaun n00b
Joined: 25 Dec 2004 Posts: 63
|
Posted: Thu Dec 30, 2004 5:17 pm Post subject: |
|
|
adaptr wrote: | Oh boy this is getting annoying
Sorry cfaun, but I still don't see it.
Examining your shell script:
Code: | #!/bin/bash
mount /boot
cp /boot/grub/grub.win /boot/grub.conf |
Copy the grub.conf you posted above to be the actual grub.conf, okay.
Install GRUB in the MBR.
Again, you should note that this does in no way depend on what is in grub.conf - it is neither read nor stored anywhere.
Code: | rm /boot/grub/grub.conf |
Remove current grub.conf, okay.
Code: | cp /boot/grub/grub.linux /boot/grub/grub.conf |
And copy the original grub.conf for Gentoo back to the current one.
The net result of this is - exactly nothing.
Whatever is in the last file copied to be grub.cof - that is what gets used on the next boot.
I'll look into a method of using two grub.conf files with a custom install and get back to y'all later.
Because it can be done. |
Actually, I believe that GRUB reads the stage1 and stage 2 files, that are created FROM grub.conf, but ONLY when GRUB is set up. Thus, changing the contents of grub.conf does nothing unless the stage 1 and stage2 files are newly created from it. I think. Maybe it only works that way in LILO... _________________ This sig intentionally left blank |
|
Back to top |
|
|
Karsten1973 Guru
Joined: 17 Dec 2004 Posts: 303 Location: Berlin, Germany
|
|
Back to top |
|
|
syg00 l33t
Joined: 23 Aug 2004 Posts: 907 Location: Brisbane, AUS
|
Posted: Wed Jan 05, 2005 2:38 am Post subject: |
|
|
Wellll ....
Anyone ever put (a dual-boot) Windoze into hibernate ???.
When you next power-on *no* grub.
How do you reckon they do that ???.
Doesn't help this discussion, but an interesting corollary. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Wed Jan 05, 2005 12:04 pm Post subject: |
|
|
Quote: | Actually, I believe that GRUB reads the stage1 and stage 2 files, that are created FROM grub.conf, but ONLY when GRUB is set up. |
Well, no.
What gives you that idea ?
GRUB doesn't read anything from the stage* files - it loads them, and passes control to each one in turn.
GRUB doesn't create anything - the boot block stages are fixed, and located in/boot/grub.
They are created once, when you install GRUB.
There are exactly one stage1.5 and one stage2 file for GRUB on x86, and that is what gets "installed", if anything.
It's always the same boot block. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
|