<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-12367155</id><updated>2012-01-04T15:13:09.377-06:00</updated><category term='ksh93'/><category term='PATH'/><category term='solaris installation'/><category term='packaging'/><category term='opensolaris'/><category term='solaris'/><category term='wish list'/><category term='dtrace'/><category term='HPSA API'/><category term='security'/><category term='shell programming'/><title type='text'>Mike Gerdts</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12367155.post-7243717983600539216</id><published>2011-11-17T23:08:00.001-06:00</published><updated>2011-11-18T16:09:33.671-06:00</updated><title type='text'>Oracle Solaris 11 Summit Day at USENIX LISA 2011</title><content type='html'>&lt;a href="http://www.usenix.org/events/lisa11/index.html" title="LISA '11 on usenix.org"&gt;LISA '11&lt;/a&gt; is just around the corner and once again includes an &lt;a href="http://www.oracle.com/us/dm/h2fy11/20741-wwmk11010781mpp004c003-oem-524681.html" title="Oracle Solaris 11 Summit Day at LISA 2011"&gt;Oracle Solaris Summit&lt;/a&gt;
 the day before the main conference.&amp;nbsp; Please come to the summit and to 
as my esteemed colleagues and I introduce many of the great improvements
 found in Solaris 11.&amp;nbsp; I'll be giving a talk on Zones.&lt;br /&gt;
&lt;br /&gt;
Even with a full day to talk about Solaris 11, we'll certainly be 
unable to get into the depth in the areas that concern you the most.&amp;nbsp; To
 get some face time with Oracle engineers, stop by the Oracle demo booth
 - I'll be there Wednesday from 2:00 - 4:00.&lt;br /&gt;
&lt;br /&gt;
If I have any updates, I'll be posting them to &lt;a href="http://blogs.oracle.com/zoneszone/"&gt;The Zones Zone&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-7243717983600539216?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/7243717983600539216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=7243717983600539216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7243717983600539216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7243717983600539216'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2011/11/oracle-solaris-11-summit-day-at-usenix.html' title='Oracle Solaris 11 Summit Day at USENIX LISA 2011'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-5736787879151631146</id><published>2011-11-09T21:55:00.000-06:00</published><updated>2011-11-09T21:55:26.481-06:00</updated><title type='text'>The Zones Zone</title><content type='html'>New posts related to Solaris can be found at &lt;a href="http://blogs.oracle.com/zoneszone/"&gt;The Zones Zone&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-5736787879151631146?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/5736787879151631146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=5736787879151631146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/5736787879151631146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/5736787879151631146'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2011/11/zones-zone.html' title='The Zones Zone'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-2241464481790441667</id><published>2011-01-03T17:07:00.000-06:00</published><updated>2011-01-03T17:07:30.749-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dtrace'/><title type='text'>dtrace PID provider vs. libraries loaded by python</title><content type='html'>As I was doing some work on beadm, I really wanted to know who was mucking with properties on datasets.  It looked as though I could do something like:
&lt;pre&gt;
# dtrace -qn 'pid$target:libzfs.so.1:zfs_prop_set:entry / copyinstr(arg0 + 8) == $1 /
{
    printf("%s(%s,%s,%s)\n", probefunc, copyinstr(arg0 + 8), copyinstr(arg1), copyinstr(arg2));
    ustack();
}' -c 'beadm create test' $dataset
&lt;/pre&gt;
But that doesn't work:
&lt;pre&gt;
... probe description pid12942:libzfs.so.1:zfs_prop_set:entry does not match any probes
&lt;/pre&gt;
My guess is because that this is because the python executable is not linked against libzfs - a very good thing.  To get around this, we need to preload libzfs.  For example:
&lt;pre&gt;
# &lt;b&gt;&lt;i&gt;LD_PRELOAD_32=libzfs.so.1&lt;/i&gt; dtrace -qn 'pid$target:libzfs.so.1:zfs_prop_set:entry / copyinstr(arg0 + 8) == $1 /
{
    printf("%s(%s,%s,%s)\n", probefunc, copyinstr(arg0 + 8), copyinstr(arg1), copyinstr(arg2));
    ustack();
}' -c 'beadm create test' rpool/zones/z1/rpool/ROOT/zbe-1&lt;/b&gt;
zfs_prop_set(rpool/zones/z1/rpool/ROOT/zbe-1,mountpoint,legacy)

              libzfs.so.1`zfs_prop_set
              libbe.so.1`be_unmount_zone_root+0xa9
              libbe.so.1`be_update_zone_vfstab+0x106
              libbe.so.1`be_copy_zones+0x9d9
              libbe.so.1`be_copy+0x8f2
              libbe_py.so`beCopy+0x245
...
&lt;/pre&gt;
The only change here was the addition of LD_PRELOAD_32=libzfs.so.1 at the beginning of the command.  LD_PRELOAD would have worked as well, but it wouldn't work if a different library that does not have a 64-bit variant was being traced.  That is because dtrace would fail to start because the 64-bit library was not able to be found.  I found this when I needed to poke around at calls within libbe.so.1, which is 32-bit only.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-2241464481790441667?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/2241464481790441667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=2241464481790441667' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/2241464481790441667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/2241464481790441667'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2011/01/dtrace-pid-provider-vs-libraries-loaded.html' title='dtrace PID provider vs. libraries loaded by python'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-3541008201786318658</id><published>2011-01-02T21:15:00.004-06:00</published><updated>2011-01-02T22:07:41.689-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell programming'/><category scheme='http://www.blogger.com/atom/ns#' term='ksh93'/><title type='text'>ksh93 backtraces</title><content type='html'>It is often times handy to get a &lt;a href="http://en.wikipedia.org/wiki/Stack_trace"&gt;backtrace&lt;/a&gt; to help you understand how a program got to an error condition.  Unfortunately, shell scripting languages tend to not provide an easy mechanism to get a backtrace.  The following examines how it can be accomplished with ksh93.
&lt;pre&gt;
#! /bin/ksh

function backtrace {
        typeset -a stack 
        # Use "set -u" and an undefined variable access in a subshell
        # to figure out how we got here.  Each token of the result is
        # stored as an element in an indexed array named "stack".
        set -A stack $(exec 2&gt;&amp;1; set -u; unset __unset__; echo $__unset__)

        # Trim the last entries in stack array until we find the one that
        # matches the name of this function.
        typeset i=0
        for (( i = ${#stack[@]} - 1; i &gt;= 0; i-- )); do
                [[ "${stack[i]}" == "${.sh.fun}:" ]] &amp;&amp; break
        done

        # Print the name of the function that called this one, stripping off
        # the [lineno] and appending any arguments provided to this function.
        print -u2 "${stack[i-1]/\[[0-9]*\]} $*"
        # Print the backtrace.
        for (( i--; i &gt;= 0; i-- )); do
                print -u2 "\t${stack[i]%:}"
        done
}

# A couple functions to illustrate the output
function a {
        b "$@"
}

function b {
        c "$@"
}

function c {
        # Trigger a backtrace and exit if no arguments were passed
        (( $# == 0 )) &amp;&amp; backtrace "missing arg" &amp;&amp; exit 1
        print -- "$@"
}

a "$@"
&lt;/pre&gt;
A couple example runs:
&lt;pre&gt;
$ ./backtrace.ksh hello world!
hello world!
$ ./backtrace.ksh
c: missing arg
        c[37]
        b[32]
        a[28]
        ./backtrace.ksh[41]
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-3541008201786318658?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/3541008201786318658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=3541008201786318658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/3541008201786318658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/3541008201786318658'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2011/01/ksh93-backtraces.html' title='ksh93 backtraces'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-8670693782956819284</id><published>2010-04-03T21:50:00.004-05:00</published><updated>2010-04-03T22:09:59.694-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HPSA API'/><title type='text'>Connecting to twist server</title><content type='html'>Once your &lt;a href="http://mgerdts.blogspot.com/2010/04/opswarehpsa-api-getting-started.html"&gt;development environment is set up&lt;/a&gt;, it is useful to know what is required to connect to the twist server.

&lt;pre&gt;
#! /opt/opsware/smopython2/python2

import sys
sys.path.append("/opt/opsware/smopylibs2")
from pytwist import *

# Establish an unauthenticated connection to twist server.  Note that the
# hostname "twist" must resolve either through /etc/hosts or DNS.
ts = twistserver.TwistServer()
&lt;/pre&gt;

&lt;p&gt;In the event the hostname twist does not resolve or points to the wrong twist server, you can do...

&lt;pre&gt;
ts = twistserver.TwistServer("twist.mycompany.com")
&lt;/pre&gt;

&lt;p&gt;See the TwistServer Method Syntax section on page 75 of the Developer's Guide for other options that may be important to you.

&lt;p&gt;It is also quite likely that you will need to do an authenticated session.  This is covered in the Error Handling section on page 76 of the Developer's Guide.  In order to prompt for a username and password, I have found something like the following works well...

&lt;pre&gt;
def authenticate(server):
        for tries in range(1,3):
                try:
                        sys.stdout.write("HPSA login: ")
                        user = sys.stdin.readline().strip()
                        pw = getpass.getpass("HPSA password: ")
                        server.authenticate(user, pw)
                        return True
                except:
                        sys.stderr.write("Authentication failed.\n")
        return False

...
ts = twistserver.TwistServer()
authenticate(ts)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-8670693782956819284?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/8670693782956819284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=8670693782956819284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/8670693782956819284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/8670693782956819284'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2010/04/connecting-to-twist-server.html' title='Connecting to twist server'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-9145995417448571196</id><published>2010-04-03T20:55:00.006-05:00</published><updated>2010-04-03T22:37:30.928-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HPSA API'/><title type='text'>Opsware/HPSA API: Getting Started</title><content type='html'>&lt;p&gt;The &lt;span style="font-style: italic;"&gt;HP Server Automation Platform Developer's Guide&lt;/span&gt; (for HPSA 7.50, September, 2008) and any other resources I've been able to find are far from complete and sometimes misleading with respect to using the HPSA API.  As I've tried to clear up my confusion with the API, google has helped me exactly 0% of the time.  Maybe  my rambling on the subject will lead to someone leading me to a better approach...

&lt;p&gt;In this first post on the subject, let's start out with enough to get a working Python environment.  Chapter 3 of the developer's guide indicates that Pytwist relies on Python 1.5.2.  Ugh.  However, pytwist can be used with Python 2.4.  Rather than following the advice to install the &lt;span style="font-family:courier new;"&gt;/Opsware/Tools/Opsware API Access&lt;/span&gt; software policy, instead install the following policies:

&lt;ul&gt;&lt;li&gt;/Opsware/Tools/Python 2/Python 2 for Server Modules&lt;/li&gt;&lt;li&gt;/Opsware/Tools/Python 2 Opsware API Access for Server Modules/Python 2 Opsware API Access for Server Modules&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;The permissions are likely such that you need to be root to execute.  Fix this with:

&lt;pre&gt;
# chmod -R a+r /opt/opsware/smopython2
# exit
$ /opt/opsware/smopython2/python -V
Python 2.4.4
&lt;/pre&gt;

&lt;p&gt;Ahhh, much better.

&lt;p&gt;Notice the path to python above.  It is actually a shell script that sets PYTHON_HOME then tries to execute python.  Unfortunately, Solaris doesn't like a shebang line in one script referring to another script.  The resulting error looks like:

&lt;pre&gt;
$ ./twister1 
import: Unable to connect to X server ().
./twister1: line 4: syntax error near unexpected token `"/opt/opsware/smopylibs2"'
./twister1: line 4: `sys.path.append("/opt/opsware/smopylibs2")'
&lt;/pre&gt;

&lt;p&gt;In other words, the shebang (#!) line python scripts will be useless as the software policy installs it.

&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Workaround 1:&lt;/span&gt;

&lt;pre&gt;
$ export PYTHONHOME=/opt/opsware/smopython2/34c.0.0.5.31-1
&lt;/pre&gt;

&lt;p&gt;Then use a shebang line like:

&lt;pre&gt;
#! /opt/opsware/smopython2/34c.0.0.5.31-1/bin/python2
&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Workaround 2:&lt;/span&gt;

Compile this program and put it at /opt/opsware/smoptyhon2/python2

&lt;pre&gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;

#define PYTHONHOME "/opt/opsware/smopython2/34c.0.0.5.31-1"

int main(int argc, char **argv) {
        char *python = PYTHONHOME "/bin/python2";

        argv[0] = python;
        setenv("PYTHONHOME", PYTHONHOME, 1);

        return execv(python, argv);
}
&lt;/pre&gt;

&lt;p&gt;Then use a shebang line like:

&lt;pre&gt;
#! /opt/opsware/smopython2/python2
&lt;/pre&gt;

&lt;p&gt;In any case (even if you used Python 1.5 like the developer's guide suggests) the path to python does not match reality.  Adjust your scripts accordingly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-9145995417448571196?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/9145995417448571196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=9145995417448571196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/9145995417448571196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/9145995417448571196'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2010/04/opswarehpsa-api-getting-started.html' title='Opsware/HPSA API: Getting Started'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-7925450315561702600</id><published>2009-06-19T21:59:00.002-05:00</published><updated>2009-06-19T22:50:56.162-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell programming'/><category scheme='http://www.blogger.com/atom/ns#' term='PATH'/><title type='text'>Shell Programming and PATH</title><content type='html'>&lt;p&gt;As most readers of this blog will already know, the PATH environment variable is used to locate commands that are executed.  Key things to remember as you read this post are:
&lt;ul&gt;
&lt;li&gt;Environment variables (including &lt;code&gt;PATH&lt;/code&gt;) are inherited by child processes&lt;/li&gt;
&lt;li&gt;Child processes are unaffected by the parent process subsequently changing &lt;code&gt;PATH&lt;/code&gt; to something else&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So what's the big deal?  Suppose you have a shell script that calls &lt;code&gt;ps -fe&lt;/code&gt;.  It works great for you because you have &lt;code&gt;/usr/bin&lt;/code&gt; first in your &lt;code&gt;PATH&lt;/code&gt;.  However, the guy down the hall that cut his teeth on a BSD system has &lt;code&gt;/usr/ucb&lt;/code&gt; first.  If your shell script does not set &lt;code&gt;PATH=/usr/bin:...&lt;/code&gt; prior to calling &lt;code&gt;ps&lt;/code&gt;, your shell script will work for you but give strange errors for the guy down the hall.  Of course, your shell script could just specify &lt;code&gt;/usr/bin/ps -fe&lt;/code&gt;...
&lt;p&gt;This brings up four different styles that are seen...
&lt;p&gt;&lt;b&gt;Style 1: Just hope for the best&lt;/b&gt;
&lt;pre&gt;
#! /usr/bin/ksh

count=$(ps -fe | wc -l)
echo "There are $count processes running"
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Style 2: Specify full path whenever calling a program&lt;/b&gt;
&lt;pre&gt;
#! /usr/bin/ksh

count=$(/usr/bin/ps -fe | wc -l)
/usr/bin/echo "There are $count processes running"
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Style 3: Create variables to store full path to all programs&lt;/b&gt;
&lt;pre&gt;
#! /usr/bin/ksh

PS=/usr/bin/ps
WC=/usr/bin/wc
ECHO=/usr/bin/echo

count=$($PS -fe | $WC -l)
$ECHO "There are $count processes running"
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Style 4: Set PATH to use the commands you want to use&lt;/b&gt;
&lt;pre&gt;
#! /usr/bin/ksh

export PATH=/usr/bin
count=$(ps -fe | wc -l)
echo "There are $count processes running"
&lt;/pre&gt;
&lt;p&gt;With &lt;b&gt;Style 1&lt;/b&gt;, the script is only reliable for the subset of users that have &lt;i&gt;the right&lt;/i&gt; version of &lt;code&gt;ps&lt;/code&gt; first in their &lt;code&gt;PATH&lt;/code&gt;.
&lt;p&gt;A workaround for this is shown in &lt;b&gt;Style 2&lt;/b&gt;.  However, this example has an intentional problem that is somewhat common when this approach is used.  Notice that &lt;code&gt;wc&lt;/code&gt; is not specified by its full path.  This will work fine until someone with a really messed up (or unset) &lt;code&gt;PATH&lt;/code&gt; tries to execute the script.
&lt;p&gt;&lt;b&gt;Style 3&lt;/b&gt; fixes the &lt;code&gt;ps&lt;/code&gt; and &lt;code&gt;wc&lt;/code&gt; problems, but introduces another small problem: it forces a &lt;code&gt;fork()&lt;/code&gt; and &lt;code&gt;exec*()&lt;/code&gt; to run something that could be more efficiently done via a &lt;a href="http://www.bolthole.com/solaris/ksh-builtins.html"&gt;built-in&lt;/a&gt;.  I'll talk more about this in a future post.
&lt;p&gt;&lt;b&gt;Style 4&lt;/b&gt; keeps the simplicity of Style 1, but ensures that each user will get the same version of the commands.  The author of the script can tailor PATH to contain the minimum set to find the required commands and test the script to gain a high degree of confidence that the script will work for others.
&lt;p&gt;I have a strong preference for Style 4.  Performing shell programming retains the feel of using a shell interactively, keeps the code understandable, and performs reliably.  But this doesn't mean that it is always the right thing to do.  Consider the &lt;a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/cron/batch.sh"&gt;&lt;code&gt;batch&lt;/code&gt;&lt;/a&gt; command.  It doesn't set &lt;code&gt;PATH&lt;/code&gt; and it is very correct in not doing so.  That is, if the following:
&lt;pre&gt;
exec /usr/bin/at -qb $*
&lt;/pre&gt;
were replaced with
&lt;pre&gt;
PATH=/usr/bin; export PATH
...
at -qb $*
&lt;/pre&gt;
This would change the environment that &lt;code&gt;at(1)&lt;/code&gt; attaches to the job - potentially breaking it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-7925450315561702600?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/7925450315561702600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=7925450315561702600' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7925450315561702600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7925450315561702600'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2009/06/shell-programming-and-path.html' title='Shell Programming and PATH'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-7179271509736236070</id><published>2009-06-19T21:06:00.005-05:00</published><updated>2009-06-19T22:51:58.653-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell programming'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='solaris'/><title type='text'>Shell Programming and temporary files</title><content type='html'>&lt;p&gt;I've been generally impressed with the coding standards that are enforced on C code in OpenSolaris, as checked by &lt;a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/tools/scripts/cstyle.pl"&gt;cstyle&lt;/a&gt;.  However, similar automated checks don't exist for shell scripts.  This, combined with a history of "/bin/sh is the one true shell", has led to inefficient scripts that very commonly have security vulnerabilities.
&lt;p&gt;I'm hoping to breathe some life into this blog with a series of posts that describe some of the common problems and some potential solutions.  I'll start with problems related to security problems with temporary files.
&lt;p&gt;Consider the following bit of code taken from &lt;code&gt;/usr/lib/lp/bin/lpadmin&lt;/code&gt;.
&lt;pre&gt;
   293  # Do the LP configuration for a local printer served by lpsched
   294  if [[ -x ${LPADMIN} &amp;&amp; -n "${local}" ]] ; then
   295          # enumerate LP configured printers before modification
   296          PRE=/tmp/lpadmin-pre.$$
   297          (/bin/ls /etc/lp/printers 2&gt;/dev/null ; /bin/ls /etc/lp/classes \
   298                  2&gt;/dev/null) &gt;${PRE}
&lt;/pre&gt;
&lt;p&gt;There are two problems here:
&lt;ol&gt;
&lt;li&gt;A &lt;a href="http://www.infosecwriters.com/texts.php?op=display&amp;id=159"&gt;symbolic link&lt;/a&gt; vulnerability exists.
&lt;li&gt;The &lt;code&gt;TMPDIR&lt;/code&gt; environment variable is not respected.  If a user has a reason to want temporary files stored in a particular file system, utilities should respect the user's wishes.
&lt;/ol&gt;
&lt;p&gt;&lt;b&gt;The solution&lt;/b&gt;
&lt;p&gt;For quite some time, Solaris has provided the &lt;a href="http://docs.sun.com/app/docs/doc/816-5165/mktemp-1?a=view"&gt;mktemp&lt;/a&gt; command has existed to facilitate the secure creation of files.  In &lt;a href="http://hg.genunix.org/onnv-gate.hg/rev/ef5b515fa521"&gt;the fix&lt;/a&gt; for this problem, I used &lt;code&gt;mktemp&lt;/code&gt; in a way that both creates the file securely and respects &lt;code&gt;TMPDIR&lt;/code&gt;.
&lt;pre&gt;
     41 MKTEMP="/usr/bin/mktemp -t"
      ...
    300  PRE=$(${MKTEMP} lpadmin-pre.XXXXXX)
    301  if [[ -z "${PRE}" ]] ; then
    302   gettext "lpadmin: System error; cannot create temporary file\n" 1&gt;&amp;2
    303   exit 2
    304  fi
    305 
    306  (/bin/ls /etc/lp/printers 2&gt;/dev/null ; /bin/ls /etc/lp/classes \
    307   2&gt;/dev/null) &gt;${PRE}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-7179271509736236070?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/7179271509736236070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=7179271509736236070' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7179271509736236070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7179271509736236070'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2009/06/shell-programming-vs-temporary-files.html' title='Shell Programming and temporary files'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-4683927555989637058</id><published>2008-07-23T19:10:00.002-05:00</published><updated>2008-07-23T19:14:01.547-05:00</updated><title type='text'>Installation of Studio 11 on Nevada</title><content type='html'>The &lt;a href="http://opensolaris.org/os/community/tools/sun_studio_tools/sun_studio_11_SPARC_special_May2008/"&gt;OpenSolaris Sun Studio installation page&lt;/a&gt; forgets to mention that the default version of Java is incompatible with the Studio installer.  The following command works for me:
&lt;pre&gt;
# export JAVA_HOME=/usr/jdk/instances/jdk1.5.0
# export PATH=/usr/jdk/instances/jdk1.5.0/bin:$PATH
# ./installer 
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-4683927555989637058?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/4683927555989637058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=4683927555989637058' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/4683927555989637058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/4683927555989637058'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2008/07/installation-of-studio-11-on-nevada.html' title='Installation of Studio 11 on Nevada'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-7555691280167757482</id><published>2008-06-11T21:15:00.003-05:00</published><updated>2008-06-11T21:18:20.336-05:00</updated><title type='text'>OpenSolaris build service proposal</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;With most open source projects the various pieces are relatively small and as a result, the build process for any component is measured in seconds or minutes.  Solaris has historically been based upon consolidations - relatively large sets of code.  The most common wrapper around the build process is called nightly for good reason - it takes hours to days to perform a full build.  Once a full build is complete incrementals can take a lot less time, but if you infrequently build the software, you are pretty much forced into a full build every time.  I just stumbled across &lt;a href="http://blogs.sun.com/jyrivirkki/entry/endless_night"&gt;this post&lt;/a&gt; that shows that others have noticed this problem too.

&lt;p&gt;&lt;b&gt;What can be done?&lt;/b&gt;
&lt;p&gt;I've been thinking that most people really don't need a full clobber build all the time.  If there is a 2 line fix somewhere, just verifying that the code builds and the resulting binaries work is most important - and most encouraging for the casual bug fixer.  If there's a big re-work of Makefiles or changes are made to the linking of a program a full build may be more important.  A service that can do incremental builds would be a big help.

&lt;p&gt;&lt;b&gt;So here's (very roughly) how I envision it.&lt;/b&gt;
&lt;p&gt;Each time a release is tagged by a participating consolidation...
&lt;ol&gt;&lt;li&gt;A job is kicked off to build it on each supported architecture.&lt;/li&gt;&lt;li&gt;A zfs snapshot is created of the workspace with the completed build.&lt;/li&gt;&lt;li&gt;The completed build is packaged into an IPS repository&lt;/li&gt;&lt;/ol&gt;When a developer wants to fix a bug...
&lt;ol&gt;&lt;li&gt;Populate a workspace with the original source code
&lt;/li&gt;&lt;li&gt;Hack&lt;/li&gt;&lt;li&gt;Create a webrev&lt;/li&gt;&lt;li&gt;Submit the webrev to the build system, saying which consolidation and build to build against and which architectures to build for&lt;/li&gt;&lt;/ol&gt;The build system then...
&lt;ol&gt;&lt;li&gt;Schedules the job via &lt;a href="https://hudson.dev.java.net/"&gt;Hudson&lt;/a&gt; or &lt;a href="http://gridengine.sunsource.net/"&gt;Grid Engine&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;The job starts by cloning the pre-built release of the consolidation.  Quite likely, it also clones then boots the proper boot environment.&lt;/li&gt;&lt;li&gt;The patch included in the webrev is applied to the source&lt;/li&gt;&lt;li&gt;An incremental build is done&lt;/li&gt;&lt;li&gt;The pre-built IPS repository is cloned to a per-developer repository&lt;/li&gt;&lt;li&gt;Packages associated with the changed files are populated into the per-developer IPS repository.  The changed packages associated with this build are added as dependencies to a special package (e.g. build-20080611.0)
&lt;/li&gt;&lt;li&gt;Results are sent to the developer.&lt;/li&gt;&lt;/ol&gt;In most cases, the execution time of the above could be just a few minutes.  If the change triggers lots of dependencies, it could be many hours.
To test the changes, the developer can use...
&lt;pre&gt;beadm create testbe
beadm mount testbe /testbe
pkg -R /testbe set-authority -O http://pkg.opensolaris.org/mysername myusername.opensolaris.org
pkg -R /testbe install build-20080611.0
beadm unmount testbe
beadm activate testbe
init 6&lt;/pre&gt;
There are certainly plenty of details to work out. This is meant to be the start of a discussion to determine wether it is something worth pursuing and if so what those missing details are.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-7555691280167757482?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/7555691280167757482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=7555691280167757482' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7555691280167757482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7555691280167757482'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2008/06/opensolaris-build-service-proposal.html' title='OpenSolaris build service proposal'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-7917758308949121941</id><published>2008-03-21T19:14:00.007-05:00</published><updated>2008-03-21T19:25:34.887-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wish list'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='solaris'/><title type='text'>Solaris Wish List: Make it Open Source</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;I frequently see references from Sun and those that quote some Sun people as saying that Solaris is Open Source.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What is Solaris?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;There are a few different flavors of things that people may refer to as Solaris:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.sun.com/software/solaris/index.jsp"&gt;Solaris 10 and earlier versions.&lt;/a&gt;  This is what most references to the word Solaris seem to be referring to.  Each release of Solaris is supported for a number of years through commercial and no-cost channels, to varying degrees.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sun.com/software/solaris/solaris-express/get.jsp"&gt;Solaris Express.&lt;/a&gt;  This is a collection of software that is viewed as a fairly stable distribution based upon the development branch of Solaris.  Very limited ("installation and configuration as well as for developer assistance") is available, but the support period seems to be limited to around 3 months per release.&lt;/li&gt;&lt;li&gt;&lt;a href="http://opensolaris.org/os/"&gt;OpenSolaris&lt;/a&gt;.  This is &lt;a href="http://opensolaris.org/os/about/"&gt;best summarized&lt;/a&gt; as "The main difference between the OpenSolaris project and the Solaris Operating System is that the OpenSolaris project does not provide an end-user product or complete distribution. Instead it is an open source code base, build tools necessary for developing with the code, and an infrastructure for communicating and sharing related information. Support for the code will be provided by the community; Sun offers no formal support for the OpenSolaris product in either source or binary form."&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;What is Open Source?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The annotated &lt;a href="http://www.opensource.org/docs/definition.php"&gt;Open Source Definition&lt;/a&gt; covers this quite well.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Is Solaris Open Source?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Let's see if &lt;a href="http://www.sun.com/software/solaris/licensing/sla.xml"&gt;the license used by Solaris&lt;/a&gt; aligns with the Open Source definition.&lt;/p&gt;

&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Free redistribution&lt;/td&gt;&lt;td&gt;&lt;b&gt;No.&lt;/b&gt; The &lt;a href="http://www.sun.com/software/solaris/licensing/sla.xml"&gt;Software License Agreement&lt;/a&gt; states: &lt;i&gt;You &lt;/i&gt;may make a single archival copy of Software, but otherwise &lt;i&gt;may not&lt;/i&gt; copy, modify, or &lt;i&gt;distribute Software&lt;/i&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Source Code&lt;/td&gt;&lt;td&gt;&lt;b&gt;No.&lt;/b&gt; The source code for Solaris is not available. Note that while a bunch of code is available at &lt;a href="http://src.opensolaris.org/"&gt;src.opensolaris.org&lt;/a&gt;, this is not the same source code that is used for building Solaris.  If I want or need to modify the behavior of Solaris, there is no straight-forward way to do so.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Derived Works&lt;/td&gt;&lt;td&gt;&lt;b&gt;No.&lt;/b&gt; Since I &lt;i&gt;may not copy, modify, or distribute&lt;/i&gt; Solaris, this point is moot.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Integrity of Author's Source Code&lt;/td&gt;&lt;td&gt;&lt;b&gt;No.&lt;/b&gt; Since the source code is not available, this point is also moot.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;No Discrimination Against Persons or Groups&lt;/td&gt;&lt;td&gt;&lt;b&gt;I think so.&lt;/b&gt; See section 11 of the license agreement for export restrictions.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;No Discrimination Against Fields of Endeavor&lt;/td&gt;&lt;td&gt;&lt;b&gt;I think so.&lt;/b&gt; While Sun's lawyers don't want to suggest that running your nuclear power plant with Solaris, they don't say that you can't.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Distribution of license&lt;/td&gt;&lt;td&gt;&lt;b&gt;No.&lt;/b&gt; Since redistribution is not allowed, this point is moot.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;...&lt;/td&gt;&lt;td&gt;...&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;Since one or more of the requirements to be called &lt;i&gt;Open Source&lt;/i&gt; are not met  by the license under which Solaris is distributed, Solaris is not open source.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;People that need support don't want source code.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;That is great in theory, but in practice it falls down a bit.  Let's pretend that you need to write a dtrace script to dig into a thorny performance problem.  If the stable dtrace providers don't provide probes at the right spot, you need to fall back on fbt or pid probes.  The only way to understand what these are tracing is to read the source.  Since the OpenSolaris and Solaris branch point is now about 3 years old, this is becoming extremely difficult to do reliably.  The code that you get by browsing the latest OpenSolaris code sometimes does not match up with the fbt probes that are available in any release of Solaris.  You may have more luck looking at historical versions of the source code, but that is a guessing game at best.&lt;/p&gt;

&lt;p&gt;There are also times when a customer's needs just do not align with what Sun is willing to offer.  Suppose you need different functionality from a device driver.   It is possible that it is a trivial change from the customer's standpoint, so long as they have current source code.  However, if the source code is not available, the best the customer can do is grab the same driver from somewhere else (e.g. opensolaris.org) and try to to maintain a special version of the driver and provide custom ports of all the bug fixes that they would otherwise get from from the Solaris source.&lt;/p&gt;
&lt;p&gt;Suppose that hypothetical fix that the customer needed was something that Sun agreed was needed but they did not have the time to develop the fix.  If the Solaris source code were as open as the OpenSolaris source code, the customer could work with the OpenSolaris community to get the fix integrated into OpenSolaris, then provide the backport to Solaris.  If the customer could do this, the code would see the appropriate code reviews, development branch burn-in, etc. with minimal additional workload on Sun.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;My Wish&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I know that Sun went through tremendous work to make OpenSolaris happen. They should be commended for that and the other tens (hundreds?) of millions of lines of code they have opened up or written from scratch in the open.  This gives them tremendous opportunity with Solaris 11 (assuming that 10+1 = 11).  Keep the code that is open, well, open.  When patches or other updates are released, be sure that it is clear in the open source code repository which files are used in building that update.  To get the full benefit of this, it should be possible for the Solaris customer to set up a build environment to build this source.&lt;/p&gt;
&lt;p&gt;It is OK if Sun doesn't want to support the code I modify.  However, I would expect that they would support the unmodified parts of Solaris much the same as they do if I install a third-party package that adds some device drivers and mucks with some files in /etc.&lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-7917758308949121941?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/7917758308949121941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=7917758308949121941' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7917758308949121941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/7917758308949121941'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2008/03/solaris-wish-list-make-it-open-source.html' title='Solaris Wish List: Make it Open Source'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-4351449650521009181</id><published>2008-03-15T22:07:00.006-05:00</published><updated>2009-06-19T22:55:35.978-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='solaris installation'/><category scheme='http://www.blogger.com/atom/ns#' term='packaging'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><title type='text'>OpenSolaris Wish List: Feature-based meta packages</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;p&gt;&lt;b&gt;The problem&lt;/b&gt;&lt;/p&gt;&lt;p&gt;There are many occasions when an administrator needs to install a particular feature on a system but tracking down the packages, patches, or revisions thereof is next to impossible.  Consider the following scenarios:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;A sysadmin is trying to build minimized systems that have a firewall, bash, python, and can support zones using Jumpstart.  What needs to appear in the Jumpstart profile?&lt;/li&gt;&lt;li&gt;That same sysadmin then decides that a particular installed system needs to be augmented  to support the OSPF routing protocol.&lt;/li&gt; &lt;li&gt;Some time passes and an updated feature of is released.  The sysadmin needs to be able to update systems to support that feature without guessing which packages or patches are required.  Note that the a subset of the required packages may not have been installed initially because they did not exist initially or they weren't required for to meet the dependencies of the earlier feature set.&lt;/li&gt; &lt;li&gt;A sysadmin notices a nifty feature mentioned in the "What's New" documentation and wants to determine if a recently patched system system supports the feature.&lt;/li&gt;&lt;/ul&gt;Dealing with any of these situations is very difficult today.&lt;p&gt;Most commonly, the best advice that is offered when trying to indicate what is required to have a particular feature is to say that the feature is available in Solaris X update Y.  While that is true to a certain extent, that is not the complete story.  It assumes that the system in question is in no way minimized and ignores the fact that the same patches that are integrated in update Y are also available for installation on releases before update Y.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Ongoing Work&lt;/b&gt;&lt;/p&gt;&lt;p&gt;The &lt;a href='http://opensolaris.org/os/project/pkg/'&gt;Image Packaging System&lt;/a&gt; looks to be outstanding work in this direction.  The &lt;a href='http://opensolaris.org/sc/src/pkg/gate/doc/one-pager-main.txt'&gt;one-pager&lt;/a&gt; is likely the best place to look for a quick overview.  While this will provide a good foundation, there are numerous posts to mailing lists of the form "I'm trying to install X, but pkg can't find it."&lt;/p&gt;&lt;p&gt;&lt;b&gt;Suggested Approach&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Some geeks (power users, whatever you would like to call them) will know the exact name of the packages that they want or will otherwise be able to search for them rather adeptly.  Having the ability to say "I want bash" rather than "I want the same shell used by most Linux distros" is important.&lt;/p&gt;&lt;p&gt;I suspect that most people will be quite happy looking at their requirements and matching them up to advertised features.  I suggest that the feature/* package namespace be reserved for meta-packages that represent features.  A feature meta-package should not deliver any files, rather it just defines dependencies for the minimal set of packages required to support the feature.  See the &lt;a href='http://opensolaris.org/sc/src/pkg/gate/src/man/pkg.5.txt'&gt;&lt;i&gt;Package FMRIs and Versions&lt;/i&gt; section of pkg(5)&lt;/a&gt; for details on package naming.&lt;/p&gt;&lt;p&gt;For instance, if I needed the zones feature I should be able to say something along the lines of "pkg install feature/zones".  This would likely correspond to an FMRI of pkg://opensolaris.org/feature/zones@5.11,5.11-7:20080326T164523Z.    When new features are updated, the build number (7 in the example FMRI) should be updated.&lt;/p&gt;&lt;p&gt;While searching the published packages would yield a pretty good list of packages required for supporting zones, someone needing the OSPF routing protocol may have a harder time with a search.  However, installing feature/network/routing/ospf would likely know that the zebra or quagga package is needed (varying by Solaris release).&lt;/p&gt;&lt;p&gt;&lt;b&gt;Integration with Documentation&lt;/b&gt;&lt;/p&gt;&lt;p&gt;With such an approach, the Solaris What's New documentation could be very helpful to sysadmins needing to update existing systems, installation profiles, etc.  Consider the following, based upon a particular entry from the Solaris 10 What's New documentation.&lt;/p&gt;&lt;blockquote style='border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;' class='gmail_quote'&gt;&lt;h2 class='sol'&gt;&lt;span style='font-size: 85%;'&gt;IPsec Tunnel Reform&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Solaris now implements IPsec Tunnel Mode per RFC 2401. Inner-packet selectors can be specified on a per-tunnel-interface basis using the new "tunnel" keyword of &lt;tt&gt;ipsecconf&lt;/tt&gt;(1M). &lt;tt&gt;IKE&lt;/tt&gt; and &lt;tt&gt;PF_KEY&lt;/tt&gt; handle Tunnel Mode identities for Phase 2/Quick Mode. Interoperability with other IPsec implementations is greatly increased.&lt;/p&gt;&lt;p&gt;For more information, see &lt;a href='http://docs.sun.com/app/docs/doc/816-4554/6maoq021h?a=view'&gt;&lt;cite&gt;Transport and Tunnel Modes in IPsec&lt;/cite&gt; in &lt;cite&gt;System Administration Guide: IP Services&lt;/cite&gt;&lt;/a&gt;.  &lt;span style='color: rgb(204, 0, 0);'&gt;This feature is available via the feature/network/protocol/rfc2401software collection.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;To help someone with this feature find documentation of this type in the future, a documentation system (installed on system or internet accessible) should be able to point a person interested in documentation related to a feature to the appropriate man page(s), online books, and other documentation.&lt;/p&gt;&lt;p&gt;Similarly, if the feature is just an update of an existing feature, having the documentation refer to a particular build (release, whatever works) of the feature package would be must useful.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-4351449650521009181?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/4351449650521009181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=4351449650521009181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/4351449650521009181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/4351449650521009181'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2008/03/solaris-wish-list-feature-based-meta.html' title='OpenSolaris Wish List: Feature-based meta packages'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-8773002961158587799</id><published>2008-03-11T18:36:00.004-05:00</published><updated>2009-06-06T07:45:33.173-05:00</updated><title type='text'>Future of OpenSolaris Boot Environment management</title><content type='html'>I was quite happy to see &lt;a href="http://opensolaris.org/jive/thread.jspa?messageID=213895&amp;amp;tstart=0"&gt;this recent post &lt;/a&gt;from Ethan Quach proposing an efficient method for sharing the variable parts of /var.  It bears a striking resemblance to something that &lt;a href="http://mail.opensolaris.org/pipermail/caiman-discuss/2007-August/000706.html"&gt;I suggested&lt;/a&gt; and &lt;a href="http://mail.opensolaris.org/pipermail/caiman-discuss/2007-August/000737.html"&gt;and clarified&lt;/a&gt; in the past.

&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Correction June 6, 2009&lt;/span&gt;: Links to mail archives at opensolaris.org seem not to be stable.  The same messages are available at the following:  My &lt;a href="http://markmail.org/message/2mevb3aog43hkz57"&gt;initial suggestion&lt;/a&gt; and &lt;a href="http://markmail.org/message/kno32zy3q7kcscmr"&gt;clarification&lt;/a&gt;.

&lt;p&gt;But why does this matter?  When you are making significant changes to the system, such as during a periodic patch cycle or upgrade, it is generally desirable to...
&lt;ol&gt;&lt;li&gt;be able to do so without taking the system down for the duration of the process
&lt;/li&gt;&lt;li&gt;be able to abort the operation if you have a change of heart
&lt;/li&gt;&lt;li&gt;be able to fail back if you realize that newer isn't better
&lt;/li&gt;&lt;/ol&gt;Consider what is in /var:
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Mail boxes&lt;/b&gt; If the machine is a mail server (using sendmail et. al.) there is a pretty good chance that users have their active mail boxes at /var/mail.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;In flight mail messages&lt;/b&gt; Most machines process some email.  For example, if a cron job generates output it is sent to the user via email.  Many non-web mail clients invoke /bin/mail or /usr/lib/sendmail to cause mail to be sent.  Each message spends somewhere between a few milliseconds and a few days in /var/spool/mqueue or /var/spool/clientmqueue.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;Print jobs&lt;/b&gt; If the machine acts as a print server (even for a directly attached printer) each print job spends a bit of time in /var/spool/lp.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;Logs&lt;/b&gt; When something goes wrong, it is often times useful to look in log messages to figure out why it went wrong.  Those are often found under /var/adm.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;Temporary files that may not be&lt;/b&gt; It is rather common for people to stick stuff in /var/tmp and expect to be able to find it sometime in the future.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;DHCP&lt;/b&gt; If a machine is a dhcp server, it will store configuration and/or state information in /var/dhcp.
&lt;/li&gt;&lt;li&gt;&lt;b&gt;...&lt;/b&gt;
&lt;/li&gt;&lt;/ul&gt;All of those things should be of a stable file format and usable before and after you patch/upgrade/whatever.  If you take the traditional &lt;a href="http://docs.sun.com/app/docs/doc/817-5505"&gt;Live Upgrade&lt;/a&gt; approach, you can patch or upgrade to an alternate boot environment.  As part of activating the new environment, a bunch of files are copied between boot environments.  According to &lt;a href="http://docs.sun.com/app/docs/doc/817-5505/6mkv5m1ks?l=en&amp;amp;a=view"&gt;this page&lt;/a&gt; the following things are synchronized:
&lt;pre&gt;/var/mail                    OVERWRITE
/var/spool/mqueue            OVERWRITE
/var/spool/cron/crontabs     OVERWRITE
/var/dhcp                    OVERWRITE
/etc/passwd                  OVERWRITE
/etc/shadow                  OVERWRITE
/etc/opasswd                 OVERWRITE
/etc/oshadow                 OVERWRITE
/etc/group                   OVERWRITE
/etc/pwhist                  OVERWRITE
/etc/default/passwd          OVERWRITE
/etc/dfs                     OVERWRITE
/var/log/syslog              APPEND
/var/adm/messages            APPEND
&lt;/pre&gt;Notice that the default configuration loses your in flight print jobs because /var/spool/lp is not copied.  Suppose you have a mail server with a few gigs of mail at /var/mail.  Is it a good use of time or disk space to copy /var/mail between boot environments?
&lt;p&gt;A much better solution seems to be to make those directories shared between the boot
environments.  The way to do this in Live Upgrade and presumably in the future is to remove (or not add) them to /etc/lu/synclist and allocate separate file systems.  However, do you really want a file system for /, /var/mail, /var/spool/mqueue, /var/spool/clientmqueue, /var/spool/lp, /var/adm, /var/tmp, /var/dhcp, ...?  What if you had someone tell you that you had to monitor every file system on every machine for being out of space?  How big would you make all of those file systems so that your monitoring didn't wake you up in the middle of the night?

&lt;/p&gt;&lt;p&gt;In the future, it looks as though OpenSolaris will use ZFS to store each boot environment.  Among the features of ZFS that make this desirable are snapshots, clones, and rethinking the boundary between disk slices (or volumes) and file systems.  If the organization of /var is changed just a bit...
&lt;/p&gt;&lt;pre&gt;/var/adm -&gt; share/adm
/var/dhcp -&gt; share/dhcp
/var/mail -&gt; share/mail
/var/spool -&gt; share/spool
/var/tmp -&gt; share/tmp
/var/share/adm
/var/share/dhcp
/var/share/mail
/var/share/spool
/var/share/tmp
&lt;/pre&gt;Then you can get by with having two zfs file systems: / and /var/share.  The Snap Upgrade process would then likely do the following:
&lt;ol&gt;&lt;li&gt;Take a snapshot of /, clone it, then mount it somewhere usable in subsequent steps (e.g.  /mnt/abe)
&lt;/li&gt;&lt;li&gt;Do whatever is needed on the alternate boot environment mounted at /mnt/abe.
&lt;/li&gt;&lt;li&gt;Unmount the alternate boot environment
&lt;/li&gt;&lt;/ol&gt;When it comes time to activate the new boot environment, there are some files that are likely need to be synchronized using the traditional mechanism.  For instance, if someone tried to get into a system by guessing a user's password, there is a reasonable chance that the account was locked via a modification to /etc/shadow.  Presumably you don't want to give the bad guy another chance when you activate the new boot environment.  Note, however that the files that may need to be synchronized in /etc are nearly always small files and there would not be very many of them.  The files in /var/shared would not need to be synchronized.  However, just in case the new version of sendmail decides to eat mailboxes, it would be very nice to be able to recover.
&lt;p&gt;This means that activating a boot environment would look like:
&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Bring the system into single-user mode
&lt;/li&gt;&lt;li&gt;&lt;i&gt;Mount the alternate boot environment&lt;/i&gt;
&lt;/li&gt;&lt;li&gt;&lt;i&gt;Synchronize those files that need to be synchronized&lt;/i&gt;
&lt;/li&gt;&lt;li&gt;&lt;i&gt;Take a snapshot of /var/shared&lt;/i&gt;
&lt;/li&gt;&lt;li&gt;Set the boot loader to boot from the new boot environment and offer a failback option to the old boot environment
&lt;/li&gt;&lt;li&gt;Reboot
&lt;/li&gt;&lt;/ol&gt;The items in italics are special to boot environment activation.  Each one should take a couple seconds or less - adding far less than thirty seconds to the normal reboot process to activate the new boot environment.  Failback would be similarly quick.
&lt;p&gt;Now suppose this system is a bit more complicated and has 20 zones on it.  Have you ever patched a system with 20 zones on it?  Did you start and Friday and finish on Monday?  How happy were the users with the "must install in single-user mode" requirement?  This same technique should allow you to have two file systems per non-global zone - one for the zone root and one for /var/shared in the zone.  Supposing that the reboot processing takes 5 seconds per zone you are looking at an extra minute to reboot rather than a weekend of down time.
&lt;/p&gt;&lt;p&gt;Without Live Upgrade or Snap Upgrade, what would backout look like?  After you had the system down for patching for a couple days, you could take it down again for a couple days to back the patches out.  Or you could go to tape.  Neither is an attractive option.  With Snap Upgrade you should be able to fail back with your normal reboot time plus a minute.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-8773002961158587799?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/8773002961158587799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=8773002961158587799' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/8773002961158587799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/8773002961158587799'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2008/03/future-of-opensolaris-boot-environment.html' title='Future of OpenSolaris Boot Environment management'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-3889198251033801786</id><published>2007-04-20T18:34:00.001-05:00</published><updated>2009-06-19T22:56:08.247-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dtrace'/><category scheme='http://www.blogger.com/atom/ns#' term='solaris'/><title type='text'>Today's dtrace one-liners</title><content type='html'>&lt;p&gt;Well, I've been spending a bit more time with dtrace lately.  I'm now starting to do interesting things with dtrace without looking at the manual or snagging other scripts.  Today I found some processes that looked like they weren't doing much of use.  In particular, I saw the following in "prstat -mL"
&lt;pre&gt;
   PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID 
 15274 oracle    46  53 0.0 0.0 0.0 0.0 0.0 0.0   0  67 .22   0 racgmain/1
 15295 oracle    47  53 0.0 0.0 0.0 0.0 0.0 0.0   0  74 .23   0 racgmain/1
 16810 oracle    47  53 0.0 0.0 0.0 0.0 0.0 0.0   0  66 .23   0 racgmain/1
 25029 oracle    47  53 0.0 0.0 0.0 0.0 0.0 0.0   0  70 .23   0 racgmain/1
&lt;/pre&gt;
&lt;p&gt;First, it is confusing that it says that these processes are doing less than one system call per second (.22 or .23), but spending more than 50% in system calls.  Looks like a bug in prstat.  To see what system call was being used...
&lt;pre&gt;
# dtrace -n 'syscall:::entry/execname == "racgmain"/ { @[probefunc] = count() }
dtrace: description 'syscall:::entry' matched 232 probes
^C

  read                                                         269039
&lt;/pre&gt;
Ahh, so it is only reads that are causing all of this.  Let's see which file descriptors are involved.
&lt;pre&gt;
# dtrace -n 'syscall::read:entry/execname == "racgmain"/{ @[pid, probefunc,arg0] = count() }'
^C
    22469  read      9                7
    22469  read      4                7
    22469  read      3                9
    22469  read      8                9
    22469  read     10               10
    22469  read      7               21
    22469  read      6               24
    15274  read     10          1026462
    15295  read     10          1044932
    25029  read     10          1051450
    16810  read     11          1060720
&lt;/pre&gt;
&lt;p&gt;It seemed rather odd that there would be so much reading on a single file descriptor per file (10 or 11, depending on the process).  If this were really the case, I would expect to see some processes showing up in prstat that were high in %sys doing writes.  Using pfiles on each of the pids showed that the file descriptor in question was a FIFO, but gave no indication what (if anything) was on the other end of the FIFO.
&lt;p&gt;To help answer the question of what might be on the other end of the FIFO, I tried this (ok, not a one liner...)
&lt;pre&gt;
#!/usr/sbin/dtrace -qs 

syscall::read:return
/execname == "racgmain"/
{
        @c[pid, arg0] = count()
}

tick-1s
{
        printf("%6s %6s %4s\n", " pid  ", " size ", "count");
        printa("%6d %6d %@4d\n", @c);
        clear(@c);
}
&lt;/pre&gt;
&lt;p&gt;Which gave the following output...
&lt;pre&gt;
 pid    size  count
 15295      0 117524
 15274      0 121065
 25029      0 121308
 16810      0 125358
 pid    size  count
 15274      0 108177
 25029      0 109639
 15295      0 115735
 16810      0 117175
 pid    size  count
 15295      0 119411
 15274      0 119471
 25029      0 120273
 16810      0 120650
&lt;/pre&gt;
&lt;p&gt;Imagine that... these processes are each doing 100,000+ zero-byte reads per second.  Time to tell the DBA's that they have some real problems with one of their daemons.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-3889198251033801786?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/3889198251033801786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=3889198251033801786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/3889198251033801786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/3889198251033801786'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2007/04/todays-dtrace-one-liners.html' title='Today&apos;s dtrace one-liners'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-842997723045045934</id><published>2007-04-11T16:59:00.000-05:00</published><updated>2007-04-11T17:05:58.850-05:00</updated><title type='text'>reproducible hang with ldom preview</title><content type='html'>&lt;p&gt;&lt;span style="font-style: italic;"&gt;This blog entry is because formatting is horribly broken at &lt;a href="http://forum.java.sun.com/thread.jspa?threadID=5159568"&gt;http://forum.java.sun.com/thread.jspa?threadID=5159568&lt;/a&gt; where I originally posted it.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;
&lt;/p&gt;&lt;p&gt;I configured a T2000 as described in the beginner's guide (&lt;a href="http://www.sun.com/blueprints/0207/820-0832.pdf"&gt;http://www.sun.com/blueprints/0207/820-0832.pdf&lt;/a&gt;) with the exception of the device allocated for the root disk.  For that I came up with my own variant of &lt;a href="http://unixconsole.blogspot.com/2007/04/time-to-build-guest-domain.html"&gt;http://unixconsole.blogspot.com/2007/04/time-to-build-guest-domain.html&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;My variant of using a file involved creating the file with mkfile on a zfs file system.  That is...
&lt;/p&gt;&lt;pre&gt;zpool create zfs mirror c1t0d0s4 c1t1d0s4
zfs create zfs/ldoms
zfs set compress=on zfs/ldoms
mkfile 32G /zfs/ldoms/root.img
&lt;/pre&gt;As I install Solaris in the ldom, the server (control domain) dies after extracting a few hundred megabytes of a flash archive.  I have traced this down to it running out of memory.

Here's "vmstat 4" output on the control domain console:
&lt;pre&gt;...
0 0 0 8636536 24776  1  70  0  0  0  0  0  0  0  0  0 1954  311 2244  0 23 76
0 0 0 8645096 22280  1  36  0  0  0  0  0  0  0  0  0 5957  370 9827  0 19 80
0 0 0 8649008 17720  1  40  0 296 313 0 44 0  0  0  0 9975  361 15877 0 24 75
0 0 0 8651104 15944  1  52  0 807 1671 0 700 0 0 0  0 10725 347 17545 0 26 74
0 0 0 8650800 18376  0  60  0 88 239 0 127 0  0  0  0 9816  391 15545 1 33 67
0 0 0 8640432 15936  0  76  0 497 3025 0 3874 0 0 0 0 11367 432 17975 0 35 65
0 0 0 8642968 17032  1  59  0 452 2028 0 842 0 0 0  0 10266 363 16127 0 27 73
kthr      memory            page            disk          faults      cpu
r b w   swap  free  re  mf pi po fr de sr m0 m1 m2 m1   in   sy   cs us sy id
0 0 0 8644768 15744  0  56  0 387 1298 0 126 0 0 0  0 10170 330 16355 0 24 75
0 0 0 8652504 18368  1 113  0 372 2462 0 273 0 0 0  0 11171 321 18613 0 35 65
0 0 0 8652832 15720  1 134  0 411 6081 0 738 0 0 0  0 11541 332 18979 0 34 66
0 0 0 8652232 14312  1  94  0 413 1806 0 7775 0 0 0 0 10718 358 18271 0 38 62
0 0 0 8647360 12592 18 133  9 555 5176 0 17490 1 0 1 0 10394 320 16970 1 37 63
0 0 0 8645248 14408  2  73 22 486 5039 0 3111 2 1 1 0 11749 383 18336 0 40 59
2 0 43 8641800 2784  1 148 99 1070 1517 0 53982 19 9 9 5 8316 356 14226 0 43 57
0 0 116 8647032 800  1  42 127 134 312 3688 76207 14 7 7 1 2153 114 3726 0 29 71
&lt;/pre&gt;At this point the server froze. Note that 116 processes were swapped and the "de" column is 3688.  Very bad news.
&lt;p&gt;My initial thoughts were that I was running into some of the low-memory problems known to happen with the ZFS arc.  This does not seem to be the case.  According to mdb, the arc size is around 60 MB:
&lt;/p&gt;&lt;pre&gt;# mdb unix.3 vmcore.3
...
&gt; arc::print -td size
uint64_t size = 0t61455360
&lt;/pre&gt;The control domain is S10 11/06 + 118833-36 + those required for ldoms + many others.  The ldom is in the process of being installed is booted from a S10 11/06 netinstall image (118833-33).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-842997723045045934?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/842997723045045934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=842997723045045934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/842997723045045934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/842997723045045934'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2007/04/reproducible-hang-with-ldom-preview.html' title='reproducible hang with ldom preview'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-115707784547574353</id><published>2006-08-31T21:26:00.000-05:00</published><updated>2006-08-31T21:31:49.350-05:00</updated><title type='text'>Random password one-liner</title><content type='html'>I recently came up with this method for generating reasonable random 8-character passwords:
&lt;pre&gt;
$ &lt;b&gt;dd if=/dev/random bs=6 count=1 2&gt;/dev/null | openssl base64&lt;/b&gt;
LCia46S4
&lt;/pre&gt;
If 8 characters is not long enough, increase the number after bs= to 75% of the number of characters you would like in the password.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-115707784547574353?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/115707784547574353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=115707784547574353' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/115707784547574353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/115707784547574353'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/08/random-password-one-liner.html' title='Random password one-liner'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-115663266583680758</id><published>2006-08-26T17:26:00.000-05:00</published><updated>2006-08-26T17:53:39.150-05:00</updated><title type='text'>Install Solaris from DVD image on disk</title><content type='html'>&lt;p&gt;My personal SPARC machine is pathetic by today's standards - An Ultra II with a pair of 300 MHz processors, 768 MB RAM, and a very slow CDROM drive.  This is pretty much the slowest machine that is supported by Solaris 10.  That, and today I decided it was time to get a fresh installation of Solaris Express (build 46) on it.&lt;/p&gt;

&lt;p&gt;I first tried the live upgrade route.  However, that didn't work out too well because I had previously used bfu to get some newer OpenSolaris bits on the machine.  I &lt;b&gt;really&lt;/b&gt; did not want to repeat the download process for all the CD ISO's (already had downloaded the DVD ISO).  Now, if you think that downloading and burning is slow - you should see the speed of the installation on this CDROM drive.  It was probably OK in the days when Solaris fit on one CD, but not today with 5(?) CD's to complete the installation.

&lt;p&gt;The disk layout of the machine was as follows:
&lt;ul&gt;
&lt;li&gt;c0t0d0 32 GB disk
 &lt;ul&gt;
  &lt;li&gt;c0t0d0s0 - 4.5 GB available for new /
  &lt;li&gt;c0t0d0s1 - ~500 MB swap
  &lt;li&gt;c0t0d0s7 - remainder as zfs pool "pool0"
 &lt;/ul&gt;
&lt;li&gt;c0t1d0 4 GB disk
 &lt;ul&gt;
  &lt;li&gt;c0t1d0s0 - Root with build 36 (?) + random BFU bits
 &lt;/ul&gt;
&lt;/ul&gt;
I had the DVD image in a subdirectory of my home directory that was in the pool0/home file system in the zfs pool.

To make use of that DVD image without buying a SCSI DVD drive, I did the following:
&lt;ol&gt;
&lt;li&gt;Burn build 46 CD0 to a CD-R
&lt;li&gt;Boot from the CD-R
&lt;li&gt;Go clean up the shop from the woodworking I was doing earlier
&lt;li&gt;Do some laundry
&lt;li&gt;Return to the Ultra II to find that it was just about to ask me which language I speak.  Really, it was still working on it.  Now do you know why I didn't want to feed it 5 CD's?
&lt;li&gt;Answer sysidcfg questions
&lt;li&gt;Exit the installer
&lt;li&gt;zpool import pool0.  After the import was complete but before mounting file systems, zpool crashed with a segv.  Later I saved that core file to /a for later analysis
&lt;li&gt;zfs set mountpoint=/tmp/home pool0/home
&lt;li&gt;zfs mount pool0/home
&lt;li&gt;lofiadm -a /tmp/home/build46.iso
&lt;li&gt;umount /cdrom
&lt;li&gt;mount -F hsfs -o ro /dev/lofi/1 /cdrom
&lt;li&gt;install-solaris
&lt;li&gt;Go blog about a cool hack.  :)
&lt;/ol&gt;

The installation is now about 40% done.  Looks like the hack is working just fine.  I wonder if I could bundle this all up in a begin script (especially the laundry) to automate the installation from an ISO image after booting from local media.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-115663266583680758?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/115663266583680758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=115663266583680758' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/115663266583680758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/115663266583680758'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/08/install-solaris-from-dvd-image-on-disk.html' title='Install Solaris from DVD image on disk'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-114116964270638072</id><published>2006-02-28T17:20:00.000-06:00</published><updated>2006-02-28T17:34:55.890-06:00</updated><title type='text'>Update on zoneadm create with zfs</title><content type='html'>&lt;p&gt;After &lt;a href="http://mail.opensolaris.org/pipermail/request-sponsor/2006-February/000263.html"&gt;reaching out to Sun&lt;/a&gt; to work on getting my work integrated into OpenSolaris, I found that Sun was already working on this feature.  Subsequently, they indicated that the code made it into some &lt;a href="http://mail.opensolaris.org/pipermail/zones-discuss/2006-February/000167.html"&gt;internal source code tree&lt;/a&gt;.  As such, I am holding off on future development until I can get at that code.

&lt;p&gt;However, if you are wanting to try it out, I have &lt;a href="http://homepages.cae.wisc.edu/~gerdts/zoneadm/"&gt;posted the code&lt;/a&gt; for others to play with.  If you have a working OpenSolaris build environment, you should be able to drop in my modified zoneadm.c, run dmake all, then use the resulting zoneadm command.  Alternatively, the &lt;a href="http://homepages.cae.wisc.edu/~gerdts/zoneadm/zoneadm-sparc"&gt;sparc version&lt;/a&gt; of the zoneadm binary is also available.

&lt;p&gt;Enjoy!

&lt;p&gt;T: &lt;a href="http://technorati.com/tag/OpenSolaris" rel="tag"&gt;OpenSolaris&lt;/a&gt; &lt;a href="http://technorati.com/tag/Zones" rel="tag"&gt;Zones&lt;/a&gt; &lt;a href="http://technorati.com/tag/ZFS" rel="tag"&gt;ZFS&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-114116964270638072?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/114116964270638072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=114116964270638072' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114116964270638072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114116964270638072'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/02/update-on-zoneadm-create-with-zfs.html' title='Update on zoneadm create with zfs'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-114040039546166856</id><published>2006-02-19T19:45:00.000-06:00</published><updated>2006-05-07T11:11:08.473-05:00</updated><title type='text'>Zone created in 0.922 seconds</title><content type='html'>I noticed today that in the latest OpenSolaris code that "zoneadm clone" exists. Unfortunately, cloning a zone only offered the copy mechanism that was essentially "find | cpio". A bit of hacking later and we have this:

&lt;pre&gt;# time ksh -x /var/tmp/clone
+ newzone=fast
+ template=template
+ zoneadm=/ws/usr/src/cmd/zoneadm/zoneadm
+ PATH=/usr/bin:/usr/sbin
+ zonecfg -z fast create -t template
+ zonecfg -z fast set zonepath=/zones/fast
+ /ws/usr/src/cmd/zoneadm/zoneadm -z fast clone -m zfsclone template
Cloning zonepath /zones/template...

&lt;span style="color: rgb(102, 102, 204); font-weight: bold" &gt;real    0m0.922s&lt;/span&gt;
user    0m0.128s
sys     0m0.171s
&lt;/pre&gt;

This comes is achieved using zfs to create a snapshot of the template zone, then clone the snapshot to create the zonepath of the new zone. A bit of cleanup is needed, but goodness is on the way.


&lt;p&gt;T: &lt;a href="http://technorati.com/tag/OpenSolaris" rel="tag"&gt;OpenSolaris&lt;/a&gt; &lt;a href="http://technorati.com/tag/Zones" rel="tag"&gt;Zones&lt;/a&gt; &lt;a href="http://technorati.com/tag/ZFS" rel="tag"&gt;ZFS&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-114040039546166856?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/114040039546166856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=114040039546166856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114040039546166856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114040039546166856'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/02/zone-created-in-0922-seconds.html' title='Zone created in 0.922 seconds'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-114005523744777419</id><published>2006-02-15T19:32:00.000-06:00</published><updated>2006-02-17T07:32:23.676-06:00</updated><title type='text'>hunting bugs in filebench</title><content type='html'>I've been using &lt;a href="http://www.solarisinternals.com/si/tools/filebench/index.php"&gt;filebench&lt;/a&gt; a bit at work and decided that I would like to try a few things out at home.  My home machine is not quite as beefy as the V40z's that I have been testing on at work.

Getting filebench to compile in the first place is a bit of work.  Probably works really well on someone else's system, but mine is obviously different.  That's another story though.  After compiling filebench, I ran it for the first time and saw this:
&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;$ &lt;/span&gt;&lt;b style="font-family: courier new;"&gt;/opt/filebench/bin/filebench&lt;/b&gt;
&lt;span style="font-family:courier new;"&gt;Segmentation fault (core dumped)&lt;/span&gt;
&lt;/pre&gt;Bummer.  Well, let's see where that is at:
&lt;pre&gt;$ &lt;b&gt;gdb /opt/filebench/bin/filebench core&lt;/b&gt;
GNU gdb 6.4-debian

. . .

(gdb) &lt;b&gt;where&lt;/b&gt;
#0  0x37dd84aa in memset () from /lib/tls/i686/cmov/libc.so.6
#1  0x0807b01e in ?? ()
#2  0x080522da in ipc_init () at ipc.c:264
#3  0x08058bc1 in main (argc=1, argv=0x3f8fdcf4) at parser_gram.y:1140
&lt;/pre&gt;
OK, so let's go with the assumption that the bug is in the code listed as alpha on the web site, and not libc.  So we go up the stack a couple levels.
&lt;pre&gt;
(gdb) &lt;b&gt;up 2&lt;/b&gt;
#2  0x080522da in ipc_init () at ipc.c:264
264             memset(filebench_shm, 0, c2 - c1);
(gdb) &lt;b&gt;print filebench_shm&lt;/b&gt;
$1 = (filebench_shm_t *) 0xffffffff
&lt;/pre&gt;
Hmmm... 0x with a bunch of f's looks like -1.  Perhaps some system call on Solaris (presumably where filebench started) returns NULL on error and on Linux it returns -1.  Let's go looking for that system call.
&lt;pre&gt;
(gdb) &lt;span style="font-weight: bold;"&gt;list
&lt;/span&gt;259     #endif /* USE_PROCESS_MODEL */
260
261             c1 = (caddr_t)filebench_shm;
&lt;p&gt;262             c2 = (caddr_t)&amp;filebench_shm-&gt;marker;
263
264             memset(filebench_shm, 0, c2 - c1);
265             filebench_shm-&gt;epoch = gethrtime();
266             filebench_shm-&gt;debug_level = 2;
267             filebench_shm-&gt;string_ptr = &amp;filebench_shm-&gt;strings[0];
268             filebench_shm-&gt;shm_ptr = (char *)filebench_shm-&gt;shm_addr;
&lt;/p&gt;&lt;/pre&gt;
Nope, not there.  Maybe a bit further up.
&lt;pre&gt;
(gdb) &lt;b&gt;list 250&lt;/b&gt;
245     #endif
246
247             if ((&lt;i&gt;filebench_shm = (filebench_shm_t *)mmap(0, sizeof(filebench_shm_t),
248                     PROT_READ | PROT_WRITE,
249                     MAP_SHARED, shmfd, 0)) == NULL&lt;/i&gt;) {
250                     filebench_log(LOG_FATAL, "Cannot mmap shm");
251                     exit(1);
252             }
253
254     #else
&lt;/pre&gt;
It looks like mmap may be the culprit.  I first asked man, but this is Linux, not Solaris.  No man page for mmap!  Next try google.  Google comes up with &lt;a href="http://www.die.net/doc/linux/man/man2/mmap.2.html"&gt;this page that looks a lot like a man page&lt;/a&gt;.  Why isn't that found on my system?  Another thing for another day.  Anyway, it says:
&lt;blockquote&gt;
&lt;b&gt;RETURN VALUE &lt;/b&gt;
&lt;p&gt;On success, mmap returns a pointer to the mapped area. On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set appropriately. On success, munmap returns 0, on failure -1, and errno is set (probably to EINVAL).
&lt;/p&gt;&lt;/blockquote&gt;
Ok, so it is returning -1 because it doesn't like something.  Let's see what it is trying to mmap:
&lt;pre&gt;
(gdb) &lt;b&gt;print sizeof(filebench_shm_t)&lt;/b&gt;
$2 = 907368000
(gdb) &lt;span style="font-weight: bold;"&gt;print sizeof(filebench_shm_t) / 1024 / 1024&lt;/span&gt;
&lt;p&gt;$3 = 865
(gdb)
&lt;/p&gt;&lt;/pre&gt;
That 'splains it.  It looks like it is trying to set up a shared memory segment that is 865 MB.  My poor little system only has 512.

FWIW, I have created a patch that addresses this one problem but I haven't had a chance to test it on Solaris yet.  Unfortunately, with the patch, it just tells me that the mmap failed.  It doesn't address the fact that it is trying to allocate a shared memory segment larger than the size of RAM on my system.

&lt;p&gt;Update 1:

&lt;p&gt;I have posted several patches to the &lt;a href="http://sourceforge.net/tracker/?group_id=133644&amp;atid=727883"&gt;bug tracking system&lt;/a&gt; at sourceforge.net.  This particular one is &lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;amp;amp;aid=1432638&amp;group_id=133644&amp;amp;atid=727883"&gt;1432638&lt;/a&gt;.  It turns out that mmap on Solaris also returns MAP_FAILED so the patch is simpler than I originally expected.

&lt;p&gt;T: &lt;a href="http://technorati.com/tag/filebench" rel="tag"&gt;filebench&lt;/a&gt; &lt;a href="http://technorati.com/tag/Debugging" rel="tag"&gt;Debugging&lt;/a&gt;&lt;div style="clear: both; padding-bottom: 0.25em;"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-114005523744777419?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/114005523744777419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=114005523744777419' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114005523744777419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/114005523744777419'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/02/hunting-bugs-in-filebench.html' title='hunting bugs in filebench'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-113876111804274532</id><published>2006-01-31T20:23:00.000-06:00</published><updated>2006-08-31T22:06:22.973-05:00</updated><title type='text'>Download and gunzip in one step</title><content type='html'>I was feeling the need to take a look at &lt;a href="http://www.gnusolaris.org/gswiki"&gt;Nexenta&lt;/a&gt; and decided that I wasn't terribly interested in waiting for a download, then waiting for a gunzip.  Why not do them both at the same time?

&lt;pre&gt;
$ &lt;b&gt;wget -O /dev/stdout  http://www.gnusolaris.org/gsmirror/genunix.org/elatte_installcd_alpha2_i386.iso.gz  | gunzip &amp;gt; elatte_installcd_alpha2_i386.iso&lt;/b&gt;         =&amp;gt; `/dev/stdout'
--20:21:47--  http://www.gnusolaris.org/gsmirror/genunix.org/elatte_installcd_alpha2_i386.iso.gz
Resolving www.gnusolaris.org... 216.129.112.21
Connecting to www.gnusolaris.org|216.129.112.21|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.genunix.org/distributions/gnusolaris/elatte_installcd_alpha2_i386.iso.gz [following]
--20:21:48--  http://www.genunix.org/distributions/gnusolaris/elatte_installcd_alpha2_i386.iso.gz
Resolving www.genunix.org... 204.152.191.100
Connecting to www.genunix.org|204.152.191.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 567,433,011 (541M) [text/plain]

13% [====&amp;gt;                                ] 77,025,880   359.25K/s    ETA 22:27
&lt;/pre&gt;

Just 22 minutes to go.  I guess at this rate I could have piped it through cdrecord with "speed=2".

&lt;p&gt;T: &lt;a href="http://technorati.com/tag/Nexenta" rel="tag"&gt;Nexenta&lt;/a&gt; &lt;a href="http://technorati.com/tag/OpenSolaris" rel="tag"&gt;OpenSolaris&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-113876111804274532?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/113876111804274532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=113876111804274532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/113876111804274532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/113876111804274532'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/01/download-and-gunzip-in-one-step.html' title='Download and gunzip in one step'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-113720978693272544</id><published>2006-01-13T21:22:00.000-06:00</published><updated>2006-01-13T21:36:26.943-06:00</updated><title type='text'>patch_order made easy</title><content type='html'>&lt;p&gt;Some of my most tedious times as a Solaris administrator have been when I needed to create a patch_order file for a custom patch cluster.  For a long time I have intended to just write a script...

&lt;/p&gt;&lt;p&gt;But now, I don't have to do that any longer!  Today I discovered that smpatch(1M) now has an &lt;i&gt;order&lt;/i&gt; subcommand.  This makes it really quite simple for me to create a patch_order file for a very long list of patches.  In this example, I create the patch_order file for the patches in the Solaris 10 Update 1 UpgradePatches directory:
&lt;/p&gt;&lt;pre&gt;
# &lt;b&gt;cd /mnt/Solaris_10/UpgradePatches&lt;/b&gt;
# &lt;b&gt;ls &amp;gt; /tmp/patches&lt;/b&gt;
# &lt;b&gt;smpatch order -d `pwd` -x idlist=/tmp/patches &amp;gt; /tmp/patch_order&lt;/b&gt;
&lt;/pre&gt;
Now, if you want to go the full length and create a patch cluster for it:
&lt;pre&gt;
# &lt;b&gt;mkdir /tmp/10U1_UpgradePatches&lt;/b&gt;
# &lt;b&gt;cd /tmp/10U1_UpgradePatches&lt;/b&gt;
# &lt;b&gt;mv /tmp/patch_order .&lt;/b&gt;
# &lt;b&gt;ln -s /mnt/Solaris_10/UpgradePatches/* .&lt;/b&gt;
# &lt;b&gt;cp /somewhere/10_Recommended/install_cluster .&lt;/b&gt;
&lt;/pre&gt;
Modify the &lt;i&gt;SUPPLEMENT_NAME="..."&lt;/i&gt; line in install_cluster to be more descriptive for this patch cluster.  Be sure to not use characters like /, \, |, etc.
&lt;pre&gt;
# &lt;b&gt;cd /tmp&lt;/b&gt;
# &lt;b&gt;zip -rq 10U1_UpgradePatches.zip 10U1_UpgradePatches&lt;/b&gt;
&lt;/pre&gt;
At this point, you can copy the 10U1_UpgradePatches around to your various machines and use it just like you would a 10_Recommended bundle.

Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-113720978693272544?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/113720978693272544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=113720978693272544' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/113720978693272544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/113720978693272544'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2006/01/patchorder-made-easy.html' title='patch_order made easy'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-111586321997636812</id><published>2005-05-11T20:54:00.000-05:00</published><updated>2005-05-11T21:00:19.983-05:00</updated><title type='text'></title><content type='html'>I am sad to report that the world is running short of geeks.  I think it was the 1200 baud modem in my 386sx system that I smoked will building Linux 0.99pl14 that solidified my position in the 90's.

&lt;p&gt;&lt;a href="http://www.nerdtests.com/ft_cg.php?im"&gt;
&lt;img src="http://www.nerdtests.com/images/ft/cg.php?val=3832" alt="My computer geek score is greater than 96% of all people in the world! How do you compare? Click here to find out!"&gt; &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-111586321997636812?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/111586321997636812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=111586321997636812' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/111586321997636812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/111586321997636812'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2005/05/i-am-sad-to-report-that-world-is.html' title=''/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12367155.post-111422261026063267</id><published>2005-04-22T18:26:00.000-05:00</published><updated>2005-04-22T21:16:50.263-05:00</updated><title type='text'>My first SUPerG</title><content type='html'>I had the privilige of attending &lt;a href="http://www.sun.com/datacenter/superg/"&gt;SUPerG&lt;/a&gt; this week.  Some of the highlights of the presentations come in the form of short quotes from some of the speakers.
&lt;blockquote&gt;Volume managers are shims that were introduced to work around bugs that should have been fixed in the file system. - &lt;a href="http://blogs.sun.com/rmc"&gt;Richard McDougall&lt;/a&gt;&lt;/blockquote&gt;&lt;a href="http://blogs.sun.com/rmc"&gt;&lt;/a&gt;
And finally, someone of authority that has said what I have been trying to get across for a couple years:
&lt;blockquote&gt;IO Wait == Idle - &lt;a href="http://blogs.sun.com/roller/page/glennf/"&gt;Glenn Fawcett&lt;/a&gt;&lt;/blockquote&gt;&lt;a href="http://blogs.sun.com/roller/page/glennf/"&gt;&lt;/a&gt;&lt;blockquote&gt;&lt;/blockquote&gt;Overall I was surprised by the amount of emphasis that Sun has put on the future of storage.  With the combination of 10 Gigabit Ethernet, FireEngine, and NFSv4, Sun very clearly stated that the future of storage is in NAS.  The story is pretty well outlined by Richard McDougall in &lt;a href="http://blogs.sun.com/roller/page/rmc/20050414#data_is_it_about_devices"&gt;this blog entry&lt;/a&gt;.

I was happy to see that the first Niagara systems seem to be ahead of schedule.  Within the next 8 months I should be able to get a single processor SPARC box that is more powerful than a 12-processor 4800 or any commodity box sporting chips from Intel or AMD.  Way cool.  The thing with silicon that really blew me away was Rock's &lt;a href="http://www.aceshardware.com/read_news.jsp?id=80000586"&gt;hardware scout&lt;/a&gt;.  This chip is able to look a thousand or more instructions ahead to optimize cache loads.  The net effect is that you can get by with a lot less cache, thereby making huge caches unnecessary.

And for those of us that are a couple years into the life of 15k's, the good news keeps coming.  First, the upgrade to UltraSPARC IV boards brings about 90% performance improvement, the UltraSPARC IV+ will add another 70%.  With an expected July release of the US IV+, this means that through periodic system board (and carrier plate...) upgrades, the 15k (and 4800, 6800, 12k, etc.) are keeping pace with Moore's Law without a forklift upgrade.  Very impressive.

There was also a lot of talk about various Solaris 10 features... however, things like zones, dtrace, zfs, etc. have been covered consistently for a long time in the press and in many data centers that there was not a whole lot new to say.  Putting all of the improvements in Solaris together with advances in other technologies (10 gigabit ethernet, multiple vendors with NFSv4, CMT,  ...)  really shows that there is a bright future for Solaris.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12367155-111422261026063267?l=mgerdts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mgerdts.blogspot.com/feeds/111422261026063267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12367155&amp;postID=111422261026063267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/111422261026063267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12367155/posts/default/111422261026063267'/><link rel='alternate' type='text/html' href='http://mgerdts.blogspot.com/2005/04/my-first-superg.html' title='My first SUPerG'/><author><name>Mike Gerdts</name><uri>http://www.blogger.com/profile/01469631035493962083</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
