1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FreeBSD 8.0 headless pxe install

Discussion in 'Installing and Upgrading FreeBSD' started by loppefaaret, Feb 20, 2010.

  1. loppefaaret

    loppefaaret New Member

    Messages:
    4
    Thanks Received:
    0
    Hi

    I'm trying to do a headless install over PXE

    http://jdc.parodius.com/freeBSD/pxeboot_serial_install_8.html

    i got a soekris 5501 that im trying to install freebsd 8 to.

    im PXE booting it from a windows server 2008.
    with tftpd32.exe wich controls the tftp & dhcp part, then i have a NFS share on the windows 2008 that allows anonymous connections, to serve the root of the tftp directory.
    my DHCP is working correctly
    my TFTP is working correctly
    my NFS is working correctly

    ive got a custom build "pxeboot" file, that was made with make BOOT_PXELDR_ALWAYS_SERIAL=1 BOOT_COMCONSOLE_SPEED=115200 on a running freebsd 8.0 release i386 system.

    ive copied the /boot directory from the 8.0-FreeBSD-RELEASE-i386-bootonly.iso into the root of my TFTP/NFS share.

    ive created a boot.config in the root of the share, with /boot/loader -h -S115200 -Dh
    ive edited /boot/loader.conf to contain:
    Code:
    mfsroot_load="YES"
    mfsroot_type="mfs_root"
    mfsroot_name="/boot/mfsroot"
    vfs.root.mountfrom="ufs:/dev/md0"


    ive unpacked /boot/mfsroot.gz to /boot/mfsroot


    now, when i boot the soekris using PXE, i get the PXE loading, followed by the FreeBSD boot menu. (default, no-acpi etc.) then it starts booting kernel and there is no more output to the serial console..

    Code:
    /boot/kernel/kernel text=0x88d680 data=0xdb0f4+0xa3104 -
    Hit [Enter] to boot immediately, or any other key for command prompt.
    Booting [/boot/kernel/kernel]...
    -
    


    maybe my problem is that the kernel switches the baud rate ? is there additional options that i have to set somewhere ? or is the problem something different ?
     
  2. J65nko

    J65nko Member

    Messages:
    424
    Thanks Received:
    109
    loppefaaret thanks for this.
  3. loppefaaret

    loppefaaret New Member

    Messages:
    4
    Thanks Received:
    0
    ok...

    soekris default serial speed is indeed 19200...


    ive decided i was a fool for going with 115200...
    just stick to 9600 like the rest of the world :)

    so i set the soekris to conspeed=9600

    ive got the DHCPD & TFTPD through tftpd32.exe(to be honest, i dont know if the DHCP works as it should, but i have previously booted freebsd 7.2 and netbsd 4.0.1 with it, so i assume it works)
    ive got NFS shared by builtin file sharing in server 2008, with anonymous access allowed, and have added the anonymous user group to the security tab of /pxeroot/ so anon can access and read files.

    then i went back to the machine running freebsd 8.0 release, and did:
    Code:
    rm -rf /usr/obj/* && cd /sys/boot && make BOOT_PXELDR_ALWAYS_SERIAL=1 BOOT_COMCONSOLE_SPEED=9600
    


    i then copy pxeboot into /pxeroot/boot/ on my windows machine.

    i extract the contents of 8.0-RELEASE-i386-bootonly.iso /boot/* into /pxeroot/boot/

    i direct my DHCP to point to /boot/pxeboot as bootfile

    i make /pxeroot/boot.config to look like this:
    Code:
    /boot/loader -h -S9600
    


    i edit /pxeroot/boot/loader.conf to look like:
    Code:
    mfsroot_load="YES"
    mfsroot_type="mfs_root"
    mfsroot_name="/boot/mfsroot"
    vfs.root.mountfrom="ufs:/dev/md0"
    console="comconsole"
    comconsole_speed="9600"
    


    i did not modify /pxeroot/boot/device.hints as it allready loads uart0 with 0x10 flag as default.

    that should do it ?


    no..
    now it doesnt even show the pxeboot loading on the serial console... before with the 115200 compiled pxeboot, i got pxeboot telling me console was serial, that the harddrive was disk0 etc.. then i had the freebsd boot choice with default, no-acpi etc, then it would load kernel, and output would halt... now output halts imidiatly after pxeboot has been loaded from tftp...

    Code:
    comBIOS ver. 1.33  20070103  Copyright (C) 2000-2007 Soekris Engineering.
    
    net5501
    
    0512 Mbyte Memory                        CPU Geode LX 500 Mhz
    
    Pri Mas  FUJITSU MHT2080BH               LBA Xlt 1024-255-63  78 Gbyte
    
    Slot   Vend Dev  ClassRev Cmd  Stat CL LT HT  Base1    Base2   Int
    -------------------------------------------------------------------
    0:01:2 1022 2082 10100000 0006 0220 08 00 00 A0000000 00000000 10
    0:06:0 1106 3053 02000096 0117 0210 08 40 00 0000E101 A0004000 11
    0:07:0 1106 3053 02000096 0117 0210 08 40 00 0000E201 A0004100 05
    0:08:0 1106 3053 02000096 0117 0210 08 40 00 0000E301 A0004200 09
    0:09:0 1106 3053 02000096 0117 0210 08 40 00 0000E401 A0004300 12
    0:20:0 1022 2090 06010003 0009 02A0 08 40 80 00006001 00006101
    0:20:2 1022 209A 01018001 0005 02A0 08 00 00 00000000 00000000
    0:21:0 1022 2094 0C031002 0006 0230 08 00 80 A0005000 00000000 15
    0:21:1 1022 2095 0C032002 0006 0230 08 00 00 A0006000 00000000 15
    
    
    comBIOS Monitor.   Press ? for help.
    
    > show
    
    ConSpeed = 9600
    ConLock = Enabled
    ConMute = Disabled
    BIOSentry = Enabled
    PCIROMS = Enabled
    PXEBoot = Enabled
    FLASH = Secondary
    BootDelay = 5
    FastBoot = Disabled
    BootPartition = Disabled
    BootDrive = 80 81 F0 FF
    ShowPCI = Enabled
    Reset = Hard
    CpuSpeed = Default
    
    > boot f0
    
    Intel UNDI, PXE-2.0 (build 082)
    Copyright (C) 1997,1998,1999  Intel Corporation
    VIA Rhine III Management Adapter v2.43 (2005/12/15)
    
    CLIENT MAC ADDR: 00 00 XX XX XX XX
    CLIENT IP: 192.168.137.10  MASK: 255.255.255.0  DHCP IP: 192.168.137.1
    GATEWAY IP: 192.168.137.1
    

    and thats it x(

    i guess ill mess a bit around with the different options like /boot/loader -h -Dh -S9600 and the loader.conf comconsole... maybe try and compile pxeboot without BOOT_COMCONSOLE_SPEED=9600, as this should be default, and therefor not needed, and by defining it in the make command, i mess up things ? but it is stated that when 1 bootstage has a serial setup, the next bootstage would detect it, and adopt the settings by itself. would that mean that by compiling pxeboot, settings in boot.config and/or loader.conf is obsolete ?


    PS: thanks to dutchdemon for cleaning up my mess.
     
  4. loppefaaret

    loppefaaret New Member

    Messages:
    4
    Thanks Received:
    0
    in a shortage of edit button!

    just wanted to clear up, that first i copy contents of the iso to /boot, then i copy the compiled pxeboot into /pxeroot/boot , and not the other way around as stated above...
     
  5. loppefaaret

    loppefaaret New Member

    Messages:
    4
    Thanks Received:
    0
    ok...

    alot of this is creditted http://jdc.parodius.com/freebsd/pxeboot_serial_install.html

    so ditched windows..
    went with freebsd as hosting pc.
    get ur self a fresh install of freebsd 8, and make sure u add the base and kernel src code, along with developer tools to compile.




    first thing i install is the nano editor, as this is my favorite editor.
    Code:
    cd /usr/ports/editors/nano
    make install clean clean-depends
    hash -r
    

    then i setup DHCP daemon
    Code:
    cd /usr/ports/net/isc-dhcp31-server
    make install clean clean-depends
    

    this will put the dhcpd.conf config script in /usr/local/etc/dhcpd.conf
    Code:
    nano /usr/local/etc/dhcpd.conf
    

    my dhcpd.cong contains the following:
    Code:
    option domain-name "local.domain";
    option domain-name-servers 192.168.137.1;
    default-lease-time 6000;
    max-lease-time 60000;
    ddns-update-style none;
    authoritative;
    subnet 192.168.137.0 netmask 255.255.255.0 {
    	range 192.168.137.10 192.168.137.200;
    	option domain-name-servers 192.168.137.1;
    	option domain-name "loca.domain";
    	option routers 192.168.137.1;
    	option broadcast-address 192.168.137.255;
    	default-lease-time 600;
    	max-lease-time 7200;
    	next-server 192.168.137.1;
    	filename "pxeroot/boot/pxeboot";
    	option root-path "/usr/local/pxeroot";
    }
    

    next step is the tftp server, that is hosted through inetd, nano /etc/inetd.conf:
    look for 1 particular line that starts with #tftp dgram udp
    carefull not to mix it up with the line #tftp dgram udp6.
    delete the leading # so the line looks like:
    Code:
    tftp	dgram	udp	wait	root	/usr/libexec/tftpd	tftpd -l -s /usr/local/pxeroot
    

    notice the ending of the line, thats the actual command, and in it we specify the directory to serve over tftp, /usr/local/pxeroot
    since tftp is anonymous, the directory has to allow access to all, but we get to that later

    next thing is the nfsd, wich is network file sharing daemon, to serve the install media.
    nfs shares are defined in the /etc/exports file, go ahead and edit it: nano /etc/exports
    and input following
    Code:
    /usr/local/pxeroot	-network 192.168.137 -mask 255.255.255.0
    

    there is more to it, to enable nfsd completely, but ill cover that part later.



    so now we have our dhcp server, tftp server and nfs server.
    now we let them run at boot time, as services.
    that is done through the /etc/rc.conf file, in this file we also set a static IP for the network interface we going to be connecting to the booting client.
    my ethernet interface is called em0, yours might be different
    go ahead and edit it: nano /etc/rc.conf
    input the following lines at the bottom:
    Code:
    ifconfig_em0="inet 192.168.137.1 netmask 255.255.255.0"
    
    dhcpd_enable="YES"
    
    inetd_enable="YES"
    
    rpcbind_enable="YES"
    mountd_enable="YES"
    nfs_server_enable="YES"
    nfs_client_enable="YES"
    

    tftp is served through inetd, and the last 4 lines are for nfs to work proberly.


    now we go ahead and create the folders for booting and installing.
    Code:
    mkdir /usr/local/pxeroot
    

    in this we have to put the files from the 8.0-RELEASE-i386-disc1.iso
    we are going to download it and extract it with the following commands:
    Code:
    cd
    wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.0/8.0-RELEASE-i386-disc1.iso
    tar -C /usr/local/pxeroot -pxvf 8.0-RELEASE-i386-disc1.iso
    


    next step is to recompile the pxeboot file, so that it will direct output to serial console
    Code:
    rm -fr /usr/obj/*
    cd /sys/boot
    make clean
    make BOOT_PXELDR_ALWAYS_SERIAL=1 BOOT_COMCONSOLE_SPEED=9600
    cp /sys/boot/i386/pxeldr/pxeboot /usr/local/pxeroot/boot
    cd /sys/boot
    make clean
    


    then we need to create /usr/local/pxeroot/boot.config with the following line inside:
    nano /usr/local/pxeroot/boot.config
    Code:
    /boot/loader -h -S9600
    


    next step we control it through the file /usr/local/pxeroot/boot/loader.conf
    go ahead and edit it: nano /usr/local/pxeroot/boot/loader.conf
    Code:
    mfsroot_load="YES"
    mfsroot_type="mfs_root"
    mfsroot_name="/boot/mfsroot"
    vfs.root.mountfrom="ufs:/dev/md0"
    console=comconsole
    comconsole_speed=9600
    



    as i said earlier, we need to let anonymous access these files, so we do the following to let anyone access it:
    Code:
    find /usr/local/freebsd8 -type d -print0 | xargs -0 chmod 0755
    find /usr/local/freebsd8 -type f -print0 | xargs -0 chmod 0644
    




    finally do a:
    Code:
    reboot
    


    now hook up the serial, and pxeboot the headless computer