# Installed Ubuntu and now stuck, Help!



## demonfire (Aug 9, 2011)

Back in February I built my FreeBSD 8.2 (64 bit) box and was running without many issues. Last month I installed Windows 7 (64 bit), not by choice but I needed an app that is windows only, on a second drive... I unplugged my BSD drive and plugged in the new drive for the install, when done I swapped the cable back and when happily back to BSD.

Last weekend I decided to try out Ubuntu 11.04 (64 bit), and followed the same procedure, new drive, all other drives unplugged...install, play, swap back...

This is where I hit a wall. Seems that Ubuntu's Grub2 flashed info to my BIOS defining my boot sequence, and not allowing me to boot anything unless the Ubuntu drive is connected. OK, no big deal, I would like to be able to boot into all three without having to open the case, so I connect all three and start fiddling with Grub2's config. Grub sees the Windows drive without issue automatically, but not the BSD. I play with it till I get Grub2 to locate and acknowledge the drive, but BSD will not boot. I just get a blinking cursor!!!

I am using the custom grub menu, the code that loads the drive and gets tot he blinking cursor is:

```
menuentry "FreeBSD 8.2" {
    set root=(hd1,1)
    chainloader+1
}
```

How can I get BSD to boot?


----------



## tobe (Aug 10, 2011)

demonfire said:
			
		

> Seems that Ubuntu's Grub2 flashed info to my BIOS defining my boot sequence, and not allowing me to boot anything unless the Ubuntu drive is connected.


No really i don't think this is possible.

Did you try to boot from the FreeBSD memstick ? It has a recovery mode so you can try to mount your drive, fix the boot loader, etc.


----------



## x-com (Aug 10, 2011)

Well your Grub config looks good but I use hdx (y,z). If you connect all drives to your PC, the right part of 

```
set root=hdx(y,z)
```
depends on the order the disks are connected. If FreeBSD is the only OS on its harddisk, you can leave y,z to 1,1 but the x depends on the order of the other drives. If BSD is on the first disk, then change hdx to hd0. For example I have to harddisks, one containing Win7 and Debian which is connected via sata (sda on linux, ad4 on FreeBSD), FreeBSD is on the second disk (sdb on linux, ad7 on FreeBSD), so my set root is

```
set root=hd1(1,1)
```
if I would change connectors it should be

```
set root=hd0(1,1)
```
After changing values, don't forget to run
`$ update-grub`


----------



## fonz (Aug 10, 2011)

tobe said:
			
		

> Did you try to boot from the FreeBSD memstick ? It has a recovery mode so you can try to mount your drive, fix the boot loader, etc.


*@demonfire:* The above procedure is probably not explained in the Handbook, so by all means feel free to ask followup questions if you get stuck.

Fonz


----------



## demonfire (Aug 11, 2011)

tobe said:
			
		

> No really i don't think this is possible.
> 
> Did you try to boot from the FreeBSD memstick ? It has a recovery mode so you can try to mount your drive, fix the boot loader, etc.



