# How to escape to Windows?



## prab (Aug 18, 2012)

Hello, everybody,
I installed FreeBSD 8.3 to my laptop and it is keeping me hostage now. I can't find means to reboot Win XP. Moves with boot0cfg didn't help. If try to boot from Windows CD (BIOS boot order: CDROM-LAN-HDD-FDD), but it ignores (it ignores every CD at boot time) and sends me to its boot  manager and offers:

```
F1  Win
  F2  FreeBSD
```
If I press F1, it hangs forever. If I press F2, it normally boots FreeBSD. Though, I can copy files from CDROM easily. Has it affected BIOS?

Help me, please, somehow.

prab
newbie


----------



## SirDice (Aug 18, 2012)

Having FreeBSD installed does not interfere with the BIOS load order.

Have a look with fdisk(8) and see which partition is marked 'active'. Try setting the Windows partition to active.

The easiest to do that is using `# fdisk -u` and following the questions. Don't change any of the partition sizes. Only the 'active' partition.


----------



## prab (Aug 18, 2012)

If I use  `# fdisk -a -1 ad0`
  it replies: 
	
	



```
Failed to write MBR. Try to use  gpart(8)
```
  What means (8) here ?


----------



## SirDice (Aug 18, 2012)

prab said:
			
		

> What means (8) here ?


Section 8 of the manpages. [cmd=]man 8 intro[/cmd]


----------



## prab (Aug 18, 2012)

Now I type:
`# /sbin/gpart set -a active -i 1 ad0`  (Is it correct?)
 it replies:

```
active set on ad0s1
```
(What I need !)
But when I reboot, behaviour is the same, I can reach only FreeBSD. What can I do more?


----------



## wblock@ (Aug 18, 2012)

Use the BIOS boot menu to boot from the CD.  Use fixboot from Windows, install EasyBCD and use it to set up multibooting.


----------



## prab (Aug 18, 2012)

Any CD inserted is absolutely ignored at boot time (but I can mount it and reach files!). Whatever BIOS boot menu I choose, it fetches me to the same boot manager, which can start FreeBSD only. Should I say farewell to my Windows partition?


----------



## SR_Ind (Aug 18, 2012)

prab said:
			
		

> *Any CD inserted is  absolutely ignored at boot time* ( but I can mount it and reach files!). Whatever BIOS boot menu I choose, it fetches me to the same boot manager, which can start FreeBSD only. Should I say farewell to my Windows partition?



If your CD is getting ignored that means the CD drive is not set up as a boot media or has a lower priority than your hard drive.

Go into your BIOS setup and set the CD drive as the first boot media.

However, even if you succeed in booting into XP via rescue CD and run fixmbr to restore the earlier MBR you will lose FreeBSD.

Look for the GAG boot Manager (after you are able to set your CD drive to boot as first device), it can boot both WinXP and FreeBSD.

@wblock@ - I don't think EasyBCD will work with WinXP.


----------



## prab (Aug 18, 2012)

All is done as you say. CD is first device. I know that all. I would never have asked, if it was that simple. Now it seems as if it was some virus, blocking BIOS work.


----------



## Beeblebrox (Aug 18, 2012)

I was trying to post at the same time as you both so I got locked out.

1st problem: You cannot boot a CD. If all else fails, disconnect (remove) the HDD and try booting a CD, any CD. Maybe your CD-player is broken and BIOS just does not see it??

2nd problem: Booting multiple OS (or multi-booting). I would prefer grub for this; way better.  BTX does not do so well with multi-booting. Downside, you must learn the grub syntax...
for 2nd problem: Is your HDD MBR or GPT? Post output of
`# gpart show`


----------



## prab (Aug 18, 2012)

Yes, very likely you  are  right:  My hardware is in failure, CDROM is not reachable from BIOS. Replacement does not work either. Thank you for  suggestion.  But how it is connected with unwillingness to boot from  HDD Windows partition?  Unfortunately I can't post anything, because it is not configured and not connected to network. I need to save most important Windows files.  Can you suggest  something downloadable via  Windows, plugable through USB stick, to write to CD or USB flash. Now there is no driver for writing.


