?
Solved

Create Automatic Boot Script PXE

Posted on 2005-03-14
26
Medium Priority
?
1,627 Views
Last Modified: 2013-12-09
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-
0
Comment
Question by:ColinWebdesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 12
26 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 13584870
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
 

Author Comment

by:ColinWebdesign
ID: 13584972
Yes please, can you write a step-by-step guide for me please..

Thanks in advance..
0
 
LVL 62

Expert Comment

by:gheist
ID: 13585183
Have you tried and failed ( so my instructions should help clean up) ????
Which version - 3.5, 3.6 or snapshot ???

0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:ColinWebdesign
ID: 13585386
Version 3.6... can you write down what you know please.
I think it will help me alot..
0
 
LVL 62

Expert Comment

by:gheist
ID: 13585391
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
 

Author Comment

by:ColinWebdesign
ID: 13585977
it it was all successfull, except for the booting on the soekris box. i can't test it right now.
thanks for now.
0
 
LVL 62

Expert Comment

by:gheist
ID: 13585997
any PXE box will do ....
0
 
LVL 62

Expert Comment

by:gheist
ID: 13586070
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
 

Author Comment

by:ColinWebdesign
ID: 13589312
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
 

Author Comment

by:ColinWebdesign
ID: 13589713
and what do you exactly mean with:
gzip -9 <bsd >/tftpboot/bsd

???
0
 

Author Comment

by:ColinWebdesign
ID: 13590283
i did configured rarpd and running, can't find any request via tcpdump about rarpd...
0
 
LVL 62

Expert Comment

by:gheist
ID: 13590415
#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
 

Author Comment

by:ColinWebdesign
ID: 13590430
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
 
LVL 62

Expert Comment

by:gheist
ID: 13590630
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
 

Author Comment

by:ColinWebdesign
ID: 13590688
your hint is me to try snapshot of openbsd ??? can you explain shortly how ...
0
 

Author Comment

by:ColinWebdesign
ID: 13591936

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
 
LVL 62

Expert Comment

by:gheist
ID: 13594914
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
 

Author Comment

by:ColinWebdesign
ID: 13596543

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
 
LVL 62

Expert Comment

by:gheist
ID: 13596623
> 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
 

Author Comment

by:ColinWebdesign
ID: 13598540
i am going to try the sk driver in about an hour. and yes your step-by-step guide work...
0
 
LVL 62

Expert Comment

by:gheist
ID: 13600037
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
 

Author Comment

by:ColinWebdesign
ID: 13600189
can't fix the sis driver problem. search the internet for good sis drivers but non of them work. :(
0
 
LVL 62

Accepted Solution

by:
gheist earned 1200 total points
ID: 13604244
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
 
LVL 62

Expert Comment

by:gheist
ID: 14321083
> 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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question