Solaris installation notes

Poster Content
nk4um Moderator
Posts: 825
August 25, 2006 18:41Re: Solaris installation notes
Hi Nigel,

Thanks for the detailed guide to the Solaris environment.  As requested I have added the newline to etc/bootloader.cfg  this will be shipped in the upcoming 3.1 distro.

Cheers,

Peter
Like · Post Reply
nk4um User
Posts: 9
August 25, 2006 16:27Solaris vs. netkernel init script
A new message in this topic for the init script

First problem, on our setup wget is not in the default
root path, it is in /usr/sfw/bin.  To fix this I added:

PATH=/usr/bin:/usr/sbin:/usr/sfw/bin


Issue 2, grep:

Grep:  grep -qai - this uses GNU grep specific options.

Again Solaris has multiple grep options:

/usr/xpg4/bin/grep - supports -q and -i
/usr/sfw/bin/ggrep - supports -qai (ggrep == GNU grep)
/usr/bin/grep      - only support -i


Issue 3, ps:

The init script uses:

  pslist=`ps ax --width=2000 | grep "$STARTGREPTEXT" | grep -v PID | awk ''{printf $1 " "}''`


This ps style is BSD specific (ps aux vs. ps -ef for SysV) and --width is GNU ps specific.

Solaris has two ps binaries:

/usr/bin/ps  - Solaris traditional/SysV ps
/usr/ucb/ps  - BSD ps


The standard /usr/bin/ps does not report more than 80 characters
of executable and arguments - probably for historical compatibility
reasons.  The classname being grep was outside the 80 chars.
pargs may provide a work around.

The BSD ps, when run with the right permissions, can do >80.
So my fix was:

pslist=`/usr/ucb/ps axww | grep "$STARTGREPTEXT" | grep -v PID | awk ''{printf $1 " "}''`


Issue 4, date formats:

+%s is not a standard format string for strftime/date - again
probably a GNU extension.   Neither /usr/bin/date or /usr/xpg4/bin/date
support this.  A work around is to use perl:

<        local starttime=`date +"%s"`
---
>        local starttime=`perl -le ''print time''`


Issue 5, invocation/redirection:

There were also a couple of problems with the command used for
the actual NK invocation.  Firstly --shell is specific to GNU
su - I think the default behaviour is to use the shell specified
for the user in /etc/password - I made this /bin/sh

Another problem was that the stdout/stderr output was appearing
on the terminal and not into the log file.
I suspect that &> and the 2>&1 ways of redirection overlap
(in bash), but the command is being run in /bin/sh
which on Solaris is not /bin/bash and does not support &>
(I think).

My su changes were:

<     exec su - -p --shell=/bin/sh $NK_USER -c "$RUNCOMMAND &>\\"$LOGFILE\\"" 2>&1 &
---
>     exec su $NK_USER -c "$RUNCOMMAND > $LOGFILE 2>&1" &



That was about it - hope someone finds this useful one day.
Cheers,
Nigel
[/u]
Like · Post Reply
nk4um User
Posts: 9
August 25, 2006 16:12Solaris installation notes
I''m very happy with the tarball install and the scripts provided
but I did find some portability issues.  I''m
not an expert at this and not confident enough to
provide updated scripts which will work on all Unixes,
nevermind on different Solaris setups.   So I''m posting
my notes/observations here in case they are useful to others in
the future.

I was using the NK 3.0 tar install on a Sun x4100 running Solaris 10.
The Solaris install was a full install and thus included dirs
like /usr/ucb.  The install was into a non-global zone.

After unpacking and running the complete-tarball-install.sh script
it produced a zero-sized etc/bootloader.cfg. 
I suspect this was because the original file does not contain a newline....

Solaris has 3 sed binaries:

/usr/bin/sed      - traditional solaris sed
/usr/ucb/sed      - BSD sed
/usr/xpg4/bin/sed - POSIX.1 sed


The first two silently produce a zero sized output,
the posix sed does work and produces a warning:

sed: Missing newline at end of file etc/bootloader.cfg.


The manpages are fairly quiet on the matter except for:

In normal operation, sed cyclically copies a line  of  input
(less  its  terminating  NEWLINE  character)  into a ...


I manually edited the bootloader.cfg file to resolve
the problem for me - but would
it be possible to add a newline to this file?
Like · Post Reply