----------



## Beeblebrox (Aug 18, 2012)

> Replacement does not work either


Does that mean a second CD-ROM also was not detected by BIOS? If so, check your cables (power and connector). Sometimes it can be as simple as a bad connector cable. Two CD-ROMS do not fail at the same time.

If you get CD-ROM to boot, we can get set-up the multi-boot environment. without CD-ROM it will be more difficult unless you know how to use USB booting. Do not worry, your windows can be easily rescued. 

You need to show the output from gpart as I asked above. The PC boots into the FreeBSD environment, right? That wil give you gpart output. Otherwise, you probably have a FreeBSD live CD? Boot the CD and it will give you the output of gpart.


----------



## prab (Aug 18, 2012)

```
gpart show
=>  63       234441585 ad0  MBR (111G)
    63       179380161 1    ntfs  (85G)
179380224    55061424  2    freebsd [active] (26G)
=> 0         55061424  ad0s2  BSD (26G)
   0         2097152       1  freebsd-ufs (1.0G)
   2097152   2012528       2  freebsd-swap  (982M)
   4109680   9394176       3  freebsd-ufs  (4.5G)
  13503856   2097152       4  freebsd-ufs  (1.0G)
  15601008   39460416      5  freebsd-ufs   (18G)
```

and the USB flash at the end (I omitted).


----------



## Jsanchez (Aug 19, 2012)

Press F8 while the bios is loading, it will most likely let you choose the boot device.


----------



## Beeblebrox (Aug 19, 2012)

I needed to see your gpart so as to decide if you could use grub. In dual-boot scenario, grub needs its own separate partition. What I can see from the layout is that you have not allocated a section for it and you would need to shrink 2 separate sections to get the needed partition. So I conclude that grub may be a little difficult for your situation.

In your setup I assume that you will want the dual-booting software to work from the windows side of things, so you need to find dual-booting solutions for windows. Other types of solutions will want their own partition (just like grub does) so not very useful for you (unless you decide to slog it out and create another partition).

If the above is the correct for you, I suggest you first restore your windows. I assume you have a Win CD? The CD has a menu at the opening to "recover windows installation" or something like that. Run the recovery and get your windows working again.

Once you get that working, you can try to edit c:/boot.ini and place a second menu entry / item into that file. This will result in a menu at boot-up where you can choose the OS you want to boot. Look at the boot.ini syntax by running msconfig in windows or just directly through notepad. I don't know if windows' boot manager can handle FreeBSD booting, I never tried it. I'm sure you can find something by googleing.

Your final choice is to use dual-booting software which runs from the windows layer.


----------



## prab (Aug 19, 2012)

Dear Beeblebrox, thank you for the information and thanks to everyone for your responses. The issue is over. The hardware is a culprit.  Peripheral chip on motherborard malfunctions. It affects not only CDROM, also 2 slots of USB out of 3 are dead


----------



## Beeblebrox (Aug 19, 2012)

For future reference:
- If possible use GPT partitioning. Much better than MBR.
- Read a little more about partitioning under GPT. You must set a very small boot-bios partition.
- Place a grub partition at the end of the HDD (256 - 512 MB).
- When BSD / Linux systems are not your primary, you do not need to allocate that many partitions for each system. Keep /var with root, mount /tmp as a tmpfs (more reading).
- Don't you want to be able to access your Documents from both OS'es? How will you do with the way you have things set up now?
- Look into sharing swap partition with windows. Have not tried but should be possible. Swap should be placed closest to center as possible (as 1st partition).

There is a good thread explaining may fine-points about dual-booting here:
http://forums.freebsd.org/showthread.php?t=31713


----------



## wblock@ (Aug 19, 2012)

In general, consider using VM software rather than dual-booting.  It doesn't endanger already-installed operating systems, and it lets both systems run at the same time.


----------



