Monday, August 25, 2008

Somthing's fishy in Linux JVM

I just encountered another failed JVM setting. This time it was the Oracle SQL Developer.

Here's the error log under verbose option:

steven@family-room:/opt/sqldeveloper$ ./sqldeveloper.sh -verbose

Oracle SQL Developer
Copyright (c) 2006, 2007, Oracle. All rights reserved.

Reading configuration from: /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
Working directory is /opt/sqldeveloper/sqldeveloper/bin
Running Command: /usr/lib/jvm/java-6-sun-1.6.0.06/bin/../jre/bin/java -Xmx512M -Xverify:none -XX:JavaPriority10_To_OSPriority=10 -XX:JavaPriority9_To_OSPriority=9 -Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=SQL_Developer -Dcom.apple.mrj.application.growbox.intrudes=false -Dcom.apple.macos.smallTabs=true -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -Dsun.java2d.ddoffscreen=false -Dide.update.masterserver=http://www.oracle.com/technology/software/products/sql/master.xml -Dwindows.shell.font.languages= -Dide.AssertTracingDisabled=true -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -Djava.util.logging.config.file=logging.conf -Dide.conf="/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf" -Dide.startingcwd="/opt/sqldeveloper/sqldeveloper/bin" -Dide.home.dir.name=.sqldeveloper -classpath ../../ide/lib/ide-boot.jar:../../jdev/lib/xmleditor.jar:../../ide/lib/oicons.jar:../../jlib/jewt4.jar:../../jlib/share.jar:../../sqldeveloper/lib/jle2.jar:../../sqldeveloper/lib/oracle.dbtools.logging.jar oracle.ide.boot.Launcher
Using oracle.home=/opt/sqldeveloper
Using ide.user.dir=/home/steven/.sqldeveloper
/opt/sqldeveloper/sqldeveloper/bin/../../ide/bin/launcher.sh: line 478: 19573 Segmentation fault ${JAVA} ${APP_VM_OPTS} ${APP_SCRIPT_USER_HOME} ${APP_ENV_VARS} -classpath ${APP_CLASSPATH} ${APP_MAIN_CLASS} ${APP_APP_OPTS}
Error: SQL Developer can't recognize the JDK version


Unlike Netbeans' error message, this one is totally bogus. Anyway, because of what happened in Netbeans, I suspected it was the JVM stack size option again, so I added "AddVMOption -Xss4M" to the jdev/bin/ide.conf, just above where the -Xms option was set.

The problem instantly disappeared. Seems to me the default JVM stack size on Linux is too small for a number of graphic heavy Java applications. I wonder if this is a bug with the Hotspot JVM implementation on Linux.

Labels: , , ,

Sunday, August 24, 2008

Netbeans Crash in Linux / Kubuntu

When I launched the Java IDE Netbeans 6.1 today, I got this error:

steven@family-room:~/netbeans-6.1/bin$ ./netbeans
An irrecoverable stack overflow has occurred.
#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb7e249bc, pid=25679, tid=3019492240
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing linux-x86)
# Problematic frame:
# C [libc.so.6+0x739bc] memcpy+0x1c
#
# An error report file with more information is saved as:
# /home/steven/netbeans-6.1/bin/hs_err_pid25679.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
./../platform8/lib/nbexec: line 466: 25679 Aborted "/usr/lib/jvm/java-6-sun/bin/java" -Djdk.home="/usr/lib/jvm/java-6-sun" -classpath "/home/steven/netbeans-6.1/platform8/lib/boot.jar:/home/steven/netbeans-6.1/platform8/lib/org-openide-modules.jar:/home/steven/netbeans-6.1/platform8/lib/org-openide-util.jar:/home/steven/netbeans-6.1/platform8/lib/locale/boot_ja.jar:/home/steven/netbeans-6.1/platform8/lib/locale/boot_pt_BR.jar:/home/steven/netbeans-6.1/platform8/lib/locale/boot_zh_CN.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-modules_ja.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-modules_pt_BR.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-modules_zh_CN.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-util_ja.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-util_pt_BR.jar:/home/steven/netbeans-6.1/platform8/lib/locale/org-openide-util_zh_CN.jar:/usr/lib/jvm/java-6-sun/lib/dt.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar" -Dnetbeans.dirs="/home/steven/netbeans-6.1/nb6.1:/home/steven/netbeans-6.1/ide9:/home/steven/netbeans-6.1/java2:/home/steven/netbeans-6.1/xml2:/home/steven/netbeans-6.1/apisupport1:/home/steven/netbeans-6.1/enterprise5:/home/steven/netbeans-6.1/mobility8:/home/steven/netbeans-6.1/profiler3:/home/steven/netbeans-6.1/gsf1:/home/steven/netbeans-6.1/ruby2:/home/steven/netbeans-6.1/visualweb2:/home/steven/netbeans-6.1/soa2:/home/steven/netbeans-6.1/identity2:/home/steven/netbeans-6.1/uml5:/home/steven/netbeans-6.1/harness:/home/steven/netbeans-6.1/cnd2:" -Dnetbeans.home="/home/steven/netbeans-6.1/platform8" '-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade' '-Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense' '-Xmx161m' '-Dcom.sun.aas.installRoot=/home/steven/glassfish-v2ur2' '-client' '-Xss2m' '-Xms32m' '-XX:PermSize=32m' '-XX:MaxPermSize=200m' '-Xverify:none' '-Dapple.laf.useScreenMenuBar=true' '-Dsun.java2d.noddraw=true' org.netbeans.Main --userdir "/home/steven/.netbeans/6.1" "--branding" "nb"


As you can see, the error is caused by a stack overflow. Of course, a number of items can go wrong with that, for example, some code with bad recursive calls; however, my Netbeans had been working fine, so I thought the default thread size might be too small for Netbeans.

The stack size option in JVM (not to be confused with heap size options) is set by using the Xss flag. As you can see from the stack trace above (no pun intended), the default stack size was 2MB. A grep on the netbean folder revealed that this is being set in etc/netbeans.conf like this:

netbeans_default_options="-J-Dcom.sun.aas.installRoot=\"/home/steven/glassfish-v2ur2\" -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m

I changed the -Xss from 2m to 4m and launched Netbeans again.

Voila. Problem solved.

PS -- each project in Netbeans has its own runtime settings. You may need to add the -Xss option to the project property (right click on the project name and select property, then select run --> vm options)

Labels: , , ,

Unix for Dummies --musings from a gcc install

Unix admins are a curious bunch.

Exhibit A. Someone posted this message on one of the Unix chat boards:
Help! My gcc install failed. The error message I got is:

(sparc) 2.95.3
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/cc1", errno 28
, No space left on device


And the answers from those helpful Unix admins on the board? They ranged from "You are running out of space." to "run a df -k".

Well, duh. I think common sense is not a popular trait among the admins.

The space error message is a problem commonly encountered during the installation of a very large package, like the gcc. 95% of the time, the answer is: the /var partition is almost full. Specifically, it is the /var/sadmin directory which contains all the package install information. To solve the problem, move the directory to another partition, and create a sym link in its old place.

Labels: , ,

Saturday, August 23, 2008

Install Samsung ML-1740 Printer in Solaris 10

The Samsung ML-1740 is a non-postscript laser printer. To print in Solaris, I decided to install and run CUPS (common unix printing system) instead of using the standard lpcommand in Solaris

Why?

Because I know CUPS will work since that's what my Kubuntu runs.

The major steps to install and configure Samsung ML-1740 in Solaris 10 are:

1. Install CUPS. You could use a pre-compiled CUPS package (freely available from the Sun Solaris Optional Component DVD and the Solaris web site), or you could download the latest source code from www.cups.org and build the binary yourself. I've tried both and would HIGHLY recommend using the latest CUPS (version 1.3.8). It's less buggy, plays nicely with clients like Firefox and has some additional niceties, like letting you browse for a printer driver file, and telling you when a particular filter specified by your printer's driver is missing.

2. Start CUPS.
/etc/init.d/cups start
Point your browser to the CUPS management interface at localhost:631 Make sure CUPS is running and you can see the management interface before continue.

3. Get the printer driver. Because the foomatic gdi driver is platform independent, I simply use the same one I have on Kubuntu, which I downloaded from OpenPrinting.org

4. Install the foomatic-rip filter.
Because my printer is not a postscript printer, the gdi driver downloaded in step 2 uses the foomatic-rip filter to translate the postscript language for CUPS. The foomatic filter is not installed by default from either CUPS package, so I again got mine off the OpenPrinting.org web site. The foomatic tar file link is here.

5. Configure the printer in CUPS. Add the printer to your user preference.

In Kubuntu, it takes all of 2 minutes to get my Samsung ML-1740 laser printer set up. But things got a lot more interesting when I tried to follow all the steps above to install the printer in Solaris.

Stay tuned if you are interested in some troubleshooting tips with CUPS in Solaris and Foomatic printer drivers. I can tell you the story does have a happy ending...

Labels: , , ,

Thursday, August 21, 2008

Linux Filesystem Viewer for Windows

Linux has long been able to mount both Windows NTFS and FAT file systems, but the reverse is not true in Windows.

To view a ext2 or ext3 file system, I tried a tool called DiskInternals Linux Reader, downloaded from the company's web site: http://www.diskinternals.com/download.shtml. I installed it on my dual boot Windows XP/Kubuntu server.

I can now see my Linux file systems in Windows XP, but if you need to read the files, you'd have to use the recovery option in the DiskInternals tool and make a copy of the file.

I guess it works for those emergency situations that you need to get a file from the Linux partition, but it is not very convenient.

So I tried a second software, called Ext2 Installable File System For Windows, from http://www.fs-driver.org/download.html. Despite the name of the product, the software works for both Ext2 and Ext3 file systems, and you have the option of disabling the write access to the Linux partition. After the install, you can mount the Linux partitions to their own drive letters, and they show up just like any other NT drives. By the way, the configuration is done through a file, ifsdrives.cpl in Windows XP, which you access through the control panel.

There are some technical issues related to mounting of an Ext3 partition vs. an Ext2 one. The Ext3 file system is the Ext2 file system which has been extended by journaling. It is backward-compatible to Ext2 - an Ext3 volume can be mounted and used as an Ext2 volume. The Ext2 IFS software is smart enough to check the Ext3 file system and will refuse mounting an Ext3 file system which contains data in its journal, just like older Linux kernels which have no Ext3 support. This way, it avoids potentially corrupting the file system in case of a prior system crash in Linux.

All and all, the IFS software is a great tool. Kudos to the folks at fs-driver.org.

Labels: , , ,

Charming Shanghai Neighborhoods

Shanghai is my favorite city in China. I loved its unique blend of European flair and Chinese characters. The following photos are from some of my favorite neighborhoods in Shanghai:



The Dongjiadu Church, a Portuguese style church, in Old Shanghai.



A traditional Shanghai Longtang (a residential quarter) in the former French Concession.




Shanghai's many lively neighborhood parks. This one on the Shaoxing Road is the smallest park in Shanghai.


The Nanjing Road pedestrian shopping district



View from the Oriental Pearl across the Bund. Notice the difference in the water color where the Suzhou Creek meets the Huangpu River.


For more, you can read a detailed Shanghai neighborhood guide I wrote.

Labels: ,

Tuesday, August 19, 2008

My favorite memories of China

 
Posted by Picasa



We just completed a family trip to China. I am going to post some of my favorite memories from the trip.

And number one on the list: Food!

Labels: ,

The empty Forbidden City

 
Posted by Picasa


As long as you know where to go to avoid the crowd, the Forbidden City can be had without tourists.

Labels: ,

Hacking Picasa

I like the Picasa software primarily for its album feature. The albums I created are stored as meta data in the Picasa database and are not physical copies of the photos, therefore, they are more efficient in terms of data storage.

However, what happens if you choose to move your photos to another location. Hey, I know! Because I found out the hard way. You lose all you albums.

Well, I managed to find a backup copy of some Picasa system files (called .pal files). Those files contain the list of photos that belong to different albums.

So I thought there's gotta be a way to hack Picasa so that I could create albums using my own meta data. I created a test album and used the backup feature in Picasa to dump the album settings into an ISO file. I then mounted the ISO file in Kubuntu:

sudo mount CD0.iso /cdrom -t iso9660 -o loop

After I opened the ISO, I found that files.txt in the ISO root contained a list of files for the album. The lines are like this:

\[Z]\mnt\xpdata\Documents and Settings\3po\My Documents\My Pictures\Test\Picasa.ini
ft,3eabbb00,1c8fc34,3eabbb00,1c8fc34

3eabbb00,1c8fc34,3eabbb00,1c8fc34 are Hex codes. Different Hex codes are appended to each line in the file. I don't know what they mean or how I could crack them. Therefore, so far, no dice on how to hack the Picasa albums.

I wonder if there's a way to hack into the Picasa db...

Labels: ,

Setting up SAMBA server on Kubuntu and client on XP

So today I decided to set up a SAMBA server on my Kubuntu because this is where my music collection is stored. My son uses the music library to sync up his ipod, and his computer is often running Windows XP.

To install SAMBA, I used the Kubuntu Debian package manager. Very straight forward.

Afterwards, before I did any configuration of the SAMBA server, I checked the SAMBA install from the XP client using \\ip_address, and it's already there! The printer is shared. Cool.

Step two, add the shared folders. Now, a lot of people will quickly tell you to go edit the /etc/samba/smb.conf file. DON'T. It's a waste of time for a simple home project like this. SAMBA works fine out of the box by default for a small network, and there is a graphic user interface in Kubuntu to handle the folder sharing.

You get to the configuration via System Settings --> Sharing --> File Sharing. Enter administrator mode and you are ready to roll. I added the My Music folder to the SAMBA share, and next thing I know, it's showed up nicely on XP.

What if you would like to limit the access to the shared folder? That's where a lot of the problems happened in the past between Windows and SAMBA and if you do a search on the Internet, you'd find numerous postings on this topic, most of them, unfortunately, are NOT helpful.

To add users to a shared folder, you can also use the GUI by selecting "More SAMBA option" then the User tab. Once there, click on the "Expert" button and add the users and assign their access privileges.

Done? Well, not so fast. If you try to access the folder from your XP client now, you'll see an authentication dialog asking for your user name and password. But it will not authenticate you even if you type in the correct credentials.

You see, Windows XP encrypts the passwords by default. So how is my Kubuntu linux going to understand the passwords being sent from an XP client?

This is where a simple SAMBA utility came into play. The utility is called smbpasswd and can keep track your Linux user names and encrypted passwords in a database on Kubuntu. Run the following command:

sudo smbpasswd -a your_user_name

-a stands for add. The program will prompt you to enter and confirm your password.

Now try again from your Windows client. Voila. All this functionality was accomplished without a single attempt to manually edit the smb.conf file.

Labels: , ,

Monday, August 18, 2008

Using NoMachine's remote connection product NX

I want to be able to connect from my Windows XP laptop to my Kubuntu server using a remote client software. NoMachine company makes this widget called NX and it works very similar to the Windows Remote Desktop.

To set it up, download the NXFree for Linux from NoMachine's web site and install it on Kubuntu. The installation is a three step process (client --> node --> server), so make sure you read the instructions before attempting the install.

I then installed the NX client for windows on my XP laptop. The connection is over SSH, so obviously you should ascertain the SSH server is running on Kubuntu.

The first time I launched the client and attempted the connection, the session crashed with an error message of "The connection with the remote server was shut down. Please check the state of your network connection." After a little probing, I found out it's caused by the session restore setting on the server. Each time I log in, I had configured the session manager to reload the last session, and when that happens, the VGA screen turns black first then reappears. Apparently, this brief flicker caused the remote connection to close.

So for now, I am configuring the session manager to start with an empty session. The NX client works fine under this setting. I can now access my Kubuntu server from any computer in the house, and see a live KDE shell. Very cool.

Tomorrow, I am going to set up a SAMBA server on Kubuntu so that I can share my music throughout the home network.

Labels: , , ,

Uninstalling KDE 4 -- Impressed with the Ubuntu package manager

There have been raves on the Internet about the Debian Package Manager used in Ubuntu and Kubuntu.

I can tell you it's even better than I imagined.

I've been trying the new KDE4 shell. Well, it's ok, but I really don't like it too much at this stage because I think it's still a little "green". So I decided to un-install it and go back to KDE3. Impossible, some might say, because of all the dependencies by other packages that I have installed which rely on KDE4.

Hey, what do you know? It CAN be done in simple steps:

1. Log into console mode. Makes sense, right?
2. Now remove all packages with names ending in kde4. sudo aptitude remove ~i~nkde4
3. Rebuild dependencies. sudo dpkg-reconfigure kdm
4. Now make sure all the packages are up to date. sudo aptitude update
5. sudo aptitude upgrade. Done.

Isn't it cool? Now imagine doing this in Windows...

Labels: , , ,

Sunday, August 17, 2008

Repairing Solair 10 boot

So yesterday I wrote that my Solaris 10 boot archive was corrupt. To fix it, I tried booting into the Failsafe mode.

It took a long time for the Failsafe mode to boot up. In fact, I left the computer running and went to bed. This morning, I saw a command prompt offering to mount the Solaris install to /a. Answered yes and started the repair process.

To repair the boot, I ran the command bootadm update-archive -R /a

the -R flag specifies an alternate root, in this case, the /a directory.

You should see the system acknowledge the boot archive is being repaired. This whole process should take at least a few minutes. If you don't see an acknowledgement, the the repair did not happen, which was what happened to me when I first ran the repair by manually mounting the device but forgetting to set it to writable.

After the repair, issue shutdown -y -i 6 to reboot the server.

After the reboot, my Solaris was back up and running. However, my network was down. I ran the ifconfig command to troubleshoot this and found out that my network interface has been changed from its proper name "vmxnet0" to "prn0".

I went to /etc and changed the files hostname.prn0 and dhcp.prn0 to their correct names with the vmxnet0 suffix, but I was confused about what happened until I read this piece in the VMWare tool install manual:

The name of the virtual network interface is hardcoded in the script /opt/vmware/linux/sbin/ifconfig. Typical choices are ae0 or pcn0 for the virtual vlance adapter.

Well, that's just horrible. It turned that I had installed VMWare tool just before the Solaris boot failed. Hmm... I am thinking the two might be linked somehow.

Labels: , ,

Saturday, August 16, 2008

Installing Solaris 10 on VMWare server

I actually tried to install Solaris 10 straight up on a blank partition, but the install does not work because the Solaris requires its boot to be located on the first 1024 cylinders of a disk. Since I already have Windows XP and Kubuntu running on my two hard drives, I decided to try the VMWare approach instead.

The installation via VMWare running on Kubuntu is really slow and took several hours. I think that's probably because I only provisioned 512 MB of RAM and a single CPU. One of the tricky parts during the install was to configure the partition table. The auto layout option provided by Solaris did not work. The default had the root file system (/), /usr and swap checked. When I left the default alone and tried the auto-layout option, I got an error message. I tried to manually partition it, but it's not that straight-forward because Solaris has some idiosyncrasies in how the slices inside the partition table should be set up. So I returned to the auto-layout option, but this time, selecting several more mount points, e.g. /opt/ export/home, etc. and the auto-layout worked. The installation was able to complete without any further problems.

I ran the system for a while but it crashed after a few abrupt power downs in the VM. So now, the boot archive is corrupt, and I stupidly chose the fail-safe mode and copied over the boot archive in the fail safe mode as well. As it stands now, the Solaris VM is officially kaput.

I need to figure out a way to rebuild the boot achieve. Save it for another day. Sigh...

Oh, incidentally, I also tried to install Fedora 9 on the VMWare Server in Kubuntu. Although the install completed successfully, the boot returned a fatal error, which appeared to be a bug in Fedora. I searched on the Internet and could not find anyone who's done an install of Fedora 9 in a Kubuntu VM. So for now, I think Fedora 9 just does not work in this set up.

Labels: , , , ,

Installing VMWare Server on Kubuntu

The VMWare Server is a free product you can download directly from VMWare. You do need to register to get a serial number to complete the installation.

The installation on Kubuntu is pretty straight forward. You need sudo privilege to run the configuration program, otherwise, the program complains. Also, either xinetd or inetd is requires. I added xinetd to my Kubuntu via adept manager since it wasn't installed prior.

After the installation, I tried to start the application but got an error. It was complaining about a libgcc_s.so.1 file in usr/lib/vmware/lib. Apparently this is a known problem after a quick search on the internet. Simply move the file out of the way solved the problem.

Voila. That's it. VMWare server is up and running on my Kubuntu.

Oh, I also created a new partition for use by the VMWare to store the images. Just in case, I figured it couldn't hurt. I mounted the partition to /vmimages and configured the default path in VMWare to point to the new partition. The setting is under "Host Settings" tab. A sudo privilege is required to make this change.

Next step, install Solaris 10 under VMWare. Fingers crossed...

Labels: ,

Friday, August 15, 2008

Migrating the Home directory in Kubuntu for Linux dummies

I decided to migrate my Home directory in Kubuntu to a new partition.

It's interesting that there isn't a lot of help about how to do it on the Internet. I tried a few tips I found on the Internet but none of those seems to work very well.

It's actually pretty straight forward and involves very few console commands. (linux purists will hate me for saying so. ha!)

Step 1, set up the partitions. First I booted into the Live CD and used the Gparted tool. I had tried to use use partition magic in Windows XP, but because I am using GRUB as the bootloader, partition magic does not work well. Gparted worked well enough. I made a new partition and formatted it into ext3.

Step 2, boot back into kubuntu. mount the newly create partition. (you know how to do this right? from the system settings--> advanced --> disk and file systems) make sure it's enabled at boot and is writeable and give it a mount point of /newhome. create the directory /newhome first of course. Now enable the new partition and make sure you can access it via the mount point.

Step 3. create a temp user. the reason I did this is because I wanted to make sure the file copy is done properly without having to log in as myself. I know people have tried to use commands to copy the home folder, but I did not find a reliable way to copy the home folder via command.

make sure the temp user has sudo privilege.

now log in as temp and copy the home folder to the new partition. I used Dolphine and it worked fine!

Step 5, now log out of the kde shell, and from the login screen, choose console login. this time, log in as your normal user. go to the /newhome folder, and do a chown operation on all the files in the folder to yourself. This step is required since you had copied the files using a different user. You could have use a command line tool like cpio to avoid this step, but it's not as easy as one would imagine.

sudo chown -R your_id:your_id your_folder

step 6, rename the /home directory to /home_backup

step 7, edit the /etc/fstab file. you should see the reference to /newhome in the file. change it to /home. save the file.

step 8, test your change by typing in startx from the command prompt. if your desktop appears, you're done!

step 9, reboot and enjoy your new Home partition.

Labels: