<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>For the good of all of us - Solaris</title>
    <link>http://www.skytale.net/blog/</link>
    <description></description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.3 - http://www.s9y.org/</generator>
    <pubDate>Sun, 21 Mar 2010 17:32:26 GMT</pubDate>

    <image>
        <url>http://www.skytale.net/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: For the good of all of us - Solaris - </title>
        <link>http://www.skytale.net/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Building a multi OS USB boot stick, Part 1 (Windows)</title>
    <link>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
            <category>Windows</category>
    
    <comments>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=33</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=33</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Among the things I carry around is always a collection of &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks, for various purposes. One of those is usually dedicated to a Linux rescue system, in order to get somehow broken systems back on their feet.&lt;/p&gt;

	&lt;p&gt;While it is possible these days to access non Linux systems from a booted Linux system any repair work beyond simple text file editing and file copying usually requires OS specific tools to get the job done. Thus it would be nice not only to have a Linux rescue system at hand, but a Windows one as well. And Solaris, while we&amp;#8217;re at it. And possibly some more.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks are cheap, at least in this part of the world. 10EUR will get you 4GB off the shelf in almost any electronics store, a little more money will get you 8GB ordered online. So space is not really an issue.&lt;/p&gt;

	&lt;p&gt;Actually installing an operating system in a way that allows it to boot off a removable media requires some specific preparations and tools in each case. This means that a running instance of that specific OS is needed to prepare the installation. This means that to get Windows to boot of an &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick a running Windows installation is needed. The same goes for Solaris and Linux.&lt;/p&gt;

	&lt;h3&gt;Preparations&lt;/h3&gt;

	&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick used for this exercise is a 4G Sandisk. This procedure will &lt;strong&gt;delete all data&lt;/strong&gt; currently on the stick, so either make sure there is nothing of any interest on it, or just get a new one.&lt;/p&gt;

	&lt;p&gt;The initial plan is to have Windows, Linux and Solaris boot off the stick. Each OS will get it&amp;#8217;s own partition, to keep possible clashes between the files of each system to a minimum (and because Solaris wants and &lt;span class=&quot;caps&quot;&gt;UFS&lt;/span&gt; partition, but more on that later).&lt;/p&gt;

	&lt;h3&gt;Installing Windows on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;The standard Windows installer does not allow for installation on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; devices. The standard tool for those tasks is &lt;a href=&quot;http://www.nu2.nu/pebuilder/&quot;&gt;BartPE&lt;/a&gt;, a free tool to create so-called Preinstalled Environments. Those are actually a Microsoft supported way to preinstall an operating system on a PC, which is used by system builders to deliver machines with the OS already installed but not registered. The Microsoft tools to create these environments are not easily available, though, and this is where BartPE came in a few years ago. It&amp;#8217;s original purpose was to create Live CDs of Windows, but booting from &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; was added (experimentally) later.&lt;/p&gt;

	&lt;p&gt;While BartPE is a very valuable tool there is an even better one for this special purpose: &lt;a href=&quot;http://www.ubcd4win.com/&quot;&gt;The Ultimate Boot CD for Windows&lt;/a&gt;, which is basically a BartPE with a lot of useful tools already tacked to the side, and a completely reworked &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installer.&lt;/p&gt;

	&lt;p&gt;To use &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; the following is needed:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; installer, which weighs in at 255MB and is available from the projects site&lt;/li&gt;
		&lt;li&gt;A Windows XP install CD (32 bit)&lt;/li&gt;
		&lt;li&gt;Service Pack 3 for XP, if the Windows CD does not already include it&lt;/li&gt;
		&lt;li&gt;A license for the Windows version (this is more a legal than a technical problem, but the Windows install on the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick needs a separate license to be legal)&lt;/li&gt;
		&lt;li&gt;Drivers&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The last point is especially interesting. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; will take all drivers whichare contained in the Windows XP install CD, which, as everyone knows who tried to install XP on a reasonably recent machine, is not exactly much. While the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installed will boot (hopefully), access to hard disk drives on the machine or access to network interfaces may be severely limited due to missing drivers.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; already comes with a largeish selection of updated drivers for mass storage, &lt;span class=&quot;caps&quot;&gt;LAN&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt;, so simply building an image with the default settings has a good chance of working on a large number of modern machines (although the &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt; drivers are disabled by default).&lt;/p&gt;

	&lt;h4&gt;Install procedure&lt;/h4&gt;

	&lt;ul&gt;
		&lt;li&gt;Make a copy of the Windows XP CD (that is, just copy all the files on it into a folder on the hard disk drive)&lt;/li&gt;
		&lt;li&gt;If the CD did not already contain a Windows copy patched to SP3 download the SP3 install package from Microsoft, and &lt;a href=&quot;http://www.howtohaven.com/system/slipstream-xp-service-pack-3.shtml&quot;&gt;slipstream the Service Pack into the copied files&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Install &lt;span class=&quot;caps&quot;&gt;UBDC&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Start &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; and enter the path to the copied Windows CD in the first field&lt;/li&gt;
		&lt;li&gt;Set Media Output to None&lt;/li&gt;
		&lt;li&gt;Click &amp;#8220;Build&amp;#8221;&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 509px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:31 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;509&quot; height=&quot;421&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd1.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;This will start a build process with the default settings, which are reasonable for a first build. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; is very customizable, most of the options are available by clicking the &amp;#8220;Plugins&amp;#8221; button on the main screen. Describing the various things that can be done here is beyond this text, but the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; home page has details on this.&lt;/p&gt;

	&lt;p&gt;After the build has finished plug in the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick and start &lt;code&gt;ubusb.exe&lt;/code&gt; from the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; install folder. To make things easier make sure no other &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; mass storage devices are connected. Set the options to match those in the screenshot below. Specifically:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Make sure the right &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device is selected&lt;/li&gt;
		&lt;li&gt;Set the partition size to 2048MB (or 2GB)&lt;/li&gt;
		&lt;li&gt;Set the file system to FAT32-&lt;span class=&quot;caps&quot;&gt;LBA&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Set the Boot Loader to grub4dos&lt;/li&gt;
		&lt;li&gt;Select the right BartPE folder (although it should pick up the correct one automatically)&lt;/li&gt;
		&lt;li&gt;Don&amp;#8217;t create a CD image&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 583px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:32 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;583&quot; height=&quot;554&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd2.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;UBUSB&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;Clicking &amp;#8220;Go&amp;#8221; will start the process of repartitioning, formattingand copying of data to the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick. This may take a while.&lt;/p&gt;

	&lt;p&gt;After the process has finished (hopefully successful) the resulting &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick can immediately be tested, because &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; comes with a copy of &lt;a href=&quot;http://www.qemu.org&quot;&gt;qemu&lt;/a&gt;, which can emulate a PC. Just click the &amp;#8220;Test USB&amp;#8221; button, and a virtual PC will try to boot off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick just created.&lt;/p&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 740px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:33 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;740&quot; height=&quot;438&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd3.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; boot menu&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 821px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:34 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;821&quot; height=&quot;638&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd4.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Windows booted off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick in qemu&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;One down, two to go.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Mar 2010 18:23:49 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/33-guid.html</guid>
    
</item>
<item>
    <title>Adding new dynamic library dependencies to an existing object</title>
    <link>http://www.skytale.net/blog/archives/28-Adding-new-dynamic-library-dependencies-to-an-existing-object.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/28-Adding-new-dynamic-library-dependencies-to-an-existing-object.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=28</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=28</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Due to some developing I needed a &lt;a href=&quot;http://www.lighttpd.net&quot;&gt;lighttpd&lt;/a&gt; with mod_magnet enabled. mod_magnet is a module which allows inserting of lua code into the request processing stream. This is a cool feature, and I was pleased to see that&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;lighttpd is on the standard Solaris install &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;mod_magnet is provided&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;Of course there is this small problem:&lt;/p&gt;

&lt;pre&gt;
2009-12-29 23:29:31: (plugin.c.165) dlopen() failed for: /usr/lighttpd/1.4/lib/mod_magnet.soi
ld.so.1: lighttpd: fatal: relocation error: file /usr/lighttpd/1.4/lib/mod_magnet.so:
symbol luaL_checklstring: referenced symbol not found
&lt;/pre&gt;

	&lt;p&gt;What this means is that there are unresolved symbols remaining in the code after the dymanic loader has done it&amp;#8217;s work, which should not happen. Let&amp;#8217;s look a the dynamic deps of the module.&lt;/p&gt;

&lt;pre&gt;
$ ldd /usr/lighttpd/1.4/lib/mod_magnet.so
        libsendfile.so.1 =&amp;#62;      /lib/libsendfile.so.1
        libm.so.2 =&amp;#62;     /lib/libm.so.2
        libresolv.so.2 =&amp;#62;        /lib/libresolv.so.2
        libnsl.so.1 =&amp;#62;   /lib/libnsl.so.1
        libsocket.so.1 =&amp;#62;        /lib/libsocket.so.1
        libc.so.1 =&amp;#62;     /lib/libc.so.1
        libmd.so.1 =&amp;#62;    /lib/libmd.so.1
        libmp.so.2 =&amp;#62;    /lib/libmp.so.2
        libscf.so.1 =&amp;#62;   /lib/libscf.so.1
        libuutil.so.1 =&amp;#62;         /lib/libuutil.so.1
        libgen.so.1 =&amp;#62;   /lib/libgen.so.1
        libsmbios.so.1 =&amp;#62;        /usr/lib/libsmbios.so.1
&lt;/pre&gt;

	&lt;p&gt;Judging from the name of the missing symbol &lt;code&gt;luaL_checklstring&lt;/code&gt; it ought to come from some kind of lua library. But the listing above does not show any missing libraries, lest of all a lua one.&lt;/p&gt;

	&lt;p&gt;So what happened?&lt;/p&gt;

	&lt;p&gt;Somehow (and I have no idea how) Sun managed to build a mod_magnet without linking it to the lua libraries at the end. Simply speaking, this is broken.&lt;/p&gt;

	&lt;p&gt;Fortunately there is a way to fix this. Sun provides a utility called &lt;code&gt;elfedit(1)&lt;/code&gt; which allows the editing of &lt;span class=&quot;caps&quot;&gt;ELF&lt;/span&gt; file headers (like shared libraries). The lua library which provides the missing symbols is called &lt;code&gt;liblua.so&lt;/code&gt; (no version information). The type of record in an &lt;span class=&quot;caps&quot;&gt;ELF&lt;/span&gt; header which denotes the dynamic libraries needed is called DT_NEEDED. &lt;code&gt;elfedit(1)&lt;/code&gt; takes two parameters: the file to edit, and the file into which to write the modified version.&lt;/p&gt;

	&lt;p&gt;First show the existing DT_NEEDED records.&lt;/p&gt;

&lt;pre&gt;
$ elfedit mod_magnet.so mod_magnet2.so
&amp;#62; dyn:value DT_NEEDED
     index  tag                value
       [0]  NEEDED            0x5f9               libsendfile.so.1
       [1]  NEEDED            0x60a               libm.so.2
       [2]  NEEDED            0x614               libresolv.so.2
       [3]  NEEDED            0x623               libnsl.so.1
       [4]  NEEDED            0x62f               libsocket.so.1
       [5]  NEEDED            0x5d3               libc.so.1
&lt;/pre&gt;

	&lt;p&gt;This is basically the same list as above, with liblua.so notably lacking. Now add a new entry:&lt;/p&gt;

&lt;pre&gt;
&amp;#62; dyn:value -add -s DT_NEEDED liblua.so
     index  tag                value
      [34]  NEEDED            0x63e               liblua.so
&lt;/pre&gt;

	&lt;p&gt;Now look at the new table, and save it.&lt;/p&gt;

&lt;pre&gt;
&amp;#62; dyn:value DT_NEEDED
     index  tag                value
       [0]  NEEDED            0x5f9               libsendfile.so.1
       [1]  NEEDED            0x60a               libm.so.2
       [2]  NEEDED            0x614               libresolv.so.2
       [3]  NEEDED            0x623               libnsl.so.1
       [4]  NEEDED            0x62f               libsocket.so.1
       [5]  NEEDED            0x5d3               libc.so.1
      [34]  NEEDED            0x63e               liblua.so
&amp;#62; :write
&amp;#62; :quit
&lt;/pre&gt;

	&lt;p&gt;Looking at the &lt;code&gt;ldd(1)&lt;/code&gt; output, just to be sure.&lt;/p&gt;

&lt;pre&gt;
$ ldd ./mod_magnet2.so
        libsendfile.so.1 =&amp;#62;      /lib/libsendfile.so.1
        libm.so.2 =&amp;#62;     /lib/libm.so.2
        libresolv.so.2 =&amp;#62;        /lib/libresolv.so.2
        libnsl.so.1 =&amp;#62;   /lib/libnsl.so.1
        libsocket.so.1 =&amp;#62;        /lib/libsocket.so.1
        libc.so.1 =&amp;#62;     /lib/libc.so.1
        liblua.so =&amp;#62;     /usr/lib/liblua.so
        libmd.so.1 =&amp;#62;    /lib/libmd.so.1
        libmp.so.2 =&amp;#62;    /lib/libmp.so.2
        libscf.so.1 =&amp;#62;   /lib/libscf.so.1
        libdl.so.1 =&amp;#62;    /lib/libdl.so.1
        libuutil.so.1 =&amp;#62;         /lib/libuutil.so.1
        libgen.so.1 =&amp;#62;   /lib/libgen.so.1
        libsmbios.so.1 =&amp;#62;        /usr/lib/libsmbios.so.1
&lt;/pre&gt;

	&lt;p&gt;Now the linker picks up the lua libraries. If the modified mod_magnet.so is now put back into &lt;code&gt;/usr/lighttpd/1.4/lib&lt;/code&gt;, lighttpd will start and mod_magnet will work.&lt;/p&gt;

	&lt;p&gt;Now, this wasn&amp;#8217;t so hard, was it?&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 30 Dec 2009 15:34:59 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/28-guid.html</guid>
    
</item>
<item>
    <title>Changing the rpool disk in Solaris</title>
    <link>http://www.skytale.net/blog/archives/27-Changing-the-rpool-disk-in-Solaris.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/27-Changing-the-rpool-disk-in-Solaris.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=27</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=27</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Ever since my storage system was built there was one thing that annoyed me. The 2.5&amp;#8221; hard disk drive that houses the operating system itself was lifted from an old notebook and had the annoying property of parking it&amp;#8217;s heads after five seconds of inactivity. Since &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; writes to the disk quite often and regularily this led to a constant cycle of parking and unparking. This was certainly not helping the disks life span, it made an annoying noise and it caused small system hangs whenever the disk had to unpark it&amp;#8217;s heads to read some data.&lt;/p&gt;

	&lt;p&gt;Under Linux one could use &lt;code&gt;hdparm&lt;/code&gt; to instruct the disk to not park it&amp;#8217;s heads, but unfortunately a program mimicking this functionality seems to be absent under Solaris. Thus the plan to replace the disk with a different one which had a more sensible apporoach to head parking.&lt;/p&gt;

	&lt;p&gt;This turned out to be an interesting endeavour.&lt;/p&gt;

	&lt;p&gt;The general problem of replacing the disk holding the rpool is common enough that the excellent &lt;a href=&quot;http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide#Replacing.2FRelabeling_the_Root_Pool_Disk&quot;&gt;&lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; troubleshooting guide&lt;/a&gt; has a section on doing this. The general plan of action is as follows:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Insert the replacement disk into an available slot&lt;/li&gt;
		&lt;li&gt;Create a partition spanning the whole disk&lt;/li&gt;
		&lt;li&gt;Create boot and data slices&lt;/li&gt;
		&lt;li&gt;Attach the new disk as a mirror to the rpool&lt;/li&gt;
		&lt;li&gt;Wait for the resilver to finish&lt;/li&gt;
		&lt;li&gt;Install grub on the new disk&lt;/li&gt;
		&lt;li&gt;Try to boot from the new disk&lt;/li&gt;
		&lt;li&gt;Detach the old disk from the rpool&lt;/li&gt;
		&lt;li&gt;Remove the old disk&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;This is all very sensible, and it all works as advertised. In my case there is, however, a last step not on the list above:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Put the new disk on the controller the old disk was attached to&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The reason for that is that the case I used only has one internal 2.5&amp;#8221; hard disk drive slot. The new disk was prepared using an external &lt;span class=&quot;caps&quot;&gt;USB-IDE&lt;/span&gt; converter module. This worked just fine, the &lt;span class=&quot;caps&quot;&gt;BIOS&lt;/span&gt; is even able to boot from the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; disk. As long as the new disk remained attached to the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; converter everything was fine, even after the old (internal) disk was removed from the rpool. But putting the new disk into the case caused Solaris to roll over and die early in the boot process due to not finding it&amp;#8217;s rpool disk. The error message indicated that it was trying to read the pool from the external &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device (which no longer existed at this point).&lt;/p&gt;

	&lt;p&gt;Investigation (and much swearing) turned up that this information was passed by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; to the Solaris kernel.&lt;/p&gt;

	&lt;p&gt;Solaris uses a patched &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; version which understands &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; and has some string replacement magic built in. Every (non failsafe) boot entry contains a line similar to this:&lt;/p&gt;

&lt;pre&gt;
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
&lt;/pre&gt;

	&lt;p&gt;&lt;code&gt;$ZFS-BOOTFS&lt;/code&gt; is replaced by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; with the following information:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The name of the root pool (usually rpool) and the number of the dataset that contains the root file system (there may be several BEs)&lt;/li&gt;
		&lt;li&gt;The device path of the disk this &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; instance was read from&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The actual command line that is executed by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; thus looks something like this:&lt;/p&gt;

&lt;pre&gt;
kernel /platform/i86pc/kernel/$ISADIR/unix -B zfs-bootfs=rpool/328 \
bootpath=&amp;#34;/pci@0,0/pci8086,2942@1c,1/pci-ide@0/ide@0/cmdk@0,0:a&amp;#34;
&lt;/pre&gt;

	&lt;p&gt;The interesting part here is the &lt;code&gt;bootpath&lt;/code&gt; parameter. This is the device that Solaris will try to mount the rpool from. Even if the rpool consists of several mirror devices, only one is used in the initial boot process. Where does &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; get the device path from? It&amp;#8217;s read from the rpool header, from the disk &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; was loaded from. Every &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; pool disk contains the device path it was last found under. This usually does not matter much, a &lt;span class=&quot;caps&quot;&gt;RAIDZ&lt;/span&gt; will still mount if you swap the disks around when the machine is off, but the boot process relies on the rpool disks not wandering around. My new disk still had the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device path embedded, which &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; read and passed to the kernel, which then failed to find the disk.&lt;/p&gt;

	&lt;p&gt;Fixing this turns out to be easy: boot into failsafe mode with the new disk on it&amp;#8217;s final connector. This will search for rpools and BEs on the system and offer to mount one of them. Pick the right one, reboot. This is enough to get the current (and correct) device path embedded into the rpool. The next (non failsafe) boot will thus pick up the correct device path and allow the boot to continue.&lt;/p&gt;

	&lt;p&gt;The morale of an afternoon thus spent in the innards of the Solaris boot process is thus: do not swap your rpool disk around.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 25 Dec 2009 16:01:53 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/27-guid.html</guid>
    
</item>
<item>
    <title>Creating a write only directory with SAMBA and ZFS</title>
    <link>http://www.skytale.net/blog/archives/26-Creating-a-write-only-directory-with-SAMBA-and-ZFS.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/26-Creating-a-write-only-directory-with-SAMBA-and-ZFS.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=26</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=26</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;One of the intended uses of my OpenSolaris storage server was to serve as a &lt;a href=&quot;http://www.samba.org&quot;&gt;SAMBA&lt;/a&gt; accessible data store. Part of that role was the wish to have an &lt;code&gt;incoming&lt;/code&gt; directory modeled after similar directories found on many &lt;span class=&quot;caps&quot;&gt;FTP&lt;/span&gt; servers. In detail this meant a share with the following properties:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Readable for everyone (including unauthenticated users, i.e. guests)&lt;/li&gt;
		&lt;li&gt;Everyone can create new files and directories on the share&lt;/li&gt;
		&lt;li&gt;Only certain users can delete files and directories from the share&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;So everyone can add files to the share, but removing them requires special privileges.&lt;/p&gt;

	&lt;p&gt;It turns out that this is impossible to do with normal &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; file system permissions, as for &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; creating a file (which is a write operation on a directory) is much the same as deleting one (which is a write operation on a directory).&lt;/p&gt;

	&lt;p&gt;Fortunately OpenSolaris supports a much more powerful file operation permission language in the form of NFSv4 permissions.&lt;/p&gt;

	&lt;p&gt;It has been said that the NFSv4 permission system has been modeled after a smudged copy of the Windows &lt;span class=&quot;caps&quot;&gt;NTFS&lt;/span&gt; permission system, and there is certainly merit to that claim, which is not a bad thing. The &lt;span class=&quot;caps&quot;&gt;NTFS&lt;/span&gt; permission system is much more expressive than the standard &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; system, as it has more actions (besides writing, reading and executing it also knows about deleting, for example), can support a large number of principals with different permissions and can actively deny an action (which is different from &amp;#8220;not allowing&amp;#8221;).&lt;/p&gt;

	&lt;h3&gt;NFSv4 permissions&lt;/h3&gt;

	&lt;p&gt;The NFSv4 system knows about the following actions:&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Action &lt;/th&gt;
			&lt;th&gt;Description for files &lt;/th&gt;
			&lt;th&gt;Description for directories &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read data &lt;/td&gt;
			&lt;td&gt; Read file contents &lt;/td&gt;
			&lt;td&gt; List directory contents &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; write data &lt;/td&gt;
			&lt;td&gt; Write file contents (anywhere in the file) &lt;/td&gt;
			&lt;td&gt; Create new files &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; execute &lt;/td&gt;
			&lt;td&gt; Execute file &lt;/td&gt;
			&lt;td&gt; Change into directory &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; append &lt;/td&gt;
			&lt;td&gt; Append data to file &lt;/td&gt;
			&lt;td&gt; Create new directories &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; delete &lt;/td&gt;
			&lt;td&gt; Delete the file &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; delete child &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
			&lt;td&gt; Delete a file in the directory &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write attributes &lt;/td&gt;
			&lt;td&gt; Read/write basic attributes &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write xattrs &lt;/td&gt;
			&lt;td&gt; Read/write extended attributes &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write &lt;span class=&quot;caps&quot;&gt;ACL&lt;/span&gt; &lt;/td&gt;
			&lt;td&gt; Read/write ACLs &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; change owner &lt;/td&gt;
			&lt;td&gt; Change the owner &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; sync &lt;/td&gt;
			&lt;td&gt; Use syncronous file access &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;NFSv4 also contains a mechanism to specify actions that apply to a file or directory, and actions that are inherited to child objects of a directory (i.e. files or subdirectories). This allows very fine grained control of file system access.&lt;/p&gt;

	&lt;p&gt;Of special interest here are the bits about writing, appending and deleting files and folders.&lt;/p&gt;

	&lt;p&gt;The ACLs are maintained in a list of entries, each entry mapping a username/action pair to a verdict (allow/deny). Each access is matched against each entry in&lt;br /&gt;
turn, and the verdict is taken from the first entry to match. So the order of entries is important.&lt;/p&gt;

	&lt;p&gt;Solaris&amp;#8217; &lt;code&gt;ls&lt;/code&gt; has two extensions to list those ACLs: &lt;code&gt;-v&lt;/code&gt; for a verbose listing and &lt;code&gt;-V&lt;/code&gt; for a concise listing. The format used by &lt;code&gt;-V&lt;/code&gt; can be passed to &lt;code&gt;chmod&lt;/code&gt; to change ACLs.&lt;/p&gt;

	&lt;p&gt;The permissions corresponding to the list of requirements stated above are as follows (&lt;code&gt;/tank/share/incoming&lt;/code&gt; is the directory associated with the &lt;code&gt;incoming&lt;/code&gt; share in &lt;code&gt;smb.conf&lt;/code&gt;):&lt;/p&gt;

&lt;pre&gt;
# ls -lVd /tank/share/incoming
drwxrwxrwx+  5 root     root           6 Dec 12 16:49 /tank/share/incoming
               user:sun:-w--dD--------:fdi----:allow
               user:sun:-w--dD--------:-------:allow
              everyone@:-w--dD--------:f-i----:deny
              everyone@:----dD--------:-di----:deny
              everyone@:----dD--------:-------:deny
              everyone@:rwxp--a-R-c--s:-di----:allow
              everyone@:r-xp--a-R-c--s:f-i----:allow
              everyone@:rwxp--a-R-c--s:-------:allow
#
&lt;/pre&gt;

	&lt;p&gt;There are two kinds of entries in this list. Those with an &lt;code&gt;i&lt;/code&gt; in the second part of the action list and those without. The entries with an &lt;code&gt;i&lt;/code&gt; are so called &amp;#8220;inherit only&amp;#8221; entries. They do not apply to the file or directory they are associated with, but are only inherited to new child entries. The other entries apply to the file/directory they are associated with. &lt;/p&gt;

	&lt;p&gt;This list can be read in three blocks:&lt;/p&gt;

	&lt;p&gt;The first block consists of the first two lines. The first line specifies that the right to delete files (&lt;code&gt;d&lt;/code&gt;), delete child entries (&lt;code&gt;D&lt;/code&gt;) and create new files/write file content (&lt;code&gt;w&lt;/code&gt;) for the user named &lt;code&gt;sun&lt;/code&gt; is inherited to new files and directories (&lt;code&gt;fdi&lt;/code&gt;). This makes sure that this user can always remove files and directories, and overwrite existing file content in newly created files. The second line applies the same rights to the &lt;code&gt;incoming&lt;/code&gt; directory itself.&lt;/p&gt;

	&lt;p&gt;The second block consists of lines 3 to 5 and contains only deny statements. They apply to &lt;code&gt;everyone@&lt;/code&gt;, which means exactly what it says on the box. Lines 3 and 4 again deal with rights that are to be inherited to child objects, but the rights inherited to files and directories are different this time. Files inherit a deny to write anywhere in the file (&lt;code&gt;w&lt;/code&gt;) and file deletion (&lt;code&gt;dD&lt;/code&gt;). Directories just inherit the deletion part, otherwise new files could not be created in subdirectories (which needs the &lt;code&gt;w&lt;/code&gt; right). The &lt;code&gt;incoming&lt;/code&gt; directory itself gets the &amp;#8220;no deletion&amp;#8221; treatment as well.&lt;/p&gt;

	&lt;p&gt;The third block consists of the last three lines and restores some rights to non privileged users. Directories inherit the right to be read (&lt;code&gt;r&lt;/code&gt;), changed though (&lt;code&gt;x&amp;#60;/code), new files and subdirectories can be created (&amp;#60;code&amp;#62;rp&amp;#60;/code), and attributes of all sorts can be read (&amp;#60;code&amp;#62;aRc&lt;/code&gt;). We also allow synchronous file access (&lt;code&gt;s&lt;/code&gt;). Files are much the same, except that the write anywhere right is missing. Not that it would matter much if that were allowed here, since it has been explicitly denied earlier. Note that the right to append to a file (&lt;code&gt;p&lt;/code&gt;) is explicity allowed. The rights for the &lt;code&gt;incoming&lt;/code&gt; directory itself (last line) again match those inherited to subdirectories.&lt;/p&gt;

	&lt;p&gt;Let&amp;#8217;s see if that works out.&lt;/p&gt;

&lt;pre&gt;
$ id
uid=60003(smbnobody) gid=60003(smbnobody)
$ touch /tank/share/incoming/foo
$ ls -V /tank/share/incoming/foo
-r-xr-xr-x+  1 smbnobody   smbnobody         0 Dec 12 18:33 /tank/share/incoming/foo
               user:sun:-w--dD--------:------I:allow
              everyone@:-w--dD--------:------I:deny
              everyone@:r-xp--a-R-c--s:------I:allow
&lt;/pre&gt;

	&lt;p&gt;The unprivileged user &lt;code&gt;smbnobody&lt;/code&gt; (&lt;span class=&quot;caps&quot;&gt;SMB&lt;/span&gt; guest access is mapped to this uid) can create a new file in the incoming directory, and the file inherits the rights mentioned above (&lt;code&gt;I&lt;/code&gt; signifies an inherited right).&lt;/p&gt;

&lt;pre&gt;
$ cat /etc/passwd &amp;#62; /tank/share/incoming/foo
bash: /tank/share/incoming/foo: Permission denied
$ cat /etc/passwd &amp;#62;&amp;#62; /tank/share/incoming/foo
$
&lt;/pre&gt;

	&lt;p&gt;The user cannot overwrite the file (even though it is empty), but he can append to it.&lt;/p&gt;

&lt;pre&gt;
$ rm /tank/share/incoming/foo
rm: /tank/share/incoming/foo: override protection 555 (yes/no)? y
rm: /tank/share/incoming/foo not removed: Permission denied
$
&lt;/pre&gt;

	&lt;p&gt;Deletion is also denied. Good.&lt;/p&gt;

&lt;pre&gt;
$ id
uid=500(sun) gid=100(users)
$ cat /etc/passwd &amp;#62; /tank/share/incoming/foo
$ rm /tank/share/incoming/foo
$
&lt;/pre&gt;

	&lt;p&gt;However, the privileged user &lt;code&gt;sun&lt;/code&gt; can overwrite and delete the file.&lt;/p&gt;

	&lt;h3&gt;Samba configuration&lt;/h3&gt;

	&lt;p&gt;Samba also needs configuration to recognize and use the extended parmission system. The following is an excerpt from &lt;code&gt;smb.conf&lt;/code&gt;, describing the &lt;code&gt;incoming&lt;/code&gt; share:&lt;/p&gt;

&lt;pre&gt;
[incoming]
        path = /tank/share/incoming
        writable = yes
        guest ok = yes
        browseable = yes
        public = yes
        acl check permissions = False
        ea support = yes
        store dos attributes = no
        map readonly = no
        map archive = no
        map system = no
        map hidden = no
        vfs objects = zfsacl
        nfs4: mode = simple
        nfs4: acedup = dontcare
&lt;/pre&gt;

	&lt;p&gt;This configures Samba to use extended ACLs using the &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; (NFSv4) permission system.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 12 Dec 2009 18:57:28 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/26-guid.html</guid>
    
</item>
<item>
    <title>Tracing errors through the code</title>
    <link>http://www.skytale.net/blog/archives/20-Tracing-errors-through-the-code.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/20-Tracing-errors-through-the-code.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=20</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=20</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Open source is a great thing. This becomes especially obvious if one is confronted with a program that refuses to work, and furthermore refuses to yield any kind of helpful error message. Reading the source may be the only way to determine what is actually going on.&lt;/p&gt;

	&lt;p&gt;Sadly I&amp;#8217;ve been doing rather a lot of that lately, This post shall serve as an example how to navigate the Open Solaris source code in search of an answer.&lt;/p&gt;

	&lt;h3&gt;The problem&lt;/h3&gt;

	&lt;p&gt;This specific problem arose during my experiments to create a small Solaris installation for use in an embedded system (small in this context means around 60MB used disk space). More details on this later.&lt;/p&gt;

	&lt;p&gt;The system has a &lt;code&gt;cfgadm(1M)&lt;/code&gt; binary, but it does not work:&lt;/p&gt;

&lt;pre&gt;
# cfgadm
cfgadm: Library error: Device library initialize failed: Facility is not active
&lt;/pre&gt;

	&lt;p&gt;As error messages go this only marginally better that &amp;#8220;Failed&amp;#8221;, but not by much. Telling the user which exact facility is not active would have been helpful.&lt;/p&gt;

	&lt;p&gt;But at least there are some search friendly strings in there that may help to determine the source code responsible for this message.&lt;/p&gt;

	&lt;h3&gt;The source&lt;/h3&gt;

	&lt;p&gt;One thing the classical &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; source approach of &amp;#8220;all the source in one tree&amp;#8221; has going for it is that it makes searching in the source relatively easy. The Open Solaris web site has build a search engine above the source tree which automatically cross-references symbols in the code and has some other nice features. &lt;a href=&quot;http://src.opensolaris.org/source&quot;&gt;The entry page to the search engine is here.&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Searching for &amp;#8220;Facility is not active&amp;#8221; (note the quotes) yields just a handful of hits. One of those (in &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/sys/errno.h&lt;/code&gt;) hints that there is a system error (and corresponding symbol) called &lt;code&gt;ENOTACTIVE&lt;/code&gt; which belongs to this error message.&lt;/p&gt;

	&lt;p&gt;Running &lt;code&gt;cfgadm&lt;/code&gt; under &lt;code&gt;truss(1)&lt;/code&gt; confirms this:&lt;/p&gt;

&lt;pre&gt;
# truss cfgadm
execve(&amp;#34;/usr/sbin/cfgadm&amp;#34;, 0x08047E24, 0x08047E2C)  argc = 1
[...]
sysconfig(_CONFIG_PAGESIZE)                     = 4096
open(&amp;#34;/devices/pseudo/devinfo@0:devinfo&amp;#34;, O_RDONLY) = 3
ioctl(3, DINFOIDENT, 0x00000000)                = 57311
ioctl(3, 0x10DF00, 0x08047460)                  Err#73 ENOTACTIVE
close(3)                                        = 0
[...]
&lt;/pre&gt;

	&lt;p&gt;Things go kind of downhill from there. So some code opens the devinfo device, runs two IOCTLs on in and the second one fails. Furthermore, &lt;code&gt;truss&lt;/code&gt; only knows the first &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; by name, not the actually failing one.&lt;/p&gt;

	&lt;p&gt;Searching for the first name turns up &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/sys/devinfo_impl.h&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
#define DINFOIDENT (DIIOC | 0x82) /* identify the driver */
&lt;/pre&gt;

	&lt;p&gt;Looking around in this file some more yields two other definitions:&lt;/p&gt;

&lt;pre&gt;
#define  DIIOC       (0xdf&amp;#60;&amp;#60;8)
[...]
#define DINFOCACHE  (DIIOC | 0x100000) /* use cached data  */
&lt;/pre&gt;

	&lt;p&gt;So the second &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; is actually called &lt;code&gt;DINFOCACHE&lt;/code&gt;. Tracing IOCTLs through the code is, unfortunately, a bit tricky, because the routine that handles the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; depends on the passed file descriptor (the first parameter to the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; call). The file associated with the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; in this case belongs to the file &lt;code&gt;/devices/pseudo/devinfo@0:devinfo&lt;/code&gt; (see the &lt;code&gt;open&lt;/code&gt; call directly above the two IOCTLs).&lt;/p&gt;

	&lt;p&gt;But since the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; handling code most likely contains the symbol &lt;code&gt;DINFOCACHE&lt;/code&gt; as well (that&amp;#8217;s what constants are for, after all) searching for the name will turn up the correct file, possibly buried among others.&lt;/p&gt;

	&lt;p&gt;Armed this knowledge the search results for &lt;code&gt;DINFOCACHE&lt;/code&gt; can be narrowed down to one likely candidate: &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/io/devinfo.c&lt;/code&gt;. This file belongs to the kernel code (it lives in &lt;code&gt;usr/src/uts&lt;/code&gt;), and the name fits the name of the device opened above.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;DINFOCACHE&lt;/code&gt; appears twice in a function called &lt;code&gt;di_ioctl&lt;/code&gt;, which sounds good. Following the code flow through this function (&lt;code&gt;DINFOCACHE&lt;/code&gt; is passed in the &lt;code&gt;cmd&lt;/code&gt; parameter), the first relevant code part reads as follows:&lt;/p&gt;

&lt;pre&gt;
if ((st-&amp;#62;command &amp;#38; DINFOCACHE) &amp;#38;&amp;#38; !cache_args_valid(st, &amp;#38;error)) {
        di_freemem(st);
        (void) di_setstate(st, IOC_IDLE);
        return (error);
}
&lt;/pre&gt;

	&lt;p&gt;(By the time execution reaches this code the &lt;code&gt;cmd&lt;/code&gt; variable has been copied to &lt;code&gt;st-&amp;#62;command&lt;/code&gt;, more or less). &lt;code&gt;cache_valid_args&lt;/code&gt;, among other things, does the following:&lt;/p&gt;

&lt;pre&gt;
if (!modrootloaded || !i_ddi_io_initialized()) {
       CACHE_DEBUG((DI_ERR,
       &amp;#34;cache lookup failure: I/O subsystem not inited&amp;#34;));
       *error = ENOTACTIVE;
       return (0);
}
&lt;/pre&gt;

	&lt;p&gt;That looks pretty promising, as it sets the right error code if the condition holds. &lt;code&gt;modrootloadied&lt;/code&gt; is a kernel symbol, so &lt;code&gt;mdb(1)&lt;/code&gt; can be used to inspect this value in a running kernel.&lt;/p&gt;

&lt;pre&gt;
# mdb -k
Loading modules: [ unix genunix specfs mac cpu.generic uppc pcplusmp scsi_vhci
ufs sockfs ip hook neti sctp arp usba uhci sd lofs logindmux ptm random crypto
zfs ipc ]
&amp;#62; modrootloaded/X
modrootloaded:
modrootloaded:  1
&lt;/pre&gt;

	&lt;p&gt;That&amp;#8217;s not the culprit. &lt;code&gt;i_ddi_io_initialized()&lt;/code&gt; basically returns the value of &lt;code&gt;sysevent_daemon_init&lt;/code&gt;, so what about that?&lt;/p&gt;

&lt;pre&gt;
# mdb -k
Loading modules: [ unix genunix specfs mac cpu.generic uppc pcplusmp scsi_vhci
ufs sockfs ip hook neti sctp arp usba uhci sd lofs logindmux ptm random crypto
zfs ipc ]
&amp;#62; modrootloaded/X
modrootloaded:
modrootloaded:  1
&amp;#62; sysevent_daemon_init/X
sysevent_daemon_init:
sysevent_daemon_init:           0
&lt;/pre&gt;

	&lt;p&gt;Bingo. From the name of the variable the probable name of the not running facility (remember the original error message?) can be deduced: &lt;code&gt;svc:/system/sysevent:default&lt;/code&gt;, which, indeed, is not running on the minimal system. Starting it makes &lt;code&gt;cfgadm&lt;/code&gt; work.&lt;/p&gt;

	&lt;p&gt;That wasn&amp;#8217;t so hard, now was it?&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 29 May 2009 16:50:12 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/20-guid.html</guid>
    
</item>
<item>
    <title>Login via serial console</title>
    <link>http://www.skytale.net/blog/archives/19-Login-via-serial-console.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/19-Login-via-serial-console.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=19</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=19</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Getting a serial console (for login purposes) on OpenSolaris seems to be a two-sided operation. Either it is insultingly simple, or a convoluted mess. The two options I&amp;#8217;ve discovered so far, in order of difficulty.&lt;/p&gt;

	&lt;h3&gt;The easy way&lt;/h3&gt;

	&lt;p&gt;By default Solaris starts a login console on &lt;code&gt;/dev/console&lt;/code&gt;, whatever that happens to be at a given moment. Passing &lt;code&gt;-B console=ttya&lt;/code&gt; on the kernel command line (via &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt;) will change the primary system console to the first serial port in the system (what Linux calls &lt;code&gt;ttyS0&lt;/code&gt;), automagically creating a login prompt there when the system has finished booting.&lt;/p&gt;

	&lt;h3&gt;The hard way&lt;/h3&gt;

	&lt;p&gt;Assuming that for whatever reason &lt;code&gt;/dev/console&lt;/code&gt; is not supposed to be on &lt;code&gt;ttya&lt;/code&gt;, things move into twilight territory.&lt;/p&gt;

	&lt;p&gt;Historically a &lt;code&gt;getty&lt;/code&gt; was spawned from inittab, and that was it. Sometime in the past Solaris changed this behaviour to a more complicated scheme.&lt;/p&gt;

	&lt;p&gt;Login processes are handled by the Service Access Controller (&lt;code&gt;sac(1M)&lt;/code&gt;), which handles port monitors. Port monitors bind services to ports, for example &lt;code&gt;ttymon(1M)&lt;/code&gt;, which handles baud rates and spawning the login process. I have to admin that I have not completely understood the architectural design behind all this. As far as I was able to deduce from the manual pages for &lt;code&gt;pmadm(1M)&lt;/code&gt;, &lt;code&gt;ttyadm(1M)&lt;/code&gt; and &lt;code&gt;sacadm(1M)&lt;/code&gt; the default setting ought to produce a login prompt on the first two serial ports. Alas, it does not.&lt;/p&gt;

	&lt;p&gt;It looks like &lt;code&gt;ttymon&lt;/code&gt;s are no longer handled by &lt;span class=&quot;caps&quot;&gt;SAC&lt;/span&gt;, no matter what the documentation says, but are instead spawned directly by &lt;span class=&quot;caps&quot;&gt;SMF&lt;/span&gt;, specifically by &lt;code&gt;svc:/system/console-login&lt;/code&gt;. This &lt;span class=&quot;caps&quot;&gt;SVC&lt;/span&gt; has several instances that handle the login prompts on the virtual consoles for &lt;span class=&quot;caps&quot;&gt;VGA&lt;/span&gt;. Adding an instance for &lt;code&gt;ttya&lt;/code&gt; makes a login prompt appear on the first serial port. The following creates and activates this instance:&lt;/p&gt;

&lt;pre&gt;
# svccfg -f - &amp;#60;&amp;#60;EOF
select svc:/system/console-login
add ttya
select svc:/system/console-login:ttya
addpg ttymon application
setprop ttymon/device = astring: /dev/term/a
setprop ttymon/label = astring: console
setprop ttymon/modules = astring: ldterm,ttcompat
setprop ttymon/nohangup = boolean: true
setprop ttymon/prompt = astring: &amp;#34;`uname -n` ttya login:&amp;#34;
addpg general framework
setprop general/enabled = boolean: true
EOF
#
&lt;/pre&gt;

	&lt;p&gt;Please note that due to the default settings in &lt;code&gt;/etc/security/login&lt;/code&gt; root logins are not possible on this terminal.&lt;/p&gt;

	&lt;p&gt;Now I am waiting for one of two things to happen:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Someone telling me that I&amp;#8217;ve got it all wrong and that there&amp;#8217;s a better way to do things&lt;/li&gt;
		&lt;li&gt;Someone telling me that this is the official way to do it and that it is documented somwhere.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;I&amp;#8217;m not holding my breath on either one.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 28 Mar 2009 14:35:04 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/19-guid.html</guid>
    
</item>
<item>
    <title>iSCSI: Opensolaris target, Fedora initiator, with CHAP</title>
    <link>http://www.skytale.net/blog/archives/18-iSCSI-Opensolaris-target,-Fedora-initiator,-with-CHAP.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/18-iSCSI-Opensolaris-target,-Fedora-initiator,-with-CHAP.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=18</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=18</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;For some reason or another finding instructions on how to actually configure iSCSI for a rather simple and common use case (one target on Solaris, one initiator on Fedora, &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; authentication) seems to be pretty hard.&lt;/p&gt;

	&lt;p&gt;Either my google-fu is seriously broken today, or everyone except for me considers this to be so easy and obvious that it does not warrant documentation. Which, having done this for the last three hours, I seriously doubt. The Solaris side is actually documented quite well (I primarily used &lt;a href=&quot;http://blogs.everycity.co.uk/alasdair/2008/11/solaris-as-an-iscsi-server-with-zfs/&quot;&gt; this blog entry by alasdair&lt;/a&gt;), the Linux side is lacking. It does not help matters that both sides use identically named tools that work in completely different ways.&lt;/p&gt;

	&lt;p&gt;So, the deal is as follows:&lt;/p&gt;

	&lt;p&gt;One OpenSolaris system, acting as iSCSI target (that is the system presenting the storage space).&lt;/p&gt;

	&lt;p&gt;One Fedora Linux system, acting as iSCSI initiator (that is the system that wants to use the storage space)&lt;/p&gt;

	&lt;p&gt;Create 100GB storage space on the target and let the initiator connect to this storage space and create a filesystem on in. The connection has to be authenticated one way (the initiator presents credentials to the target).&lt;/p&gt;

	&lt;h3&gt;The Solaris side&lt;/h3&gt;

	&lt;p&gt;The system is running Nevada, the configuration here was done with build snv_110.&lt;/p&gt;

	&lt;p&gt;First, the iSCSI target software needs to be installed and enabled:&lt;/p&gt;

&lt;pre&gt;
# gkp.pl -d /mnt/Solaris_11/Product SUNWiscsitgtu
# svcadm enable iscsitgt:default
#
&lt;/pre&gt;

	&lt;p&gt;The backing store for the iSCSI volumes shall be provided by ZFS:&lt;/p&gt;

&lt;pre&gt;
# zfs create -o canmount=off tank/iscsi
# zfs create -V 100G -o shareiscsi=on tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
    iSCSI Name: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
    Alias: tank/iscsi/vol001
[...]
#
&lt;/pre&gt;

	&lt;p&gt;The &lt;code&gt;iSCSI Name&lt;/code&gt; will be different for each created volume. Per default this target will be available via all interfaces and IPs of the machine. Since this is not what I want in this special case the target is bound to a fixed IP by a construct called a Target Port Group Tag. The &lt;span class=&quot;caps&quot;&gt;TPGT&lt;/span&gt; used here has the number 1.&lt;/p&gt;

&lt;pre&gt;
# iscsitadm create tpgt 1
# iscsitadm modify tpgt -i 212.51.12.90 1
# iscsitadm list tpgt -v 1
TPGT: 1
    IP Address: 212.51.12.90
# iscsitadm modify target -p 1 tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
[...]
    TPGT list:
            TPGT: 1
[...]
#
&lt;/pre&gt;

	&lt;p&gt;In order to secure access to this volume some more the initiator is required to authenticate itself using &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; before access is granted. To do this three pieces of information are needed:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The iqn (basically a unique name) of the initiator&lt;/li&gt;
		&lt;li&gt;A username&lt;/li&gt;
		&lt;li&gt;A password&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The initiator used here has an iqn of &lt;code&gt;iqn.2005-03.com.max:01.cb5c4c&lt;/code&gt; (see below for the source of this information). The username is &lt;code&gt;lain&lt;/code&gt; and the password is &lt;code&gt;iscsipassword&lt;/code&gt; for the purpose of this demonstration. The password has to be between 12 and 16 charcters in length and should definitely be something stronger for production purposes.&lt;/p&gt;

&lt;pre&gt;
# iscsitadm create initiator -n iqn.2005-03.com.max:01.cb5c4c lain
# iscsitadm modify initiator --chap-name lain lain
# iscsitadm modify initiator --chap-secret lain
[...]
# iscsitadm list initiator -v
Initiator: lain
    iSCSI Name: iqn.2005-03.com.max:01.cb5c4c
    CHAP Name: lain
    CHAP Secret: Set
# iscsitadm modify target --acl lain tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
[...]
    ACL list:
            Initiator: lain
[...]
#
&lt;/pre&gt;

	&lt;p&gt;This concludes the Solaris side of things.&lt;/p&gt;

	&lt;h3&gt;The Fedora side&lt;/h3&gt;

	&lt;p&gt;The system is running Fedora Rawhide, close to the Fedora 11 Beta release at the time of this writing.&lt;/p&gt;

	&lt;p&gt;On the Linux side iSCSI is handled by the open-iscsi toolchain, packaged as &lt;code&gt;iscsi-initiator-utils&lt;/code&gt; in Fedora. To install it:&lt;/p&gt;

&lt;pre&gt;
# yum install iscsi-initiator-utils
[...]
#
&lt;/pre&gt;

	&lt;p&gt;Since the system in question is a notebook, and the iSCSI target may not be available at all times, the iSCSI service must be instructed not to connect to configured devices automatically:&lt;/p&gt;

&lt;pre&gt;
# perl -pi -e &amp;#39;s/node.startup.*/node.startup = manual/&amp;#39; /etc/iscsi/iscsid.conf
#
&lt;/pre&gt;

	&lt;p&gt;The initiator name mentioned in the Solaris section above can be configured freely on the system. A random value is created during package installation and saved in &lt;code&gt;/etc/iscsi/initiatorname.iscsi&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2005-03.com.max:01.cb5c4c
#
&lt;/pre&gt;

	&lt;p&gt;Be sure the name configured there matches the name defined in the initiator on the Solaris side. Even though a username/password pair was defined on the target credentials are not needed for target discovery (the process by which an initiator asks a target which iSCSI volumes are available):&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m discovery -t st -p 212.51.12.90
212.51.12.90:3260,1 iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
# iscsiadm -m node
212.51.12.90:3260,1 iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
#
&lt;/pre&gt;

	&lt;p&gt;The discovery process has found a single volume exported by the target and added it to the local node list. The iqn matches the value shown above in the Solaris section. Now the &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; credentials have to be added to the node so the initiator can actually connect to the volume:&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.authmethod&amp;#39; -v &amp;#39;CHAP&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.username&amp;#39; -v &amp;#39;lain&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.password&amp;#39; -v &amp;#39;iscsipassword&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39;
node.name = iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
node.tpgt = 1
node.startup = manual
[...]
node.session.auth.authmethod = CHAP
node.session.auth.username = lain
node.session.auth.password = ********
[...]
#
&lt;/pre&gt;

	&lt;p&gt;Now the volume can finally be accessed:&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; --login
Logging in to [iface: default, target: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8,
portal: 212.51.12.90,3260]
Login to [iface: default, target: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8,
portal: 212.51.12.90,3260]: successful
#
&lt;/pre&gt;

	&lt;p&gt;After some seconds a device node for this volume should appear in &lt;code&gt;/dev/disk/by-path&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
# ls /dev/disk/by-path/
ip-212.51.12.90:3260-iscsi-iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8-lun-0
[...]
#
&lt;/pre&gt;

	&lt;p&gt;The disk is ready to be used.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 24 Mar 2009 01:16:10 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/18-guid.html</guid>
    
</item>
<item>
    <title>Using pkgsrc on Opensolaris, Part 3</title>
    <link>http://www.skytale.net/blog/archives/17-Using-pkgsrc-on-Opensolaris,-Part-3.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/17-Using-pkgsrc-on-Opensolaris,-Part-3.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=17</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=17</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;h3&gt;Initial install&lt;/h3&gt;

	&lt;p&gt;&lt;code&gt;pkgsrc&lt;/code&gt; can be obtained in two main ways. The first is via anonymous &lt;span class=&quot;caps&quot;&gt;CVS&lt;/span&gt; checkout, the second is via quarterly tarball releases. Since the whole tree is several hundred megabytes (even without sources) and the NetBSD &lt;span class=&quot;caps&quot;&gt;CVS&lt;/span&gt; servers are permanently overloaded a tarball is the way to go for the initial install. The tarballs can be found in the NetBSD mirror structure, &lt;a href=&quot;ftp://ftp.netbsd.org/pub/pkgsrc/current&quot;&gt;the main mirror being here&lt;/a&gt;. At the time of this writing pkgsrc-2008Q4 is current.&lt;/p&gt;

	&lt;p&gt;The tarball already contains a pkgsrc directory at the top level, so it has to be unpacked under &lt;code&gt;/usr&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
# wget ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz
# gtar -xzf pkgsrc.tar.gz -C /usr
# chown -R builder: /usr/pkgsrc
&lt;/pre&gt;

	&lt;p&gt;This will unpack the tarball into the filesystem mounted at &lt;code&gt;/usr/pkgsrc&lt;/code&gt; and change the ownership to the build user created earlier.&lt;/p&gt;

	&lt;h3&gt;Patching gcc&lt;/h3&gt;

	&lt;p&gt;Unfortunately the gcc suite as delivered with Solaris has a small flaw, which will cause some packages to be built incorrectly (the most famous example is openssl, which will build but not work afterwards). Fortunately the bug has been tracked down &lt;a href=&quot;http://www.openssl.org/%7Eappro/values.c&quot;&gt;and a bandaid is available here&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;This file is a nice little hack in itself as it is a shell script and a C source file at the same time. If executed by a shell this file will be put though gcc three times to produce three object files, which are placed into a directory where the compiler can find them and use them instead of files that were delivered with the compiler.&lt;/p&gt;

&lt;pre&gt;
# bash ./values.c /usr/sfw/bin/gcc
[....]
# ls -l $(dirname $(/usr/sfw/bin/gcc -print-libgcc-file-name))
[...]
-rw-r--r-- 1 root root    763 2009-02-21 17:34 values-Xa.o
-rw-r--r-- 1 root root    763 2009-02-21 17:34 values-Xc.o
-rw-r--r-- 1 root root    763 2009-02-21 17:34 values-Xt.o
#
&lt;/pre&gt;

	&lt;h3&gt;Bootstrapping&lt;/h3&gt;

	&lt;p&gt;With this particular bug out of the way &lt;code&gt;pkgsrc&lt;/code&gt; needs to be bootstrapped. This means that the initial set of programs needed to build further packages (the package management itself and some helper programs) need to be built and installed on the host system. This has to be done as root. In order to find some programs it is necessary to expand the &lt;code&gt;$PATH&lt;/code&gt; a bit.&lt;/p&gt;

&lt;pre&gt;
# cd /usr/pkgsrc/bootstrap
# PATH=&amp;#34;$PATH:/usr/sfw/bin:/usr/xpg4/bin&amp;#34; ./bootstrap
[....]
#
&lt;/pre&gt;

	&lt;p&gt;Bootstrapping will take a while, but it should run though cleanly. Afterwards there should be some files in &lt;code&gt;/usr/pkg&lt;/code&gt; and running &lt;code&gt;/usr/pkg/sbin/pkg_info&lt;/code&gt; should list a handful of installed packages.&lt;/p&gt;

	&lt;h3&gt;Vulnerabilities and updates&lt;/h3&gt;

	&lt;p&gt;Packages need to be kept up-to-date, for new features as much as for possible vulnerabilites. In the latter department the bootstrap installed two programs to help with identifying such programs.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;/usr/pkg/sbin/download-vulnerability-list&lt;/code&gt; will fetch a list of vulnerable program versions. Builds of such versions will fail, unless explicitly requested otherwise. For already installed programs there is &lt;code&gt;/usr/sbin/pkg/audit-packages&lt;/code&gt; which will identify and list installed vulnerable versions.&lt;/p&gt;

	&lt;p&gt;Both programs should be used on a regular basis.&lt;/p&gt;

	&lt;p&gt;Updates of packages (whether due to a vulnerability or not) are best done via &lt;span class=&quot;caps&quot;&gt;CVS&lt;/span&gt;. Updates can be done on the whole package tree or on individual subtrees, as needed. Assuming an older installed version the following command will update the whole tree to 2008Q4:&lt;/p&gt;

&lt;pre&gt;
# su - builder
$ cd /usr/pkgsrc
$ cvs up -dPR -rpkgsrc-2008Q4
[...]
$
&lt;/pre&gt;

	&lt;p&gt;It&amp;#8217;s important to check the output of the &lt;span class=&quot;caps&quot;&gt;CVS&lt;/span&gt; command for eventual problems, especially if local modifications to packages have been done.&lt;/p&gt;

	&lt;h3&gt;Host tools&lt;/h3&gt;

	&lt;p&gt;There are a number of tools that are used by a large number of packages during the build process. &lt;code&gt;pkgsrc&lt;/code&gt; will build all of these from source if necessary, but most of them can be supplied by the host system instead.&lt;/p&gt;

	&lt;p&gt;Among these tools are&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; m4&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; make&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; gettext&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; tar&lt;/li&gt;
		&lt;li&gt;Perl&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; patch&lt;/li&gt;
		&lt;li&gt;unzip&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;BISON&lt;/span&gt; &amp;amp; &lt;span class=&quot;caps&quot;&gt;FLEX&lt;/span&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; make and &lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; tar are already installed, the rest of the packages can be found on the Solaris install media. The rest can easily be installed:&lt;/p&gt;

&lt;pre&gt;
# gkp.pl -d /mnt/Solaris_11/Product SUNWgm4 SUNWgnu-gettext SUNWgpch SUNWunzip \
SUNWbison SUNWflexlex
[...]
#
&lt;/pre&gt;

	&lt;p&gt;Now &lt;code&gt;pkgsrc&lt;/code&gt; has to be made aware of these tools in order to use them. The main config file is &lt;code&gt;/usr/pkg/etc/mk.conf&lt;/code&gt;. Adding the following statements somewhere above the final &lt;code&gt;.endif&lt;/code&gt; will make &lt;code&gt;pkgsrc&lt;/code&gt; use the host version of the above mentioned tools instead of building it&amp;#8217;s own:&lt;/p&gt;

&lt;pre&gt;
# SUNWgm4
TOOLS_PLATFORM.m4=              /usr/bin/gm4
TOOLS_PLATFORM.gm4=             /usr/bin/gm4
# SUNWgmake
TOOLS_PLATFORM.gmake=           /usr/bin/gmake
# SUNWgnu-gettext
TOOLS_PLATFORM.msgfmt=          /usr/bin/gmsgfmt
# SUNWgtar
TOOLS_PLATFORM.tar=             /usr/bin/gtar
TOOLS_PLATFORM.bsdtar=          /usr/bin/gtar
# SUNWgpch
TOOLS_PLATFORM.patch=           /usr/bin/gpatch
TOOLS_PLATFORM.gpatch=          /usr/bin/gpatch
#
TOOLS_PLATFORM.perl=            /usr/bin/perl
# SUNWunzip
TOOLS_PLATFORM.unzip=           /usr/bin/unzip
# SUNWbison
TOOLS_PLATFORM.bison=           /usr/bin/bison
TOOLS_PLATFORM.bison-yacc=      /usr/bin/bison -y
# SUNWflexlex
TOOLS_PLATFORM.lex=             /usr/bin/flex
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Mon, 23 Mar 2009 02:47:00 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/17-guid.html</guid>
    
</item>
<item>
    <title>Using pkgsrc on Opensolaris, Part 2</title>
    <link>http://www.skytale.net/blog/archives/16-Using-pkgsrc-on-Opensolaris,-Part-2.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/16-Using-pkgsrc-on-Opensolaris,-Part-2.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=16</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=16</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Preparing the system for &lt;code&gt;pkgsrc&lt;/code&gt; involves several steps. A compiler has to be installed to bootstrap &lt;code&gt;pkgsrc&lt;/code&gt;, and a directory structure has to be prepared in which the files downloaded and generated will be stored. Moreover, it is a good idea to create a special user which will be used to build software.&lt;/p&gt;

	&lt;h3&gt;Compiler environment&lt;/h3&gt;

	&lt;p&gt;The Solaris core installation does not come with a compiler, but a version of &lt;span class=&quot;caps&quot;&gt;GCC&lt;/span&gt; 3 can be found on the &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; (3.4.3 in snv_109). &lt;code&gt;pkgsrc&lt;/code&gt; will also work with the proprietary Sun compiler suite, but that is beyond the scope here.&lt;/p&gt;

	&lt;p&gt;In addition to the compiler itself several other programs are needed to get &lt;code&gt;pkgsrc&lt;/code&gt; off the ground.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Binutils (SUNWbinutils)&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; Make (SUNWgmake)&lt;/li&gt;
		&lt;li&gt;System header files (SUNWhea)&lt;/li&gt;
		&lt;li&gt;System libraries (SUNWlibmr, SUNWlibm)&lt;/li&gt;
		&lt;li&gt;XPG4 compatible system utilities (SUNWxcu4)&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The complete command line for installing all this is&lt;/p&gt;

&lt;pre&gt;
# gkp.pl -d /mnt/Solaris_11/Product SUNWarc SUNWgccruntime SUNWbinutils SUNWgcc \
SUNWgmake SUNWhea SUNWlibmr SUNWlibm SUNWxcu4 SUNWsprot
&lt;/pre&gt;

	&lt;p&gt;The compiler is installed into &lt;code&gt;/usr/sfw/bin&lt;/code&gt; by default, which is not in the system search path.&lt;/p&gt;

	&lt;h3&gt;Directories and users&lt;/h3&gt;

	&lt;p&gt;By default &lt;code&gt;pkgsrc&lt;/code&gt; uses three directories on the system, in which all files are installed.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;/usr/pkg&lt;/code&gt; for installed packages&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;/usr/pkgsrc&lt;/code&gt; for the source tree&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;/var/db/pkg&lt;/code&gt; for the package database&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;There is no good reason to change these defaults here. &lt;code&gt;/usr/pkg&lt;/code&gt; and &lt;code&gt;/usr/pkgsrc&lt;/code&gt; will get their own &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; filesystems, while &lt;code&gt;/var/db/pkg&lt;/code&gt; will just be a directory.&lt;/p&gt;

&lt;pre&gt;
# zfs create -o mountpoint=/usr/pkg rpool/pkg
# zfs create -o mountpoint=/usr/pkgsrc rpool/pkgsrc
&lt;/pre&gt;

	&lt;p&gt;These two commands create two new filesystems on the root pool and set the mount points to the correct directories. The filesystems are automatically mounted and are immediately ready to be used.&lt;/p&gt;

	&lt;p&gt;Having a special user for building packages instead of using root is a good idea in general. It protects the system from eventual errors in the build system, which might cause files to be written outside the build root (even if those files are completely harmless and not malicious they are a nuisance nonetheless). The build user should also have no special privileges on the system.&lt;/p&gt;

&lt;pre&gt;
# useradd -d /export/home/builder -m -s /usr/bin/bash -c &amp;#34;pkgsrc build user&amp;#34; builder
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Tue, 17 Mar 2009 17:43:19 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/16-guid.html</guid>
    
</item>
<item>
    <title>Using pkgsrc on Opensolaris, Part 1</title>
    <link>http://www.skytale.net/blog/archives/15-Using-pkgsrc-on-Opensolaris,-Part-1.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/15-Using-pkgsrc-on-Opensolaris,-Part-1.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=15</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=15</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Even though Solaris comes with a large selection of software these days (and some of it in recent versions) there still will be software that is not on the install media. In my case the greatest itch was &lt;a href=&quot;http://libtorrent.rakshasa.no/&quot;&gt;rtorrent&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;I was not too keen on the idea of building everything from scratch the classic way (&lt;code&gt;tar; configure; make; make install;&lt;/code&gt;), as this makes tracking software versions and removing software somewhat more complicated than I prefer it to be. If there had to be compiling it would have to come with some kind of system that kept track of the various programs it had compiled.&lt;/p&gt;

	&lt;p&gt;All this sounded a lot like the FreeBSD ports system to me which I found to be unavailable on Solaris. But the general idea was sound, and in the immediate neighbourhood I discovered the &lt;a href=&quot;http://www.pkgsrc.org/&quot;&gt;NetBSD &lt;code&gt;pkgsrc&lt;/code&gt;&lt;/a&gt; system.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;pkgsrc&lt;/code&gt; is what the ports system is to FreeBSD, a directory tree containing files describing the method to build a certain piece of software (dependencies, source files, patches and so on). It is primarily developed for NetBSD, of course, but over the years support for other &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; like operating systems has been added, allowing the system to build software on non-NetBSD systems. Solaris has been on the list of supported systems for several years now.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;pkgsrc&lt;/code&gt; is able to build a self-contained software repository on the guest system, including it&amp;#8217;s own compiler, binutils and all the other utilities needed to build software. Of course it will initially need a compiler supplied by the guest system, but it&amp;#8217;s not necessary to keep using that compiler. In other words, &lt;code&gt;pkgsrc&lt;/code&gt; can pull a complete Münchhausen, if needed.&lt;/p&gt;

	&lt;p&gt;On the other hand it can be instructed to use the compiler and tools supplied by the guest operating system, if those are available and recent enough, so that just software that the guest system does not supply is built by &lt;code&gt;pkgsrc&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;pkgsrc&lt;/code&gt; will by default use it&amp;#8217;s own dedicated directory tree to keep the software built by it and write only a minimum amount of files into the guest systems file system space. Getting rid of &lt;code&gt;pkgsrc&lt;/code&gt; can be as simple as removing three directories (the source tree, the binary tree and the package database tree).&lt;code&gt;pkgsrc&lt;/code&gt; also builds it&amp;#8217;s own package management tools that allow clean deinstallation of it&amp;#8217;s packages.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 12 Mar 2009 17:59:07 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/15-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 6</title>
    <link>http://www.skytale.net/blog/archives/14-Building-an-OpenSolaris-storage-Software,-Part-6.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/14-Building-an-OpenSolaris-storage-Software,-Part-6.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=14</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=14</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Since I tend to forget these things, here&amp;#8217;s a short list showing various package management tasks.&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Task &lt;/th&gt;
			&lt;th&gt;&lt;span class=&quot;caps&quot;&gt;RPM&lt;/span&gt; &lt;/th&gt;
			&lt;th&gt;pkg (Solaris) &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; List all installed packages &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -qa&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkginfo&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Show all files belonging to an installed package &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -ql [package]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkgchk -l [package] | grep Pathname&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Find package owning a file &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -qf [filename]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkgchk -l -p [filename]&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt; 
    </content:encoded>

    <pubDate>Wed, 11 Mar 2009 20:50:18 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/14-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 5</title>
    <link>http://www.skytale.net/blog/archives/13-Building-an-OpenSolaris-storage-Software,-Part-5.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/13-Building-an-OpenSolaris-storage-Software,-Part-5.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=13</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=13</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Some releases ago Solaris introduces a Role Bases Access System (details and introduction &lt;a href=&quot;http://developers.sun.com/developer/technicalArticles/opensolaris/pfexec.html&quot;&gt;here&lt;/a&gt;). The upshot of this is that Profiles can be attached to a user account, giving this account elevated privileges for some tasks.&lt;/p&gt;

	&lt;p&gt;The main administrator account should probably be able to execute all command with root privileges. Linux/&lt;span class=&quot;caps&quot;&gt;BSD&lt;/span&gt; systems use &lt;code&gt;sudo&lt;/code&gt; for this, Solaris has &lt;code&gt;pfexec&lt;/code&gt;. From a high level standpoint those two commands serve much the same purpose.&lt;/p&gt;

	&lt;p&gt;Almost all tutorials about &lt;code&gt;pfexec&lt;/code&gt; will mention the &amp;#8220;Primary Administrator&amp;#8221; profile, which will give an account the permissions to execute every command as root. The rub is that a (reduced) Solaris install does not contain this profile. Instead, it is hidden in the SUNWwbcor package. It has to be installed separately.&lt;/p&gt;

&lt;pre&gt;
# gkp.pl -d /mnt/Solaris_11/Product SUNWwbcor
[...]
# usermod -P&amp;#39;Primary Administrator&amp;#39; admin
# su - admin
$ id
uid=500(admin) gid=100(users)
$ pfexec id
uid=0(root) gid=0(root)
&lt;/pre&gt;

	&lt;p&gt;The admin user can now execute every command as root without needing the root password (or any password, for that matter) simply by prefixing it with &lt;code&gt;pfexec&lt;/code&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 06 Mar 2009 20:51:10 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/13-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 4</title>
    <link>http://www.skytale.net/blog/archives/12-Building-an-OpenSolaris-storage-Software,-Part-4.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/12-Building-an-OpenSolaris-storage-Software,-Part-4.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=12</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;After the newly installed system has booted for the first time it is time to make Solaris a bit more homely. This involves installing a number of packages, which brings me neatly to the first thing that annoys me (and probably a lot of other people used to current Linux distributions): the package management is an absolute mess.&lt;/p&gt;

	&lt;p&gt;Most Linux distributions take a two-tiered approach to package management: there are low level tools that allow installation of one or more packages, reading from a local filesystem, removal of packages, listing information about packages and so on. &lt;span class=&quot;caps&quot;&gt;RPM&lt;/span&gt; is an example of this, as is &lt;span class=&quot;caps&quot;&gt;DPKG&lt;/span&gt;.&lt;/p&gt;

	&lt;p&gt;Then there are high level tools that know about local and remote collections of packages, can resolve dependencies for package installation and removal. &lt;span class=&quot;caps&quot;&gt;YUM&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;APT&lt;/span&gt; and PackageKit are examples of these tools.&lt;/p&gt;

	&lt;p&gt;Unless something is severely broken the high level tools are used for package management in the usual cases. Noone actually wants to do all the manual dependency solving and package downloading themselves, that&amp;#8217;s what computers are for, after all.&lt;/p&gt;

	&lt;p&gt;Unfortunately all Solaris provides are tools of the first category. While I understand that changing the low level tools is impossible for binary compatibility reasons I do not see a reason why high level tools for handling all the grunt work are not being provided.&lt;/p&gt;

	&lt;p&gt;The logical response to this dilemma is to write a rudimentary high level tool which takes away some of the pain. My version is written in Perl (which, astoundingly, is part of the core install, and not even insultingly old). Currently all it can do is install packages. It relies on the dependency information in the Solaris packages, which is spotty at best.&lt;/p&gt;

	&lt;p&gt;So, lets make this system a bit more habitable.&lt;br /&gt;
&lt;pre&gt;
mount -F nfs 10.200.200.1:/jumpstart /mnt
gkp.pl -d /mnt/Solaris/Product SUNWgcmn SUNWwgetr SUNWwgetu SUNWntpr SUNWntpu SUNWgtar \
SUNWsshcu SUNWsshr SUNWsshu SUNWsshdr SUNWsshdu SUNWbash SUNWless SUNWdoc SUNWman \
SUNWgnu-coreutils SUNWtoo
&lt;/pre&gt;&lt;/p&gt;

	&lt;p&gt;Among other things this will install&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Bash&lt;/li&gt;
		&lt;li&gt;wget&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; tar&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;SSH&lt;/span&gt; server and client&lt;/li&gt;
		&lt;li&gt;man pages&lt;/li&gt;
	&lt;/ul&gt;

	&lt;h3&gt;Setting the root shell&lt;/h3&gt;

	&lt;p&gt;I probably won&amp;#8217;t make many friends here, but I like bash. And I also like  a root shell I can actually work with. So, root gets a bash. Contrary to what other people might say this is an absolutely harmless change on modern Solaris systems. &lt;code&gt;/bin/sh&lt;/code&gt; still points to ksh (and that should not be changed), but the shell of the root account is not important to the work of the system itself. And should the root shell be unavailable or broken Solaris will fall back to &lt;code&gt;/bin/sh&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
usermod -s /usr/bin/bash root
&lt;/pre&gt;

	&lt;h3&gt;Configuring &lt;span class=&quot;caps&quot;&gt;SSH&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;Working on the console itself is tedious, so getting &lt;span class=&quot;caps&quot;&gt;SSH&lt;/span&gt; up and running is important. Even though the packages are installed they are not configured or enabled yet.&lt;/p&gt;

	&lt;p&gt;First, though, I usually define a special group to which accounts which are allowed to ssh into the system are added. Then the keys are generated, and finally ssh is enabled.&lt;/p&gt;

&lt;pre&gt;
groupadd sshusers
echo &amp;#34;AllowGroups sshusers&amp;#34; &amp;#62;&amp;#62; /etc/ssh/sshd_config
/lib/svc/method/sshd -c
svcadm enable ssh
&lt;/pre&gt;

	&lt;h3&gt;Security settings&lt;/h3&gt;

	&lt;p&gt;By default Solaris creates &lt;code&gt;crypt&lt;/code&gt; encrypted passwords. While this is compatible with almost every &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; system since the later jurassic, it is certainly no longer up to date. The following will change the password algorithm to the &lt;span class=&quot;caps&quot;&gt;BSD&lt;/span&gt; (and Linux) compatible version of MD5.&lt;/p&gt;

&lt;pre&gt;
perl -pi -e &amp;#39;s/^CRYPT_DEFAULT=.*/CRYPT_DEFAULT=1/&amp;#39; /etc/security/policy.conf
&lt;/pre&gt;

	&lt;p&gt;This will &lt;em&gt;not&lt;/em&gt; change existing accounts. Only newly created password hashes are affected. This means that the root password should be set again, to create a new hash.&lt;/p&gt;

	&lt;h3&gt;Adding normal users&lt;/h3&gt;

	&lt;p&gt;Working as root is a bad idea, so adding normal users is the order of the  day to do normal work on the system. I prefer to have a special group containing all normal users, so this has to be added as well. &lt;/p&gt;

	&lt;p&gt;In addition, giving every user a separate &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; filesystem as home directory is a good idea. The dataset &lt;code&gt;rpool/export/home&lt;/code&gt; does already exist, the installer created it.&lt;/p&gt;

	&lt;p&gt;Since this is going to be a storage system without a lot of users there is no big problem with &lt;code&gt;/export/home&lt;/code&gt; living on &lt;code&gt;rpool&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
groupadd users
zfs create rpool/export/home/admin
useradd -g users -G sshusers -d /export/home/admin -s /usr/bin/bash \
 -c &amp;#34;Admin User&amp;#34; -m admin
chown -R admin:users ~admin
&lt;/pre&gt;

	&lt;p&gt;The user becomes a member of the &lt;code&gt;sshusers&lt;/code&gt; group and can thus login via &lt;span class=&quot;caps&quot;&gt;SSH&lt;/span&gt; (after a password is set).&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 06 Mar 2009 16:13:21 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/12-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 3</title>
    <link>http://www.skytale.net/blog/archives/11-Building-an-OpenSolaris-storage-Software,-Part-3.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/11-Building-an-OpenSolaris-storage-Software,-Part-3.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=11</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=11</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Installing Solaris can be a strange experience for someone who is only used to modern time Linux installers. Yes, there is a graphical installer, but it consists of little more than an X windows which basically asks the same questions as the text mode installer. Unless you already know how to install Solaris, and what the installer expects of you some of the questions and dialogs seem a little strange.&lt;/p&gt;

	&lt;p&gt;Due to Solaris&amp;#8217; focus on binary compatibility some of the defaults don&amp;#8217;t make that much sense anymore, either, but changing them to more sensible defaults would cause confusion, or so it seems.&lt;/p&gt;

	&lt;p&gt;For the install on the storate system, though, most of the defaults are sensible, and since Solaris does not have to share any disks withother operating systems the partitioning process is not that painful, either.&lt;/p&gt;

	&lt;p&gt;The first question the installer asks (always in text mode) is about the general installaton mode the user wishes to perform (roughly graphical/text based or rescue shell). Interactive/text mode (option 4) is usually fine.&lt;/p&gt;

	&lt;p&gt;If the system has booted from the network the installer will not ask about IP configuration for the network cards but assume &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; for IPv4.&lt;/p&gt;

	&lt;p&gt;The question about the name resolution service is one of the odd quirks in the installer. The naming service defaults to &lt;span class=&quot;caps&quot;&gt;NIS&lt;/span&gt;, which is probably wrong for almost any new installation on this planet. Usually &lt;span class=&quot;caps&quot;&gt;DNS&lt;/span&gt; is the right choice here. The installer will then ask for the &lt;span class=&quot;caps&quot;&gt;DNS&lt;/span&gt; server IPs and default domains. If the installer can not resolve the current machine IP via these nameservers it will explicitly ask for confirmation that the data is really right.&lt;/p&gt;

	&lt;p&gt;The default answers for the next questions (Kerberos/NFS4) are sensible in the usual cases.&lt;/p&gt;

	&lt;p&gt;When asked for the file system to use for the root filesystem the default is &lt;span class=&quot;caps&quot;&gt;UFS&lt;/span&gt;. Change it to &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt;. I prefer to use separate datasets for &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;/var&lt;/code&gt;, but that is a matter of personal taste.&lt;/p&gt;

	&lt;p&gt;The (almost) final question is for the amount of packages to be installed. The installer offers five predefined groups, ranging from several hundred to almost three gigabytes of installed data. Selecting the smallest set will do fine here, the system will boot, have network and &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt; client support, which is enough to get at the rest of the packages to install later.&lt;/p&gt;

	&lt;p&gt;That&amp;#8217;s it, basically. The installer will now copy the files to the boot disk, prepare the bootloader and restart the system.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 22 Feb 2009 16:35:11 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/11-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 2</title>
    <link>http://www.skytale.net/blog/archives/10-Building-an-OpenSolaris-storage-Software,-Part-2.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/10-Building-an-OpenSolaris-storage-Software,-Part-2.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=10</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=10</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;After solving the cache issue on the &lt;span class=&quot;caps&quot;&gt;MSI&lt;/span&gt; board it was time to install the OS for real. I had planned to do the install via the network, for two reasons.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;To avoid having to burn a &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; for this&lt;/li&gt;
		&lt;li&gt;To find out how to do it&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;Installing Solaris via the network has been supported for a very long time, and Solaris being what it is the process has not changed very much. That means that there are some quirks in it.&lt;/p&gt;

	&lt;p&gt;Because this was the first Solaris installation in my network some non-Solaris machine had to take over the job of providing the various services needed for an installation. The job was delegated to my notebook running Linux.&lt;/p&gt;

	&lt;p&gt;The following services are needed to install Solaris over the network:
	&lt;ul&gt;
		&lt;li&gt;A &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; server&lt;/li&gt;
		&lt;li&gt;A &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server&lt;/li&gt;
		&lt;li&gt;An &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt; server&lt;/li&gt;
	&lt;/ul&gt;&lt;/p&gt;

	&lt;p&gt;In addition to that some software:
	&lt;ul&gt;
		&lt;li&gt;A Solaris medium (obviously)&lt;/li&gt;
		&lt;li&gt;A bootloader (I&amp;#8217;ll use &lt;a href=&quot;http://syslinux.zytor.com/&quot;&gt;SYSLINUX&lt;/a&gt;, at least version 3.73 required)&lt;/li&gt;
	&lt;/ul&gt;&lt;/p&gt;

	&lt;p&gt;First and foremost, though, the network card in the system that is to be the target of the installation needs to support &lt;a href=&quot;http://en.wikipedia.org/wiki/Preboot_Execution_Environment&quot;&gt;PXE&lt;/a&gt;. &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; is a method that defines a way for a network card &lt;span class=&quot;caps&quot;&gt;BIOS&lt;/span&gt; to obtain an IP address via &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; and load a piece of software from the network, which is then executed by the system. In addition &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; provides a handful of library functions that give the just loaded software a way to talk to the network itself (to load even more software, for example).&lt;/p&gt;

	&lt;p&gt;Most modern network cards and BIOSes support &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; and booting from the network. If this is not the case the nice people over at &lt;a href=&quot;http://etherboot.org&quot;&gt;etherboot.org&lt;/a&gt; have a large library of network card specific code that can be booted via a floppy disk or a bootable &lt;span class=&quot;caps&quot;&gt;CDROM&lt;/span&gt; which will provide the network card with the appropriate capabilities.&lt;/p&gt;

	&lt;p&gt;A dedicated network will be used for the installation, namely 10.200.200.0/24. The install server has the IP 10.200.200.1.&lt;/p&gt;

	&lt;h3&gt;Preparing the tftpboot directory&lt;/h3&gt;

	&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server will serve it&amp;#8217;s files from the &lt;code&gt;/tftpboot&lt;/code&gt; directory. The following structure is expected there:&lt;/p&gt;

&lt;pre&gt;
/tftpboot/
|-- mboot.c32
|-- pxelinux.0
|-- pxelinux.cfg
|   `-- default
`-- solaris
    |-- platform
    |   `-- i86pc
    |       `-- kernel
    |           `-- unix
    `-- x86.miniroot
&lt;/pre&gt;

	&lt;p&gt;The &lt;code&gt;mboot.c32&lt;/code&gt; and &lt;code&gt;pxelinux.0&lt;/code&gt; files come from the &lt;span class=&quot;caps&quot;&gt;SYSLINUX&lt;/span&gt; bootloader package. &lt;code&gt;pxelinux.cfg/default&lt;/code&gt; is the configuration file for the &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; bootloader. It is loaded and read when &lt;code&gt;pxelinux.0&lt;/code&gt; runs. It has the following content:&lt;/p&gt;

&lt;pre&gt;
DEFAULT jumpstart
LABEL jumpstart
  KERNEL mboot.c32
  APPEND -solaris solaris/platform/i86pc/kernel/unix -v -m verbose -B install_media=10.200.200.1:/jumpstart  --- solaris/x86.miniroot
&lt;/pre&gt;

	&lt;p&gt;The parameters describe the path of the kernel image under the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server root (&lt;code&gt;solaris/platform/i86pc/kernel/unix&lt;/code&gt;), request a verbose startup (&lt;code&gt;-v -m verbose&lt;/code&gt;), select the install method, server and path (&lt;code&gt;-B install_media=10.200.200.1:/jumpstart&lt;/code&gt;) and the describe the path to the miniroot which contains the installer (&lt;code&gt;solaris/x86.miniroot&lt;/code&gt;).&lt;/p&gt;

	&lt;p&gt;The two files in the &lt;code&gt;solaris&lt;/code&gt; directory are found on the Solaris install media under the &lt;code&gt;/boot&lt;/code&gt; directory in a similar directory structure. It is important that this structure is retained (even if it seems a bit pointless).&lt;/p&gt;

	&lt;h3&gt;Preparing the &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; server&lt;/h3&gt;

	&lt;p&gt;There is not much to this, really, all that is required (besides the obvious IP address and netmask) is the IP address of the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server and the filename of the &lt;span class=&quot;caps&quot;&gt;SYSLINUX&lt;/span&gt; bootloader in the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; directory structure. The complete config file (for the &lt;span class=&quot;caps&quot;&gt;ISC&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; server) looks like this:&lt;/p&gt;

&lt;pre&gt;
subnet 10.200.200.0 netmask 255.255.255.0 {
    range 10.200.200.128 10.200.200.200;
    option routers 10.200.200.1;
    option subnet-mask 255.255.255.0;
    next-server 10.200.200.1;
    filename &amp;#34;/pxelinux.0&amp;#34;;
}
&lt;/pre&gt;

	&lt;h3&gt;Preparing the &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt; server&lt;/h3&gt;

	&lt;p&gt;There are several ways to present the contents of the install media via &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt;, but for this install the method that worked best for me was to simply mount the &lt;span class=&quot;caps&quot;&gt;ISO&lt;/span&gt; into a directory and share that via &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt;.&lt;/p&gt;

&lt;pre&gt;
# mkdir /jumpstart
# mount -o ro,loop /tmp/nv105.iso /jumpstart
&lt;/pre&gt;

	&lt;p&gt;The entry in &lt;code&gt;/etc/exports&lt;/code&gt; looks like this:&lt;/p&gt;

&lt;pre&gt;
/jumpstart      *(ro,no_subtree_check,sec=sys)
&lt;/pre&gt;

	&lt;h3&gt;Putting it all together&lt;/h3&gt;

	&lt;p&gt;That should be it, basically. If the machine is turned on and set to boot from the network the following chain of events will take place, provided all goes well:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;BIOS&lt;/span&gt; sends &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; requests&lt;/li&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; server answers the requests, assigning an IP address and the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server information&lt;/li&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;PXE&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;BIOS&lt;/span&gt; loads &lt;code&gt;/pxelinux.0&lt;/code&gt; from the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server and executes it&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;/pxelinux.0&lt;/code&gt; loads &lt;code&gt;/pxelinux.cfg/default&lt;/code&gt; from the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server and interpets it as a config file&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;/pxelinux.0&lt;/code&gt; loads the Solaris kernel and miniroot from the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server and runs the kernel&lt;/li&gt;
		&lt;li&gt;The Solaris kernel boots, mounts the miniroot and starts the installer and re-requests the &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; address&lt;/li&gt;
		&lt;li&gt;The installer mounts the &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt; directory&lt;/li&gt;
	&lt;/ul&gt; 
    </content:encoded>

    <pubDate>Mon, 16 Feb 2009 15:05:46 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/10-guid.html</guid>
    
</item>

</channel>
</rss>