## Beeblebrox (Aug 22, 2012)

@wblock: Yeah, I keep forgetting to include that bit of advice...


----------



## SirDice (Aug 23, 2012)

Beeblebrox said:
			
		

> - If possible use GPT partitioning. Much better than MBR.


I'm not sure if Windows XP supports that. Maybe only Vista and higher. Can anybody confirm that?


----------



## freethread (Aug 23, 2012)

SirDice said:
			
		

> I'm not sure if Windows XP supports that. Maybe only Vista and higher. Can anybody confirm that?



I cannot confirm that but perhaps this page can help. It seems GPT is not supporte on XP

http://support.microsoft.com/kb/2581408


----------



## Beeblebrox (Aug 23, 2012)

> I'm not sure if Windows XP supports that


It does not. I was thinking Windows 7 for some reason. Details:
http://msdn.microsoft.com/en-us/library/windows/hardware/gg463525.aspx#X-201104111922342


----------



## wblock@ (Aug 23, 2012)

Windows 7, and only 64-bit last I looked.  Possibly only with UEFI.


----------



## bill92 (Aug 23, 2012)

I have a similar problem. I have installed BSD9 from Window XP in an old computer (of 4 yrs). Perhaps I did something stupid, but it seems that the boot manager from BSD did not to give me any option to boot the XP.

It looks something like
1) Boot
2) Escape
3) Reboot

Option 4.5.6 seems to be configuration like safe mode, single user etc.

I tried to chose 2 to see if I have any chance to boot Window, but I fail to find the solution (It seems to be a subset of unix command). 


Now I have not managed to get the X11 running because of the mouse problem and I have to struggle for it for quite a while. Although I can boot from CD and re-install Window or Linux, I wonder if I have any easy way to boot my XP OP without ruining my existing Windows and BSD installation?

Beside, what the stupid thing I might have done to get this problem and how to avoid it next time I install BSD?

Thank you in advance for any help.


----------



## Beeblebrox (Aug 24, 2012)

1. Use the "windows rescue" feature on your Windows CD to recover your windows OS.
2. Before trying to install a Linux or BSD system, read and understand HDD partitioning and multi-booting - this thread is very detailed about such issues.
3. Instead of #2, you should probably just run your FreeBSD and Linux through a Virtual Machine layer under windows until you are comfortable with the OS.
4. Start a new thread for any further questions.


----------



## michaelrmgreen (Aug 28, 2012)

I was faced with a very similar situation only a few days ago. To complicate matters the owner of the computer did not know the password to the 'Administrator' account. This is a problem because the 'Repair' mode, accessible from the WinXP install CD, requires the Administrator password.

I resolved the problem by booting from the GAG install CD (http://gag.sourceforge.net/)  and using the 'Uninstall GAG (restores standard MBR)' prompt. It did the job very efficiently.

Executive summary: Use GAG.


----------



## prab (Aug 29, 2012)

Dear michaelrmgreen,
 there is one circumstance in my particular case: I cannot boot from CD (my BIOS affected), but I can mount and  use CD when I am inside FreeBSD (FreeBSD as far as I know does not use BIOS) I need to restore bootability of Windows using FreeBSD instruments. Can you advise any?


----------



## michaelrmgreen (Aug 29, 2012)

Hello there Mr. Prab. You might be able to boot from an external USB connected CD/DVD drive, if you can borrow one. I have one of these: http://www.ebuyer.com/180608-liteon-etau108-usb-2-0-dvd-write-optical-drive-retail-etau108-02
which is able to boot an attached PC. Ask around, someone you know might have one.

If you can boot your system from the remaining USB port you might be able to use Unetbootin to install the GAG installer to a USB stick and install it to the hard disk from there. (I'm sure I read that it was possible be can't now find the reference).

Best of luck.


----------



## kr651129 (Aug 29, 2012)

I don't know if this would work but I would think you could install grub/grub2.  The only expiernce I've had with grub was in a Ubuntu/Windows setup and it worked well for me.


----------

