Thursday Apr 05, 2012

Setting up port forwarding for 7000 appliance VM in VirtualBox

I've been using the 7000 appliance VM for a lot of testing lately and relied on others to set up the networking for the VM for me, but finally, I decided to take the dive and do it myself.  After some experimenting, I came up with a very brief number of steps to do this all using the VirtualBox CLI instead of the GUI.

First download the VM image and unpack it somewhere.  I put it in /var/tmp. Then, set your VBOX_USER_HOME to some place with lots of disk space and import the VM:

export VBOX_USER_HOME=/var/tmp/MyVirtualBox
VBoxManage import /var/tmp/simulator/vbox-2011.\ ZFS\ Storage\ 7000.ovf

(go get a cup of tea...)

Then, set up port forwarding of the VM appliance BUI and shell:

First set up port as NAT:
VBoxManage modifyvm Sun_ZFS_Storage_7000 --nic1 nat

Then set up rules for port forwarding (pick some unused port numbers):
VBoxManage modifyvm Sun_ZFS_Storage_7000 --natpf1 "guestssh,tcp,,4622,,22"
VBoxManage modifyvm Sun_ZFS_Storage_7000 --natpf1 "guestbui,tcp,,46215,,215"

Verify the settings using:
VBoxManage showvminfo Sun_ZFS_Storage_7000 | grep -i nic

Start the appliance:
$ VBoxHeadless --startvm Sun_ZFS_Storage_7000 &

Connect to it using your favorite RDP client.  I use a Sun Ray, so I use the Sun Ray Windows Connector client:
$ /opt/SUNWuttsc/bin/uttsc -g 800x600 -P <portnumber> <your-hostname> &

The portnumber is displayed in the output of the --startvm command.(This did not work after I updated to VirtualBox 4.1.12, so maybe at this point, you need to use the VirtualBox GUI.)

It takes a while to first bring up the VM, so please be patient. The longest time is in loading the smf service descriptions, but fortunately, that only needs to be done the first time the VM boots.  There is also a delay in just booting the appliance, so give it some time.

Be sure to set the NIC rule on only one port and not all ports otherwise there will be a conflict in ports and it won't work.

After going through the initial configuration screen, you can connect to it using ssh or your browser:

ssh -p 45022 root@<your-host-name>


BTW, for the initial configuration, I only had to set the hostname and password.  The rest of the defaults were set by VirtualBox and seemed to work fine.

Sunday Nov 20, 2011

How to trace a function array argument in DTrace

I still use dtrace just about every day in my job and found that I had to print an argument to a function which was an array of strings.  The array was variable length up to about 10 items.  I'm not sure if the is the right way to do it, but it seems to work and is not too painful if the array size is small.

Here's an example.  Suppose in your application, you have the following function, where n is number of item in the array s.

void arraytest(int n, char **s)
    /* Loop thru s[0] to s[n-1] */

How do you use DTrace to print out the values of s[i] or of s[0] to s[n-1]?  DTrace does not have if-then blocks or for loops, so you can't do something like:

    for i=0; i<arg0; i++
        trace arg1[i];

It turns out that you can use probe ordering as a kind of iterator. Probes with the same name will fire in the order that they appear in the script, so I can save the value of "n" in the first probe and then use it as part of the predicate of the next probe to determine if the other probe should fire or not.  So the first probe for tracing the arraytest function is:

    self->n = arg0;

Then, if I want to print out the first few items of the array, I first check the value of n.  If it's greater than the index that I want to print out, then I can print that index.  For example, if I want to print out the 3rd element of the array, I would do something like:

/self->n > 2/
    printf("%s",stringof(arg1 + 2 * sizeof(pointer)));

Actually, that doesn't quite work because arg1 is a pointer to an array of pointers and needs to be copied twice from the user process space to the kernel space (which is where dtrace is). Also, the sizeof(char *) is 8, but for some reason, I have to use 4 which is the sizeof(uint32_t). (I still don't know how that works.)  So, the script that prints the 3rd element of the array should look like:

    /* first, save the size of the array so that we don't get     
       invalid address errors when indexing arg1+n. */
    self->n = arg0;
/self->n > 2/
    /* print the 3rd element (index = 2) of the second arg. */
    i = 2;
    size = 4;
    self->a_t = copyin(arg1+size*i,size);
    printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));

If your array is large, then it's quite painful since you have to write one probe for every array index.  For example, here's the full script for printing the first 5 elements of the array:

#!/usr/sbin/dtrace -s
        /* first, save the size of the array so that we don't get
           invalid address errors when indexing arg1+n. */
        self->n = arg0;
/self->n > 0/
        i = 0;
        size = sizeof(uint32_t);
        self->a_t = copyin(arg1+size*i,size);
        printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));
/self->n > 1/
        i = 1;
        size = sizeof(uint32_t);
        self->a_t = copyin(arg1+size*i,size);
        printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));
/self->n > 2/
        i = 2;
        size = sizeof(uint32_t);
        self->a_t = copyin(arg1+size*i,size);
        printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));
/self->n > 3/
        i = 3;
        size = sizeof(uint32_t);
        self->a_t = copyin(arg1+size*i,size);
        printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));
/self->n > 4/
        i = 4;
        size = sizeof(uint32_t);
        self->a_t = copyin(arg1+size*i,size);
        printf("%s: a[%d]=%s",probefunc,i,copyinstr(*(uint32_t *)self->a_t));

If the array is large, then your script will also have to be very long to print out all values of the array.

Friday Mar 11, 2011

DTrace script for who exec'd a process

I was wondering what process was executing logadm on a test system so I wrote a simple dtrace one-liner:

dtrace -q -n 'proc:::exec { self->parent = execname;}' -n 'syscall::exec*:return /execname == "logadm"/ { printf("%Y %s execs %s\\n",walltimestamp,self->parent,curpsinfo->pr_psargs); }'

 Here is sample output:

2011 Mar 11 17:35:00 sh execs /usr/sbin/logadm

In this case, it turned out to be cron, but I also found the script useful to check if and when a process was called in other cases.  Actually, this example was not too useful, but I didn't want to show the actual bug that I was working on.  However, I ended up using that DTrace one-liner many times this week.

Tuesday Jul 29, 2008

LiveUSB creator for fedora

I needed to install Linux to reproduce a bug remotely displaying apps from Linux to Solaris and found a very easy to use Windows executable to create a Fedora Live USB. You can get it from:

The application lets you choose from a couple of different Fedora releases to download and it downloads and creates the USB all in one step.  If the USB create fails for some reason, it doesn't have to download the image again and it lets you continue on after correcting the error.  In my case, my flash drive was not FAT formatted, so after correcting that and refreshing the target device in their GUI, I continued with the USB creation.  The liveUSB booted fine on my Acer 3400.  Now, why can't creating an OpenSolaris liveUSB be that easy?

Sunday Jul 20, 2008

Ukulele Underground!

About a year ago, I posted some ukulele links.  Well, that list of links has turned into just one link:


I'm a sustaining engineer and not particularly good at marketing, but this website has everything you ever need for learning to play the ukulele or just enjoying ukulele music.  There's tutorials on the front page, you can buy a CD of original ukulele music,  and the best part are the pointers in the forum to all the cool ukulele videos on youtube and to some really interesting discussions. See if you can find which user is me...

The folks who created the website are on tour in California this week.  They spent three days in San Francisco, CA playing at Mike DeSilva's in Berkeley on Friday night and then at the Hukilau in SF on Sunday night.  I also got to jam with them until the wee hours of the morning on Saturday night.  They will be playing in San Diego, California on July 21, 22, and 23. (See the website for the exact place and times.)

If you like the ukulele, you'll love even more!

If there are any ukulele players at Sun, please contact me and we can get together to jam sometime!

Wednesday Jul 16, 2008

OpenSolaris on an iPod Touch (via VNC)

Not sure if this would actually be usable, but here it is:

OpenSolaris 2008.05 on an iPod Touch via VNC.

This is using an iPod Touch that I bought a few months ago running the 2.0 Update and running a free VNC app from the App Store.  OpenSolaris 2008.05 in running on a Sun Ultra 20.  I had to enable XDMCP in gdm by editing the file /etc/X11/gdm/custom.conf and changing the xdmcp section to read:


Hm... This looks just like OpenSolaris.  "How do I know that you're running on an iTouch?", one might ask.  The only difference is those three buttons on the bottom of the image.  The keyboard button brings up keyboard input:

