# NanoBSD booting problem



## zennybsd (Mar 14, 2011)

New to BSD world. I am posting after trying to fix this for about two weeks on my own. (See PS). I am just lost with the following problem.

A nanobsd image (_.disk.full and _.disk.img) was created, and dd-ed it to the usb stick as well as 1gb sandisk memory disk. When I try to boot with the usb stick image, I keep on getting:


```
F1 FreeBSD
F2 FreeBSD

F6 PXE
Boot: F1
```
and whether I press F1 or F2 I get echoed # prompt and nothing else. With sandisk memory, I get a blinking cursor forever.

I checked all over the net for about a week and could not figure out exactly, instead I found many having similar problem. Any hints? Appreciate any inputs to make it a go. It is worth mention that I have set NANO_BOOTLOADER=/boot/boot0 for vga console in nanobsd configuration.

PS: Don't blame that I am lazy, though new to BSD. I am posting this after reading a lot of literatures for about two weeks as of below:
1) http://blog.freenas.org/2010/08/ixsystems-freenas-snapshot.html
2) http://www.psconsult.nl/talks/AsiaBSDcon2010-Servers/
3) http://wirelessleiden.nl/projects/nodefactory/wiki/NanoBSD
4) http://forums.freebsd.org/showthread.php?t=18800
5) FreeBSD official guide on NanoBSD and NanoBSD article
6) pfsense 2.0 (also based on nanobsd) forum with similar problems
7) bsdrp.net wiki
9) https://ssl.scroogle.org/cgi-bin/nbbw.cgi?Gw=nanobsd+not+booting


----------



## SirDice (Mar 14, 2011)

Make sure the slice the memory stick boots from is marked active.


----------



## zennybsd (Mar 14, 2011)

Thanks, SirDice. However, I already checked and he slice is active as evident from the fdisk output:


```
# fdisk da1
******* Working on device /dev/da1 *******
parameters extracted from in-core disklabel are:
cylinders=976 heads=64 sectors/track=32 (2048 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=976 heads=64 sectors/track=32 (2048 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
    start 32, size 1998816 (975 Meg), flag 80 (active)
    beg: cyl 0/ head 1/ sector 1;
    end: cyl 1023/ head 1/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```


----------



## SirDice (Mar 14, 2011)

Are you sure it's set up correctly? I've never used nanoBSD before but I'm sure it doesn't boot from a FAT partition.


----------



## zennybsd (Mar 14, 2011)

What I did was I just created the nanobsd image and then *dd* it to the new usbstick which usually is fat32 partition (msdos label).

Doesn't *dd* takes care of the rest like formatting to the right fs? I believe so.

Else do I have to partition the entire usb stick to ufs single partition?


----------



## zennybsd (Mar 14, 2011)

When I checked with linux, I got the following with my usb stick (which is not a fat32 partition):


```
Disk /dev/sdb: 1023 MB, 1023410176 bytes
16 heads, 63 sectors/track, 1982 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x90909090

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         948      477760+  a5  FreeBSD
/dev/sdb2   *         949        1896      477760+  a5  FreeBSD
/dev/sdb3            1897        1900        2016   a5  FreeBSD
/dev/sdb4            1901        1966       33264   a5  FreeBSD
```

It does not seem like related with the partition stuff, there are several threads online that deals with the same problem like I posted and unresolved. Maybe a FreeBSD/nanobsd bug?

Input from FreeBSD experts solicited.


----------



## SirDice (Mar 14, 2011)

I would expect dd to overwrite the existing partition table. Unless you dd'ed to da1s1 instead of da1.


----------



## wblock@ (Mar 14, 2011)

GEOM won't let you overwrite the boot block without disabling the safety:
`# sysctl kern.geom.debugflags=16`
Then do the copy.


----------



## zennybsd (Mar 14, 2011)

After I *dd* to /dev/da1 directly, it can boot, but I am seeing two things:

1) GEOM: geometry does not match label

2) It lands to the 'mountroot>' prompt. 

I could not figure out which mount point to mount as root? Any pointer?


----------



## wblock@ (Mar 14, 2011)

Probably da0s1a or da1s1a.  Label your filesystems and it won't matter.  For USB booting, add

```
kern.cam.boot_delay=10000
```
to /boot/loader.conf.


----------



## SirDice (Mar 14, 2011)

Yeah, that's the problem with booting from USB. You have to keep the device order the same. But as wblock pointed out, use labels. Then it won't matter if it's da0, da1 or da2.


----------



## zennybsd (Mar 14, 2011)

I am just wondering and seems lost as a BSD newbie, how can the I make the changes in the /boot/loader.conf when I cannot boot to the image. It keeps on giving me the 'geom not matching' error and hangs, and when I press enter the machine reboots. I have enabled AHCI in BIOS.

Any hints?


----------



## wblock@ (Mar 14, 2011)

AHCI is not relevant to labels (and I need to split that article up, labels and AHCI aren't tied together).  I'd leave it off until the other isssues are solved.

The geom warning should not be significant, it's all just blocks.  You can label the filesystems from the "host" system where you ran the nanobsd script.  Connect the device target device, let's say a USB stick that comes up as da1.  Don't mount the filesystems, just label them with tunefs(8).  Disconnect the USB stick and reconnect it.  Mount the / filesystem and edit fstab to use the new labels.

Of course it's possible the system is hanging due to the hardware or some NanoBSD customization.


----------



## zennybsd (Mar 14, 2011)

wblock: Thanks for your comprehensive reply.

Actually I am using the configurations from http://www.psconsult.nl/talks/NLLGG-BSDdag-Servers/ and trying to create a server, fyi.


----------



## DutchDaemon (Mar 15, 2011)

zennybsd, read your signup email about the forum rules: http://forums.freebsd.org/showthread.php?t=11799. Format your posts.


----------



## zennybsd (Mar 15, 2011)

Thanks DutchDaemon for the trouble to make the necessary formatting.

But the problem is I usually use links to browse the net and to post I use firefox with all scripts disabled which prevents me from formatting. Text-based browsing is most of the sys/netadmin prefers to do.

And secondly, I checked to my posts to make changes, but could not figure out the edit options, or did I miss something?


----------



## DutchDaemon (Mar 15, 2011)

If you read the page about formatting, you can see that you can add tags by hand just as easily. To edit you need 10 posts AND 10 days of membership. And text-based browsing is what a sysadmin does when there's no alternative around, or me and my fellow admins have been severely deluded for the past 15 years...


----------

