LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-27-2005, 08:33 AM   #1
kilgor
Member
 
Registered: Oct 2002
Posts: 38

Rep: Reputation: 15
linux booting windows


Hi,

Is it possible to create such a setup:

1) Computer is turned on.

2) Linux is booting.

3) Linux does some automated stuff (with the Windows partition).

4) Computer boots to windows.

5) User sees windows desktop. It's the first time the user can do anything with the computer.

This sequence must repeat each time the computer is rebooted.


So each time the compter is rebooted it first boots linux, which does some stuff and then boots to windows.

My first thought was to set the default boot option to linux in grub/lilo. Linux boots, does it's stuff, changes grub.conf so that WinXP would be default and reboots. That's easy, but the next time(s!) the computer is rebooted it would boot WinXP straight away.

I don't think it's possible to make grub change it's own config after the command to boot it's default option is performed. In other words: after it has chosen to boot from the windows partition grub would change the default option back to linux. I doubt that's possible tho :(.

I don't think WinXP could change this while/after booting either, or could it?

How would one create such a setup? It's all just theory right now, so all ideas are welcome.


Thanks!
 
Old 08-27-2005, 08:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Could you explain WHY you want to do this in the first place? Maybe if we knew why you wanted to do such a bizarre thing we'd be able to offer useful suggestions to achieve your goal.
 
Old 08-27-2005, 09:07 AM   #3
kilgor
Member
 
Registered: Oct 2002
Posts: 38

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by acid_kewpie
Could you explain WHY you want to do this in the first place? Maybe if we knew why you wanted to do such a bizarre thing we'd be able to offer useful suggestions to achieve your goal.
Linux would run scripts that would check what has been changed on the windows partition and restore files if need be from a server. Or update the installation of windows and other programs that are installed from the central server. This would be more convenient at a gaming/internet cafe instead of a "Kiosk mode" in windows.

The user could do almost anything, but a reboot would fix it all. A reboot could update windows itself, any programs or just desktop shortcuts.
 
Old 08-27-2005, 09:27 AM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
One way would be to set up a small FAT partition on the HD and put install GRUB on it, and set you boot to load from the FAT partition. (Set it up like a floppy boot disk.) Then both Windows and Linux could access the grub.conf file and change it as needed.

Note: I haven't done this myself, but I think it should work. I do have a boot floppy, but it's configured as an e2fs disk. (Only 15% of the 1.4 Mb disk is used, so the partition can be quite small. Hum -- a thought: You could develop and test the concept using a FAT floppy as the GRUB boot disk, setting your system to boot from the floppy.)

Last edited by PTrenholme; 08-27-2005 at 09:28 AM.
 
Old 08-27-2005, 10:27 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
My last post got me interested, so I built a FAT boot floppy, and it seemed to work well. At least both XP and FC4 could boot from the floppy, and read /boot/grub/grub.conf on the floppy

If you haven't done this, here's how:
Code:
1) Put a DOS formatted floppy in you drive.
$ mount /media/floppy (or wherever you mount your floppies)
$ mkdir /media/floppy/boot
$ mkdir /media/floppy/boot/grub
$ sudo cp /boot/grub/* /media/floppy/boot/grub/
Password:
$ sudo /sbin/grub
grub> root (fd0)
grub> setup (fd0)
grub> quit
$ umount /media/floppy
And that's it: Now just boot from the floppy and you should see the same GRUB menu you have on your HD, since all you did was copy your /boot/grub directory to the floppy.

My grub.conf file looks like this:
Code:
$ sudo cat /boot/grub/grub.conf
Password:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd1,1)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=7
#splashimage=(hd1,1)/grub/splash.xpm.gz
#hiddenmenu
title Fedora Core 4 (2.6.12-1.1398)
        root (hd1,1)
        kernel /vmlinuz-2.6.12-1.1398_FC4smp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.12-1.1398_FC4smp.img
title Fedora Core 4 Init 3, no rhgb
        root (hd1,1)
        kernel /vmlinuz-2.6.12-1.1398_FC4smp ro root=/dev/VolGroup00/LogVol00 3 quiet
        initrd /initrd-2.6.12-1.1398_FC4smp.img
title Fedora Core 3 (2.6.12-1.1372)
        root (hd5,0)
        kernel /vmlinuz-2.6.12-1.1372_FC3smp ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.12-1.1372_FC3smp.img
title Windows
        rootnoverify (hd0,0)
        chainloader +1
so I can boot into either XP or FC4 (or FC3 for a backup) from the floppy or HD.

Good luck.

Last edited by PTrenholme; 08-27-2005 at 01:05 PM.
 
Old 08-27-2005, 10:44 AM   #6
sam.pedraglio
Member
 
Registered: Jul 2005
Distribution: Mint 14 64bit
Posts: 71

Rep: Reputation: 16
I don't know if it's possible to boot from a FAT partition on the HD but if it'd be possible it's easy to create a "file.bat" automaticaly executed at the XP start-up: once you've created it put it into Start->Programs->Startup.
This file should copy a version of the grup file with the Linux start-up.
 
Old 08-27-2005, 01:21 PM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally posted by sam.pedraglio
<snip>I don't know if it's possible to boot from a FAT partition on the HD</snip>
I've never tried it, but, since you can (if you wished) install a Linux OS on a FAT partition, and since you can boot from a FAT floppy, I suspect it would work.

Oh, kilgor, to make GRUB use, say, the fifth partition on your second HD for boot, you'd do something like
Code:
$ sudo /sbin/grub
Password:
grub> root (hd0)
grub> setup (hd1,4)
grub> quit
That tells GRUB that it should install to the MBR of (hd0), the first HD, and set it to transfer to the fifth partiton on the second hd, (hd1,4).

Last edited by PTrenholme; 08-27-2005 at 01:22 PM.
 
Old 08-27-2005, 01:23 PM   #8
kilgor
Member
 
Registered: Oct 2002
Posts: 38

Original Poster
Rep: Reputation: 15
Thanks a lot, I actually had this kind of idea, but thought grub wouldn't work on fat. Dunno why.

I now know it's possible!

:)
 
Old 08-27-2005, 05:15 PM   #9
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
No problem. I do recommend that you develop the system using the boot-from-floppy approach, where you just set your BIOS to boot first from the floppy. That way you'll still have a working system when you (if you're like me) make the inevitable "boo-boo."
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting Linux from within windows ccates Linux - Software 5 01-22-2005 04:59 PM
Booting linux while running windows Superme Linux - Software 6 10-26-2004 06:03 PM
Dual booting windows + linux untwisted Linux - General 8 09-23-2004 01:26 PM
dual booting linux and windows kevincadogan Linux - Software 3 02-01-2004 12:42 PM
dual booting windows with linux garorag Linux - General 1 01-19-2003 09:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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