Monday, August 30, 2010

GlassFish v3 on OpenSolaris

OpenSolaris is dead as a distro, but it is still around, unless it's content moved/migrated to Nexenta or, later, IllumOS. Today I've got weird error from GlassFish v3 after installation. Apparently that's because OpenSolaris has chronically screwed up locales (one never grows up). Here is the way how the thing looks like in all its glory:
Waiting for DAS to start ..Error starting domain: domain1.
The server exited prematurely with exit code 6.
Before it died, it produced the following output:

UTF ERROR ["../../../src/solaris/instrument/EncodingSupport_md.c":66]: Failed to complete
iconv_open() setup
So the cure is quite simple: fix that broken locale (in fact, broken locale breaks other things anyway). To do so, install SUNWlang-enUS from the IPS and add export LANG=en_US.UTF-8 in your .profile to make it default. Maybe also good idea to add it to the skeleton... :)

Tuesday, August 17, 2010

Mirroring ZFS rpool

OK, time to mirror my rpool. Apparently, it rendered for that works with FreeBSD, but does not with Solaris. (WTF!?)
# zpool attach rpool c0t0d0 c0t1d0
cannot label 'c0t1d0': EFI labeled devices are not supported on root pools.
Ewww... :-(

Here is the steps to cure this illness:
  1. format -e will give you all the drives available.
  2. If you found one it needs to be formatted, use fdisk and create 100% Solaris2 partition.
  3. Your drive supposed to be in /dev/rdsk/ somewhere (don't forget to look in "rdsk", instead in "dsk"). In my case /dev/rdsk/c0t1d0
  4. Fix broken bones for the Disk Format:
    prtvtoc /dev/rdsk/c0t0d0 | fmthard -s - /dev/rdsk/c0t1d0
    Then fmthard should tell you something like: "New volume table of the contents now in place". If it didn't — you're out of luck and try to figure out why. :-)
  5. Try to attach a drive to rpool, but it may scream, something like this:
    zpool attach rpool c0t0d0 c0t1d0
    invalid vdev specification
    use '-f' to override the following errors:
    /dev/dsk/c0t0d0 overlaps with /dev/dsk/c0t1d0

    Well, so be it. Use '-f' option to force it:

    zpool attach -f rpool c0t0d0 c0t1d0

    Please be sure to invoke installgrub(1M) to make 'c0t1d0' bootable.
    Make sure to wait until resilver is done before rebooting.
  6. Normally, you're done: zpool status should show you a mirrored rpool. But you're almost there: still you need to install GRUB.
  7. Install GRUB this way:
    installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0
Basically this is it, now you might try to boot from another drive. But wait your rpool resilvered though... :-)

Wednesday, June 02, 2010

Fight with OpenNMS on OpenSolaris

I've tried to install OpenNMS on OpenSolaris from standalone installer (shipped in one single JAR file that you suppose to run). Everything fine (mostly) as long as you follow the instructions, but some ugly things needs to be mentioned:
  • Your JRE is not enough. See, OpenNMS will ask you to install full blown JDK. What for — I have no idea. But that's why we hate most Java developers: they are unable to make cute small things in most cases.
  • Your PostgreSQL will say something rude to the installer and latter will be upset, asking you personal questions. So make sure, in prior to running the installer, you did the following:
    postgres=# create user opennms with password 'opennms';

    postgres=# alter user opennms with password 'opennms';
    ALTER ROLE

    postgres=# create database opennms owner opennms;
    CREATE DATABASE

    postgres=# grant all privileges on database opennms to opennms;
    GRANT
  • You changed your passwords for "opennms" user in DB and also you fixed your trust store where password it "changeit".
Everything else should work, as long as your ports are opened properly. In order to know if something wrong (and it usually is), try to see what's running and what's not by issuing a command:

$OPEN_NMS/bin/opennms -v status

This will list all the processes and will show you the status.

Thursday, May 13, 2010

Cloud vs Grid computing

Folks, enough!
There is no such thing as "versus" and it is not anything that you don't know yet. Grid computing is an engine on a chassis, where cloud computing is a complete car that you drive on. Hence, grid computing is how data is distributed in heterogeneous fashion skipping geographical constraints, while cloud computing is how data is accessed. So the complete product is all these things working together. End of story.
And, yes, it has been around for last 20 years: "The Network Is The Computer", if you still didn't noticed...

Monday, March 29, 2010

DTrace. Quick start.

Here.

OpenSolaris and ISO images

You have an OpenSolaris box and you also want to archive some things on DVD (well, just in case). Here the things everyone on Solaris should know (in case you don't):
  1. First, make an ISO out of the directory that allows full 31 character filenames, instead to truncate them 8.3 format which is compatible with MS-DOS. You also might consider "joliet-long" option in order to allow Joliet filenames to be up to 103 Unicode characters. This breaks the Joliet specs, but appears to work. The following example is just a straight-forward:
    mkisofs -J -l -o foobar.iso /path/to/the/folder
  2. Second, you want to test and verify it. In Solaris, prior to mounting, you should make a block device from the file, first. In this case, lofiadm is your friend in this way:
    pfexec lofiadm -a foobar.iso
    Please note that you will need to escalate a privileges, because it will create a new device in /dev/lofi directory. To know all the list, simply run lofiadm as is. In this example it appears as "/dev/lofi/1" device.
  3. Now is a time to mount the device. Create some directory (e.g. /tmp/foobar) and mount the device (not the .iso file):
    pfexec mount -F hsfs /dev/lofi/1 /tmp/foobar/
    Things looks OK? :)
  4. Un-mount your filesystem and remove mount point to cleanup the mess behind you:
    pfexec umount /tmp/foobar; rmdir /tmp/foobar
  5. Remove block device (same mess):
    pfexec lofiadm -d /dev/lofi/1
  6. I usually don't burn CD/DVD's on a server remotely due to a number of issues with that, but if you like, you can do it. Normally, you want to use "cdrw" on Solaris (SUNWcdrw package in IPS, in case you haven't it installed) like this:
    cdrw -C -i /path/to/your/foobar.iso
    This will also detect automatically you're burning DVD or CD, will check the size and so on.
  7. Probably remove your .iso image as well. :-)
That's was a Solaris way and is slightly different that on a typical Linux box.

Friday, March 26, 2010

Mail.app, show me a plain text!

I hate HTML messages. Especially, when you ask your mates not to send HTML for simple text. They do. You won't shoot em, because you will have to do their job as well (this leads to lack of sleep). So there is other way: force Mail.app display a plain text. Normally, there is no checkbox in Preferences, but Mail.app still "eats" this preference in plist, like this:
<key>PreferPlainText</key>
<true/>
Cool. So we can do this:
defaults write com.apple.mail PreferPlainText -bool TRUE

Now restart Mail.app and you've done.