Well... It appears to be possible, somehow. My mobo is a Asus P8P67 Deluxe which has a GUI bios. If I power down, disconnect all drives (including CD) except the BSD drive (which is read only, so Ubuntu did not/can not write to it, and enter my bios, there are two drives shown, the Hitachi drive BSD is on, and another labeled Ubuntu (it has 4 letters in a banner across one corner, and when I mouse over it tells me Ubuntu). Even it I tell my BIOS to boot the BSD drive specifically, or if I disable the Ubuntu drive, I get an error that the second drive that has Ubuntu installed is not connected and the system halts. I will reset momentarily with no drives installed at all and check the BIOS....brb

back...
will all drives removed, BIOS only has 'ubuntu' in the boot menu


----------



## demonfire (Aug 11, 2011)

x-com said:
			
		

> Well your Grub config looks good but I use hdx (y,z). If you connect all drives to your PC, the right part of
> 
> ```
> set root=hdx(y,z)
> ...




I will try to use this syntax next.


----------



## demonfire (Aug 11, 2011)

using this:

```
menuentry "FreeBSD 8.2" {
    set root=hd0(1,1)
    chainloader +1
```
can't find partition

using this:

```
menuentry "FreeBSD 8.2" {
    set root=hd1(1,1)
    chainloader +1
```
gives me a blinking cursor. I left it for 10 minutes and nothing happens. This gets to the drive, but does not hand-off booting to the BSD OS it seems.

the BSD drive is the #1 drive, but according to what I have been reading about Grub2, they changed the numbering scheme to start at 1 rather than 0 like Grub.

And I have tried both 'freebsd /boot/loader' and 'kfreebsd /boot/loader' rather than 'chainloader +1', which I have read should work, but it does not... gives command not found


----------



## demonfire (Aug 11, 2011)

fonz said:
			
		

> *@demonfire:* The above procedure is probably not explained in the Handbook, so by all means feel free to ask followup questions if you get stuck.
> 
> Fonz



I have no clue where to even start for this, can you elaborate?


----------



## x-com (Aug 11, 2011)

demonfire said:
			
		

> Well... It appears to be possible, somehow. My mobo is a Asus P8P67 Deluxe which has a GUI bios. If I power down, disconnect all drives (including CD) except the BSD drive (which is read only, so Ubuntu did not/can not write to it, and enter my bios, there are two drives shown, the Hitachi drive BSD is on, and another labeled Ubuntu (it has 4 letters in a banner across one corner, and when I mouse over it tells me Ubuntu). Even it I tell my BIOS to boot the BSD drive specifically, or if I disable the Ubuntu drive, I get an error that the second drive that has Ubuntu installed is not connected and the system halts. I will reset momentarily with no drives installed at all and check the BIOS....brb
> 
> back...
> will all drives removed, BIOS only has 'ubuntu' in the boot menu



Normally the boot manager is installed in the mbr of the first hard disk, if you are using mbr and not gpt or something else. But this thing sounds like something that should be written up in the mainboard handbook. Can you set the factory defaults? (make some notes about important changes!)


----------



## tobe (Aug 11, 2011)

demonfire said:
			
		

> My mobo is a Asus P8P67 Deluxe which has a GUI bios.


This motherboard seems quite buggy:

http://www.behardware.com/news/11289/intel-bug-what-sata-to-use.html
http://vip.asus.com/eservice/changeSandybridge_MB.aspx?slanguage=en-us


----------



## demonfire (Aug 11, 2011)

tobe said:
			
		

> This motherboard seems quite buggy:
> 
> http://www.behardware.com/news/11289/intel-bug-what-sata-to-use.html
> http://vip.asus.com/eservice/changeSandybridge_MB.aspx?slanguage=en-us



Well, it was...sort of. It was not the board itself, it was the Intel SATA3 controller that was buggy. The chips that controlled the SATA3 communications had a flaw in the silicon which made their speed degrade quickly and eventually shut off completely. This effected all SandyBridge motherboards world wide, causing a massive recall for all manufacturers. My board is 'rev. 3.0' which was made after Intel got their act together and released proper chips.


----------



## demonfire (Aug 12, 2011)

More information / issues.

I figured maybe I would update my BIOS to get rid of this issue, but thus far have been unsuccessful.

My box is running an 1155 (SandyBridge) chipset, which apparently is the first consumer based chipset to come with EFI ability, which is to say UEFI ability. As Grub2 is a UEFI boot loader, it is able to alter/enable UEFI in the BIOS on my board. Since it has altered/enabled UEFI, I am now not able to update my BIOS as the BIOS updates from the Asus are not EFI BIOSes. So, I am stuck!

EFI/UEFI is capable of booting FreeBSD, but my BSD drive does not have EFI files on it in the boot area (or elsewhere as far as I know) which may be why I am having issues.


----------



## demonfire (Aug 12, 2011)

I finally got the BIOS updated (to the most recent one out of Beta), which did remove the UEFI 'ubuntu' listing out of the BIOS boot menu, but the system still requires the Ubuntu drive to be installed, and still defaults to Grub2, so still no BSD yet.


----------



## ahavatar (Aug 12, 2011)

Your FreeBSD disk uses UEFI (GUID) partition or MBR(MS-DOS) type partition scheme? I don't think that you can mix the two.


----------



## tobe (Aug 12, 2011)

demonfire said:
			
		

> I finally got the BIOS updated (to the most recent one out of Beta), which did remove the UEFI 'ubuntu' listing out of the BIOS boot menu, but the system still requires the Ubuntu drive to be installed, and still defaults to Grub2, so still no BSD yet.



Is there any option to reset the BIOS configuration to factory settings ?


----------



## demonfire (Aug 12, 2011)

ahavatar - My BSD drive does not have a MBR partition, and the entire drive is ufs (no fat, which is needed for ms-dos type mbr), but it does not have the 'EFI' area that Grub2 is looking for. And as the drive is read-only when accessed from not BSD OS, I can't seen to add the needed files.


tobe - I have scoured the BIOS and was unable to find anything that resets to factory defaults this deep. I found domething that resets voltages, multipliers, and clock speeds to factory (to undo overclocking), as well as things like default interface (EZ or Advanced), but nothing removes the Ubuntu requirement.

I feel that if I could just get BSD to boot, I could install Grub from the port tree, set BSD as default, and set up the boot menu for all three OSes


----------



## wblock@ (Aug 12, 2011)

Can you boot a CD or USB stick?


----------



## demonfire (Aug 13, 2011)

Yes I can boot via CD drive.

I attempted to boot from my install DVD, which loads the sysinstall tool without issue. I tried to use that to install Grub2, it can connect to the BSD ftp server fine to get a list of packages, but when I tell it to install grub, it says it has to get the libiconv package (dependency) downloads 1kb only, then hangs for about 5 minutes, then reboots.

Is there a way to boot from CD/DVD, but actually boot into the BSD hard drive?


----------



## wblock@ (Aug 13, 2011)

plop is worth a try.  But I was thinking of mfsBSD.


----------



## demonfire (Aug 13, 2011)

wblock said:
			
		

> plop is worth a try.  But I was thinking of mfsBSD.



mfsBSD was neet, but I could not get it to allow me to install from ports to the drive.

plop WORKED!!! I am now in BSD, and got Grub2 from the ports tree! awesome! Thanks!



wait.... now I have another problem... the port compiled fine. Next I went to install Grub2 on the drive and got this:


```
DemonMachine# grub-install /dev/ad24s1a
/usr/local/sbin/grub-setup: error: hd0,1,a appears to contain a ufs2 filesystem which 
isn't known to reserve space for DOS-style boot.  Installing GRUB there could result 
in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe 
disables this check, use at your own risk).
```

What do I do now?

note: yes, by BSD drive labels itself 'ad24', it always has, even when it was the only drive in the box. and yes, it is plugged into SATA1 on the board. I don't know why it does this, but it does. 

Here is the output of gpart to show my drives:


```
DemonMachine# gpart show 
=>       63  321672897  ad24  MBR  (153G)
         63  321672897     1  freebsd  [active]  (153G)

=>        0  321672897  ad24s1  BSD  (153G)
          0    2097152       1  freebsd-ufs  (1.0G)
    2097152    8388608       2  freebsd-swap  (4.0G)
   10485760   25090048       4  freebsd-ufs  (12G)
   35575808    2097152       5  freebsd-ufs  (1.0G)
   37672960  283999937       6  freebsd-ufs  (135G)

=>       34  241254653  ad28  GPT  (115G)
         34      39063     1  efi  (19M)
      39097  224478516     2  linux-data  (107G)
  224517613   16737042     3  linux-swap  (8.0G)
  241254655         32        - free -  (16K)

=>       63  160086465  ad30  MBR  (76G)
         63       1985        - free -  (993K)
       2048     204800     1  ntfs  [active]  (100M)
     206848  159877120     2  ntfs  (76G)
  160083968       2560        - free -  (1.3M)
```


----------



## x-com (Aug 13, 2011)

Your BSD disk USES mbr scheme. You've mixed up mbr and uefi (on you linux disk). Unplug that disk and search your BIOS for the start-up options. There must be some option toggling between uefi and mbr.
If Ubuntu has caused this toggle, I know why I use Debian


----------



## demonfire (Aug 13, 2011)

I have not found anything in the BIOS, or the mobo manual about changing between UEFI and mbr.

I am not ready do blame Ubuntu specifically for this yet, as all current versions of Linux should use an unchanged version of Grub2 by default. I have a hard time believing that Ubuntu modified Grub for their install in a way that wrote to my UEFI bios. I think it is more likely that Grub2 was not expecting the UEFI bios (which seems to be new to consumer mobos as of 1/2011) to allow it to be modified in the manner it was.

How come Grub can mount a Win7 MBR, but not a BSD MBR? You can see from my gpart output above that I have 2 drives running MBR (ad24 is BSD, and ad30 is Win7), and I can load Windows without issue from Grub.


----------



## ahavatar (Aug 14, 2011)

If all your disks are smaller than 2.1TB, how about using MBR patition format for all of them? Your Grub2 setting on Ubuntu should work well. 

I'm not sure if we need Grub2 when we use UEFI(GUID) partitions to boot.


----------

