View Source

After [starting and connecting to Solaris|NetworkSettings], you can minimize the VMWare windows (containing the Solaris desktop) and interact with your guest OS through Mac windows. The easiest way to get a Terminal window is to select Spotlight and type "Terminal"; select the application at the top of the hit list. (To keep it in your Dock for quick reuse later, hold down the mouse button on the Terminal icon in the dock until the dock menu pops up, and select "Keep in Dock".)

In a Terminal window, first double check that you can ssh to your guest:
{noformat}
macosx$ ssh -l joeuser solaris-devx.local uname -a
Password:
SunOS solaris-devx 5.11 snv_55b i86pc i386 i86pc
{noformat}

Notes:
* The "-l joeuser" is optional if (as recommended) you have harmonized your Mac and Solaris user IDs.
* The "uname -a" command is arbitrary, just enough to verify a connection. Omit the command to get a real login session.
* If you have configured a public key passphrase, the ssh login interaction will be a bit different.
* The latest Mac OS, Leopard, can manage ssh passphrases for you on your keychain.
* On any Mac OS, you can make a keychain entry manually, and consult it manually. This is handy because the dialog box has a nice mode for choosing random passwords for you. (I assume the entropy source is good enough; who knows?)
* Another reason it's handy to use the keychain is that it keeps your passwords together. (But your master password must be strong enough to protect the most sensitive of your data.)

The best way on Solaris to escape the limitations of a login session is to use the Gnu "screen" program. ([Check here|UsingEmacs#Stablescreensessions] for information on downloading "screen".) Once a screen session has been started, you can rejoin it at any time, from any Terminal window, as long as you do not reboot Solaris.

{noformat}
macosx$ ssh solaris-devx.local
Password:
Last login: Tue Oct 2 22:21:09 2007 from macosx
Sun Microsystems Inc. SunOS 5.11 snv_55 October 2007
Warning: $TERM xterm-color: Unknown terminal type
solaris-devx$ echo >> .screenrc 'escape ^o^o' #[recommended for emacs users]
solaris-devx$ TERM=xterm screen -xRR
New screen... #[followed by a clear page]
#[at this point, type Control-O followed by a question mark '?' for command help]
{noformat}

You now have a shell session which will last as long as Solaris does. This can be months, if you use the VMWare "snapshot" feature.

The next step is to start your Solaris environment. Here's Emacs:

{noformat}
solaris-devx$ DISPLAY='' TERM=vt100 xemacs -nw
#[emacs starts up, lands you in the *scratch* buffer]
emacs-version #[type preceding, then type Control-J]
"21.4 (patch 12) \"Portable Code\" XEmacs Lucid" #[or equivalent]
#[type Escape-X "shell" Return]
emacsshell$ ps
PID TTY TIME CMD
2441 pts/10 0:00 bash
2444 pts/10 0:00 ps
emacsshell$
{noformat}

It is easy to get Emacs to launch another screen, if you like:
{noformat}
emacsshell$ screen dbx foobar
#[up pops a fresh screen running dbx or whatever]
#[type Control-O Control-N to cycle back to the original screen]
{noformat}

Or, just use multiple Emacs shell buffers. For example, here is how to create shell buffers named "/Workspace" and "/Build". (The leading slash is just a convention to help distinguish them from file buffers.)
{noformat}
#[type Escape-X "shell" Return]
emacsshell$
#[type Escape-X "rename-buffer" Return "/Workspace" Return]
#[type Escape-X "shell" Return]
emacsshell$
#[type Escape-X "rename-buffer" Return "/Build" Return]
{noformat}

Even if you use "screen", your Solaris session will end when you log out or reboot your Mac, since that halts VMWare. To extend the lifetime of your Solaris session, use VMWare "snapshots". Do this:
* Start an ssh session on Solaris. (See above for prerequisites and details.)
* Once in Solaris, start (or restart) a screen session.
* Start whatever other tools you want. (XEmacs with the gnuserver is recommended.)
* Close your Terminal window. This breaks your ssh session but not your screen session.
* (To double-check, open another Terminal window, do ssh, do "screen -xRR", and verify that your Solaris environment is still alive inside of screen.)
* Pull up the VMWare window, which (hopefully) has been invisible for some time.
* Select Virtual Machine => Take Snapshot.
* Wait. The whole thing will be written to disk, including your Solaris environment session(s).
* Now exit VMWare. This takes down Solaris.
* Restart VMWare, launch your Solaris instance, and immediately select Virtual Machine => Revert to Snapshot.
* Repeat the previous step at any time to reset to a clean environment.

The resetting operation is very powerful. It will wipe away any state you have accumulated in your Solaris environment, except for state that is written to a disk outside of Solaris. This is why it is best to keep your home directory on the Mac file system.

_You do not want your home directory rolled back when you revert to a snapshot!_ This is why, when setting up your user, you issued this command:
{noformat}
# ln -s /net/macosx/Users/joeuser/solaris-devx-home /export/home/joeuser{noformat}

The effect of this symbolic link was to let Solaris know that your home directory is NFS mounted somewhere else. In fact, it's in a specially configured folder in your Mac user's home folder.

By the way, one advantage of keeping your home directory out of Solaris is that all of your documents (including source files you are developing with Solaris) are indexed in real time by Spotlight. (Spotlight makes a fine alternative to cscope and other source browsers.)

Before you make your (final) snapshot, you should probably warm up a nice XEmacs session, if you are an Emacs user. That way your only action in a Terminal window is:
* Get another ssh login.
* Optionally, issue "screen -xRR" to get back your tty-based Emacs.
* Re-connect to your Mac desktop (via X11) by issuing a "gnuclient" command. (This can be from any shell, inside or outside of Emacs, as long as the $DISPLAY is set properly.)

But that's a story for [another page|UsingX11].

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact