There was an error in this gadget

Monday, June 25, 2012

Installing Windows after Ubuntu while dual-booting

    If you ever want to install windows on your system and dual boot with your current ubuntu installation, you don't have to get rid of your current installation. You can do it without re-installing ubuntu all-over again. 

Note : You need to have a working internet connection for the same or you need to have following five files correspong to your system architecture ( amd64 or i386 ) to proceed.
a) grub2-common_1.99-12ubuntu5_<architecture>.deb
b) grub-gfxpayload-lists_0.5_<architecture>.deb
c) grub-pc-bin_1.99-12ubuntu5_<architecture>.deb
d) grub-common_1.99-12ubuntu5_<architecture>.deb
e) grub-pc_1.99-12ubuntu5_<architecture>.deb
     You can download these from :

If your system satisfy the above condition then just do as in the following steps :

1) Back-up whatever you want to preserve. ( for worst-case scenario )

2) Have a Ubuntu CD / DVD / bootable USB disk with you. You will need it later on.

3) Create a partition for your windows installation from your ubuntu installation ( if you don't have one ) . The partion need-not to be formated as NTFS for now as you can do the same while installing windows. Just make a unformatted partition or simply create a blank free space (partition ) . You can do it via Gparted partition editor. If you don't have it installed , you can have it by entering following command in the terminal :
                       sudo apt-get update && sudo apt-get install gparted

4) Install Windows on the new partition.Remember not to touch the partition(s) containing your ubuntu installation or swap area.

5) At this point of time you won't be able to see or use your current ubuntu installtion as the system will straight boot into the new Windows installation.

6) Boot from your Ubuntu CD / DVD / bootable USB disk .

7) Open the terminal and enter the following command :

 i) sudo mkdir /mnt/temp ( creates a temporary directory for mounting your ubuntu partition )
ii) sudo mount /dev/sda2 /mnt/temp ( here /dev/sda2 is the partition where your ubuntu installation lies )
iii) Also mount some miscellaneous file-systems for proper working of chroot command : 
        for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i; done
iv) Now chroot into your ubuntu Installation :
                                  sudo chroot /mnt/temp
v) If the above commands run successfully, the terminal prompt should include "root" ( root@ubuntu:/# ), which indicates you are in the chroot environment.
vi) Confirm you have working net connection in the chroot environment ( for downloading the grub installation files if you have not already downloaded it ) :
                               ping archive.ubuntu.com
vii) Update your package list : This step is optional if you have already downloaded the grub files.
                                sudo apt-get update
viii) Purging the Grub Loader : Do not proceed to next command if you don't have a working internet connection or you do not have access to downloaded grub files . The next command will remove grub, grub-pc (Grub 2) and grub-common. If you are sure you have never had Grub legacy on the current installation you may omit "grub" from the next command.
                             apt-get purge grub grub-pc grub-common
Here is what you will have to do:
  • Press ENTER to continue.
  • Read the warning during the install about removing the bootloader. TAB to highlight "<Yes>" and press ENTER.
viii) Re-install the grub packages : 
                   Command :
                           apt-get install grub-common grub-pc
Here is what will happen:
  • You will be given the opportunity to add extra kernel options to the kernel line. If you don't know, you probably don't need them ; TAB to highlight "<OK>" and press ENTER.
  • Read the installation notes. TAB to "<OK>" to continue.
  • When presented with the device option, use the Up/Down keys to select the correct drive ( /dev/sdX ).
  • Make sure the installation drive [*] /dev/sdX has an asterisk next to it ( example: [*] /dev/sda ). 
  • If it doesn't, highlight it and press the SPACE bar to select it. Do not select a partition ( example: [ ] /dev/sda5 , etc). 
  • TAB to "<OK>" and press ENTER. When it has finishing the installation, you should have Grub 2 installed.
ix) Update the Grub Loader files
                     update-grub
x)- Exit the chroot environment
                       exit
If you have successfully exited chroot, the terminal prompt should return to the Ubuntu Live CD prompt ( ubuntu@ubuntu:~$ ).

8) Reboot your system and you will be presented a grub based boot-menu containing the choice of operating systems ( including Windows ) you want to boot.There it goes ....

Have a happy Ubuntu Experience...

Wednesday, June 13, 2012

Trouble-shooting oracle 11g installation on Ubuntu

In my one of the previous post ( http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html ) , I told you about steps for installation of Oracle 11g R2 express edition on Ubuntu. But I found out that many of you are facing problems in installing using the given steps. So, I came up with an idea of adding a trouble-shooter post which can enable you to have a hassle-free installation experience.
                Most of the time, if you followed the steps in previous post then you should be able to reach at least up to the configuration part ( Step # 6(ii) ). If you face any problem before this step then you must perform re-installation. For this do the following :
1) Enter the following command on terminal window :
sudo -s
/etc/init.d/oracle-xe stop
ps -ef | grep oracle | grep -v grep | awk '{print $2}' | xargs kill
dpkg --purge oracle-xe
rm -r /u01
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove

2) Follow the steps given in the previous post to install the Oracle 11g XE again.

Now, once you have reached the configuration part. Do the following to avoid getting MEMORY TARGET error ( ORA-00845: MEMORY_TARGET not supported on this system ) :
sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

(here size will be the size of your RAM in MBs ).

The reason of doing all this is that on a Ubuntu system  /dev/shm is just a link to /run/shm but Oracle requires to have a seperate /dev/shm mount point.

3) Next you can proceed with the configuration and other consequent steps.

To make the change permanent do the following :

a) create a file named S01shm_load in /etc/rc2.d :

sudo vim /etc/rc2.d/S01shm_load

Now copy and paste following lines into the file :

#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
       touch /var/lock/subsys/listener
       rm /dev/shm 2>/dev/null
       mkdir /dev/shm 2>/dev/null
       mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
   exit 1 ;;
esac

b) Save the file and provide execute permissions :

         sudo chmod 755 /etc/rc2.d/S01shm_load

This will ensure that every-time you start your system, you get a working Oracle environment.

If you face any other problem while installing Oracle 11g R2 XE on Ubuntu, please feel free to ask as comments.

Reference:
1) Ubuntu man-page