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... :-)