Showing posts with label jumpstart. Show all posts
Showing posts with label jumpstart. Show all posts

Tuesday, February 3, 2009

JumpStart Symlinks And Solaris 10 Unix

Hey there,

Today's topic covers a little issue I ran into at work (which I actually do from time to time ;) that had me puzzled for a bit. If you're a grizzled Solaris/Slakware veteran like me, some of the newer features of Solaris 10 are pretty much lost on you until you absolutely "need" to understand them ;) Case in point, NFS sharing and JumpStart on Solaris 10 and/or ZFS (a point we seem to have overlooked in the onslaught of information in our post featuring Solaris' 5/08 Release Notes. Do a find for "NFS" - it's a realllllly long release note :)

The issue we had going on was that we'd gotten in the habit of running a JumpStart, and then sometime later (maybe days, weeks, who knows?) running another, etc; money's tight, not too many new machines to build and everything worked fine. Solaris 10 was doing great (That isn't to say that it didn't do great the entire time we had this problem ;) The issue was more of a fundamental misunderstanding and lack of knowledge on my part). Then, a few days ago, we had the time and the means, and I began a two-fisted JumpStart (Nothing violent, just concurrent installations ;)

Then, after I'd run through this a few more times than I'm proud to admit, I finally threw up my hands after yet another attempt at double-JumpStarting failed. The failure was very specific so I was fairly certain I was either doing something wrong or I was doing something wrong ;) Basically, both machines would boot up to the net and begin their JumpStart installations. All would go swimmingly; finding the JumpStart host, grabbing the correct profile, finish scripts and sysidcfg files. The bummer was that, after completing the full install of Solaris 10 (yes, it made us wait until after "all" of the software had been installed) it would get this funky error (hopefully, you've seen it before, and this post might just help you out :) :

Completed software installation

Solaris 10 software installation succeeded

Customizing system files
- Mount points table (/etc/vfstab)
- Unselected disk mount points (/var/sadm/system/data/vfstab.unselected) - Network host addresses (/etc/hosts)

ERROR: Could not open file (/etc/hosts)

ERROR: Could not set up the remote host file (/etc/hosts)

ERROR: System installation failed
Solaris installation program exited.


????????????

Okay, so we were kind of stumped (well, totally stumped until we figured out the solution - by definition, I think ;) It turns out that one of our procedurals before initiating the "boot net - install" portion of single server JumpStarts was actually contributing to our confusion about what the problem really was. The reason for that is because we would always sync our local JumpStart server with the master. Good practice, but (in this case) a bit of a diversion. Anyway, we'll get to why that mattered in a bit ;)

Investigation into the matter (which, after several failed installs, consisted of crashing the install in the mini-root to check the state of the JumpStart temporary mount configuration in real-time) revealed something interesting. If you look up the page a little (or just remember ;) the killer error we got was:

ERROR: Could not open file (/etc/hosts)

ERROR: Could not set up the remote host file (/etc/hosts)

ERROR: System installation failed


Looking at the state of the filesystem, after crashing at the point of error, revealed this directory structure in the temporarily mounted /etc filesystem (stripped down a bit for brevity's sake):

...
-r--r--r-- 1 root sys 99 Feb 2 16:48 hosts
...
-r--r--r-- 1 root sys 91 Feb 2 16:48 ipnodes
...
-r--r--r-- 1 root sys 384 Feb 2 16:48 netmasks
...


The reason that's interesting is that those files should have looked like this:

...
lrwxrwxrwx 1 root other 29 Feb 2 16:56 hosts -> ../../tmp/root/etc/inet/hosts
...
lrwxrwxrwx 1 root other 31 Feb 2 16:56 ipnodes -> ../../tmp/root/etc/inet/ipnodes
...
lrwxrwxrwx 1 root other 32 Feb 2 16:56 netmasks -> ../../tmp/root/etc/inet/netmasks
...


Essentially, Solaris 10 was converting special symlinked files into straight-up flat-files during the JumpStart process. Once that was complete (and the files were corrupted) it really "couldn't" open them up, because the real /etc/hosts file was supposed to be in the /tmp/root/etc directory and not the local one (which is on JumpStart's read-only mini-root filesystem)!

It turns out that this problem (as far as we were interested in figuring out) seems to manifest itself in Solaris 10 for the most part. It may happen in Solaris 9, but we can't go back now!!! :)

And the root cause was... drum roll, please, as I build up to feeling really stupid ;)

The JumpStart mini-root directory was being served up via NFS "read/write"! Doh! And (I'm bringing this back from up top, just as I promised) our procedure for doing JumpStarts had actually made this harder to see. Since we only did one JumpStart at a time, the initial JumpStart would work (even though it left behind a corrupted filesystem). And, per our procedure, right before we kicked off the next one, we'd sync that filesystem up with the known-good master JumpStart server. At no point was this filesystem corruption ever noticed due to the fact that we never had to jump more than one box at a time. Crazy ;)

Anyway, long story short, the quick and simple fix was to unshare the mini-root (/JumpStart/Sol10 for instance, or whatever yours might be) and then reshare it as "read only." If you've been doing this all along (which you should be ;), you'll never have our problem ...probably ;)

Depending upon how your system is setup, you can share NFS a number of ways in Solaris 10. After I ran "unshareall," I was a bit puzzled as to why /etc/dfs/dfstab was empty (See what I meant before? ;). Since I'm such a dinosaur, I wrote it off, figuring somebody had run the share command at the command line and forgot to put that command in an init script or the dfstab file. On many occasions, I would have been correct (and Solaris 10 does still support this type of NFS sharing). The cool thing here is that our JumpStart mini-root was living on a Solaris 10 ZFS dataset. So, all that had to be done to correct the issue (after I uncorrected my incorrect correction ;) was to adjust a property of the dataset in Solaris 10 (actually a very cool feature, I think :) Since the ZFS datasets have a "sharenfs" attribute built-in (set to "no" by default), all we had to do was to change that. A very simple command line to type and a very simple solution to a seemingly complicated issue:

host # zfs set sharenfs=ro,anon=0 maindg/jumpstart/Sol10

Problem solved. And only 3 or 4 hours wasted (I mean, well spent ;) Hopefully this pitiful little tale of woe will get you out of a similar jam sometime :)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, February 14, 2008

