Create Automatic Boot Script PXE

Hello,

I am now busy with Soekris, small servers running with OpenBSD 3.5.
What i want to make is, a bootable media, pxeboot, with an automatic installer.
So when i bootup my Soekris, via TFTP, it's installs himself. can i create my own pxeboot... yes, how ?
can i create my own script, when i bootup my Soekris, via TFTP, with auto execute... yes, how ?

How can i do this.

If this can work. it will spare me much time...

Thanks in advance.

-Colin-
ColinWebdesignAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
Probably there is nothing to be scared of:
http://www.openbsd.org/faq/faq6.html#PXE

You can either put all on linked ramdisk like installers do ( and if you have lots of RAM ) , or point kernel to / on nfs

I never tried that to PC further than loading installer ramdisk, but repeated many times for many SUN boxes for many years ( not pxe, but similar concept )

If you ask I can write long step-by-step guide
0
ColinWebdesignAuthor Commented:
Yes please, can you write a step-by-step guide for me please..

Thanks in advance..
0
gheistCommented:
Have you tried and failed ( so my instructions should help clean up) ????
Which version - 3.5, 3.6 or snapshot ???

0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

ColinWebdesignAuthor Commented:
Version 3.6... can you write down what you know please.
I think it will help me alot..
0
gheistCommented:
Basic bootsrapping steps:
1) PXE rom loads pxeboot from tftp on server host as instructed by dhcpd
2) pxeboot loads (probably gzipped) DISKLESS kernel from same tftp
3) kernel mounts nfs root filesystem, and probably swap/dump filesystem as instructed by bootparamd
4) it executes normal boot sequence from nfs /, which may include mounting web data directory etc.

I will assume yoour netboot server has IP address 192.168.254.1/24 on netcard named fxp0, and knowing how to route (or nat) to other networks, and all networking gear auto-negotiates well and netcards are well supported by OpenBSD (mine, only with PXE does not ... :-(  )

So steps for setting up netboot server
(1,2) requires two server daemons - dhcp and tftp to succeed
create /tftpboot directory and populate it with bootstrap files, namely
pxeboot - probably from ftp
bsd - diskless kernel ( cd /usr/src/sys/arch/i386/conf ; config DISKLESS ; cd ../compile/DISKLESS ; make depend ; make ; gzip -9 <bsd >/tftpboot/bsd )
etc/boot.conf - probably containing set tty com0 and boot in two lines, man boot.conf for more detail
now enable tftp dgram udp ... in /etc/inetd.conf and kill -HUP `cat /var/run/inetd.pid`

* now test it:
$cd /tmp
>tftp 127.0.0.1
>get bsd
>quit
diff /tmp/bsd /tftpboot/bsd

This server will start at boot if you have not disabled inetd

Next is DHCP
create /etc/dhcpd.conf (or add this)
shared-network soekris {
        option  domain-name "colin.dom";
        option domain-name-servers 192.168.254.1;

        subnet 192.168.254.0 netmask 255.255.255.0 {
                option routers 192.168.254.1;
                filename "pxeboot";
                range 192.168.254.2 192.168.254.250;
        }
}
now run dhcpd -q fxp0

Now test - just boot one soekris box - it should load pxeboot and kernel and leave it complaining where root device is

Now add this to /etc/rc.conf.local to start dhcpd at boot
dhcpd_flags="-q fxp0"

So far so good, let me relax hands for few minutes now....
0
ColinWebdesignAuthor Commented:
it it was all successfull, except for the booting on the soekris box. i can't test it right now.
thanks for now.
0
gheistCommented:
any PXE box will do ....
0
gheistCommented:
next comes naming the hosts, via generating dns zones in both directions, or generating /etc/hosts

then comes rpc.botparamd

/etc/bootparams:
# host name root/swap/dump=mountpoint
h-254-1.colin.dom  root=192.168.254.1:/nfsroot

for start:
portmap
rpc.bootparamd

/etc/rc.conf.local
portmap=YES # needed by the rest
bootparamd_flags=""

then comes nfs

/etc/exports:
/nfsroot -maproot:nobody h-254-1.colin.dom

for start:
mountd
nfsd -tun4

/etc/rc.conf.local:
nfs_server=YES

For test (on server):
$ rpcinfo -p # at least these
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100026    1   udp    963  bootparam
    100005    1   udp    829  mountd
    100005    3   udp    829  mountd
    100005    1   tcp    915  mountd
    100005    3   tcp    915  mountd
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
$ showmount -e
Exports list on localhost:
/nfsroot                  h-254-1.colin.dom

-----------

to reduce kernel size try dmassage, to write out repeating configs try ipfmeta
0
ColinWebdesignAuthor Commented:
well, followed all the steps you wrote now. nfs is running as well. but when i boot up the soekris box with the new created diskless kernel i get the following panic:

------------------------------
sysbeep0 at pcppi0
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pccom0: console
pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
biomask fbe5 netmask ffe5 ttymask ffe7
pctr: no performance counters in CPU
nfs_boot: using network interface 'sis0'
panic: revarp failed, error=51
Stopped at      Debugger+0x4:   leave
RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
ddb>
------------------------------
0
ColinWebdesignAuthor Commented:
and what do you exactly mean with:
gzip -9 <bsd >/tftpboot/bsd

???
0
ColinWebdesignAuthor Commented:
i did configured rarpd and running, can't find any request via tcpdump about rarpd...
0
gheistCommented:
#define ENETUNREACH     51              /* Network is unreachable */
Must be some media problems

did I say something about rarpd ??? do you have sparc or sparc64 ???

gzip compresses file using zlib compression, format supported by pxeboot.
0
ColinWebdesignAuthor Commented:
where did you find "#define ENETUNREACH     51              /* Network is unreachable */" ???

do not have sparc, i am using i386. find something about rarpd....

can't find what i am doing wrong:
---
nfs_boot: using network interface 'sis0'
panic: revarp failed, error=51
Stopped at      Debugger+0x4:   leave
RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
ddb>
---
0
gheistCommented:
You do everything right.

So far where you got you can create own ramdisk kernel with applications and mount /var and /usr as nfs....
(some tips on this are here: /usr/src/distrib/i386/ramdisk_cd)

I have repeated almost the same, my netcard is Marvell as found on ASUS mainboard.
dmesg complains it has no phy ( which imo is another bug ), then aftrer revarp fails, due to this bug , and another bug comes in place - system crashes when automatic root mount fails.

As far as I looked around the web only hints were to change system bios ( including PXE) back or forth, or my own hint after looking up driver in cvs, is to try snapshot (is what I will do....)

For your case some more guesswork ....
your netcard was reset before that revarp., so it renegotiated media speeds and was half dead for a while and revarp packet never hit the wire ( hint: set 10/half in card bios or so)
0
ColinWebdesignAuthor Commented:
your hint is me to try snapshot of openbsd ??? can you explain shortly how ...
0
ColinWebdesignAuthor Commented:

Don't understand what you mean:

---
For your case some more guesswork ....
your netcard was reset before that revarp., so it renegotiated media speeds and was half dead for a while and revarp packet never hit the wire ( hint: set 10/half in card bios or so)
---
0
gheistCommented:
error codes are in /usr/include/sys/errno.h

Maybe problem with revarp can be fixed by avoiding automatic network media renegotiation ....

I found running snapshot advisable for me since http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_sk.c tells that many phy detection problems are solved.....

When you replace _sk with _sis in url you find something for you probably.

0
ColinWebdesignAuthor Commented:

yeah, i configured my own bsd server at home for tftp boot. with nfsd and so on. and it worked. i booted a normal computer (i386) with a 3com NIC, xl0. it worked.

so i have to download http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_sk.c.... and then what, what do i have to do with it ?

i thought i knew a lot, but when i learn something i even know better i know less :)

