Here's a pretty cool tool for developers, similar to the DTrace GUI from XCode in OS X 10.5 Leopard (Instruments):
It's part of Sun Studio 12.
It's still in development, but it can be pretty useful.
Wednesday, June 25, 2008
D-Light DTrace script for Sun Studio 12 in Solaris
Posted by cmihai at 12:13 AM 0 comments
Labels: Debugging, Software Development, Solaris
Tuesday, June 24, 2008
Using AWK to convert UNIX passwords from HP-UX to Solaris
Converting password hashes from HP-UX 11.11 to Solaris is pretty simple if you are using UNIX crypt passwords (if HP-UX isn't a Trusted System. If it is, it will use bigcrypt passwords, > 8 characters, converting them to Solaris UNIX crypt could be problematic).
Here's the gest of it:
On the HP-UX System, we create a test user:
# useradd testNow we convert the passwd file to generate passwd entries for Solaris:
# passwd test
test
- # awk ' BEGIN { FS = ":" } { print $1":x:" $3 ":" $4 "::/export/home/" $1 ":/usr/bin/sh" }' /etc/passwd
- test:x:107:20::/export/home/test:/usr/bin/sh
And we create the shadow file entries, including the password hash:
Just add them using /usr/ucb/vipw to the password file, edit the shadow file for consistency and test. Be sure to backup the files and to test using a few users at first.
- # awk ' BEGIN { FS = ":" } { print $1":"$2"::::::" }' /etc/passwd
- test:lsDWJo7M.iAhY::::::
Mix with some shell scripting and mkdir's and you're set :-). Next time, use LDAP :P.
- $ su test
- Password:
- $ id
- uid=127(test) gid=120
- $ whoami
- test
- $ echo $HOME
- /export/home/test
- $ echo $SHELL
- /usr/bin/sh
Posted by cmihai at 10:49 PM 1 comments
Monday, June 23, 2008
Tru64 UNIX AdvFS open sourced
HP Tru64 UNIX's filesystem has been open sourced under a GPLv2 license.
http://advfs.sourceforge.net/
Press release here.
Documentation here.
What is it with UNIX giants making filesystems open source?
Posted by cmihai at 8:28 PM 1 comments
Labels: Open Source, Tru64
Sunday, June 22, 2008
Making NetBSD 4.0 and OpenBSD 4.3 install in VirtualBox
Installing NetBSD 4.0 in VirtualBox fails with:
Failed to write to file. /usr/bin/dig (or whatever) (Bad address).
To make it work disable ACPI, enable VT-x and set the IDE controller type to PIIX4.
VT-x makes all the difference for NetBSD also. Without VT-x, unpacking install sets is very slow (200kb/s). With VT-x, I get 6.42 MB/s.
Plus, it won't fail writing to files.
The same thing happens with OpenBSD, and can be fixed by using VT-x.
Posted by cmihai at 7:07 PM 0 comments
Labels: BSD, Virtualization
Fixing Java WebConsole ZFS Administration on Solaris Express Community Edition build 90, 91
Application Error
com.iplanet.jato.NavigationException: Exception encountered during forward
Root cause = [java.lang.IllegalArgumentException: No enum const class com.sun.zfs.common.model.AclInheritProperty$AclInherit.restricted]
Notes for application developers:
- To prevent users from seeing this error message, override the
onUncaughtException()
method in the module servlet and take action specific to the application - To see a stack trace from this error, see the source for this page
Generated Sun Jun 22 14:22:44 EEST 2008
If this happens to you, you need to set acl inherit to passthrough:
# zfs set aclinherit=passthrough rpool
Now WebConsole ZFS Admin will work.
You also need to make sure the webconsole serivce is enabled before you can use it:
# svcs -a | grep webconsole
disabled 15:32:25 svc:/system/webconsole:console
# svcadm enable webconsole
# svcs -xv webconsole
svc:/system/webconsole:console (java web console)
State: online since Sun Jun 22 15:34:40 2008
See: man -M /usr/share/man -s 1M smcwebserver
See: /var/svc/log/system-webconsole:console.log
Impact: None.
When you're done using it, you should probably disable the service, as Java will eat up 100MB of memory :-). Besides, you don't really need a GUI for ZFS admin. It's just nice to show to your friends.
# svcadm disable webconsole
You should also make sure to disable webconsole in your Zones, as it serves no purpose what so ever (and it will bloat your zones by about 100MB memory usage).
Posted by cmihai at 2:25 PM 0 comments
Labels: OpenSolaris, Solaris
Friday, June 20, 2008
Compiling 64 bit OpenSSL and OpenSSH on Solaris with Sun Studio 12; SSH ASCII fingerprints
For building OpenSSL.
% ./config
Replace -xarch=amd64 with -m64 in the Makefile.
% gmake
# gmake install
Now build OpenSSH:
export CFLAGS=-m64
export LDFLAGS=-m64
% ./configure --with-ssl-dir=/usr/local/ssl
% make
% su
# make package
The following packages are available:
1 OpenSSH OpenSSH Portable for Solaris
(i386) OpenSSH_5.0p1
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: Transferring
# pkgadd -d OpenSSH-OpenSSH_5.0p1-Solaris-i386.pkg
If you're using OpenSSH portable from CVS you can also enjoy the ASCII art fingerprint funtion:
ibmsolaris% ./ssh -F /etc/ssh/ssh_config 192.168.21.168
Host key fingerprint is ...
+--[ RSA]----------+
| |
| = . |
| . = F |
| + * + |
| S * . |
| o + . |
| . = o . . |
| o + . o |
| . .oo . |
+----------------------+
Just add CheckHostIP fingerprint to ssh_config.
To compile OpenSSH from CVS:
% export CVSROOT=anoncvs@anoncvs.mindrot.org:/cvs
% export CVS_RSH=/usr/bin/ssh
% cvs get openssh
# ln -s /usr/bin/automake-1.10 /usr/bin/automake
% make
% su
# make package
Posted by cmihai at 7:13 PM 0 comments
Labels: Open Source, OpenSolaris, Solaris
Solaris ZFS to ZFS LiveUpgrade
Regular UFS to UFS LiveUpgrade used to take a while to create the boot environment, etc. Complicated :-).
As of Solaris Express Community Edition 90, you can use LiveUpgrade with ZFS. You can also LU a UFS system to ZFS.
One of the benefits of ZFS root is the ZFS clone command (lucreate -n happens in a second):
# lucreate -n sxce91
Checking GRUB menu...
Analyzing system configuration.
No name for current boot environment.
INFORMATION: The current boot environment is not named - assigning name
Current boot environment is named
Creating initial configuration for primary boot environment
The device
PBE configuration successful: PBE name
Comparing source boot environment
system(s) you specified for the new boot environment. Determining which
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment
Source boot environment is
Creating boot environment
Cloning file systems from boot environment
Creating snapshot for
Creating clone for
Setting canmount=noauto for
Creating snapshot for
Creating clone for
No entry for BE
Population of boot environment
Creation of boot environment
Mount the DVD image loopback:
# mkdir /mnt/iso
# lofiadm -a /export/home/cmihai/Desktop/SunDownloads/sol-nv-b91-x86-dvd.iso
/dev/lofi/1
# mount -F hsfs /dev/lofi/1 /mnt/iso
Liveupgrade:
# luupgrade -u -n sxce91 -s /mnt/iso/
No entry for BE
Copying failsafe kernel from media.
Uncompressing miniroot
Uncompressing miniroot archive (Part2)
13371 blocks
Creating miniroot device
miniroot filesystem is
Mounting miniroot at
Mounting miniroot Part 2 at
Validating the contents of the media
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE
Checking for GRUB menu on ABE
Saving GRUB menu on ABE
Checking for x86 boot partition on ABE.
Determining packages to install or upgrade for BE
Performing the operating system upgrade of the BE
CAUTION: Interrupting this process may leave the boot environment unstable
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Restoring GRUB menu on ABE
Adding operating system patches to the BE
The operating system patch installation is complete.
ABE boot partition backing deleted.
Configuring failsafe for system.
Failsafe configuration is complete.
INFORMATION: The file on boot
environment
INFORMATION: The file on boot
environment
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment
environment
required or if additional media of the software distribution must be
installed.
The Solaris upgrade of the boot environment
Installing failsafe
Failsafe install is complete.
# luactivate sxce91
System has findroot enabled GRUB
Generating boot-sign, partition and slice information for PBE
Saving existing file in top level dataset for BE
Generating boot-sign for ABE
Saving existing file in top level dataset for BE
Generating partition and slice information for ABE
Boot menu exists.
Generating direct boot menu entries for PBE.
Generating xVM menu entries for PBE.
Generating direct boot menu entries for ABE.
Generating xVM menu entries for ABE.
GRUB menu has no default setting
No more bootadm entries. Deletion of bootadm entries is complete.
GRUB menu default setting is unchanged
Done eliding bootadm entries.
**********************************************************************
The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.
**********************************************************************
In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:
1. Boot from Solaris failsafe or boot in single user mode from the Solaris
Install CD or Network.
2. Mount the Parent boot environment root slice to some directory (like
/mnt). You can use the following command to mount:
mount -Fzfs /dev/dsk/c1t0d0s0 /mnt
3. Run
environment root slice, as shown below:
/mnt/sbin/luactivate
4. luactivate, activates the previous working boot environment and
indicates the result.
5. Exit Single User mode and reboot the machine.
**********************************************************************
Modifying boot archive service
Activation of boot environment
# init 6
Posted by cmihai at 9:45 AM 8 comments
Labels: OpenSolaris, Solaris
Wednesday, June 18, 2008
Sun Solaris DTrace - counting page-ins
Need more details than:
% kstat -n vm | grep pgin
anonpgin 727
execpgin 0
fspgin 1012885
pgin 999385
pgpgin 1013612
anonpgin 1347
execpgin 0
fspgin 187550
pgin 46875
pgpgin 188897
22:41 <> hello, is there a way to see what processes could be causing a page-in excess?
22:43 <> dtrace pgin
As always, DTrace to the rescue :-).
cthulhu# dtrace -n pgin'{@[pid, execname] = count();}'
dtrace: description 'pgin' matched 1 probe
^C
27462 gnome-keyring-da 1
27495 wnck-applet 1
430 dbus-daemon 2
27446 gnome-session 2
27483 nautilus 4
27319 Xorg 11
Posted by cmihai at 10:49 PM 0 comments
Labels: OpenSolaris, Software Development, Solaris
Installing CentOS 5.1 in textmode
Need the old textmode installer? No time to kickstart?
Type
linux mem=192M noprobe
at the GRUB install prompt ;-). A system needs > 128MB RAM to install with Anaconda, but will default to the textmode installer if it has < 256MB RAM.
Posted by cmihai at 1:33 AM 1 comments
Labels: Linux, Open Source
Making VirtualBox work in headless mode on Solaris
If you've ran VirtualBox 1.6.2 on Solaris or OpenSolaris (SXCE anyway) you'll see something interesting happen when you run VBoxHeadless (let's say in GNU screen) and kill X :-). It will die.
cthulhu% ./VBoxHeadless -s CentOS51
VirtualBox Headless Interface 1.6.2
(C) 2008 Sun Microsystems, Inc.
All rights reserved
Listening on port 3389
X connection to :0.0 broken (explicit kill or server shutdown).
Which is kind of silly for something called "headless"...
Here's the fix:
env DISPLAY=buggerthis /opt/VirtualBox/VBoxHeadless -s SomeMachine
Now you can kill X happily.
It basically dies when :0.0 dies. Make it look for another DISPLAY, and it's fine.
Posted by cmihai at 1:09 AM 0 comments
Labels: OpenSolaris, Solaris, Virtualization
Sunday, June 15, 2008
Mortal Kombat 4 on Solaris - Wine
Using Wine, DosBOX, DosEMU, GSNEX, GBA, ePSX and various other Windows, DOS and game console emulators you can get a fair amount of fun old games running on Solaris (like StarCraft, Mortal Kombat Series, Final Fantasy 1-8, etc). Not to mention the whole Doom, Quake 1,2,3 series using the open sourced engines.
Add a Windows XP in VirtualBox to the mix and you're set :-). You can also use SeamlessRDP to run remote Windows app on your desktop.
Posted by cmihai at 1:17 PM 2 comments
Labels: OpenSolaris, Solaris, Virtualization
Saturday, June 14, 2008
Installing TeX Live 2008 LaTeX distribution on Solaris
If you're installing TeXLive on Solaris you'll run into some issues with tar / GNUtar (gtar).
I've used the small bootstrap installer available on CTAN.
# ./install-tl
...
Installing: 12many
tar: /dev/rmt/0: No such file or directory
It basically sends UNIX tar GNU tar flags. Just copy /usr/bin/gtar to ~/bin/tar (or some other PATH) and put that in PATH first. TeX Live will install just fine.
# copy /usr/bin/gtar /root/bin/tar
# export PATH=/root/bin
# ./install-tl
Posted by cmihai at 6:33 PM 0 comments
Labels: Open Source, OpenSolaris, Solaris
Wednesday, June 11, 2008
Deploying IBM DB2 inside a Solaris 10 Container
1. Creating the ZFS filesystem:
# zfs create rpool/export/zones
2. Configuring the DB2 zone:
# zonecfg -z db2
db2: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:db2> create
zonecfg:db2> set zonepath=/export/zones/db2
zonecfg:db2> set autoboot=true
zonecfg:db2> add net
zonecfg:db2:net> set address=192.168.1.100/24
zonecfg:db2:net> set physical=iwk0
zonecfg:db2:net> end
zonecfg:db2> verify
zonecfg:db2> commit
zonecfg:db2> exit
3. Installing the DB2 zone:
# zoneadm -z db2 install
A ZFS file system has been created for this zone.
Preparing to install zone
Creating list of files to copy from the global zone.
Copying <9648> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1319> packages on the zone.
Initialized <1319> packages on zone.
Zone
Installation of these packages generated errors:
Installation of these packages generated warnings:
The file
4. Listing the zones:
# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- db2 installed /export/zones/db2 native shared
5. Booting the DB2 zone:
# zoneadm -z db2 boot
6. Logging into the zone:
# zlogin -C db2
[Connected to zone 'db2' console]
Configure the initial system (locale, etc).
7. Install IBM DB2 Database 9:
db2# gunzip db2_v9fp1_ese_solaris_x64.tar.gz
db2# tar xvf db2_v9fp1_ese_solaris_x64.tar
db2# cd ese/disk1/
db2# ./db2_install
Default directory for installation of products - /opt/IBM/db2/V9.1
***********************************************************
Do you want to choose a different directory to install [yes/no] ?
no
Specify one or more of the following keywords,
separated by spaces, to install DB2 products.
CLIENT
RTCL
ESE
Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
CLIENT RTCL ESE
DB2 installation is being initialized.
Total number of tasks to be performed: 41
Total estimated time for all tasks to be performed: 915
Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: GSKit support
Estimated time 19 second(s)
...
8. Add a regular user account to your DB2 zone:
db2# mkdir -p /export/home/cmihai
db2# useradd -s /usr/bin/zsh -d /export/home/cmihai cmihai
db2# chown cmihai /export/home/cmihai
db2# passwd cmihai
New Password:
Re-enter new Password:
passwd: password successfully changed for cmihai
db2# su - cmihai
db2% cd /opt/IBM/db2/V9.1/bin
Check locale(1) and export LC_ALL=C if needed or db2 will complain:
db2% ./db2fs
couldn't set locale correctly
Make sure you read the install log in /tmp.
Here's a tip though: if you can, use the Graphical installer (ssh -X and run db2setup instead of db2_install).
All you need now is add various tuning, limitations and zfs quotas, etc.
If you need to start over, there's always ZFS snapshots or db2_deinstall.
Either way, if you need to create an instance:
# ./db2icrt -s wse -u db2fenc1 db2inst1
Sun Microsystems Inc. SunOS 5.11 snv_90 January 2008
Sun Microsystems Inc. SunOS 5.11 snv_90 January 2008
DBI1070I Program db2icrt completed successfully.
You can now use db2 to create a database and connect to it.
# db2
db2=> CREATE DATABASE test
db2 => CONNECT TO test
Database Connection Information
Database server = DB2/SUN64 9.1.1
SQL authorization ID = DB2INST1
Local database alias = TEST
db2 => CREATE TABLE clients (name char(25), surname char(50))
DB20000I The SQL command completed successfully.
db2 => LIST TABLES
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
CLIENTS DB2INST1 T 2008-06-11-05.39.58.167896
1 record(s) selected.
db2 => INSERT INTO clients VALUES ('Some','Guy')
DB20000I The SQL command completed successfully.
db2 => SELECT * FROM clients
NAME SURNAME
------------------------- --------------------------------------------------
Some Guy
1 record(s) selected.
Posted by cmihai at 3:15 AM 0 comments
Labels: Databases, DB2, IBM, OpenSolaris, Solaris
Building xpdf on Solaris
Building xpdf on SXCE 90:
xpdf has some issues building with Sun Studio, so I suggest you use gcc. Make sure you export CC=g++ or linking will fail.
export PATH=/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:/usr/sbin:/opt/SUNWspro/bin:/usr/local/bin:/usr/sfw/bin:/usr/sfw/sbin
export CC=/usr/sfw/bin/g++
./configure --with-freetype2-library=/usr/lib --with-freetype2-includes=/usr/include/freetype2 && gmake
su
gmake install
Posted by cmihai at 2:37 AM 0 comments
Labels: OpenSolaris, Solaris
Reading Microsoft Office 2007 formats with OpenOffice
You can rename the .docx or whatever to .zip and look at the .xml files, or you can use this:
OpenOffice plugin for Microsoft XML document format:
http://www.novell.com/documentation/openwg/esd/di_ooo_openxml_translator.html
Posted by cmihai at 2:01 AM 0 comments
Labels: Microsoft, Open Source
Staring SQL Developer or JDeveloper fails due to hidden messagebox
Can you spot why Oracle SQL Developer and JDeveloper aren't starting in this scenario?
You can't even see it on a white background (and there is no window in the taskbar) but there is a question box right behind the slash screen :-). Pay attention to the right edge of the splash...
Still, I love the new Java look.
Posted by cmihai at 12:13 AM 0 comments
Labels: Databases, Oracle, Software Development
Tuesday, June 10, 2008
Compiling GNU Screen, irssi and Emacs on Solaris with Sun Studio 12
Screen, Emacs and irssi aren't included in Solaris, and the Sun Freeware versions tend to be out of date. Blastwave usually pulls in too many depends. You can compile screen, irssi and emacs without any additional depends on SXCE 90 and you get to use SS12.
Here's how you compile them on SXCE 90 using Sun Studio 12.
- Install Sun Studio 12. If you have SXCE, just use the Developer Tools installer from the DVD.
- Export a PATH that includes Sun Studio (you can also just export CC):
PATH=/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:/usr/sbin:/opt/SUNWspro/bin
export PATH - Download and untar the sources
- ./configure --prefix=/usr/local; gmake; su; gmake install
Look for the offending line:
# if defined(linux) || defined(__convex__) || (BSD >= 199103)
setenv(var, value, 1);
# else
setenv(var, value);
# endif /* linux || convex || BSD >= 199103 */
#endif /* USESETENV */
Better yet (pkgsrc):
- Index: misc.c
- --- misc.c.orig 2003-12-05 14:45:41 +0100
- +++ misc.c 2006-07-13 18:00:46 +0200
- @@ -613,7 +613,7 @@
- */
- # endif /* NEEDSETENV */
- #else /* USESETENV */
- -# if defined(linux) || defined(__convex__) || (BSD >= 199103)
- +# if defined(linux) || defined(__convex__) || (BSD >= 199103) || defined(__sun)
- setenv(var, value, 1);
- # else
- setenv(var, value);
Now screen will compile. You can also make packages.
Other software such as top, smartctl (smartmontools) and so on all compiles cleanly without the need for 3rd party depends.
Posted by cmihai at 10:12 PM 1 comments
Labels: Open Source, OpenSolaris, Solaris
Monday, June 09, 2008
GStreamer plugins to decode MP3 files in SXCE 90
Solaris Express no longer provides a GStreamer MP3 decoder plugin, so you'll need to install a 3rd party plugin (or the plugin from an older SXCE release).
Basically, when you plug in your iPod or run Rythmbox and add some mp3 song, you'll get something like:
"The GStreamer plugins to decode "MP3" files cannot be found.
You can download the MP3 decoder plugin for free from Fluendo (you still need to register and use the webshop interface to "buy" it for 0$).
http://www.fluendo.com/resources/fluendo_mp3.php
Select "Fluendo MP3 Decoder".
Read the documentation, and make sure the plugin is set to executable and all dependencies are resolved.
cthulhu% gst-inspect flump3dec
(gst-inspect:7948): GStreamer-WARNING **: Failed to load plugin '/export/home/cmihai/.gstreamer-0.10/plugins/libgstflump3dec.so': ld.so.1: gst-inspect-0.10: fatal: libgcc_s.so.1: open failed: No such file or directory
No such element or plugin 'flump3dec'
cthulhu% ldd ~/.gstreamer-0.10/plugins/libgstflump3dec.so
warning: ldd: /export/home/cmihai/.gstreamer-0.10/plugins/libgstflump3dec.so: is not executable
libgstreamer-0.10.so.0 => /usr/lib/libgstreamer-0.10.so.0
cthulhu% chmod +x ~/.gstreamer-0.10/plugins/libgstflump3dec.so
cthulhu% grep libgcc /var/sadm/install/contents
/usr/sfw/lib/amd64/libgcc_s.so=libgcc_s.so.1 s none SUNWgccruntime
cthulhu% export LD_LIBRARY_PATH=/usr/sfw/lib
cthulhu% gst-inspect flump3dec
Factory Details:
Long name: Fluendo MP3 Decoder (C build)
Class: Codec/Decoder/Audio
Description: Decodes MPEG-1 Layer 1, 2 and 3 streams to raw audio frames
Author(s): Fluendo Support
Rank: primary (256)
cthulhu% rhythmbox
Now you can play MP3 files in Rhythmbox, Totem, etc.
Posted by cmihai at 11:55 PM 5 comments
Labels: Media, Open Source, OpenSolaris
ZFS Root in Solaris Express Community Edition - SXCE 90
Solaris Express Community Edition now supports ZFS root. Pick Solaris Express Developer in the grub menu, exit the X gui installer (Ctrl - Alt - Backspace) and use the text mode installer (install-solaris from the console). Now select "ZFS root" :-).
You should now have a default ZFS rpool.
It also supports JumpStart:
http://opensolaris.org/os/community/zfs/boot/zfsbootFAQ/
Posted by cmihai at 10:19 AM 0 comments
Labels: Open Source, Solaris, Sun