Extended Options For Solaris' Jumpstart Boot

Hey There,

Most Solaris Admins are familiar with the basic procedure for kicking off a JumpStart installation. Bare bones, it's usually getting down to the PROM and executing one of either:

ok> boot cdrom - install

or

ok> boot net - install

There are, however, quite a few more options you can throw at even the older Solaris boot PROMs to kick off your JumpStart the way you like. Note that in the below examples, the "|" character is used to indicate an either-or option.

For instance, you can boot directly off of the local hard disk with this option:

file://jumpstartDirectory/compressedConfigurationFile

or from an NFS server, like so:

nfs://serverName|IP/jumpstartDirectory/compressedConfigurationFile

Even an http server:

http://serverName|IP/jumpstartDirectory/compressedConfigurationFile

To flesh out the above examples to a certain degree, these would the type of commands you would type at the PROM ok> prompt:

ok> boot cdrom - install file://jumpstartDirectory/compressedConfigurationFile
ok> boot net - install nfs://serverName/jumpstartDirectory/compressedConfigurationFile
etc...


In certain modes, you will boot from a tar file on your JumpStart server. Just make sure you've placed your sysidcfg inside your tar ball and try this:

ok> boot net - install http://192.168.0.1/jumpstart/config.tar

And, if you use an http server, you don't even need to go through all the hassle we explored in a past post about using JumpStart across multiple subnets, because you can add the "proxy" option to that argument (much like our workaround for JumpStart across subnets, you need to specify the IP address of the proxy, and not the hostname), like so:

ok> boot net - install http://xyz.com/jumpstart/config.tar&proxy=192.168.0.0.1

Hopefully, some of this trivia will prove useful to you at some point. Now there should be almost no way you can get out of having to JumpStart that new server ;)

Cheers,

, Mike




Saturday, January 26, 2008

Local Unix Linux Article Repository Updated!

Happy weekend,

As you may or may not know, I'm in the habit of submitting articles on Linux, Unix, shell scripting, etc, to article sites every now and again. Mostly to promote this blog, which shouldn't be a problem if you're reading this ;)

Now that we've got another socked away, I'm bringing it in-house. I do this for 2 reasons:

1. I have no idea when my online articles are going to be randomly deleted

2. Generally, I have to "edit for content" no matter where I submit. This is okay, although I must admit that it burns a little when I have to pour over an article to remove html tags and relevant links (against policy) only to have my words draped with 100's of advertisements for miracle cream ;)

For today, I've posted both versions of an article on ways to trick JumpStart into working across subnets without following the rules :) In a future post, we'll go into how to script out this kind of setup, so you can do it on the fly. Sometimes, when the seconds count, executing a shell script is a lot more comforting than methodically following a long set of rules ;)

Here they are - the two separate versions (Posting both because the two separate article sites mangled them in two separate ways):

Jumpstarting Across Subnets - version 1

Jumpstarting Across Subnets - version 2

Hope you enjoy reading one of them and have a great Saturday!

, Mike




Tuesday, January 15, 2008

Begin and Finish Script Unix Shell Variables For JumpStart

Today, we're going to finish up what we started in yesterday's and the previous day's posts detailing the customization of Solaris JumpStart using simple Unix shell scripting techniques.

Please, only go back there and read those if the specific topics are of interest to you. If you're just looking for a good collection of available scripting variables for Begin and Finish scripts, you'll thank me for saving you the time ;)

Both Begin and Finish scripts export a certain number of variables automatically. Following is a list of the ones I've discovered during the process of working with the program. The following sections are divided into CRASH (The environment you're left with if you crash to a restricted root shell at any point during the installation), BEGIN (The environment exported during the execution of your begin script) and FINISH (The environment exported during the execution of your finish script). I've denoted the more useful variables (insofar as scripting is concerned) by indenting them slightly more.

Note that all of these variables were found by terminating the execution of JumpStart at the given point and dumping the output of the commands "set" and "env" - I filtered out the variables that were off-topic. Please note, also, that these variables exclude the JASS and SST environment variables, as my aim here is to provide a listing of all available variables that can be used in Begin and Finish scripts no matter what your situation. You can use these whether or not you decide to avail yourself of the additional Solaris JumpStart custom packages Sun has put together over the years (Basically, to make it so you don't have to do any security hardening on your own. I'm not saying this is a bad thing; only that you may know what you want to control and not require that "convenience").

NOTE: Surprisingly enough, there is no SI_INSTALL_DIR or SI_INST_DIR variable provided to indicate your installation directory (e.g., /export/install).

Hopefully, having this list of Solaris Unix variables will prove useful to you at some point during your JumpStart scripting endeavors!

Good Luck and Best Wishes,

CRASH:

HOME=/tmp/root
PATH=/sbin:/usr/sbin/install.d:/usr/sbin:/usr/bin
PLATFORM=sparc
SHELL=/sbin/sh
TEXTDOMAIN=SUNW_INSTALL_SCRIPTS
TZ=PST8PDT
_DVFS_RECONFIG=YES

BEGIN:

CHECK_INPUT=/tmp/install_config/rules.ok
HOME=/tmp/root
LANG=en
LC_COLLATE=en_US
LC_CTYPE=en_US
LC_MESSAGES=C
LC_MONETARY=en_US
LC_NUMERIC=en_US
LC_TIME=en_US
PATH=/sbin:/usr/sbin/install.d:/usr/sbin:/usr/bin
PLATFORM=sparc
SHELL=/sbin/sh
SI_BEGIN=jclient_begin
SI_CLASS=jclient_class
SI_CONFIG_DIR=/tmp/install_config (This is the default, but you should have set it to /export/install with the add_install_client command)
SI_CONFIG_FILE=/tmp/install_config/rules.ok
SI_CONFIG_PROG=rules.ok
SI_FINISH=jclient_finish
SI_HOSTNAME=jclient
SI_INSTALL_APP=jumpstart
SI_PROFILE=/tmp/install_config/jclient_class
SI_SYS_STATE=/a/etc/.sysIDtool.state TERM=vt100
TEXTDOMAIN=SUNW_INSTALL_SCRIPTS
TZ=US/Central
_DVFS_RECONFIG=YES

