Thursday Feb 05, 2009

Meta Kiosk: How to run multiple different types of kiosk modes on a Sun Ray Server/FOG

Haven't you ever wanted to be able to have more than one type of  kiosk running from the same Sun Ray server or FOG? Now you can. JDS, UTTSC, VDA, VDA no Card, VDM, and even non-kiosk uses like X11 (using Xnest), VNC and full screen apps. (I've even thrown utswitch and xterm for convenience.)

I've "productised" a Kiosk mode that sits above other Kiosks to call on them as required - as always, based on what you tell your tokens to use, leveraging the "Other Info" field.

It's called "META KIOSK".

Monday Sep 24, 2007

CAM Mode Gotcha

There are few gotcha's here and there in Controlled Access Mode (note this is CAM under Sun Ray 3.x and 2.x, not the new Kiosk under SRSS 4 U2).  None more elusive than this one that seems to rear it's ugly head about once a year.  After I have them check "here and there" and everything is OK, it usually means that /var/adm/sulog is full.  The only problems is that I always seem to forget about sulog.  :(

Under CAM 2.x and 3.x, one of the CAM scripts has root su to one of the CAM users which then runs your CAM script.  If this log is full (50 MB limit), then the CAM Startup will bail and you'll be left with cycling Sun Rays.  And since that server won't have any sessions on it, it will always get the new sessions in a FOG since it is the least loaded.  Big headache.

If you enable debugging (the "there" link above) you'll see something like this happen right before the session gets torn down:

/opt/SUNWbb/bin/bbrootsession[191]: 8057 File Size Limit Exceeded
+ remove_lock

If you look at /opt/SUNWbb/bin/bbrootsession, you'll see that's where it's trying to do the su and that little message means that sulog is full.   

Simple fix is to assume root, rm /var/adm/sulog;touch /var/adm/sulog and things will once again be happy.

And no, I don't know the history behind sulog having that limit.  But one way or another, that's a lot of su'ing to fill that log so either your Sun Ray Servers have been up for a real long time, or your script does have a problem in it that causing it to cycle.

Finally, with Sun Ray Software 09/07 Kiosk has been totally re-written to use PAM.  The su doesn't happen anymore.



Tuesday Jun 19, 2007

A "USB Drive" daemon for Sun Ray sessions

\*\*\*\* THIS VERSION OF usbdrived IS DEPRECATED - see \*\*\*

A lot of people ask me the age-old question: how can I see thumb drives (and others) attached to my Sun Ray on JDS/CDE/Windows? (it probably works unchanged for SLES and RHEL.)

The inelegant, user-unfriendly solution that is always there for you (JDS/CDE):
Without doing any further work, the answer is quite trivial: SRSS mounts the thumb drive on a non-trivial directory (non-trivial as in "not in your home directory") - namely at:


(mounted disk names and #s appear here)

You can then access this via the file manager - for example, in JDS, (right-click) Launch -> Browse Documents (Nautilus) and point to this directory. Better yet - bookmark this directory under Nautilus as soon as you can!

However, the above is typically unacceptable for customer deployments, and until the time Solaris/JDS can handle this automatically, I've scripted a couple of workarounds. See next section.

The elegant solution: "USB Daemon (usbdrived)"
The following instructions will automate USB drive "show-up" so that when you insert a thumbdrive into your Sun Ray:
1) a file manager window (Nautilus) will automatically open up showing the top-level directory of the USB drive, and
2) a link is created on your desktop, called "USB Drive" (I just couldn't come up with a better name...)

Once you pull the drive out, the above disappear, so it's important to make sure that any copying process is done before pulling it out. (actually, the file manager window disappears only if its on the root level of your USB drive. If anyone can tell me how to close any Nautilus window that's open on sub-directories, please let me know!)

The instructions here also integrate the script with utaction so that disconnected users don't chew up unnecessary Sun Ray server resources.

HOW TO (Basic instructions for JDS):
These instructions assume that you'll install this for your user account. Extrapolate for server-wide deployment as required...

1) If you don't have one, create a bin directory in your home directory
- run this: mkdir $HOME/bin

2) copy usbdrived to your newly created "bin" and give it exec permissions
- run this: chmod +x $HOME/bin/usbdrived


3) If you're running version 1.23 or better of utdiskadm, skip to step 6. To find out, this command will tell you the version number
- run this: head /opt/SUNWut/bin/utdiskadm | grep ident | awk '{ print $4 }'

4) If you're on version 1.22 or lower of utdiskadm you need to patch an 'alternate' version that includes a little fix: copy the standard utdiskadm to your bin directory (call it utdiskadm.fix) and change one line (because, under certain circusmtances, logname returns nothing...) - the script will probe for an up-to-date utdiskadm and ignore yours when the system has been patched as required!
- run this: cp /opt/SUNWut/bin/utdiskadm $HOME/bin/utdiskadm.fix
                vi $HOME/bin/utdiskadm.fix
                find the line UTUSERNAME="`logname`"
                change to UTUSERNAME=$USER
                :wq (save the file ;)

5) If you are \*not\* placing the updated utdiskadm.fix file in your bin directory, update your "usbdrived" script to reflect the location of utdiskadm.fix.

6) add a line to your .profile (bash/ksh/sh) or .login (csh) in your home directory that will enable the daemon on card insertion (change the path accordingly if the script is not in your bin directory)
- run this: echo '/opt/SUNWut/bin/utaction -c  "$HOME/bin/usbdrived start" -d  "$HOME/bin/usbdrived stop" -i &' >> $HOME/.profile   (or .login if csh)

7) Log out, log in... That's it. (or you can run the above line to test as a one-off until you log out).

If your are using CAM/CDE, make sure you edit the script and change the USEJDS variable to 0, so that:
1) Nautilus is not invoked automatically (though you can, but...)
2) The "USB Drive" link is created in the user's home dir and not the Desktop dir, which doesn't exist

You can then add a CAM menu entry to open dtfile on this, such as "Open My USB Drive". You do this anyway without usbdrived by following the earlier section, but it won't open in the exact mount, but rather in the parent folder. These instructions are particularly useful for the next section...

Under Windows
You need to run the daemon like above under either JDS or CDE (whatever it is you are using underneath) and make sure you start up uttsc with the appropriate -r option, e.g. -r disk:U="$HOME/Desktop/USB Drive" for JDS. This will let you browse the U: drive when there is something mounted, and it will allow for changing USB drives without disconnecting your Windows session, as usbdrived depends on utdiskadm to create the "USB Drive" link on demand.

Make sure that if you are using CAM with the Sun Ray Windows Connector, you make USEJDS=0 in the usbdrived script.

This only allows for one USB drived at a time to show up and be managed. That's enough for now ;) 

Thursday Feb 22, 2007

CAM Deep Dive

[Read More]

Tuesday Nov 21, 2006

Turbo CAM

As promised from my Immersion Week classes here are some ways to really help reduce the amount of work your Sun Ray Server does on bring up.  While we focused on CAM, all of these apply (except dtsession) to normal Sun Ray operations

Update:  We've found that the utprodinfo hack breaks normal sessions using NSCM (Mobile Sessions).  Do not use the utprodinfo hack for anything other than CAM.  It may also break other things that we are not yet aware of so use at your own risk.

In our case study we were trying to bring up 50 Sun Rays but were running into problems.  We started with a base line of 36 terminals coming up in about 30 minutes.  The box was so busy that certain calls in the cam script that did call backs to authd were timing out.  You could consider this the same as a cold restart or a massive shift change in a call center environment. 

Here are the magic 5 things you can do to tune CAM

(Thanks to those in Sun Ray Engineering who don't blog namely Sangeeta Varma and Ron Shipper)

What: Increase Authd worker threads from 8 to 32.

Why:  This is the target number of spare threads to maintain to handle new terminal connections.  When many sessions are starting up, we can exhaust authd fairly easily.  This can have a big effect on a Sun Ray Server that is servicing a lot of DTU's. 

How: Change the Workers = 8 to Workers = 32 in /etc/opt/SUNWut/auth.props

What: Change utprodinfo to do an echo vs. a pkginfo

NOTE:  This will break NSCM (i.e. non smart card mobile sessions).  Do not use if you are NOT running CAM for non-card sessions.

Why: While we currently only support installing Sun Ray Server Software in /opt, there are plenty of hooks to allow for future changes.  One of these is to query where the packages are installed.  This is done via pkginfo -r <package name> via a script called utprodinfo.  Consider that in order to just get to a login screen (i.e. dtgreet) eight pkginfo's are ran.  Multiply that by the number of DTU's you have, and the fact that pkginfo can be fairly taxing in itself and you have a recipe for wasted cycles.  Since we currently only support Sun Ray Server Software to be installed in /opt, we can change utprodinfo just echo out "/opt". 

How:  Make a copy of /opt/SUNWut/lib/utprodinfo

Find the line that reads:

r)     setOP "r";;

And change it to this:

#Tuning Fix - echo "/opt" and exit
r)     setOP "r" 
       echo "/opt" 

What: Use non-invasive methods for finding the Sun Ray MAC address or other information from the data store

Why:  If the Sun Ray Server is already taxed due to massive session creations, making calls to the data store that requires real time data from the session manager just worsens the situation.  A lot of folks use commands like utwho, utdesktop -Lc, utuser -lc, utdesktop -p, etc.  While these will return the desired information, if authd is too busy to service this request, it will time out.  If your CAM script relies on information from these queries, it will fail and cause your session to cycle.  This further exacerbates the problem of a taxed box.

How:  Check to see if the command you wish to use requires authd.  Open one window and truss the java process running authd.  Open another window and run your commands.  You should notice the changes to the truss.  Any command that gets current information or status information is going to make a callback to authd.  For example, utdesktop -lc will open authd, while utdesktop -l is just an ldap call.  Yes the -l will result in more information to parse through, but it does not rely on authd to readily service your request.  Most ut\* calls that call authd have a time out of 5000 ms.  utwho on the other hand does not seem to time out which could lead to CAM scripts hanging if authd is too busy.

Some folks also use these commands to figure out the MAC of the Sun Ray DTU.  Typically I've always recommended that people do a pwd on $UTDEVROOT, like so:

SRMAC=`cd $UTDEVROOT; pwd | sed 's/.\*\\(............\\)/\\1/'`

While that's a non-invasive command, it won't work if your Sun Ray is NAT'd.  Another method that will work in a NAT'd environment and is also non-invasive from a authd standport is to create a small script that queries the dispinfo files:

MYDISP=`echo $DISPLAY | awk -F: '{print $2}' | awk -F. '{print $1}'`
MYMAC=`grep TERMINAL /tmp/SUNWut/config/dispinfo/$MYDISP | awk -F. '{print $2}'`
echo $MYMAC

You can then use that script to set your variable.

What: Remove dtsession as a CAM application if not required.

Why: Not only does dtsession consume at least 30 MB of RAM per session (more for multihead), it takes cycles away from the CPU's and in most cases is not required.  If you are using CAM for full screen windows, dump dtsession.

How:  Remove dtsession from from the applications to launch selection under CAM.  Remember however that at least one application must be set to critical.  Dtsession usually fills this role, just remember to set on of your CAM applications to critical.

What: Increase the initial and max heap size for Authd

Why:  Under the 1.4 JRE, the max heap size will default to 64 MB.  Increasing this to 128 allows for more head room and will lower the number of times garbage collection occurs.  We find this setting to be a good balance between the number of times GC occurs and the amount of time GC takes.

How:  Make a copy of /opt/SUNWut/lib/utauthd and make the following changes:

Find the lines that read:


And add one more option:

JAVA_OPTS="-Xmixed -Xms128M -Xmx128M"

The end result of these changes? 

82 terminals up and logged into windows in 3 minutes from a cold restart of Sun Ray Services


Think Thin is a collection of bloggers that work with Oracle's Virtual Desktop portfolio of products.


« July 2016