(sorry for my bad english)
0
gheistCommented:
> d a normal computer (i386) with a 3com NIC, xl0
so my instructions work ....
Your soekris driver is here ( sk is the driver for card I have problems )
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/if_sis.c

For example I find this commit message for if_sk ( my netcard) very releavant ...
---------
Don't initialize the card (and start an autonegotiation!) every time
the IP address changes. Makes 'dhclient sk0' invocations way faster
and more consistant. i.e. one DHCPREQUEST elicts the DHCPACK.
---------
I just wonder if something like that relates to your ethernet adapter (sis)....

Maybe ask soekris support about what do they think.

I simply have no soekris boxes to test with..... :-(

I will try tomorrow with my laptop ( Intel netcard, fxp0 ), i guess it will be fine just like your 3com
0
ColinWebdesignAuthor Commented:
i am going to try the sk driver in about an hour. and yes your step-by-step guide work...
0
gheistCommented:
you have to use sis driver ; sk is for completely different hardware, but with alike problems.

you have to solve sis problems
i have to solve sk problems

they somehow are integrated on mainboard but fail thanks to weak drivers

confirmed with fxp driver - setup works....
0
ColinWebdesignAuthor Commented:
can't fix the sis driver problem. search the internet for good sis drivers but non of them work. :(
0
gheistCommented:
You can boot same DISKLESS kernel with small ramdisk still and mount other filesystems using tools in it. Not very good solution, but can make server farm up and running.

the patch for sk 1.55->1.56 but applied to sis driver ... please try out, i cannot test since i have no hardware ... maybe it works, maybe breaks build, if it works submit to bugs@. Please examine that if_sk , there is same patch in some other cases too, basically dealing with not bringing interface down on spurious problems

     s = splnet();

+      if (ifp->if_flags & IFF_RUNNING) {
+            splx(s);
+            return;
+      }
+
        /*
         * Cancel pending I/O and free all RX/TX buffers.
         */
        sis_stop(sc);

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
> Date: 03/20/2005 05:10AM PST
this is more of an answer to question's subject. (probably most seeked by those who read topic and look into answers)

after that comes blind & failed  attempt to fix HW driver
Thank you for understanding
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.