Wednesday, October 28, 2009

Dual Booting Windows 7 and Linux with EasyBCD

I decided to use Windows 7 bootloader instead GRUB to manage the dual boot.

I've been using GRUB before to manage Linux/Windows dual boot -- you need to edit the menu.lst file in the /boot folder under the Linux root partition; this time, I decided to give the Windows 7 bootloader a try.

Windows 7 uses the same bootloader as Windows Vista. One of the best tool for managing the bootloader is EasyBCD from NeoSmart

Interestingly, the easiest way to dual boot Linux (in my opinion)-- using the NeoGrub bootloader, is not well documented by the maker NeoSmart.

NeoGrub is made by NeoSmart as a bootloader within a bootloader. It can live anywhere on your Windows filesystem; you just make a reference to it inside EasyBCD. After you install NeoGrub from within EasyBCD, you want to click the Configure button and modify the menu.lst file (that's only way to modify it. the file is locked outside the program).

Just copy the boot entries from the old menu.lst file. (if you are wondering how in the world you would be able to reach the old menu.lst from inside Windows 7, you might want to read my old post on Ext2 IFS :) Those boot entries should look like the following:

title Ubuntu 8.04.1, kernel 2.6.24-19-generic
root (hd1,0)
kernel /boot/vmlinuz-2.6.24-19-generic
root=UUID=c28b6727-d0e5-46c1-93a8-9b336033ff05 ro quiet splash
initrd /boot/initrd.img-2.6.24-19-generic
quiet


Save the file and EasyBCD writes a new NeoGrub entry the into the Windows 7 bootloader for you. Done.



Result of the bootloader entries including the new NeoGrub entry:

Labels: , , , , ,

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: , , ,

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: , , ,

Tuesday, August 19, 2008

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: , , ,

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: