Monday, 10 January 2011

Public key authentication with bluecoat proxy

- Create a key with length maximum 1024 on your machine

$ ssh-keygen -t rsa -b 1024 -f filename

- ssh to the bluecoat proxy


> en
# configure terminal
#(config) ssh-console
#(config ssh-console) inline client-key admin ...
< paste the key after those three dots >
...


./arun

Monday, 6 December 2010

Converting LVM virtual machine storage to image

To convert the LVM disk to qcow2 formatted disk image,

Use lvdisplay to get the Logical volume name
$ sudo lvdisplay

Use qemu-img to convert to the required image format
# qemu-img convert -O qcow2 /dev/mapper/lv_name <destination_file>.qcow2

eg:
# qemu-img convert -O qcow2 /dev/mapper/disk1 disk1.qcow2

This will be useful to replicate the virtual machines to other hardware.

./arun

Friday, 1 October 2010

Install CyanogenMod 6 (Android 2.2 Froyo alternative) on HTC Dream (ADP1)



Atlast managed to get the 2.2 flavour on ADP1. (this installation is only applicable for root'd Android developer phone HTC dream)

  • Requirements:


Tools: fastboot


images:
Amon_Ra 1.7.0 ( http://files.androidspin.com/downloads.php?dir=amon_ra/RECOVERY/&file=recovery-RA-dream-v1.7.0.img )
radio image for adp1 (http://sapphire-port-dream.googlecode.com/files/ota-radio-2_22_19_26I.zip)
update-cm-6.0.0-DS-signed.zip (http://forum.cyanogenmod.com/files/file/95-update-cm-600-ds-signedzip/)
gapps-mdpi-tiny-20100926-signed.zip (http://forum.cyanogenmod.com/files/file/124-google-addon-mdpi-tiny-20101020/)
DangerSPL (http://sapphire-port-dream.googlecode.com/files/spl-signed.zip)

  • Procedure:


Ref : http://wiki.cyanogenmod.com/index.php?title=Full_Update_Guide_-_Android_Dev_Phone_1#Installing_a_Custom_Recovery_Image

- Download and copy all these images to the root of your sdcard except the recovery image

  • Install custom recovery image:


- boot the phone in fastboot mode by pressing camera button while rebooting

- From your machine make sure the device is visible
# ./fastboot-mac devices
HT845Gxxxxx fastboot

- flash the cyanogen recovery image and reboot
# ./fastboot-mac flash recovery recovery-RA-dream-v1.7.0.img
sending 'recovery' (4594 KB)... OKAY
writing 'recovery'... OKAY

# ./fastboot-mac reboot

- Once the phone is rebooted make sure  you have the 1.7 recovery image

  • Flash the radio image


Now flash the radio once the phone rebooted to recovery RA 1.7.0 by pressing the home button while rebooting
- select install zip from sdcard and choose the radio image , once the installation is done reboot the phone and make sure that you have the 2_22_19_26I base band version





  • Flash danger spl now


Ref: http://wiki.cyanogenmod.com/index.php?title=DangerSPL_%26_CyanogenMod_5/6#Install_DangerSPL

boot the phone in recovery mode, and select install zip from sdcard and select install the danger spl image, reboot

This will update the Hboot to 1.33.2005,  this is required to increase the ROM size to hold the cm6 image.



  • flash the cyanogen mode 6 images


Ref : http://wiki.cyanogenmod.com/index.php?title=DangerSPL_%26_CyanogenMod_5/6#Installing_CyanogenMod_ROM

boot the phone again in recovery mode, select and install the cm 6 image, reboot the phone and make sure that you can boot in to the new cyanogen 6.



  • Install the google addons


The important thing is dont install the full version of google apps on ADP1 just use the MDPI tiny version. otherwise the phone cannot boot properly.

Ref: http://wiki.cyanogenmod.com/index.php?title=Latest_Version#Google_Apps



Now clear wipe the cache and reboot the phone, That is it. Now you have ADP1 installed with Cyanogenmod 6, Enjoy..



./arun

Thursday, 23 September 2010

Install *.apk to android phone

It was disappointing that the android devices selling in most of the gulf countries doesnt have market place installed :( - One of the core and major feature of androis is missing.

Anyway the softwares available in Android Package file (apk) can be installed by downloading it to the pc using adb

eg: to install slide me market place, an alternative for google market place.
download the latest apk from http://slideme.org/.
$ ./adb install ~/sam2.apk
1686 KB/s (506724 bytes in 0.293s)
pkg: /data/local/tmp/sam2.apk
Success


./arun

Tuesday, 10 August 2010

Exporting display over ssh

To export the display from a remote server over ssh:

ssh -X user@host

Just made sure that, X11 forwarding is enabled on the sshd_config .

Once the connection is made, you can make sure the display is exported using:

# echo $DISPLAY
localhost:10.0


if the value is empty, make sure you have the necessary package (mkxauth) installed to create .XAuthority file.

./arun

Wednesday, 28 July 2010

IPv6 configuration for KVM guests

It is simple and straight forward to enable IPv6 on KVM guests

Configure the host machine with IPv6 Address on the bridge interface

cat ifcfg-br0



IPV6INIT=yes
IPV6ADDR=xxxx.xx::10
IPV6_DEFAULTGW=xxxx.xx::1
IPV6_AUTOCONF=no




Configure the interface on virutal machines with ipv6 address

cat ifcfg-eth0



IPV6INIT=yes
IPV6ADDR=xxxx.xx::11
IPV6_DEFAULTGW=xxxx.xx::1
IPV6_AUTOCONF=no




Add the the necessary firewall rules to ip6tables on the host machine


-A FORWARD -m physdev --physdev-is-bridged -j ACCEPT.



./arun

Tuesday, 20 July 2010

NAT with port forwarding on Virtual Box

You can use the host-only-adapter networking, if you require the virtual machine to be accessible only from the host machine. In this case your virtual machine will not have access to anywhere outside the host. Read more about virtual box networking at http://www.virtualbox.org/manual/ch06.html


On the other hand NAT enabled interface can communicate with clients outside the host, but the host cannot access the services on the virtual machine directly. We need to enabled port forwarding with NAT interface to achieve this.


On Linux:
If you need to have ssh accessible from host machine to virtual machine,
$ VBoxManage modifyvm "VM Name" --natpf1 "openssh,tcp,127.0.0.1,2222,,22"

Where --natpf1 is for adapter1, openssh is just a anme, and you can also input the ip address of virtual machine like
$ VBoxManage modifyvm "VM Name" --natpf1 "openssh,tcp,127.0.0.1,2222,10.0.2.20,22"

(assume the virtual machine ip is 10.0.2.20)

Now you can make ssh connection from host like, $ ssh localhost -p 2222

We can use same port number for port number about 1024 , say for a service running on port 8080 we can forward it with
VBoxManage modifyvm "VM Name" --natpf1 "proxy,tcp,127.0.0.1,8080,10.0.2.20,8080"

These rules will be added to the .VirtualBox/Machines/machine_name/machine_name.xml file like:
< Forwarding name="openssh" proto="1" hostip="127.0.0.1" hostport="2222" guestip=10.0.2.20 guestport="2222"/>

You can forward connection to any port on virtual host like this.

Make sure that the virtual machine interface is closed and the vm is not running while you change it, otherwise the changes will not take effect.

On Windows:
VBoxManage setextradata "VM Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "VM Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "VM Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

* Replace VM Name with your virtual instance name

./arun

Convert KVM images to Virtual Box (VDI)

It took a while to get the KVM image working with Sun virtual box.


The advantages of a virtual box image is, you can run it on any platform (linux, mac or windows), works without virtualization enabled processor and will work on a 32bit machine
Here are the steps to create an image that works with virtual box:


From the KVM installed server
$ qemu-img convert kvm-os.img -O raw kvm-os-raw.img

Copy the image (kvm-os-raw.img) to virtual box machine
$ VBoxManage convertfromrow --format VDI kvm-os-raw.img vbox.vdi

Converting from raw image file="kvm-os-raw.img" to file="vbox.vdi"...
Creating dynamic image with size ....

This will create a virtual box compatible image
Incase required you can compact the image to actual size
$ VBoxManage modifyvdi /home/user/vbox.vdi compact

0%...10%...20%...30%...40%...50%...60%...70%
Here the path to vdi image must be absolute.

Now you can create a new virtual machine from virtual box console/command line, with the vdi image as storage.
Boot the machine and hope for the best :)
But it wasn't easy for me even after this beautiful vdi image, boot hangs with a kernel panic, file system not found.


To fix this issue, we need to recreate the initrd image in the virtual machine:
instructions to do it for redhat:
- Boot the virtual machine in rescue mode with Redhat CD
> linux rescue

# chroot /mnt/sysimage

take a backup of existing initrd
# cp /boot/initrd-2.6.xxx.img initrd-2.6-old

create new initrd image
# mkinitrd -v /boot/initrd-new.img kernel-version

// eg: mkinitrd -v /boot/initrd-new.img 2.6.18-194.8.1.el5

edit the grub configuration and replace the initrd image name with new one
# cat /boot/grub/menu.lst

Reboot the machine and see if it boots :)

Hope this will be helpful for someone, I spent hours to get it working :) .
./arun

Monday, 5 July 2010

Netboot KVM guest

To install the KVM guest operating system (eg: RHEL) from the network
- Create the bridge interface on the KVM host machine (http://arunnsblog.com/2010/04/09/virtualization-with-kvm-under-redhat-linux-migrate-vmware-virtual-images-to-kvm/)
- Make sure that the gateway is configured in the bridge interface (GATEWAY=).
- Make sure that you have the required rules added to the iptables:
-A FORWARD -m physdev --physdev-is-bridged -j ACCEPT
- Create virtual machine with supported network interface type (pcnet, rtl8139 used to work)
- Add the mac address of kvm guest to the dhcp server

Start the virtual machine and see if it can kick start from the network.

You can trouble shoot with a tcpdump on the KVM host machine:
tcpdump -i br0 port bootps -vvv -s 1500

./arun

Monday, 28 June 2010

Install Zope Object Database (ZODB) for python

ZODB is a way to store persistent data, ZODB comes with ZOPE.
To import ZODB directly to python.

$ easy_install ZODB3==VERSION

eg: $ easy_install ZODB3==3.8.3


$python
>>> import ZODB


./arun