The "+" button brings up a menu of options and the "hand" button switches between using our finger as the pointer within VNC and using it as the pointer on the Touch. (i.e. to resize the screen and scroll).

Trust me.  I really do have my iTouch running a VNC app and displaying OpenSolaris 2008.05.  It really works! 

Wednesday Jul 02, 2008

simple DTrace script to print function argument

Someone asked me for a DTrace script to print out the argument to an arbitrary function. I'm not exactly sure if this is what he meant, so I wrote a script which lets you specify a function name and the position of the string argument that you want printed out and then the command to run.  Since it's a script, you can modify to print out integer args or to connect to a running process, etc...

The script is called printarg.d.  You have to run it either as root or with sufficient privileges in /etc/user_attr.  For example, this entry allows me to run dtrace scripts:


Anyway, here's an example:

$ printarg.d XLoadQueryFont 1 -c dtcalc
XLoadQueryFont: arg1=-dt-interface user-medium-r-normal-m\*-\*-\*-\*-\*-\*-\*-\*-\*
XLoadQueryFont: arg1=-dt-interface system-medium-r-normal-m sans-17-170-72-72-p-97-iso8859-1
XLoadQueryFont: arg1=-dt-interface user-medium-r-normal-m sans-14-140-72-72-m-90-iso8859-1

Here's another example:

$ printarg.d fopen 0 -c dtcalc
fopen: arg0=/home/uejio/.Xauthority
fopen: arg0=/usr/openwin/lib/locale/locale.alias
fopen: arg0=/usr/openwin/lib/locale/locale.dir
fopen: arg0=/usr/openwin/lib/locale/locale.alias
fopen: arg0=/usr/openwin/lib/locale/locale.alias
fopen: arg0=/usr/openwin/lib/locale/locale.dir
fopen: arg0=/usr/openwin/lib/X11/Xcms.txt
fopen: arg0=/home/uejio/.icons/blueprint-cursor-theme/cursors/arrow
fopen: arg0=/home/uejio/.icons/blueprint-cursor-theme/index.theme
fopen: arg0=/usr/share/icons/blueprint-cursor-theme/cursors/arrow
fopen: arg0=/usr/share/icons/blueprint-cursor-theme/index.theme
fopen: arg0=/usr/share/pixmaps/blueprint-cursor-theme/cursors/arrow
fopen: arg0=/usr/share/pixmaps/blueprint-cursor-theme/index.theme
fopen: arg0=/home/uejio/.icons/default/cursors/arrow
fopen: arg0=/home/uejio/.icons/default/index.theme
fopen: arg0=/usr/share/icons/default/cursors/arrow
fopen: arg0=/usr/share/icons/default/index.theme
fopen: arg0=/usr/share/pixmaps/default/cursors/arrow
fopen: arg0=/usr/share/pixmaps/default/index.theme
fopen: arg0=/usr/dt/appconfig/icons/C/
fopen: arg0=/usr/dt/appconfig/icons/C/

Well, I thought this was pretty cool and so easy to do in DTrace, but your mileage may vary. ;-)

If anyone knows of a simpler way to calculate the args to pass in, please let me know.

Thursday Jun 05, 2008

Difference between deadbeef and baddcafe

No, this is not a posting about food poisoning at a restaurant.

It's about my experience with libumem.  libumem is a very useful and fast preload library for detecting memory corruption and memory leaks. I was working on a bug where the Xserver crashes, but only under libumem. The stack trace showed that a particular function was being called with the first argument equal to "deadbeef".  Something like:

(dbx) where
=>[1] SizeDeviceInfo(0xdeadbeef, 0xffbfed44, 0xffbfed40, 0x1f, 0x58, 0x52d1c8), at 0xff0ee260
  [2] ProcXListInputDevices(0xda1188, 0x1, 0xffbfed44, 0xdeadbeef, 0xff102000, 0xffbfed40), at 0xff0ee0f8

Well, actually it is 0xdeadbeef.  This is a special constant that libumem uses.  I thought it was for an uninitialized variable and kept looking for that in the code, but I couldn't find it. But, after reading the manpage for umem_debug(3MALLOC) it turns out that the constant for uninitialized variables is "baddcafe". "deadbeef" is used to show that a chunk of memory has been freed. So, basically I was trying to access freed memory.  So, it was just a matter of stepping thru the code and looking to see where the memory got freed.

It turns out that the bug was that a data structure was being freed and then a field of that structure was being accessed.  Something like:

newdev = dev->next;

So, I just fixed it to do:

newdev = dev->next;

(The code was a bit more complicated than that...)

D'oh!  Fortunately, not much was happening in the "..." so the code only crashes under libumem or other memory checkers.  But, if more code was added in that section, there could be some strange behavior that would be really hard to track down.

Here's a link to someone else's experience with libumem and accessing freed memory.  I should really blog more about using mdb and libumem one of these days...

Saturday May 03, 2008

Another acronym for JAVA

I went to DC a couple of weeks ago and at the Cherry Blossom Festival, I saw sign that said "JAVA", but it wasn't from Sun:


Their website is at  From their about page: "This is an umbrella website representing a number of Japanese American Veterans' organizations throughout the United States."  It looks like some sites are still under construction, but have a look anyway.

Wednesday Dec 05, 2007

Favorite Podcasts for December 2007

I was talking to some coworkers at lunch the other day about my favorite podcasts, so here's an updated list for December 2007 (I still use iTunes to subscribe to them, but I put links for more information):

Daily Giz Wiz - Dick DeBartolo and Leo Laporte review gadgets Monday thru Friday

Car Talk's Call of the Week

WNYC's Radio Lab - sometimes contains material not suitable for young children

NPR Shuffle - an  assortment of news from NPR (National Public Radio)

NPR Technology

NPR Health and Science

Wait Wait... Don't Tell Me! - NPR quiz show

This American Life

net@nite - Web 2.0 stuff with Leo Laporte and Amber MacArthur. I really like that they put all the links that they discuss on their website.

Jumping Monkeys - A parenting podcast with Leo Laporte and Megan Morrone

While compiling the links above, I noticed that NPR has a huge assortment of podcasts which I really need to explore.

Corrupted BIOS on laptop

As a computer geek, I often get calls from friends or relatives for help with their PC issues. I'm no PC expert, but knowing about Solaris and Sun hardware seems to transfer well to other computer systems and especially how to search the Internet goes a long way.

This evening, my nephew who goes to UCB  (you know who you are...), called with a "simple" computer problem.  His Compaq Presario laptop shutoff several times because it was out of power and now it doesn't boot.  It just hangs at the Windows logo.  So, the first thing we tried is to boot in Safe Mode.  Well, that also didn't work.  Infact, all the Safe Mode options hung.  Next, is try the Window XP CD.  That also hung.

A quick search of the internet yielded several suggestions and one site said to take the battery out and boot with only the AC adapter plugged in.  That worked!  I guess his laptop BIOS got corrupted somehow and removing the battery allows it to get reset.

Well, that was easy.

Wednesday Nov 14, 2007

DTrace Tutorial for X Window Programmers

Here's some notes on a DTrace presentation I gave to our desktop sustaining group. It's geared towards application debugging esp. for X Window System programmers and not for kernel debugging.

DTrace is usually thought of as a tool for kernel debugging. However, I have found it very useful for user level debugging, too. It's especially useful when first debugging an issue that you don't know where to begin and for issues involving applications that are already running.

I usually use DTrace for debugging the call stack.  That is, trying to figure out what functions are being called, by whom, and with what arguments.  DTrace also lets you look at return values. I've also used DTrace for performance issues such as determining how many times a function is called and how long that took.

Useful One-liners:

Here are some one-liners for client debugging.  There are a number of useful ones from Brendan Gregg's website at:

Here's one which prints out new processes:

dtrace -qn 'syscall::exec\*:return { printf("%Y %s\\n",walltimestamp,curpsinfo->pr_psargs); }'

If I run gnome-terminal, I see the following output:

2007 Nov 14 16:56:17 gnome-terminal
2007 Nov 14 16:56:18 gnome-pty-helper
2007 Nov 14 16:56:18 pt_chmod 4
2007 Nov 14 16:56:18 /usr/lib/utmp_update testuser /5 pts/5 19917 7 0 0 1195088178 373248 0 000000000
2007 Nov 14 16:56:18 bash

Here's one for looking at files opened by processes:

dtrace -n 'syscall::open\*:entry { printf("%s %s",execname,copyinstr(arg0)); }'

If I run gnome-terminal again, I get a lot of output:

  0  43837      open64:entry gnome-terminal /usr/share/themes/blueprint/gtk-2.0/vertStepDwnButton.png
  0  43837      open64:entry gnome-terminal /usr/share/themes/blueprint/gtk-2.0/menuBorderButton.png
  0  43453      open:entry nscd /etc/user_attr
  0  43453      open:entry utmpd /proc/19924/psinfo
  0  43453      open:entry gconfd-2 /export/home/testuser/.gconf/apps/panel/profiles/default/applets/...
  0  43453      open:entry gconfd-2 /export/home/testuser/.gconfd/saved_state.tmp

Try doing this with dbx or truss or any other tool, especially the first example!

Some things to notice about these one-liners:

The -q option means "quiet".  The -n means that the next argument is a probe name.  In these examples, we're looking at system calls so we use the syscall provider and then specify which function call and that we're looking at the entry to a function.  This probe fires at the entry to the function.

The arguments to the function are accessible via the variables arg0, arg1, arg2, etc.  So, in the open example, we're printing the first argument to the function open which is the pathname.  For strings variables, you need to use the copyinstr() function to print the contents of the string.  For integers you don't have to do any special conversion.

However, I found that it's not usually system calls that I want to look at, but rather user library calls.  Unfortunately, you can't just do something like:

# dtrace -n 'syscall::XOpenDisplay:entry'

You will get the error:

dtrace: invalid probe specifier syscall::XOpenDisplay:entry: probe
description syscall::XOpenDisplay:entry does not match any probes

DTrace only knows about system calls, but you can use the pid provider to look at all the calls in a particular process.  For example "dtrace -l" will list out the probes. You can limit that also with -n.  Let's look at the probes for metacity for an Xlib call XMoveWindow:

dtrace -l -n "pid`pgrep metacity`::XMove\*:"
   ID   PROVIDER            MODULE                          FUNCTION NAME
44083   pid19834                       XMoveWindow return
44084   pid19834                       XMoveWindow entry
44085   pid19834                       XMoveWindow 0
44086   pid19834                       XMoveWindow 1

Lots of output.  There are probes for both entry and return points and also arbitrary instructions.  You could trace the execution of instructions within a function as well.  However, I find dbx is probably a much easier tool to use for doing that.

In my examples, I'm only going to mention entry and return points.

So, now, let's take a look at a simple DTrace script, libX11.d. This script  just traces all calls to libX11:

# ./libX11.d `pgrep gnome-terminal`
dtrace: script './libX11.d' matched 1629 probes
CPU     ID                    FUNCTION:NAME
  0  44400                   XPending:entry
  0  44401             _XEventsQueued:entry
  0  44326                    _XFlush:entry
  0  44309                 _XFlushInt:entry
  0  44402     _X11TransBytesReadable:entry
  0  44403 _X11TransSocketBytesReadable:entry

Wow, lots of calls to XPending() and other functions.  We probably don't want to debug those, so before we remove them, we can format the output nicer by adding to the libX11.d script:

#pragma D option flowindent

Now we can see that XPending is calling these functions and that's probably not a very interesting function to look at, so, we can get rid of them by setting a flag in the entry probe to XPending(). Then in the return probe of XPending unset the flag.  When the flag is set, don't print out the function calls and when it is not set, then print out calls.

However, I'm also going to remove the flowindent because the indenting is sometimes annoying.  Also, I'm going to add a "quiet" option which will cause DTrace to not print out every probe that fires. So, I need to add my own printfs.  This results in, libX11_pending.d:

# ./libX11_pending.d `pgrep gnome-terminal`
XNextEvent called
_XDeq called
XFilterEvent called
XNextEvent called
_XDeq called
XChangeGC called
_XUpdateGCCache called
XChangeGC called
XChangeGC called
XSetClipRectangles called
_XSetClipRectangles called
XSetTSOrigin called
XFillRectangle called

So, we see lots and lots of libX11 functions being called.  Well, this also is too much information and probably not useful.  Suppose, we wanted to instead limit the calls to a specific type of call.  So, let's look at the next example.  libX11_grab.d.  This example prints out all the calls to any Xlib grab functions.  It also prints out the stack trace of the user process (gnome-terminal in this case) whenever the grab or ungrab function is called.  Printing out stack traces for grabs can be a problem when running in dbx since you probably can't type in the dbx window if client has a keyboard or pointer grab. So, DTrace is definitely the better tool here. In this example, I press the mouse button on the Edit menu item and get a popdown menu.

# ./libX11_grab.d `pgrep gnome-terminal`
XGrabPointer called

XGrabKeyboard called


More Complex Examples:

Now let's look at a complex example involving two processes.  Suppose, we want to know what happens in one processs when another process calls some function. The script trace2processes.d takes 3 arguments--the process id of the two processes and the function to key off of.  For example, if I want to know what the Xserver is doing when metacity calls XMoveWindow(), I would execute:

# ./trace2processes.d `pgrep Xnest` `pgrep metacity` XMoveWindow
metacity: XMoveWindow: enters
metacity: XMoveWindow: returns
Xnest: xnestGetImage: return = 1
Xnest: WriteToClient: entering
Xnest: WriteToClient: return = 2400
Xnest: DoGetImage: return = 0
Xnest: ProcGetImage: return = 0
Xnest: FlushAllOutput: entering

In my example, I am using the Xnest server since I was demo'ing this via a VNC session to engineers in Ireland and India and had Xnest running in VNC.

Here's another example, xscope in DTrace:


This shows how to use some of the Xserver probes to implement a simple DTrace version of the X debugging tool called xscope. Xscope is a tool for viewing the X protocol between client and server.

It's a pretty complex example.

First, I need to run DTrace with -C option so that it uses the preprocessor to parse the #include lines.  Then, I need include X11 header files.  However, I can't include X11/Xlib.h because there is a structure which conflicts with DTrace  So, not all Xlib structures can be used in DTrace. Unfortunately, the most important structure that you can't access is the Display structure. The xscope.d script shows an example of how to cast structures in DTrace such as casting the xEvent structure to show the component fields of an XEvent. The output of xscope is detailed in an earlier blog here.

Handy DTrace scripts from the DTrace Toolkit at:

I've used:

execsnoop - Traces execs of all processes.

dtruss - Truss written in DTrace  Runs much faster than truss so it can be very useful when truss is too slow.


memleak.d - from  Lists memory leaks using DTrace.  Much faster than libumem and good when dbx access checking fails.

But, mostly, I modify one-liners from:

Sorry, I don't know of any way to detect memory corruption using DTrace.  

Tuesday Nov 06, 2007

xscope in dtrace ver. 0.1

I've been playing with dtrace a lot lately to help debug issues with the Xserver and some X clients. Since Alan added the dtrace probes for the Xserver in Solaris 10, I've been meaning to rewrite xscope using dtrace. It's probably a much bigger job than I have the spare time for, but I did start working on a simply version called xscope.d.  This is version 0.1 and just prints a simple one line output for each X request and event and is based on Alan's sample scripts.

Here is some example output when xlogo is started:

request-start: from client=21 (), request = X_CreateWindow
request-done: from client=21 (), request = X_ChangeWindowAttributes, resultCode = 0
request-start: from client=21 (), request = X_ChangeWindowAttributes
client-auth: client=21, from local pid=7209 (/usr/openwin/bin/xlogo)
request-done: from client=21 (/usr/openwin/bin/xlogo), request = X_ChangeWindowAttributes, resultCode = 0

This shows that the xlogo probably calls XCreateWindow() then XChangeWindowAttributes().  One odd thing about this output is that the client-auth probe which should fire when the client first connects to the Xserver seems to be called after the client makes a X_CreateWindow request. I can't figure out if that's a bug in dtrace or the Xserver probes.

I also added an example in xscope.d which gives more detail for the PropertyNotify event, so for this example, I see:

send-event: to client = 21 (/usr/openwin/bin/xlogo), event type =  PropertyNotify (28)
PropertyNotify: window=0xa80001, atom=0x27, state=0, time=381056109

What that means is that xlogo is probably changing the atom 0x27.  What atom is that?  I can use xlsatoms to list all the atoms (using the -f "%x %s" option to display in hex) and find that 0x27 is WM_NAME.  So, this event corresponds to xlogo setting the name of the window. This is not particularly useful for this case, however, I have been working on a bug with focus events and modified this script to print out details for the FocusIn and FocusOut events.  My xscope.d script has been very useful for understanding what's happening with that bug.

Monday Nov 05, 2007

Experience with OpenSolaris Developer Preview Live USB

Last year,  I tried running Belenix OpenSolaris Live USB and have been wondering how to run Solaris from a live USB.  I just haven't had time to play with it, but with the recent announcement of the OpenSolaris Developer Preview, I thought I'd give it a try again.  Thanks, to Alan for providing me with various links on how to get the USB flash image (see here for one way), I was on my way. 

I got an internal copy of a flash image and downloaded it to my Acer 3400 laptop running Solaris 10.  I first tried the script from Belenix, but my flash image was not an ISO image.  Fortunately, a fellow blogger posted instructions on using a command called usbcopy.  Unfortunately, I didn't have usbcopy on my Solaris 10 machine.  So, the instructions said to use mercurial. But, I didn't have that either...

Fortunately, I could download mercurial from blastwave and after an hour or so of fiddling and downloading dependent packages (mostly due to the fact that I had run out of disk space in "/") I was able to run usbcopy. 

Finally, I ran it and got:

Found the following USB devices:
Enter the number of your choice:

There were no devices listed!  D'oh!

I took a look at the usbcopy command and it was parsing the output of rmformat. I ran that command by hand and it showed my Kingston 1.0 Gb USB stick:

     3. Logical Node: /dev/rdsk/c4t0d0p0
        Physical Node: /pci@0,0/pci1025,57@10,3/storage@3/disk@0,0
        Connected Device: Kingston DataTraveler 2.0 PMAP
        Device Type: Removable

But the size and bus type were missing.  Hm...  Now what?  Well, I looked closely at the usbcopy script and found that it was just getting the logical device name and then running fdisk and format on the drive.  Then, it copied the contents using dd and finally added the boot sectors with installgrub.  So, I did all that by hand (I had to disable volume management first):

# svcadm disable volfs
# fdisk -B /dev/rdsk/c4t0d0p0
# format -e /dev/rdsk/c4t0d0p0

I partitioned the drive as a single root partition using the entire disk from starting cylinder 1.  This is what the usbcopy script was doing, so I just copied that.

Then, I ran the dd command and about 20 minutes later it was done.  I forgot to save the output of the command, but for future use, the output device was /dev/rdsk/c4t0d0s0.  Then I ran the installgrub as in the usbcopy script.  And I was done, but "will it blend?"

Amazingly, "YES!".  I was so happy that I even attempted to explain this to my wife whose eyes  began to glaze over and she immediately changed the subject... Ok.  So, maybe my son is right.  I am a nerd (or at least a geek).

BTW, to boot off the USB drive on an Acer 3400, you have to insert the drive before powering on the computer.  Then, press the F2 key for the setup screen and select the hard drive as the boot disk. The hard drive will contain two entries: one for the hard drive and one for the flash drive.  Move the flash drive above the hard drive using the F5 or F6 key.  Then save and boot up. 

Also, don't forget to read the release notes to get the default user and root passwords... 

So, OpenSolaris booted up fine from the Live USB drive and I was surprised at how usable the performance was even running from a USB drive.  It connected automatically to my router (hardwired) and I was able to get to my work email using Thunderbird.  Firefox works great.  Infact, I'm typing this blog from it.  Although, I noticed that the fan on my laptop keeps running.  I guess there's still some issues with power, but this is a developer preview after all.  I don't want to upgrade my Solaris 10 image to it just yet, but maybe soon!

Now to take this USB stick to some other laptops and see how it runs there...


Sunday May 13, 2007

Ukulele Links

My manager Manuel recently got me interested in playing the Ukulele again.  Growing up in Hawaii, I learned to play the Ukulele in Elementary school.  Then, many years later, I bought my own Ukulele for $35 (el-cheapo model shown at left) and even played and sang to my kids when they were young enough not to know better... I sure miss my sister's Kamaka that I used in my childhood.

I found a couple of really nice links for beginners (and maybe experienced players as well):

Ukulele Boogaloo - includes the Beatles "I'll Follow the Sun".  Easy and sounds cool too.

Ukulele Strummers Songbook - includes "Somewhere over the Rainbow" by Braddah Iz.




« April 2014