FINISH:

CHECK_INPUT=/tmp/install_config/rules.ok
HOME=/tmp/root
LANG=
LC_COLLATE=en_US
LC_CTYPE=en_US
LC_MESSAGES=C
LC_MONETARY=en_US
LC_NUMERIC=en_US
LC_TIME=en_US
PATH=/sbin:/usr/sbin/install.d:/usr/sbin:/usr/bin
PLATFORM=sparc
SHELL=/sbin/sh
SI_BEGIN=jclient_begin
SI_CLASS=jclient_class
SI_CONFIG_DIR=/tmp/install_config
SI_CONFIG_FILE=/tmp/install_config/rules.ok
SI_CONFIG_PROG=rules.ok
SI_FINISH=jclient_finish
SI_HOSTNAME=jclient
SI_INSTALL_APP=jumpstart
SI_PROFILE=/tmp/install_config/jclient_class
SI_SYS_STATE=/a/etc/.sysIDtool.state
TERM=vt100
TEXTDOMAIN=SUNW_INSTALL_SCRIPTS
TZ=US/Central
_DVFS_RECONFIG=YES


, Mike




Monday, January 14, 2008

Extended Begin and Finish Script Examples For Solaris JumpStart

Today, I'm extending on what I wrote about in yesterday's post on creating Derived Profiles for JumpStart using simple Unix shell scripting techniques. If you don't feel like going back and reading over all that now, I'll start out by summarizing and sparing you the possibly-irrelevant-to-your-situation details ;)

Begin and Finish scripts are simple shell scripts used to perform any additional customization to your JumpStart installation process that you deem necessary. As I noted yesterday, a lot of this has now been "supplied" for you if you use Solaris' JASS or SST setups. However, these core scripting concepts are still at the heart of those utilities (and I use that word in its primary sense: The setups are utile :).

Begin scripts serve as pre-installation scripts. They won't affect the custom look and feel of your newly installed client, but can be used to perform critical safety routines, such as backing up the hard drive to tape, before beginning the install and creating Derived Profiles, as per the post mentioned above.

Finish scripts are generally more complex, as they're mosty used to customize your newly installed system (everything from installing packages and patches to creating a company standard subdirectory structure).

Some rules and characteristics that apply to both Begin and Finish scripts are:

1. They should be written in either /bin/sh, /sbin/sh, /bin/ksh or any other common shell.

2. All commands should be given as absolutes, unless the commands are shell primitives.

3. FINISH SCRIPTS ONLY: Remember that the new filesystem is mounted on /a before the post-installation reboot and on / afterward. When copying files over you will need to write the command as such:

cp /usr/bin/someprog /a/usr/bin/

in order to copy someprog from the install server's /usr/bin directory to the install client's /usr/bin directory.

4. BEGIN SCRIPTS ONLY: Remember that the existing filesystem is mounted on /tmp before the installation begins. When copying or listing files from the existing filesystem you need to the type the command like:

ls /tmp/usr/bin/someprog

to list the someprog file in the existing filesystem's /usr/bin directory.

5. Standard comments (lines beginning with the pound (#) character) may be included and announcements may be echoed without adversely affecting the outcome of the script.

6. These scripts should be owned by root and have 644 permissions.

7. The output from the scripts will be written to /var/sadm/system/logs/finish.log or /var/sadm/system/logs/begin.log on the install client.

Below, I've included both a detailed Begin and Finish script that have actually been used successfully. They employ Unix shell scripting techniques and moderate complexity only to demonstrate how much freedom you have when creating these kinds of scripts. The Begin script is kept simple since we went into more detail on that previously. They're commented liberally to avoid the annoyance (for both you and me) of beating you over the head with the same things, twice in a row, to get the meaning across :)

Also note that the instances in the scripts, where we insert control characters, are not typed literally as they appear. For more about how to represent actual control character sequences in a script, check out this post from the past.

Best Wishes,


Creative Commons License


These works are licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License


1. Example Begin Script:

#!/bin/sh

#
# begin - do a preinstallation backup
# generic run - unused slices aborted and
# skipped by ufsdump.
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

TAPE=/tmp/dev/rmt/0mn DISK=/tmp/dev/dsk
mt -t $TAPE rewind
ufsdump 0f $TAPE $DISK/c0t3d0s0
ufsdump 0f $TAPE $DISK/c0t3d0s1
ufsdump 0f $TAPE $DISK/c0t3d0s3
ufsdump 0f $TAPE $DISK/c0t3d0s4
ufsdump 0f $TAPE $DISK/c0t3d0s5
ufsdump 0f $TAPE $DISK/c0t3d0s6
ufsdump 0f $TAPE $DISK/c0t3d0s7
mt -t $TAPE rewind


2. Example finish script:

#!/sbin/sh

#
# finish - custom installation parameters script
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

################################################
# Setup root environment
################################################

echo "Setting up root environment"
echo ""
cat > /a/.profile << END
stty erase ^H
stty intr ^C
TERM=vt100
PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
MANPATH=/usr/man:/usr/local/man
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
export TERM PATH MANPATH LD_LIBRARY_PATH
END

################################################
# Setup crons
################################################

echo "Installing root crontab"
echo ""
cp ${SI_CONFIG_DIR}/jclient_root_dir/root /a/usr/spool/cron/crontabs/root

################################################
# Copy over precustomized etc dir files
################################################

echo "Copying over precustomized etc dir files"
echo ""
for x in `ls ${SI_CONFIG_DIR}/jclient_etc_dir`
do
cp -R ${SI_CONFIG_DIR}/jclient_etc_dir/$x /a/etc/
done

################################################
# Ensure sendmail points to custom built v8
################################################

echo "Ensuring sendmail points to custom built v8"
echo ""
rm -f /a/etc/mail/sendmail.cf
rm -f /a/etc/sendmail.cf
ln -s mail/sendmail.v8 /a/etc/sendmail.cf
ln -s sendmail.v8 /a/etc/mail/sendmail.cf
rm -f /a/usr/lib/sendmail
cp ${SI_CONFIG_DIR}/jclient_etc_dir/usrlibsendmail /a/usr/lib/sendmail
chown root:bin /a/usr/lib/sendmail
chmod 4551 /a/usr/lib/sendmail

################################################
# Create local dirs and ship over files
################################################

echo "Creating local dirs and shipping over files"
echo ""
mkdir /a/usr1/local
ln -s /usr1/local /a/usr/local
cd /a/usr1/local
for x in `ls ${SI_CONFIG_DIR}/jclient_local_dir`
do
echo "Disting $x"
cp ${SI_CONFIG_DIR}/jclient_local_dir/$x /a/usr1/local/$x
echo "Uncompressing $x"
uncompress /a/usr1/local/$x
new_x=`echo $x|cut -d'.' -f1,2`
echo "Untarring $new_x"
tar xf /a/usr1/local/$new_x
echo "Removing $new_x"
echo ""
rm -f /a/usr1/local/$new_x
done

################################################
# Take care of some admin packages we need.
################################################

echo "Loading up monitoring and admin software"
echo ""
cd /a/u
for x in `ls ${SI_CONFIG_DIR}/jclient_sys_dir`
do
echo "Disting $x"
cp ${SI_CONFIG_DIR}/jclient_sys_dir/$x /a/u/$x
echo "Uncompressing $x"
uncompress /a/u/$x
new_x=`echo $x|cut -d'.' -f1,2`
echo "Untarring $new_x"
tar xf /a/u/$new_x
echo "Removing $new_x"
echo ""
rm -f /a/u/$new_x
done

################################################
# Set up a few user accounts
################################################

echo "Setting up initial user accounts"
echo ""
for x in `echo username1 username2 sysadmin`
do
echo "$x..."
echo ""
mkdir /a/u/$x
cat > /a/u/$x/.profile <<- END
stty erase ^H
stty intr ^C
set -o vi
TERM=vt100
PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
MANPATH=/usr/man:/usr/local/man
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
export TERM PATH MANPATH LD_LIBRARY_PATH
END
done
cat ${SI_CONFIG_DIR}/jclient_users_dir/PWDFILE >>/a/etc/passwd
cat ${SI_CONFIG_DIR}/jclient_users_dir/SHADFILE >>/a/etc/shadow

################################################
# Verify root password is set
################################################

PASSWD=ez89iik4rj77d
cp /a/etc/shadow /a/etc/shadow.orig
nawk -F: '{
if ( $1 == "root" )
printf"%s:%s:%s:%s:%s:%s:%s:%s:%s\n",$1,passwd,$3,$4,$5,$6,$7,$8,$9
else
printf"%s:%s:%s:%s:%s:%s:%s:%s:%s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9
}' passwd="$PASSWD" /a/etc/shadow.orig > /a/etc/shadow
perm=`grep '^/etc/shadow e' /a/var/sadm/install/contents | (read f1 f2 f3 f4 f5 ; echo $f4)`
chmod $perm /a/etc/shadow
rm -f /a/etc/shadow.orig
sed -e 's/0 # root/1 # root/' ${SI_SYS_STATE} > /tmp/state.$$
mv /tmp/state.$$ ${SI_SYS_STATE}
echo "All set!"


, Mike




Sunday, January 13, 2008

Creating Derived Profiles For Solaris Jumpstart

For today's post, I wanted to take a look at a part of Solaris JumpStart that (with the advent of JASS and SST) not many administrator's avail themselves of anymore. Derived Profiles. It's true that they've always had a limited usefulness, but I always thought they were good things to know how to create. And, they still work with Jumpstart to this day!

Derived profiles (basically, Unix shell scripts) enable the Solaris JumpStart administrator to create custom profiles, or class files, on the fly. These are useful when the similarity between two machines would result in the creation of convoluted, or impossible, rulesets in the rules file to distinguish between them (Obviously, this doesn't apply if you keep your ruleset matches to hostnames. I hope ;)

To use a derived profile on Solaris, the ruleset that matches the particular machine must have its profile_script variable replaced by an equals (=) sign and the begin_script field set to the name of the begin script that will be creating the derived profile.

Ex:
! karch sun4c && memsize 128 profile_script = finish_script


Normally, at the end of the ruleset after the match criteria, you'd see something like:

begin_script profile_script finish_script

More often than not, that old standard would be written as:

- profile_script finish_script

since begin scripts aren't used very much anymore (as noted above).

But the "=" sign that indicates you'll be deriving a profile, makes it so the place in the argument where the begin_script name would normally reside should become the name of the profile_script you're going to derive through creative scripting. You can name your derived profile shell script "begin_script," but it might cause confusion. Depending on how you process thought, one way is more intuitive than the other. And, as luck would have it, neither are wrong :)

And, that's all there is to that. When a given machine matches the indicated ruleset, the begin script will create the profile, or class file, according to the instructions provided by your begin script. The more advanced your scripting skills, the more useful and practical these simple Unix scripts can, ultimately, be for you. With a little bit of work, you might be able to save yourself a lot of repetitive scripting in the future.

Assuming you still like to do it the old-fashioned way, like me ;)

Cheers,

Example Derived Profile script To Handle Locally Attached Disk:


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/sh

#
# This script parses the install clients /dev/dsk directory,
# passes over all non-disks and uses all available disks for
# the OS install.
#
# Note that $SI_PROFILE is automatically defined by Solaris
# and begin scripts execute with the main disk mounted on /tmp
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

#!/bin/ksh

echo "install_type initial_install" >>${SI_PROFILE}
echo "system_type standalone" >>${SI_PROFILE}
echo "partitioning default" >>${SI_PROFILE}
echo "cluster SUNWCreq" >>${SI_PROFILE}
ls /tmp/dev/dsk |while read line
do
notdisk=`echo $line|cut -d"t" -f2|cut -d"d" -f1`
disk=`echo $line|cut -d"s" -f2`
if [ $notdisk -gt 3 ]
then
continue
elif [ $disk -eq 2 ]
then
whole=`echo $line|cut -d"s" -f1`
echo "usedisk $whole" >>${SI_PROFILE}
else
continue
fi
done

Thursday, January 3, 2008

Bypassing Boot Server Installation When Jumpstarting Across Subnets

Greetings,

Today I thought we'd go with a little "trickery," although this isn't really a trick; it's just not the way you're supposed to use Solaris' Jumpstart when Jumpstarting across subnets. It has it's benefits, though, aside from the obvious (I'll get to that at the end :) Note that some of this process varies in Solaris 10 (insofar as the starting up of services goes, but we'll hit that in a later post, since they've completely changed the procedure). This will work, almost word for word in Solaris versions up to and including 9.

Now, to get started:

In order to install and configure a system across subnets, it is recommended by Sun that the Jumpstart client be configured to run through a Boot Server on that client's subnet (and on a separate server for every subnet that you need to hop through). This involves executing the add_install_client command on the Boot Server on the same subnet as the client, and installing all the software required to run a Boot Server.

It is possible, however, to use any server on the client's subnet as a conduit through which to pass the boot, installation and configuration information between the client and server without expending the time, or wasting the resources, that installing a Boot Server on the intermediate client requires.

In order to make this seamless connection between subnets possible, and allow your Jumpstart client to install and configure itself through the server, you will need to modify certain files and ensure that several daemon processes are active on the gateway computer.

1. First, be sure to update the gateway computer's /etc/hosts and /etc/ethers files to include entries for the install client. The gateway computer is were we'd normally have to consume the disk space to actually set up a legitimate Boot Server.

2. Ensure that the proper daemons are active on the gateway computer. You may need to start up rarpd, bootparamd and tftpd (which is, by default, commented out of the /etc/inetd.conf file, so you'll need to "kill -1" or "kill -HUP" the inetd process after uncommenting that entry).

3. Create an entry for the install client in the /etc/bootparams file. You can generally copy the entry that exists in your Jumpstart server's /etc/bootparams file, but you will need to make a few changes:

a. Translate the hostname of the server (if entered in this fashion) to it's I.P. Address.

b. Adding an ns entry won't hurt. Assuming a Jumpstart server with I.P. Address 192.168.0.12, no supported nameservice active and a netmask of 255.255.255.0, you can add this to the end of the /etc/bootparams entry for your client (on the gateway computer, of course):

Ex:

ns=192.168.0.12:none(255.255.255.0) <-- Add a colon to the beginning of this addition if the /etc/bootparams entry doesn't end with one!


4. Create a directory off of the root partition named tftpboot.

Ex:

mkdir /tftpboot


5. Populate your /tftpboot directory with the contents of the /tftpboot directory on your Jumpstart server host and ensure all file and directory ownership and permissions are the same. If you know exactly what to look for, you really only need to copy the files that are relevant to the server you're trying to Jumpstart, but you can't go wrong by copying them all.

Now, the intermediate host/server should be prepared to accept your Jumpstart client's rarp requests and transparently forward them to your Jumpstart server on the alternate subnet!

Note that you can do this on as many servers as you like (if, for instance, you have to take multiple hops across subnets to get to your Jumpstart server). Just duplicate on each intermediate host. The only thing you'll have to change (and sometimes you won't even have to do this) is the Jumpstart host listed in /etc/bootparams on the servers that come before you hit the server that can get to the Jumpstart server. You can create a simple daisy chain by replacing the Jumpstart server name with the IP of the next host along the way in the /etc/bootparams file. Hopefully, you won't ever have to hop more than once to get to an internal network that has a Jumpstart server on it.

And finally, as promised, the extra benefit: If you ever get stuck at home and have to boot a Solaris box that won't come up, the box is on a subnet without a Jumpstart (or Boot) server and there's no one at the office to put in a CD for you to boot off of, you can use this exact same procedure to hop subnets and get to single user mode with:

boot net -s

Cheers,

, Mike