<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unwinding the Stack</title>
	<atom:link href="http://thestaticvoid.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thestaticvoid.com</link>
	<description>Explorations in Computing</description>
	<lastBuildDate>Thu, 22 Jul 2010 20:25:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fun With vpnc</title>
		<link>http://thestaticvoid.com/post/2010/07/22/fun-with-vpnc/</link>
		<comments>http://thestaticvoid.com/post/2010/07/22/fun-with-vpnc/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 20:20:20 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[snoop]]></category>
		<category><![CDATA[vpnc]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=337</guid>
		<description><![CDATA[I recently got a new laptop at work and I decided to put OpenSolaris on it. This meant I had to setup vpnc in order to access the server networks and wireless here. I installed my vpnc package, copied the profile from my Ubuntu workstation, and started it up. It connected, but no packets flowed. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got a new laptop at work and I decided to put OpenSolaris on it.  This meant I had to setup vpnc in order to access the server networks and wireless here.  I installed <a href="http://thestaticvoid.com/post/2010/02/26/vpnc-for-opensolaris/">my vpnc package</a>, copied the profile from my Ubuntu workstation, and started it up.  It connected, but no packets flowed.  I didn&#8217;t have time to investigate, so I decided to work on it some more at home.</p>
<p>The strange thing is that it connected from home with the very same profile and everything worked fine.  I immediately suspected something was wrong with the routing tables, like maybe some of the routes installed by <tt>vpnc-script</tt> were conflicting with the routes necessary to talk to the VPN concentrator.  I endlessly compared the routing tables between work and home and my working Ubuntu workstation, removing routes, adding routes, and manually constructing the routing table until I was positive it could not be that.</p>
<p>Everything I pinged worked.  I could ping the concentrator.  I could ping the gateway.  I could ping the tunnel device.  I could ping the physical interface&#8212;or so I thought.</p>
<p>As I was preparing to write a message to the <a href="http://news.gmane.org/gmane.network.vpnc.devel">vpnc-devel mailing list</a> requesting help, I did some pings to post the output in the email.  I ran</p>
<pre class="terminal">
$ <kbd>ping &lt;concentrator ip&gt;</kbd>
&lt;concentrator ip&gt; is alive
</pre>
<p>which looked good, but I wanted the full ping output, so I ran</p>
<pre class="terminal">
$ <kbd>ping -s &lt;concentrator ip&gt;</kbd>
PING &lt;concentrator ip&gt;: 56 data bytes
^C
----&lt;concentrator ip&gt; PING Statistics----
4 packets transmitted, 1 packets received, 75% packet loss
round-trip (ms)  min/avg/max/stddev = 9223372036854776.000/0.000/0.000/-NaN
</pre>
<p>For some reason, only the first ping was getting through.  The rest were getting hung up somewhere.  The really strange thing was that I saw the same behavior on the local physical interface:</p>
<pre class="terminal">
$ <kbd>ifconfig bge0</kbd>
bge0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
        inet 161.253.143.151 netmask ffffff00 broadcast 161.253.143.255
$ <kbd>ping -s 161.253.143.151</kbd>
PING 161.253.143.151: 56 data bytes
^C
----161.253.143.151 PING Statistics----
5 packets transmitted, 1 packets received, 80% packet loss
round-trip (ms)  min/avg/max/stddev = 9223372036854776.000/0.000/0.000/-NaN
</pre>
<p>I have never seen a situation where you couldn&#8217;t even ping a local physical interface!  I checked and double checked that IPFilter wasn&#8217;t running.  Finally I started a packet capture of the physical interface to see what was happening to my pings:</p>
<pre class="terminal">
# <kbd>snoop -d bge0 icmp</kbd>
Using device bge0 (promiscuous mode)
161.253.143.151 -> &lt;concentrator ip&gt; ICMP Destination unreachable (Bad protocol 50)
161.253.143.151 -> &lt;concentrator ip&gt; ICMP Destination unreachable (Bad protocol 50)
161.253.143.151 -> &lt;concentrator ip&gt; ICMP Destination unreachable (Bad protocol 50)
^C
</pre>
<p>That&#8217;s when by chance I saw messages being sent to the VPN concentrator saying &#8220;bad protocol 50.&#8221;  <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml">IP protocol</a> 50 represents &#8220;ESP&#8221;, commonly used for IPsec.  Apparently Solaris eats these packets.  Haven&#8217;t figured out why.</p>
<p>I remembered seeing something in the vpnc manpage about ESP packets:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">--natt-mode &lt;natt/none/force-natt/cisco-udp&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; Which NAT-Traversal Method to use:<br />
&nbsp; &nbsp; &nbsp; o &nbsp; &nbsp;natt -- NAT-T as defined in RFC3947<br />
&nbsp; &nbsp; &nbsp; o &nbsp; &nbsp;none -- disable use of any NAT-T method<br />
&nbsp; &nbsp; &nbsp; o &nbsp; &nbsp;force-natt -- always use NAT-T encapsulation &nbsp;even<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;without presence of a NAT device (useful if the OS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;captures all ESP traffic)<br />
&nbsp; &nbsp; &nbsp; o &nbsp; &nbsp;cisco-udp -- Cisco proprietary UDP &nbsp;encapsulation,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;commonly over Port 10000</div></div>
<p>I enabled <tt>force-natt</tt> mode, which encapsulates the ESP packet in a UDP packet, normally to get past NAT, and it started working!  In retrospect, I should have been able to figure that out much easier.  First, it pretty much says it on the <a href="http://www.unix-ag.uni-kl.de/~massar/vpnc/">vpnc homepage</a>: &#8220;Solaris (7 works, 9 only with &#8211;natt-mode forced).&#8221;  I didn&#8217;t even notice that.  Second, I should have realized that I was behind a NAT at home and not at work, so they would be using a different NAT-traversal mode by default.  Oh well, it was a good diagnostic exercise, hence the post to share the experience.</p>
<p>In other vpnc related news, I&#8217;ve ported <a href="http://www.whiteboard.ne.jp/~admin2/tuntap/">Kazuyoshi&#8217;s</a> <a href="http://www.whiteboard.ne.jp/~admin2/tuntap/source/openvpn/patch.openvpn-2.1.1.tun.c">patch</a> to the <tt>open_tun</tt> and <tt>solaris_close_tun</tt> functions of OpenVPN to the <tt>tun_open</tt> and <tt>tun_close</tt> functions of vpnc.  His sets up the tunnel interface a little bit differently and adds TAP support.  It solves the random problems vpnc had with bringing up the tunnel interface such as:</p>
<pre class="terminal">
# <kbd>ifconfig tun0</kbd>
tun0: flags=10010008d0&lt;POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4,FIXEDMTU&gt; mtu 1412 index 8
        inet 128.164.xxx.yy --> 128.164.xxx.yy netmask ffffffff
        ether f:ea:1:ff:ff:ff
# <kbd>ifconfig tun0 up</kbd>
ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface
# <kbd>dmesg | grep tun0</kbd>
Jul 23 14:56:05 swan ip: [ID 728316 kern.error] tun0: DL_BIND_REQ failed: DL_OUTSTATE
</pre>
<p>The changes are in the latest vpnc package available from my <a href="http://pkg.thestaticvoid.org:10000/">package repository</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/07/22/fun-with-vpnc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Professional Photo Workflow for OpenSolaris</title>
		<link>http://thestaticvoid.com/post/2010/05/02/a-professional-photo-workflow-for-opensolaris/</link>
		<comments>http://thestaticvoid.com/post/2010/05/02/a-professional-photo-workflow-for-opensolaris/#comments</comments>
		<pubDate>Sun, 02 May 2010 05:05:17 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[argyll]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[raw]]></category>
		<category><![CDATA[ufraw]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=327</guid>
		<description><![CDATA[I am not a professional by any means, but I like to know I can get the most out of my tools if the need arises. That means shooting in RAW along side JPEG so I can take control of image processing settings or correct little mistakes such as under-exposure or incorrect white balance. RAW [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a professional by any means, but I like to know I can get the most out of my tools if the need arises.  That means shooting in RAW along side JPEG so I can take control of image processing settings or correct little mistakes such as under-exposure or incorrect white balance.  RAW files contain raw sensor data from the camera (duh) and must be processed by special programs before they can be printed or shared.  My camera came with the Canon Digital Photo Professional software which I&#8217;ve heard is pretty good.  There are other (expensive) commercial options such as <a href="http://www.adobe.com/products/photoshoplightroom/">Adobe Lightroom</a>.  Obviously none of these work in Solaris (though they might work in Wine), so I decided to explore the open-source offerings.</p>
<p>Fortunately, this is a good time in the open-source world for RAW processing.  Tools like <a href="http://ufraw.sourceforge.net/">UFRaw</a> and <a href="http://lensfun.berlios.de/">LensFun</a> are maturing rapidly and beginning to give their commercial counterparts a run for their money.  I spent the past week porting them, and the color management software, <a href="http://www.argyllcms.com/">Argyll</a>, to OpenSolaris.</p>
<h3>Argyll</h3>
<p>Argyll is a suite of color management tools for Unix and Windows.  It can be used to calibrate displays, cameras, scanners, and printers.  When all of your equipment is properly calibrated, then colors should appear the same on all devices.  So if I were to photograph a stop sign, it would appear to be the same red on my monitor as in real life.</p>
<div style="text-align: center"><a href="http://www.flickr.com/photos/mrstaticvoid/4570201472/" title="Color Calibration Tools by MrStaticVoid, on Flickr"><img src="http://farm4.static.flickr.com/3439/4570201472_a5e2bdf5ea.jpg" width="500" height="333" alt="Color Calibration Tools" /></a></div>
<p>Color calibration requires special equipment.  For your monitor, you need a colorimeter.  I already had an <a href="http://www.google.com/products/catalog?hl=en&#038;safe=off&#038;client=firefox-a&#038;hs=zt6&#038;rls=org.mozilla:en-US:official&#038;resnum=0&#038;q=x+rite+display+lt&#038;um=1&#038;ie=UTF-8&#038;cid=2978199230474206625&#038;ei=8AHdS5XYCJHU8ASOm6HKBw&#038;sa=X&#038;oi=product_catalog_result&#038;ct=result&#038;resnum=4&#038;ved=0CCsQ8wIwAw#ps-sellers">X-rite i1Display</a> to calibrate my TVs, and it works just fine with Argyll and Solaris (using libusb).  Following <a href="http://www.marcelpatek.com/argyll.html">these instructions</a> I was able to calibrate my monitors in a few minutes.  It was so easy I did my work monitors and laptop too!</p>
<p>Camera calibration was just as easy following <a href="http://blog.pcode.nl/2008/11/15/color-profiling-your-own-dslr-redux/">Pascal de Bruijn&#8217;s instructions</a>.  I picked up a very affordable IT8.7 target from <a href="http://www.targets.coloraid.de/">Wolf Faust</a>.  It arrived from Germany in about a week.</p>
<p>Argyll can be installed from my <a href="http://pkg.thestaticvoid.com:10000/">software repository</a> by typing <tt>pfexec pkg install argyll</tt>.</p>
<h3>UFRaw</h3>
<div class="text-align: center"><a href="http://www.flickr.com/photos/mrstaticvoid/4570241734/" title="UFRaw by MrStaticVoid, on Flickr"><img src="http://farm5.static.flickr.com/4051/4570241734_1375b53ab0.jpg" width="500" height="285" alt="UFRaw" /></a></div>
<p>UFRaw with lens correction support using LensFun can be installed from my repository by typing <tt>pfexec pkg install ufraw</tt>.  I went through hell trying to port this and its dependencies.  LensFun was particularly terrible with its crazy Makefiles (please use Autotools!) and non-standard C++ which Sun Studio choked on.</p>
<p>I don&#8217;t have much else to say about this yet, I&#8217;m still playing around with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/05/02/a-professional-photo-workflow-for-opensolaris/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Building a Photography Light Box</title>
		<link>http://thestaticvoid.com/post/2010/04/18/building-a-photography-light-box/</link>
		<comments>http://thestaticvoid.com/post/2010/04/18/building-a-photography-light-box/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 02:41:51 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[light box]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=284</guid>
		<description><![CDATA[Light boxes (or light tents) provide a scene with even lighting and a seemingly no background, great for product photography. You can make one yourself with stuff you probably already have lying around. You will need: A cardboard box White poster board White tissue paper Scissors Ruler or tape measure (for straight lines) Pen (to [...]]]></description>
			<content:encoded><![CDATA[<p>Light boxes (or light tents) provide a scene with even lighting and a seemingly no background, great for product photography.  You can make one yourself with stuff you probably already have lying around.  You will need:<br />
<a href="http://www.flickr.com/photos/mrstaticvoid/4533375584/" title="Supplies by MrStaticVoid, on Flickr"><img style="margin: 10px; float: right;" src="http://farm5.static.flickr.com/4025/4533375584_544ddb2fbc_m.jpg" width="160" height="240" alt="Supplies" /></a></p>
<ul>
<li>A cardboard box</li>
<li>White poster board</li>
<li>White tissue paper</li>
<li>Scissors</li>
<li>Ruler or tape measure (for straight lines)</li>
<li>Pen (to mark lines)</li>
<li>Clamp lamps</li>
<li>100 watt light bulbs.  I use GE &#8220;Reveal&#8221; bulbs which supposedly approach the color temperature of the sun.</li>
<li>Tape such as Scotch tape or masking tape.</li>
</ul>
<div>&nbsp;</div>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4533376174/" title="Cut Holes by MrStaticVoid, on Flickr"><img style="margin: 10px; float: left;" src="http://farm5.static.flickr.com/4005/4533376174_c2ec3feae4_m.jpg" width="240" height="160" alt="Cut Holes" /></a> Start by cutting a window on the left and right sides of the box, leaving about a one inch border for structural support.  You may find it easiest to start in the middle of the window and cut out small sections at a time.</p>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4532743569/" title="Line Box with Poster Board by MrStaticVoid, on Flickr"><img style="margin: 10px; float: right;" src="http://farm3.static.flickr.com/2775/4532743569_19c70afa1a_m.jpg" width="240" height="160" alt="Line Box with Poster Board" /></a><br />
Next, erect the box and line it with the white poster board.  Make sure you put the matte side of the poster board facing out to avoid any unwanted reflections.  Also create a small curve in the poster board toward the back of the box to give the illusion that it goes on forever.</p>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4533377574/" title="Line Sides with Tissue Paper by MrStaticVoid, on Flickr"><img style="margin: 10px; float: left;" src="http://farm3.static.flickr.com/2731/4533377574_2a533f73ae_m.jpg" width="240" height="160" alt="Line Sides with Tissue Paper" /></a><br />
Then line the open sides of the box with tissue paper.  This diffuses the light evenly over the inside of the box.  You will have to experiment with how many layers of tissue paper is required.  I&#8217;ve started with two.</p>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4533377942/" title="Attach Lamps by MrStaticVoid, on Flickr"><img style="margin: 10px; float: right;" src="http://farm3.static.flickr.com/2692/4533377942_fda773a3e5_m.jpg" width="240" height="160" alt="Attach Lamps" /></a><br />
Now you&#8217;re ready to attach the lamps.  I&#8217;m using clamp lamps which I picked up from Home Depot for $5 each.  They attach firmly to the box sides and can be repositioned very easily.  You can use desk lamps if you don&#8217;t have these.</p>
<p>Please have a fire extinguisher rated for paper and electrical fires handy.  200 watts of very hot lamps and and tissue paper don&#8217;t mix.</p>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4532744937/" title="Align Lamps by MrStaticVoid, on Flickr"><img style="margin: 10px; float: left;" src="http://farm3.static.flickr.com/2728/4532744937_6eef1c8d4d_m.jpg" width="240" height="160" alt="Align Lamps" /></a><br />
You will have to reposition the lamps to get the best possible lighting.  Here I&#8217;ve held the lamps close to the windows using masking tape.  You will have to experiment with this.</p>
<p><a href="http://www.flickr.com/photos/mrstaticvoid/4533378844/" title="Adjust White Balance by MrStaticVoid, on Flickr"><img style="margin: 10px; float: right;" src="http://farm5.static.flickr.com/4059/4533378844_10c6d86846_m.jpg" width="240" height="160" alt="Adjust White Balance" /></a><br />
Before you begin, make sure you set a custom white balance.  This is different for every camera, but typically you will take a photo of just the white background and the camera can figure it out from that.  Then choose an object and try it out.</p>
<p>This was my very first test:</p>
<div style="text-align: center;"><a href="http://www.flickr.com/photos/mrstaticvoid/4532745603/" title="Guinness by MrStaticVoid, on Flickr"><img style="margin: 10px;" src="http://farm5.static.flickr.com/4035/4532745603_10c3bb7f07.jpg" width="333" height="500" alt="Guinness" /></a></div>
<p>My other test did not turn out as well:</p>
<div style="text-align: center;"><a href="http://www.flickr.com/photos/mrstaticvoid/4532745957/" title="Phone by MrStaticVoid, on Flickr"><img style="margin: 10px;" src="http://farm3.static.flickr.com/2710/4532745957_df1fa81470_m.jpg" width="240" height="160" alt="Phone" /></a><a href="http://www.flickr.com/photos/mrstaticvoid/4532746341/" title="Phone by MrStaticVoid, on Flickr"><img style="margin: 10px;" src="http://farm3.static.flickr.com/2747/4532746341_67a405068f_m.jpg" width="240" height="160" alt="Phone" /></a></div>
<p>I will either need more light or more experimentation with exposure settings in order to get the background more white.</p>
<p>Either way, this light box was simple, fun, and cheap to create.  I hope this has inspired you to try it out yourself!</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/04/18/building-a-photography-light-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DTrace to the Rescue Again!</title>
		<link>http://thestaticvoid.com/post/2010/03/30/dtrace-to-the-rescue-again/</link>
		<comments>http://thestaticvoid.com/post/2010/03/30/dtrace-to-the-rescue-again/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:33:30 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=278</guid>
		<description><![CDATA[I am really beginning to understand just how powerful and important this tool is. I ran into another problem at work where I was seeing errors, but the details weren&#8217;t very helpful. I recently made a NFS mounted filesystem read-only, and some errors started to pop up in the system log: # dmesg ... Mar [...]]]></description>
			<content:encoded><![CDATA[<p>I am really beginning to understand just how powerful and important this tool is.  I ran into another problem at work where I was seeing errors, but the details weren&#8217;t very helpful.  I recently made a NFS mounted filesystem read-only, and some errors started to pop up in the system log:</p>
<pre class="terminal">
# <kbd>dmesg</kbd>
...
Mar 30 12:09:00 ragno nfs: [ID 808668 kern.notice] NFS write error on host nasfb: Read-only file system.
Mar 30 12:09:00 ragno nfs: [ID 702911 kern.notice] (file handle: 1d010000 1000000 e10d1300 a5122c4b 1d010000 1000000 15000000 5c179c4a)
...
</pre>
<p>I wanted to know which file is being written to.  The file handle isn&#8217;t very useful for me.  I tried using <tt>lsof</tt> like:</p>
<pre class="terminal">
# <kbd>lsof -N -z ragno /zones/ragno/root/home</kbd>
lsof: WARNING: can't stat() 5 zone file systems; using dev= options
COMMAND     PID ZONE      USER   FD   TYPE        DEVICE             SIZE/OFF       NODE NAME
httpd      3065 ragno webservd  cwd   VDIR     256,65718                    0          0 /zones/ragno (ragno)
httpd      3065 ragno webservd  rtd   VDIR     256,65718                    0          0 /zones/ragno (ragno)
httpd      3065 ragno webservd  txt   VREG     256,65718                    0          0 /zones/ragno (ragno)
httpd      3065 ragno webservd  txt   VREG     256,65718                    0          0 /zones/ragno (ragno)
...
</pre>
<p>but it didn&#8217;t give me any useful information either.  Maybe I&#8217;m not using it correctly?</p>
<p>Then I found the <a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/nfs/nfs_client.c#nfs_write_error">function</a> in the kernel which is responsible outputting the NFS write errors that appear in the system log:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">...<br />
<span style="color: #993333;">void</span><br />
nfs_write_error<span style="color: #009900;">&#40;</span>vnode_t <span style="color: #339933;">*</span>vp<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> error<span style="color: #339933;">,</span> cred_t <span style="color: #339933;">*</span>cr<span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
...</div></div>
<p>This function gets passed a <a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/vnode.h#227"><tt>vnode_t</tt></a> pointer which has tons of data on the current I/O operation, including the file name.  DTrace enabled me to access this data dynamically:</p>
<pre class="terminal">
# <kbd>dtrace -n 'fbt:nfs:nfs*_write_error:entry /zonename == "ragno"/ {vp = (vnode_t*) arg0; printf("%s", stringof(vp->v_path));}'</kbd>
dtrace: description 'fbt:nfs:nfs*_write_error:entry ' matched 2 probes
CPU     ID                    FUNCTION:NAME
  0  56891            nfs_write_error:entry /zones/ragno/root/home/rmserver/Logs/rmaccess.log
  0  56891            nfs_write_error:entry /zones/ragno/root/home/rmserver/Logs/rmaccess.log
  0  56891            nfs_write_error:entry /zones/ragno/root/home/rmserver/Logs/rmaccess.log
  0  56891            nfs_write_error:entry /zones/ragno/root/home/rmserver/Logs/rmaccess.log
  0  56891            nfs_write_error:entry /zones/ragno/root/home/rmserver/Logs/rmaccess.log
</pre>
<p>And there&#8217;s the culprit.  Now I know which file needs to be relocated to local read/write storage.  Neato!</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/03/30/dtrace-to-the-rescue-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VPNC for OpenSolaris</title>
		<link>http://thestaticvoid.com/post/2010/02/26/vpnc-for-opensolaris/</link>
		<comments>http://thestaticvoid.com/post/2010/02/26/vpnc-for-opensolaris/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 20:02:16 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[vpnc]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=260</guid>
		<description><![CDATA[I&#8217;ve compiled VPNC and the requisite TUN/TAP driver for OpenSolaris so that I can access my work network from home. Kazuyoshi&#8217;s driver adds TAP functionality to the original TUN driver which hasn&#8217;t been updated in nine years. It&#8217;s a real testament to the stability of the OpenSolaris kernel ABI that the module still compiles, loads, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve compiled <a href="http://www.unix-ag.uni-kl.de/~massar/vpnc/">VPNC</a> and the requisite <a href="http://www.whiteboard.ne.jp/~admin2/tuntap/">TUN/TAP driver</a> for OpenSolaris so that I can access my work network from home.  Kazuyoshi&#8217;s driver adds TAP functionality to the original <a href="http://vtun.sourceforge.net/tun/">TUN driver</a> which hasn&#8217;t been updated in nine years.  It&#8217;s a real testament to the stability of the OpenSolaris kernel ABI that the module still compiles, loads, and works properly.</p>
<p>All of the software can be installed from my repository onto build 111 or higher:</p>
<pre class="terminal">
$ <kbd>pfexec pkg set-publisher -O http://pkg.thestaticvoid.com:10000/ thestaticvoid</kbd>
$ <kbd>pfexec pkg install vpnc</kbd>
</pre>
<p>The tun driver should load automatically and create <tt>/dev/tun</tt>.  Now create a VPN profile configuration in <tt>/etc/vpnc/</tt>.  The configuration contains a lot of private information so I&#8217;m not going to share mine here, but <tt>/etc/vpnc/default.conf</tt> is a good start.</p>
<p>One thing I do like to do is make sure only certain subnets are tunneled through the VPN.  That way connecting to the VPN doesn&#8217;t interrupt any connections that are already established (for example, AIM).  To do that I create a script <tt>/etc/vpnc/gwu-networks-script</tt> containing</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Only tunnel GWU networks through VPN</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC</span>=<span style="color: #000000;">2</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_ADDR</span>=161.253.0.0<br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_MASK</span>=255.255.0.0<br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_MASKLEN</span>=<span style="color: #000000;">16</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_PROTOCOL</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_SPORT</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_0_DPORT</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_ADDR</span>=128.164.0.0<br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_MASK</span>=255.255.0.0<br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_MASKLEN</span>=<span style="color: #000000;">16</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_PROTOCOL</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_SPORT</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">CISCO_SPLIT_INC_1_DPORT</span>=<span style="color: #000000;">0</span><br />
<br />
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vpnc<span style="color: #000000; font-weight: bold;">/</span>vpnc-script</div></div>
<p>then add <tt>Script /etc/vpnc/gwu-networks-script</tt> to the end of my VPN profile configuration.</p>
<p>Connecting to the VPN you should see messages like:</p>
<pre class="terminal">
$ <kbd>pfexec vpnc gwu</kbd>
Enter password for jameslee@&lt;no&gt;:
which: no ip in (/sbin:/usr/sbin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin)
which: no ip in (/sbin:/usr/sbin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin)
add net 128.164.&lt;no&gt;: gateway 128.164.&lt;no&gt;
add host 128.164.&lt;no&gt;: gateway 161.253.&lt;no&gt;
add net 161.253.0.0: gateway 128.164.&lt;no&gt;
add net 128.164.0.0: gateway 128.164.&lt;no&gt;
add net 128.164.&lt;no&gt;: gateway 128.164.&lt;no&gt;
add net 128.164.&lt;no&gt;: gateway 128.164.&lt;no&gt;
VPNC started in background (pid: 594)...
</pre>
<p>The <tt>vpnc-script</tt> will modify your <tt>/etc/resolv.conf</tt> and routing tables so be sure to run <tt>vpnc-disconnect</tt> when you are done with the connection to restore the original configuration.</p>
<p>Thanks to the good folks at <a href="http://www.infradead.org/openconnect.html">OpenConnect</a> for a well-maintained <a href="http://git.infradead.org/users/dwmw2/vpnc-scripts.git/blob/HEAD:/vpnc-script"><tt>vpnc-script</tt></a> which works on Solaris.  Spec files for these packages are available from my <a href="http://thestaticvoid.com/wsvn/specs/trunk/vpnc.spec">Subversion</a> <a href="http://thestaticvoid.com/wsvn/specs/trunk/tuntap.spec">repository</a> if you want to roll your own.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/02/26/vpnc-for-opensolaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MusicBrainz Picard</title>
		<link>http://thestaticvoid.com/post/2010/02/14/musicbrainz-picard/</link>
		<comments>http://thestaticvoid.com/post/2010/02/14/musicbrainz-picard/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 09:54:17 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[picard]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=241</guid>
		<description><![CDATA[MusicBrainz along with the Picard tagger is without a doubt the best way to organize and manage large collections of music. The tagger will fingerprint audio files and automatically correct their metadata and filenames. I&#8217;ve been using MusicBrainz since 2005, and even attempted to write my own tagger for it in Java back when Picard [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://musicbrainz.org/">MusicBrainz</a> along with the <a href="http://musicbrainz.org/doc/PicardTagger">Picard tagger</a> is without a doubt the best way to organize and manage large collections of music.  The tagger will fingerprint audio files and automatically correct their metadata and filenames.</p>
<p><a href="http://thestaticvoid.com/wordpress/wp-content/uploads/2010/02/picard.png"><img src="http://thestaticvoid.com/wordpress/wp-content/uploads/2010/02/picard-300x206.png" alt="" title="MusicBrainz Picard" width="300" height="206" class="aligncenter size-medium wp-image-244" /></a></p>
<p>I&#8217;ve been using MusicBrainz since 2005, and even attempted to write <a href="http://thestaticvoid.com/wsvn/junepimp/trunk/">my own tagger</a> for it in Java back when Picard didn&#8217;t exist.  When I switched to OpenSolaris, it was one of the programs I missed the most.  So I went about building a package for it.</p>
<p>Unfortunately, the software has a lot of complicated dependencies such as <a href="http://qt.nokia.com/">Qt</a> and <a href="http://www.ffmpeg.org/">FFmpeg</a> which aren&#8217;t included in OpenSolaris either.  FFmpeg I can understand; it infringes on countless software patents &lt;insert rant here&gt;.  But Qt?  There&#8217;s no reason for that.  It is easily the second most popular graphics toolkit for Unix.  Sure, the <a href="http://techbase.kde.org/Projects/KDE_on_Solaris/OpenSolaris">Solaris KDE</a> guys have a build of it, but it installs to a non-standard prefix and doesn&#8217;t include 64-bit libs.  No thank you.</p>
<p>Anyway, the package and its dependencies are up on my <a href="http://pkg.thestaticvoid.com:10000/">package repository</a> for b132 and later.  You know the deal&#8230;<tt>pfexec pkg install picard</tt>.  Spec files are, as always, available from my <a href="http://thestaticvoid.com/wsvn/specs/trunk/">svn repository</a>.</p>
<p>Now that I have a good start on the FFmpeg package, I&#8217;m going to keep working on it, adding support for more codecs and eventually build <a href="http://www.mplayerhq.hu/design7/news.html">MPlayer</a> so I can stop using <a href="http://solaris.homeunix.com/?q=node/24">this guy&#8217;s</a> less-than-ideal build.</p>
<p><strong>EDIT:</strong> Just FYI, in order to get nice antialiased fonts in Qt applications, I had to modify the fontconfig settings.  This is not necessary for GTK+ applications because they get their settings from the <tt>gnome-appearance-properties</tt> dialog.  So in <tt>~/.fonts.conf</tt> add:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE fontconfig SYSTEM &quot;fonts.dtd&quot;&gt;</span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fontconfig<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #808080; font-style: italic;">&lt;!-- &nbsp;Use the Antialiasing --&gt;</span> <br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;font&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;edit</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;antialias&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;assign&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;bool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bool<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/edit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fontconfig<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Other Qt appearance settings can be changed from the <tt>qtconfig</tt> dialog.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2010/02/14/musicbrainz-picard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Start Virtual NICs on OpenSolaris Boot</title>
		<link>http://thestaticvoid.com/post/2009/12/23/start-virtual-nics-on-opensolaris-boot/</link>
		<comments>http://thestaticvoid.com/post/2009/12/23/start-virtual-nics-on-opensolaris-boot/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:12:51 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[crossbow]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[smf]]></category>
		<category><![CDATA[zones]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=230</guid>
		<description><![CDATA[One of the more frustrating things I deal with on OpenSolaris is that every time I reboot, I have to manually bring up each virtual network interface in order to start all of my zones. There is a bug report for this problem that says a fix will be integrated into b132, which is just [...]]]></description>
			<content:encoded><![CDATA[<p>One of the more frustrating things I deal with on OpenSolaris is that every time I reboot, I have to manually bring up each virtual network interface in order to start all of my zones.  There is a <a href="http://bugs.opensolaris.org/view_bug.do?bug_id=6776009">bug report</a> for this problem that says a fix will be integrated into b132, which is just a few weeks away, but in the mean time, I&#8217;ve whipped up an SMF service to handle this for me.  Create a file <tt>vnic.xml</tt>:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE service_bundle SYSTEM &quot;/usr/share/lib/xml/dtd/service_bundle.dtd.1&quot;&gt;</span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_bundle</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'manifest'</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'vnic'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'network/vnic'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'network_service'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">grouping</span>=<span style="color: #ff0000;">'require_all'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">restart_on</span>=<span style="color: #ff0000;">'none'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_fmri</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'svc:/network/service'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependent</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'network_vnic'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">grouping</span>=<span style="color: #ff0000;">'optional_all'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">restart_on</span>=<span style="color: #ff0000;">'none'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_fmri</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'svc:/system/zones'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'start'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/usr/sbin/dladm up-vnic ${SMF_FMRI/*:/}'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'60'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'stop'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">':true'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'60'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property_group</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'startd'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'framework'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;propval</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'duration'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'astring'</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'transient'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property_group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;stability</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'Unstable'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;common_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;loctext</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">'C'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Virtual Network Interface<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/loctext<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/common_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;documentation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manpage</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'dladm'</span> <span style="color: #000066;">section</span>=<span style="color: #ff0000;">'1M'</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">manpath</span>=<span style="color: #ff0000;">'/usr/share/man'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/documentation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service_bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>This service should run sometime after the network is started but before the zones are started.  Load it in with <tt>svccfg -v import vnic.xml</tt> and create an instance of the service for each of the VNICs that you want to start.  For example, if you want to start <tt>vnic0</tt> on boot:</p>
<pre class="terminal">
# <kbd>svccfg -s vnic add vnic0</kbd>
# <kbd>svcadm refresh vnic0</kbd>
# <kbd>svcadm enable vnic0</kbd>
</pre>
<p><strong>UPDATE:</strong> Build 132 is out an this functionality has been integrated as the <tt>svc:/network/datalink-management:default</tt> service.  The services that were added above can be removed by running <tt>svccfg delete vnic</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2009/12/23/start-virtual-nics-on-opensolaris-boot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watching Network Connections with DTrace</title>
		<link>http://thestaticvoid.com/post/2009/12/14/watching-network-connections-with-dtrace/</link>
		<comments>http://thestaticvoid.com/post/2009/12/14/watching-network-connections-with-dtrace/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 19:44:02 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=221</guid>
		<description><![CDATA[DTrace is one of those magical tools that I sort of know how to use but never had the chance to. Usually, firing up truss is sufficient to figure out what&#8217;s happening in a process. But recently, a team at GWU was setting up a web application and having some problems. It would hang whenever [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hub.opensolaris.org/bin/view/Community+Group+dtrace/WebHome">DTrace</a> is one of those magical tools that I sort of know how to use but never had the chance to.  Usually, firing up <a href="http://docs.sun.com/app/docs/doc/816-0210/6m6nb7mnl">truss</a> is sufficient to figure out what&#8217;s happening in a process.</p>
<p>But recently, a team at GWU was setting up a web application and having some problems.  It would hang whenever it was accessed.  The application is highly modular and accesses several other servers for resources, so I suspected there must have been some sort of network problem, probably a blocked firewall port somewhere.  Unfortunately, the application produces no logs (!) so it was pretty much guesswork.</p>
<p>I started <a href="http://docs.sun.com/app/docs/doc/819-2240/snoop-1m?a=view">snoop</a> to watch for traffic generated by the application.  I knew from watching the production application that there should be communication between two servers over port 9300, but I wasn&#8217;t seeing anything.  I thought of using truss to determine if the application was at least trying to connect, but being a web application, the process was way too short-lived to attach to.  Even if I was able to attach to it, all I might have learned was that the application was calling the &#8216;connect&#8217; system call and possibly getting a return value.</p>
<p>DTrace, on the other hand, doesn&#8217;t have to attach to a particular process.  It just sits in the kernel and dynamically observes what your scripts tell it to.  It also has the ability to look into data structures so you can actually see what values are passed to functions and system calls.  I used this ability to watch every call to the <a href="http://docs.sun.com/app/docs/doc/816-0214/6m6nf1oeq?a=view">connect</a> system call.</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#!/usr/sbin/dtrace -qs</span><br />
<br />
syscall<span style="color: #339933;">::</span><span style="color: #202020;">connect</span><span style="color: #339933;">:</span>entry<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; socks <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> copyin<span style="color: #009900;">&#40;</span>arg1<span style="color: #339933;">,</span> arg2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; hport <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint_t<span style="color: #009900;">&#41;</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; lport <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint_t<span style="color: #009900;">&#41;</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; hport <span style="color: #339933;">&lt;&lt;=</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; port <span style="color: #339933;">=</span> hport <span style="color: #339933;">+</span> lport<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s: %d.%d.%d.%d:%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> execname<span style="color: #339933;">,</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> socks<span style="color: #339933;">-&gt;</span>sa_data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>This script copies <tt>arg2</tt> bytes from the address pointed to by <tt>arg1</tt> into kernel space and uses the data to determine the port (big endian order) and destination address.</p>
<p>When run, the script immediately revealed that the web application was trying to connect to itself rather than a database server, a simple configuration mistake made difficult to diagnose due to poor logging facilities in the application.</p>
<p>In the future, there will be a <a href="http://hub.opensolaris.org/bin/view/Community+Group+dtrace/NetworkProvider">network provider</a> for DTrace which will simplify the job of extracting data from network calls.  It should then be possible to rewrite the script to simply:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#!/usr/sbin/dtrace -qs</span><br />
<br />
tcp<span style="color: #339933;">:::</span><span style="color: #202020;">connect</span><span style="color: #339933;">-</span>request<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s: %s:%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> execname<span style="color: #339933;">,</span> args<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>ip_daddr<span style="color: #339933;">,</span> args<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>tcp_dport<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Hopefully I&#8217;ll have more opportunities to use DTrace in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2009/12/14/watching-network-connections-with-dtrace/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Music Player Daemon on OpenSolaris</title>
		<link>http://thestaticvoid.com/post/2009/12/04/music-player-daemon-on-opensolaris/</link>
		<comments>http://thestaticvoid.com/post/2009/12/04/music-player-daemon-on-opensolaris/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 01:44:36 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[mpd]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[packages]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=188</guid>
		<description><![CDATA[MPD is essential software for me. It&#8217;s one of the few music players out there for Unix that does gapless playback and ReplayGain. It&#8217;s also nice that, because it&#8217;s a daemon, I&#8217;m not bound to any particular interface. Fortunately, there is a really good one in the form of Sonata. MPD is not included in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki">MPD</a> is essential software for me.  It&#8217;s one of the few music players out there for Unix that does gapless playback and ReplayGain.  It&#8217;s also nice that, because it&#8217;s a daemon, I&#8217;m not bound to any particular interface.  Fortunately, there is a really good one in the form of <a href="http://sonata.berlios.de/">Sonata</a>.</p>
<p>MPD is not included in OpenSolaris yet, so last weekend I built some packages for it.  The build has been stable for me and I&#8217;m happy with the state of the packages so I thought I&#8217;d share them.  First add my <a href="http://pkg.thestaticvoid.com:10000/">package repository</a>:</p>
<pre class="terminal">
$ <kbd>pfexec pkg set-authority -O http://pkg.thestaticvoid.com:10000/ thestaticvoid</kbd>
</pre>
<h3>MPD</h3>
<p>This package and its dependencies require OpenSolaris 2009.06 or newer.  Install it by typing <tt>pfexec pkg install mpd</tt>.  The following formats are supported:</p>
<pre class="terminal">
$ <kbd>mpd -V</kbd>
...
Supported decoders:
[mad] mp3 mp2
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[audiofile] wav au aiff aif
[faad] aac
[mp4] m4a mp4
[mpcdec] mpc
[wavpack] wv

Supported outputs:
shout null fifo ao solaris httpd 

Supported protocols:
file:// http://
</pre>
<p>I plan on adding ffmpeg support soon which will add support for even more codecs.</p>
<p>To run MPD, create a configuration file in your home directory like</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">port&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;6600&quot;<br />
music_directory &nbsp; &nbsp; &nbsp; &nbsp; &quot;~/music&quot;<br />
playlist_directory &nbsp; &nbsp; &nbsp;&quot;~/.mpd/playlists&quot;<br />
db_file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;~/.mpd/mpd.db&quot;<br />
log_file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;~/.mpd/mpd.log&quot;</div></div>
<p>Create any directories from the configuration file that don&#8217;t exist, such as <tt>~/.mpd/playlists</tt> and start the daemon by running <tt>mpd ~/.mpdconf</tt> as your user.  It will immediately build a library of your music.</p>
<p>Alternatively, mpd can be run system-wide, which just seems more appropriate to me for whatever reason.  The only complicated part about this is that you have to give MPD permission to write to the audio device.  Edit <tt>/etc/logindevperms</tt>, find the <tt>/dev/sound/*</tt> lines and change the mode to 0666 so that they look like:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/console&nbsp; &nbsp; 0666&nbsp; &nbsp; /dev/sound/*&nbsp; &nbsp; &nbsp; &nbsp; # audio devices<br />
/dev/vt/active&nbsp; 0666&nbsp; &nbsp; /dev/sound/*&nbsp; &nbsp; &nbsp; &nbsp; # audio devices</div></div>
<p>Logout and log back in for the settings to take effect.  Then modify <tt>/etc/mpd.conf</tt> to your liking and start the daemon by typing <tt>svcadm enable mpd</tt>.  You may have to <tt>svcadm refresh manifest-import</tt> for SMF to load the mpd manifest.</p>
<h3>mpdscribble</h3>
<p>I also built a package for <a href="http://mpd.wikia.com/wiki/Client:Mpdscribble">mpdscribble</a> which is a mature, well-maintained scrobbler for <a href="http://www.last.fm/">Last.fm</a>.  Install it by typing <tt>pfexec pkg install mpdscribble</tt>.  Set your Last.fm or Libre.fm username and password in <tt>/etc/mpdscribble.conf</tt> and start the daemon with <tt>svcadm enable mpdscribble</tt>.  That&#8217;s all there is to it.</p>
<h3>Sonata</h3>
<p>Sonata is a lightweight cilent for MPD.  Looks pretty nice too:</p>
<p><img src="http://thestaticvoid.com/wordpress/wp-content/uploads/2009/12/sonata.png" alt="Sonata" title="Sonata" width="408" height="326" class="aligncenter size-full wp-image-201" /></p>
<p>Because Sonata requires Python 2.5, and OpenSolaris 2009.06 only really supports Python 2.3, this package requires build 127 or newer.  Install it by typing <tt>pfexec pkg install sonata</tt>.  It can be launched from the Applications->Sound &#038; Video menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2009/12/04/music-player-daemon-on-opensolaris/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mixer State in OpenSolaris</title>
		<link>http://thestaticvoid.com/post/2009/11/25/mixer-state-in-opensolaris/</link>
		<comments>http://thestaticvoid.com/post/2009/11/25/mixer-state-in-opensolaris/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 18:32:48 +0000</pubDate>
		<dc:creator>James Lee</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[mixer]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[smf]]></category>

		<guid isPermaLink="false">http://thestaticvoid.com/?p=174</guid>
		<description><![CDATA[I&#8217;ve recently installed OpenSolaris on my desktop and noticed that my volume settings do not persist between reboots. A quick search revealed that that functionality hasn&#8217;t been implemented yet. The thread suggested using the mixerctl command to save and restore the mixer state so I&#8217;ve thrown together an SMF service to do it automatically on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently installed OpenSolaris on my desktop and noticed that my volume settings do not persist between reboots.  A quick search revealed that <a href="http://opensolaris.org/jive/thread.jspa?threadID=118058&#038;tstart=0">that functionality hasn&#8217;t been implemented yet</a>.  The thread suggested using the <tt>mixerctl</tt> command to save and restore the mixer state so I&#8217;ve thrown together an SMF service to do it automatically on boot and shutdown.</p>
<p>First, the script which should go into <tt>/lib/svc/method/sound-mixer</tt>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/sbin/sh</span><br />
<br />
. <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>svc<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>smf_include.sh<br />
smf_is_globalzone <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_OK</span><br />
<br />
<span style="color: #007800;">ctl_file</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>svcprop <span style="color: #660033;">-p</span> options<span style="color: #000000; font-weight: bold;">/</span>ctl_file <span style="color: #007800;">$SMF_FMRI</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
<span style="color: #ff0000;">'start'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$ctl_file</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Mixer control file <span style="color: #007800;">$ctl_file</span> does not exist.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_OK</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>mixerctl <span style="color: #660033;">-r</span> <span style="color: #007800;">$ctl_file</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error restoring mixer state.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_OK</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<br />
<span style="color: #ff0000;">'stop'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>mixerctl <span style="color: #660033;">-f</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$ctl_file</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error saving mixer state.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_OK</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 { start | stop }&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_ERR_CONFIG</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$SMF_EXIT_OK</span></div></div>
<p>Second, the manifest which can be saved anywhere and loaded with <tt>svccfg -v import &lt;manifest&gt;</tt>:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE service_bundle SYSTEM &quot;/usr/share/lib/xml/dtd/service_bundle.dtd.1&quot;&gt;</span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_bundle</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'manifest'</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'mixer'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">name</span>=<span style="color: #ff0000;">'system/sound/mixer'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;create_default_instance</span> <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">'true'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;single_instance</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">name</span>=<span style="color: #ff0000;">'fs-local'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">grouping</span>=<span style="color: #ff0000;">'require_all'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">restart_on</span>=<span style="color: #ff0000;">'none'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_fmri</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'svc:/system/filesystem/local'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">name</span>=<span style="color: #ff0000;">'device-audio'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">grouping</span>=<span style="color: #ff0000;">'require_all'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">restart_on</span>=<span style="color: #ff0000;">'none'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_fmri</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'svc:/system/device/audio'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">name</span>=<span style="color: #ff0000;">'start'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/lib/svc/method/sound-mixer start'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'60'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">name</span>=<span style="color: #ff0000;">'stop'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/lib/svc/method/sound-mixer stop'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'60'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property_group</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'options'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;propval</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'ctl_file'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'astring'</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'/etc/sound/mixer.state'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property_group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property_group</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'startd'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'framework'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;propval</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'duration'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'astring'</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'transient'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property_group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;stability</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'Unstable'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;common_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;loctext</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">'C'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Mixer State Saver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/loctext<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/common_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;documentation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manpage</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'mixerctl'</span> <span style="color: #000066;">section</span>=<span style="color: #ff0000;">'1M'</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">manpath</span>=<span style="color: #ff0000;">'/usr/share/man'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/documentation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service_bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p><strong>UPDATE:</strong> In b130, the <tt>audioctl</tt> command replaces <tt>mixerctl</tt>.  In the <tt>sound-mixer</tt> script above, change <tt>/usr/sbin/mixerctl -r $ctl_file</tt> to <tt>/usr/bin/audioctl load-controls $ctl_file</tt> and <tt>/usr/sbin/mixerctl -f -s $ctl_file</tt> to <tt>/usr/bin/audioctl save-controls -f $ctl_file</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thestaticvoid.com/post/2009/11/25/mixer-state-in-opensolaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
