On February 25, 2005, I undertook to transfer a nontrivial software development/deployment setup from OS X and Linux to Solaris 10. I have lots of old Unix and recent Linux experience, but none with Solaris. This entry will serve as the permanent home for my technical diary documenting the learning process, which I shall update in-place. [Updated: New sections on docs.sun.com, NFS, and, believe it or not, %.]

Table of Contents ·

Introduction · ongoing is a blog, but this entry isn’t, so I’m going to write in chronological order, with new stuff at the bottom. I’m consciously pitching this thing so that it’s as likely as possible to be turned up by Google or equivalent when someone’s looking for help with these problems, and thus it’ll work better if new arrivals can read it from the top down.

There are probably mistakes, I did all this in a big hurry, and there probably also other useful S10-for-Linux-hacks resource sites; let me know about ’em and I’ll point to them.

Thanks to those who’ve contributed so far: Sean Neakums, James Dickens, Tim Foster, Bryan Cantrill (of course), Chris Ferris, Scott Henry, Clayton Wheeler, Ryan Underwood, Niall Richard Murphy, Michal Benkur, and Bruce Riddle.

Background and Prejudices · Since 1979 I have used, in chronological order, Unix V6 on a PDP-11/34, 4.1bsd and 4.2bsd on a variety of VAXes, Xenix on Intel 386-class machines, commercial Unixes including SunOS (up to about 1992) and DEC Unix under various labels up to about 1996, and in the last 10 years, the Red Hat (lightly), Debian, and SuSE flavors of GNU/Linux on the server and since 2002 Mac OS X on my laptop.

My longevity in this space means that some of my approaches are old-fashioned. I am given to incantations such as
ls -l | sort +4rn | head
and I still type more not less. I lean to Emacs but can use Vi competently.

You know, we need a generic term to apply to all operating systems on which fork(2) is understood to be the normal process-creation tool. In the context of this essay, I’m going to use, um, “Unix”.

Disclosure: I have advantages that the average Linux hack dipping into Solaris won’t, namely I can ask questions of people like Bryan Cantrill.

plus-plus

First Steps and Ssh · Sometime around February 24th, I was set up with a pair of Opteron boxes that, they told me, were running generic Solaris 10 straight out of the box.

The first thing you do with a new Unix box is ssh into it. And indeed, it works perfectly, and so far, I can’t distinguish between the workings of Solaris’ ssh/sshd and those I’m used to anywhere else.

plus-plus

Bash, Or Not · Once connected I quickly concluded that the default shell was bash, which made me happy. Except for, I copied over my .bashrc from the laptop, and it didn’t work. All the PS1 and PATH settings worked by hand if I typed them in... hmm. So I reached back into my Unix past and put them in .profile instead, and there I was.

This isn’t bash at all, it’s the “Posix Shell”; but bash-lovers will feel at home. The choice of shells is less important these days now that we have command-line editing. It has the important stuff like control-Z and bg/fg and the good old for/do/done loop syntax and >&.

And it turns out that bash is there in /usr/bin if you really want it.

minus-minus

Directory Hell · A lot of commands I wanted to use (ping and wget were the first two I think) weren’t where I expected them to be. It turns out the commands in Solaris are splashed over a bunch of different directories. Bryan Cantrill had pointed out some helpful stuff in /opt/csw/bin but I didn’t have one, but that was OK because I do have /usr/sfw/bin, and some of stuff he was talking about was there.

That’s OK, nothing a little environment hacking (don’t forget MANPATH) won’t solve. Thus the following from my .profile:
PATH=/opt/csw/bin:/opt/sfw/bin:/usr/sfw/bin:/usr/X/bin:/usr/ccs/bin:$HOME/dev/jython/bin:$HOME/bin:$PATH
But, uh, why? Do these directories actually serve any purpose other than to confuse newbies?

plus-plus

Man Pages · In both OS X and Linux, from time to time I come across a missing or vestigial man page. Solaris seems to take this real seriously; they all seem to be there, and a bit more polished too.

Of course, like all Unix man pages, they are designed to answer “What are the precise effects of this command?” rather than “How on earth do I do XXX?”, but that’s just the way things are.

plus-plus

Two-Letter Command Surprises · Well, you gotta use ps if you’re going to accomplish anything on a Unix box, right? I mechanically typed
ps axuwwww | grep tb
which is my usual way of asking “what do I have running?” and realized that that mouldy old stuff doesn’t work any more. What I wanted, of course, was
ps -ef
and I didn’t even have to look it up, those options were there in some dusty memory closet with dim letters on the door spelling, I think, “System V”.

For those who really want old-fashioned PS, go use /usr/ucb/ps; but a better option is the nice modern pgrep(1), which has been there on Solaris for eight years.

Then I wondered about my disk setup and typed
df -k
and quickly became very confused, because it turns out that in Solaris, -k changes everything around. It turns out that what I really need are the -h and -l options; I wonder how I missed those.

This df exercise did reveal that on Solaris, /tmp is mounted on a RAM disk. Cool.

minus-minus

pkg-get · Bryan told me that if I wanted any open-source software that doesn’t come with Solaris, this was the way to get it; seems to work about like apt-get, which I’ve always regarded as the supreme achievement in the universe of release engineering.

Except for, it wasn’t there, so I had to go get it from Blastwave.org, which meant I had to go find wget, and then figure out how to tell it to use the Sun Intranet HTTP proxies, which is how I found about all those weird directories where the commands are hiding.

Uh, guys, why? If you need this tool to use Solaris, why doesn’t it come with Solaris?

Afterward, I found out that what I really needed to do was install the “Freeware Companion” CD, which would have had a lot of the missing pieces. But I still think that pkg-get should just be there.

plus-plus

Perl and Python and Java ·

zep01 524> perl -ver

This is perl, v5.8.4 built for i86pc-solaris-64int
(with 27 registered patches, see perl -V for more detail)

zep01 528> python
Python 2.3.3 (#1, Dec 16 2004, 14:38:56) [C] on sunos5

zep01 529> java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Server VM (build 1.5.0_01-b08, mixed mode)
minus-minus

cc, Chapter One ·

zep01 502> cat hello.c
main()
{
  printf("hello world\n");
}
zep01 503> cc -o hello hello.c
-bash: cc: command not found

Grr... but they told me they were shipping a compiler!

Oh, wait, he said GCC.

plus-plus

cc, Chapter Two ·

zep01 505> gcc -o hello hello.c
zep01 506> ./hello
hello world
zep01 523> which gcc
/usr/sfw/bin/gcc

Let’s see, there is a cc, over in /usr/ucb, but it turns out to be a front-end for another compiler, the non-free Forte kit that we sell.

But this is really no biggie, because GCC is a fine compiler; still, it’s a pity that out of the box, you can’t just type cc. After all, Linux uses GCC too, and calls it cc.

C++, you ask? We don’ need no steenkin’ C++! What? You insist? Oh well...

zep01 509> g++ -o hello hello.c
hello.c: In function `int main()':
hello.c:3: error: `printf' undeclared (first use this function)
hello.c:3: error: (Each undeclared identifier is reported only once for each function it appears in.)

I hope you feel better now. [Update: someone wrote me to tell me which include files would make the compile errors go away. Like, it’s a joke, OK?]

plus-plus

A Few Useful Solarisms · That was the title of an email from Fazal Majid, containing this:

	isainfo -v (should show you you are in 64 bit mode)
	gcc -m64 (compile in 64 bit mode)
	iostat -xzd 5 (shows disk usage)
	prstat -vm (like top, finer grained)
	truss (follow syscalls)
	pmap (dump a process' adress space, try it with a 64 bit exe)
	prtconf -v (get hardware info)
	fuser (like lsof, with some twists)
minus-minus

tar · It may have once been a tape archiver, but these days it’s a tarbaby. Solaris is a little behind Linux in this department; the basic tar doesn’t have the z modifier so you’ll find yourself doing a lot of
tar cf - . | gzip
Also, it whined about the symbolic links in the Tomcat tarball from Apache Jakarta.

Mind you, neither of these are fatal. But if they bother you, here’s the solution:
pkg-get -i gtar

I talked this over with Bryan and he explained there’s a monster legacy problem: Historically, there have been a lot of subtle tar compatibility issues, and Sun customers all over the place have wired tar into shipping production applications, so changing it is really scary (but he could see the advantage of the z modifier). Anyhow, I aliased tar to gtar and I’m fine.

By the way, just today I read in a couple places about something called star, in the news because it’s been relicensed under CDDL. You can get it via pkg-get and it looks like it might be a better choice than gtar. Cool name, too.

plus-plus

Javaland Apparatus · The Zeppelin needs Tomcat and Jython servlets.

I downloaded Tomcat, unzipped it. Worked first time.

I downloaded Jython, ran the self-installer. Worked first time.

I hooked up Jython to Tomcat’s servlet engine following Sean McGrath’s instructions (which are Windows-centric and full of examples like d:\jython-2.1). Worked first time.

Yawn. I tell ya, this Java stuff is gonna catch on.

plus-plus

docs.sun.com · So, I’ve got these two machines and I want Zeppelin to share code and test data and scripts in the obvious ways. I assume that NFS is the way to go, but last time I set that up it was well back in the last century. I have vestigial lizard-brain memory of some commands, and the root password; not a good combination.

There’s this thing called docs.sun.com; I seem to recall that my old friend Jon Bosak was hired away from Novell to Sun all these years ago to help build it. Anyhow, it’s got a link for Solaris 10 help on the top level, and drilling down through a couple of levels of tables-of-contents got me to what I needed to know, with even a specific page of instructions for Consolidating Project-Related Files, which I pretty well just copied and now I’m all set up with my machines sharing back and forth.

Also, the Task Overview Page was very good.

plus-plus

NFS · Now, I’m way out of date on how setting up shares works on Linux these days, so I don’t know if Solaris is any better but Solaris is pretty damn slick. The thing I liked best was that all the instructions were for for doing things permanently; not “Here’s how you export a filesystem” but “Here’s how you set up your exports so they’ll take effect now and be there forever.” Because my #1 problem on Linux is always that I set something up and get it working, and forget to twiddle the config files right so disaster ensues after the next boot which, Linux being Linux, may be months later when I’ve totally forgotten what it was I did.

minus-minus

%, Dammit! · I haven’t rebuilt my Emacs environment yet over on Solaris so I’m editing with Vi. For years now, when I edit with Vi, I hit ^Z to background the editor, chat at the shell a little bit, then hit % to get the editor back. Solaris’ shell moans something about
fg: %: no such job
so I have to type %1.

I thought it might be that I wasn’t using bash, so I fired it up but it had the same behavior. OK, so it’s a little gripe, but it’s one that hits me every couple of minutes.

Hey........ wait! Solaris 10 is Open-Source. I can do more than complain, I can fix (potentially at least) fix it! Good lord, how many decades since I last looked at shell source code?


author · Dad
colophon · rights

February 27, 2005
· Technology (90 fragments)
· · Linux (6 more)
· · Solaris (27 more)

By .

The opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.

I’m on Mastodon!