# PXE problem



## zambombas (Apr 14, 2012)

Hi, I wanted to perform an unattended installation of a client's system but after loading loader.conf on the client machine, the spinning â€˜\â€™ would hang. I found the next solution:



> Problem: After loading loader.conf on the client machine, the spinning â€˜\â€™ would hang.
> This was because I had originally rebuilt pxeboot to accept a higher com port speed.
> For some reason, if the com port is set up in any way, the client will hand here.
> Solution: Dont configure the com port to accept the higher speed of 115200, just use the pxeboot that comes out of the box.



I don*'*t understand how to do that. Any help please? Thanks.


----------



## Beeblebrox (Apr 15, 2012)

How is the client connected to the server? Ethernet or com1? The above problem has to do about connecting over com1, which I doubt has to do with your issue since you are asking about it.
If your connection is Ethernet, this does not apply to you and you should re-check your dhcp - tftp - nfs chain. post some output from configs of those services so we can help.


----------



## zambombas (Apr 15, 2012)

Beeblebrox said:
			
		

> How is the client connected to the server? Ethernet or com1? The above problem has to do about connecting over com1, which I doubt has to do with your issue since you are asking about it.
> If your connection is Ethernet, this does not apply to you and you should re-check your dhcp - tftp - nfs chain. post some output from configs of those services so we can help.



 I've fixed the mistake and now I get the following error: (server)


```
Apr 16 00:14:42 so tftpd[1915]: Filename: 'pxeboot'
Apr 16 00:14:42 so tftpd[1915]: Mode: 'octet'
Apr 16 00:14:42 so tftpd[1915]: Got ERROR packet: TFTP Aborted
Apr 16 00:14:42 so tftpd[1917]: Filename: 'pxeboot'
Apr 16 00:14:42 so tftpd[1917]: Mode: 'octet'
Apr 16 00:14:42 so tftpd[1917]: 192.168.1.101: read request for //pxeboot: success
```

and this on the client:


```
can't load kernel 

Type '?' for a list of commands, 'help' for  more detailed help
OK
```

Any idea?
Thanks again!

cat


----------



## Beeblebrox (Apr 16, 2012)

> tftpd[1915]: Got ERROR packet: TFTP Aborted


Don't worry about that, the error message gets spit out but boot process goes on - a non issue.


> can't load kernel


If you got there, dhcp + tftp did their job but either your setting for root-path is wrong or you have an nfscl problem.
1. Check /etc/exports and *option root-path* setting in dhcpd.conf to make sure setting is correct. My root-path, for ex:

```
option root-path "192.168.2.1:/data/amd64";	# NFS root
```
2. Do you have NFS_ROOT enabled in your kernel? Read this and also adjust your nfsroot/boot/loader.conf as described there.
3. Place in your client's etc/rc.conf (usually in nfsroot/conf/<ip>/etc):

```
root_rw_mount="NO"
```
If you don't want mount-root to break with "cannot mount as read-write"
You should carefully read section 32.8.2 of this page in Handbook to understand how to create client-specific rc.conf files.


----------



## zambombas (Apr 16, 2012)

Beeblebrox said:
			
		

> Don't worry about that, the error message gets spit out but boot process goes on - a non issue.
> 
> If you got there, dhcp + tftp did their job but either your setting for root-path is wrong or you have an nfscl problem.
> 1. Check /etc/exports and *option root-path* setting in dhcpd.conf to make sure setting is correct. My root-path, for ex:
> ...



Thank You ^^. 
I followed the instructions in these pages, especially PDF. Now when I restart I get the prompt mfsroot. What am I doing wrong?
http://postfixquotareject.ramattack.net/freebsdpxehowto.pdf
http://www.catpa.ws/unattended-freebsd-pxe-installation/

These are my config files:

loader.rc


```
echo Booting Kernel via TFTP ...
load /boot/kernel/kernel
echo Loading MFSRoot via TFTP ...
load -t mfs_root /boot/mfsroot
echo Mounging MFSRoot ...
set vfs.root.mountfrom="ufs:/dev/md0c"
boot
```

loader.conf


```
mfsroot_load="YES"
mfsroot_type="mfs_root"
mfsroot_name="/boot/mfsroot"
```

And finally my install.cfg


```
debug=yes
nonInteractive=yes
keeprcconf=yes
releaseName=9.0-RELEASE
netDev=em0
ifconfig_em0=DHCP
tryDHCP=YES
hostname=so
domainname=practicaso.com
_ftpPath=ftp://ftp.au.freebsd.org/pub/FreeBSD/
mediaSetFTP
dists=base GENERIC doc manpages catpages dict des ports
distSetCustom
disk=ad0
partition=all
bootManager=none
diskPartitionEditor
ad0s1-1=swap 614400 none
ad0s1-2=ufs 0 /
diskLabelEditor
installCommit
command=/bin/sh -c 'echo sshd_enable=\"YES\" > /etc/rc.conf'
system
command=/bin/sh -c 'echo PermitRootLogin yes >> /etc/ssh/sshd_config'
system
command=/bin/sh -c 'echo 12345 |pw mod user root -h 0'
system
shutdown
```


----------



## Beeblebrox (Apr 16, 2012)

I only looked at the second link, which was not pdf. While the tutorial is well written, maybe you would like to look through several other resources:
JUMPSTART (Sect 5) in th Handbook: http://www.locolomo.org/howto/pxeboot/article.html
wblock's tutorial for pxe: http://www.wonkity.com/~wblock/docs/html/pxe.html

Your install.cfg is not important atm, as you first need to get kernel to boot and root to mount.
The advice in my previous post (specially #3) was for mounting nfs exported systems, since you did not specify you were doing an mfsroot mount. They are not so relevant for mfsroot mounting.



> when I restart I get the prompt mfsroot.


Please elaborate. I assume mfsroot is the hostname specified in your mfsroot.gz? What do you mean by prompt? is it after the "can't load kernel" message?


----------



## DutchDaemon (Apr 16, 2012)

zambombas, use the proper formatting tags please.


----------



## zambombas (Apr 16, 2012)

DutchDaemon said:
			
		

> zambombas, use the proper formatting tags please.



Sorry, I'll do from now.



> Please elaborate. I assume mfsroot is the hostname specified in your mfsroot.gz? What do you mean by prompt? is it after the "can't load kernel" message?



I fixed the other problems.When the client machine finishes restart prompt is this  

```
FreeBSD i386 (mfsbd) ttyv0
login:
```

 Should load the script install.cfg but does not. Sorry for my English and thank you again.


----------



## Beeblebrox (Apr 17, 2012)

Not sure, but I think you have to login and start install.*sh* from command shell. install.cfg is a config file, not an action script. If script is in folder specified in $PATH, just *# install* should get it going. If not, locate the directory where install.sh is and cd to it then,
`# ./install.sh`


----------



## zambombas (Apr 17, 2012)

I tried to load the configuration file install.cfg from the 
	
	



```
sysinstall
```
 menu but just gives me the option to boot from the cd. Any Idea?

EDIT :I read that to let you do have to compile with this option sysinstall LOAD_CONFIG_FILE. Any idea how?


----------



## Beeblebrox (Apr 18, 2012)

Not much experience with sysinstall, sorry. Maybe someone else can be of help there...


----------



## aa (Apr 19, 2012)

zambombas said:
			
		

> EDIT :I read that to let you do have to compile with this option sysinstall LOAD_CONFIG_FILE. Any idea how?



LOAD_CONFIG_FILE used to hardcoded filename to be automatically run by sysinstall. In your case (in your script), you'd rather execute sysinstall loadConfig=fullpath-to-install.cfg



> I tried to load the configuration file install.cfg from the sysinstall menu but just gives me the option to boot from the cd. Any Idea?



The last command in your install.cfg is shutdown, I think it was the BIOS message when no valid OS installed.


----------



## zambombas (Apr 20, 2012)

aa said:
			
		

> LOAD_CONFIG_FILE used to hardcoded filename to be automatically run by sysinstall. In your case (in your script), you'd rather execute sysinstall loadConfig=fullpath-to-install.cfg
> The last command in your install.cfg is shutdown, I think it was the BIOS message when no valid OS installed.


Thank you!!!!!!! :r:r:r
Works!!!!!  installation begin,now I have the following error :
(sysinstall) uid 0,was killed: out of swap space 
though I have 2GB of ram :/

EDIT : I created a swap file in /tftboot/usr and then enabled  the swap file in tftboot/etc/rc.conf the installation hang on 


> mounting 192.168.1.7:/tftboot over NFS on /dist


----------



## zambombas (Apr 21, 2012)

*A*lways runs out of swap memory, any idea?


----------



## aa (Apr 21, 2012)

It seems that your disk partitioning/labeling has failed.

Perform sysinstall manually/interactively and pay attention to the device naming, it might be da0, ada0, or even ad8, rather than ad0.

Another thing to consider:  what has been called as swap space by sysinstall actually is temporary area (default to: /var/tmp). That's a bit misleading, since swap, for the rest of us, most definetely means a swap-fs() (like you had in your install.cfg).


----------



## Beeblebrox (Apr 21, 2012)

Look into gpart(8)(). Before running sysinstall you can try running gpart to partition your disk manually. At least create the swap space and mount it with
`# swapon /dev/ada0p<n>`
You should normally (at this point in technology) prefer GPT partitioning over MBR, hence the p<n> notation above. For example, my partition:

```
=>       34  625142381  ada0  GPT  (298G)
         34         96    10  freebsd-boot  (48k)
        130    4194304     1  freebsd-swap  (2.0G)
    4194434  167772160     3  freebsd-zfs  (80G)
```


----------



## zambombas (Apr 22, 2012)

Thank you both! I created a swap file and mounted. I run the sysctl command with configFile option. It begins to copy in swap memory and I check it with command 
	
	



```
swap info -h
```
 Is taking his time with the request message 
	
	



```
extracting all distributions
```
 Is this normal?

PD. still doing, I think that crash
PD2:It seems that was the ports package that makes me run out of memory


----------



## Beeblebrox (Apr 23, 2012)

You can always add /usr/ports and /usr/src (source) later. You don't even need ports if you will be adding software as binaries with pkg_add. You need ports if you plan on building a binary package.


----------



## aa (Apr 24, 2012)

I have told you, that was not because of swap partition. You must have accessible *temporary-area* which is default to /var/tmp which you did not have.

Either add entry: PKG_TMPDIR=/tmp (to set temporary area in root) or add /var partition (eg. ad0s1-2=ufs 209715 /var) to install.cfg.


----------



## zambombas (Apr 24, 2012)

aa said:
			
		

> I have told you, that was not because of swap partition. You must have accessible *temporary-area* which is default to /var/tmp which you did not have.
> 
> Either add entry: PKG_TMPDIR=/tmp (to set temporary area in root) or add /var partition (eg. ad0s1-2=ufs 209715 /var) to install.cfg.



You were right, I did but now *I* have the following error:

```
error [FILE]mounting nfs://192.168.1.9:/tftboot[/FILE] on[FILE] dist [/FILE]: no such file or directory
```
I mounted the nfs and it works, what is the dist directory?


----------



## nORKy (Apr 25, 2012)

*H*i, is NFS the only way to mount root? *C*an't download and load in Ramdisk?


----------

