Pages

Wednesday, December 7, 2011

cannot open consolekit session unable to open session

Since doing an update (Kubuntu 10.04), this message appears when attempting to log in;

Message is :
Warning: cannot open ConsoleKit session: Unable to open session: the permission of the setuid helper is not correct.

Solving Code is:
(In Teminal)
sudo dpkg --configure -a

Thursday, November 24, 2011

To Set Global Environment Variables(JAVA_HOME) in CentOS

The easiest way to set an environment variable in CentOS is to use export as in

    # export JAVA_HOME=/usr/java/jdk.1.5.0_12

    # export PATH=$PATH:$JAVA_HOME

However, variables set in such a manner are transient i.e. they will disappear the moment you exit the shell. Obviously this is not helpful when setting environment variables that need to persist even when the system reboots.

In such cases, you need to set the variables within the system wide profile. In CentOS (I’m using v5.3), the folder /etc/profile.d/ is the recommended place to add customizations to the system profile.

For example, when installing the Sun JDK, you might need to set the JAVA_HOME and JRE_HOME environment variables. In this case:

   1. Create a new file called java.sh

          vim /etc/profile.d/java.sh

   2. Within this file, initialize the necessary environment variables

          export JRE_HOME=/usr/java/jdk1.5.0_12/jre
          export PATH=$PATH:$JRE_HOME/bin

          export JAVA_HOME=/usr/java/jdk1.5.0_12
          export JAVA_PATH=$JAVA_HOME

          export PATH=$PATH:$JAVA_HOME/bin

Now when you restart your machine, the environment variables within java.sh will be automatically initialized (checkout /etc/profile if you are curious how the files in /etc/profile.d/ are loaded) .

PS: If you want to load the environment variables within java.sh without having to restart the machine, you can use the source command as in:

   # source java.sh

Tuesday, September 20, 2011

To increase SWAP memory in Ubuntu 10.04


Option # 1: Use 64 bit Ubuntu Linux

64 bit Linux kernel will take care of 4G or more memory. Just grab latest 64 bit version and install it.

Option #2: Install PAE enabled kernel

Open terminal and type the following command if you are using Ubuntu version Ubuntu v9.04 and earlier:
$ sudo apt-get update$ sudo sudo apt-get install linux-headers-server linux-image-server linux-server



If you are using Ubuntu v9.10 (Karmic Koala) and above, enter:
$ sudo apt-get install linux-generic-pae linux-headers-generic-pae


Once kernel images installed, just reboot your workstation, type:
$ sudo reboot



After reboot, login into your system and type the following command to verify memory usage:
$ free -m






Option #3: (10.04)



While installing Ubuntu, sometimes we forget to allocate swap memory. This mistake can degrade the performance of the system. It is advice to allocate swap at the beginning. But its not a major problem since we can allocate swap memory indirectly.  SWAP memory should be double of the primary memory. If you have 512MB of RAM then it is wise to allocate 1GB of swap memory.
Here are the steps to increase the swap area in you Linux Machine
1. To create 2GB (2048MB) swap file (1024*2048MB = 2097152 block size)
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152
2. set up linux swap area
sduo mkswap /swaparea1
3. Activate /swaparea1 swap space immediately
sudo swapon /swaparea1
4. Reebot and open gedit
sudo gedit /etc/fstab
5. Append following line to file
/swaparea1 swap swap defaults 0 0
6. Reboot and to check
sudo free -m