Archive

Archive for the ‘Operating Systems’ Category

Merging VMWare files to single file

May 27, 2010 Leave a comment

A few days back I had to use a VMWare image, being not really a fan of VMWare I wanted to use it with VirtualBox (http://www.virtualbox.org/) and found out that .vmdk files from VMWare are supported in VirtualBox which was a sigh of relief but then got hit with another requirement…

VirtualBox supports single VMWare .vmdk file and the VM I had was using multiple small vmdk files which means it will not work in VirtualBox.

Next step for me was to find a way if possible to convert those multiple files into a single “big” .vmdk file that I can use with VirtualBox and that was in the end a single VMWare commad from the folder where I had all the small vmdk files:

# vmware-vdiskmanager -r smallfiles.vmdk -t 0 bigsinglefile.vmdk
Creating disk 'bigsinglefile.vmdk'
Convert: 100% done.
Virtual disk conversion successful.
….Once this was done it was just a matter of adding this new .vmdk file as a disk in VirtualBox and booting a VM from that.
Shoaib Mir
shoaibmir[@]gmail.com
Categories: Operating Systems Tags: , ,

Reading XML file using shell script

May 2, 2010 2 comments

This was like the first time where I had to write something that will be able to read something out of a XML file using a shell script. Usually I would use Python/Perl as my favorite choices in such a scenario but in this one I really *had* to do all within a shell script.

This is an example of the type of XML file I had to read:

<Logentry>
<changelog>Fixed a new bug</changelog>
<name>Shoaib Mir</name>
<date>Sun, 02 May 2010</date>
<email>shoaibmir[@]gmail.com</email>
</Logentry>

I ended up having a shell script like this:

#!/bin/bash

#Looking for four keywords in here
for key in changelog name date email
do
OUTPT=`grep $key log.xml | tr -d '\t' | sed 's/^\([^<].*\)$/\1/' `
eval ${key}=`echo -ne \""${OUTPT}"\"`
done

# Getting the results in four specific arrays
changelogarr=( `echo ${changelog}` )
namearr=( `echo ${name}` )
datearr=( `echo ${date}` )
emailarr=( `echo ${email}` )

#Print all Arrays
echo ${changelogarr[@]}
echo ${namearr[@]}
echo ${datearr[@]}
echo ${emailarr[@]}

Which gives me an output:

shoaib@shoaib-desktop:~/Desktop$ ./readxml.sh
Fixed a new bug Shoaib Mir
Sun, 02 May 2010
shoaibmir[@]gmail.com


Shoaib Mir
shoaibmir[@]gmail.com

Printing PDF file with images

January 23, 2010 Leave a comment

A few days back I was having a terrible time when I tried to print a few tickets that I had in a PDF document. It all started since I upgraded my desktop Ubuntu to 9.1, didnt have time at that moment so asked a colleague to do the print for me.

Once I got time, after a little bit of googling found out that it was a package that I was missing which is needed for the rendering of images and that needs to be installed before I go on printing PDF docs with images in them.

It was:

poppler-data

Hope it helps someone else who is going through the same pain of not able to print out PDF docs πŸ™‚


Shoaib Mir
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: , ,

Disable notification system in Ubuntu

November 3, 2009 1 comment

I dont know about everyone else but for some reason I just found the notification system really annoying with my Ubuntu setup, after struggling with a few files and settings finally was able to get it all disabled.

Here is a quick how-to in case someone wants to disable/enable it….

For disabling use the following:

sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service 
/usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled

To re-enable it:

sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service.
disabled /usr/share/dbus-1/services/org.freedesktop.Notifications.service


Shoaib Mir
shoaibmir[@]gmail.com

Converting IMG files to Virtual Box VDI format

September 13, 2009 11 comments

In order to avoid installing the whole VM myself, I got an IMG file from a colleague for the CentOS VM. Now once I had the IMG file, but had not in the past converted it before to a VirtualBox compatible VDI format… after doing a little bit of research I found that to be a very simple process, so thought of sharing it with anyone who will like to do the same….

Once you have the .img file just run the following from command line:

VBoxManage convertfromraw -format VDI [filename].img [filename].vdi

Depending on the size of .img file it might take a little while as for my desktop machine it took like around 5 minutes for converting a 4GB img file to vdi format. Once its all done just add the VDI file as another disk, attach it to a VM in VirtualBox… start the VM and you just got it all working πŸ™‚


Shoaib Mir
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: , , ,

Configuring SSH access for VirtualBox Guest Host

September 13, 2009 6 comments

A few days back at work, I had to configure a CentOS VM and after I was done with installation on the host itself under VirtualBox I tried doing SSH to the CentOS VM and it didnt let me do that. I had it all configured with NAT and never thought that it will give me such a problem, googling it for a little while for an answer I found the solution… here is a quick howto for setting up SSH access to a VirutalBox VM:

Let <VMname> be the guest machine name (use quotes if it contains spaces), here are the commands that you have to execute for host machine console:

$ VBoxManage setextradata <VMname> “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort” 2222
$ VBoxManage setextradata <VMname> “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort” 22
$ VBoxManage setextradata <VMname> “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol” TCP

The HostPort must be greater than or equal to 1024 since listening on ports 0-1023 needs root permssions (and Virtualbox usually doesn’t).

Once all goes good with the commands, you need to exit out (close it) of the guest Machine (different from a reboot as a reboot will not be enough in this case), restart it and then connect via ssh with:

$ ssh -l username -p 2222 localhost

Replace “localhost” with the host machine IP address if you are connecting from another computer.


Shoaib Mir
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: , , ,

Using projector screen with Ubuntu

August 5, 2009 1 comment

Since upgrading to Ubuntu 9.04 I was having problems with using the projector for doing demos and all. It used to detect the signal from the projector to my video but I couldnt make my desktop to show on the projector screen. I didn’t care much about it then as I was able to get a colleague’s laptop and do my presentations but like last week I had to do a PostgreSQL training for which I really needed my laptop as I had setup almost everything on my machine for doing practicals.

So I thought of giving it a try to see if I can somehow make it work…

Googled it and found someone mentioning “Randr” and when I searched the same through apt-get I was able to find “Grandr” which is a GNOME Panel Applet that allows you to select screen resolution and orientation from the GNOME Panel.

Once I got it installed, connected the projector screen and opened up “Grandr” and then in the first try I was able to see my desktop on the projector screen… I did the following:

– Once Grandr was up I could see my laptop screen as LVGS and project screen as VGA
– Selected ‘Auto’ for VGA and used the normal resolution I go with for my laptop screen
– Clicked on Apply and thats it…

“Grandr ” came out very handy during the training and I was able to do the whole thing using my laptop πŸ™‚


Shoaib Mir
shoaibmir[@]gmail.com

GCC installation problem for OpenSolaris (VM)

May 19, 2009 Leave a comment

Just today as I was trying to port my application code to Solaris and the first thing was to install GCC for Opensolaris and I was using VMware for that purpose.

While installing GCC I got the following error:

user name not found: root

Which didnt make any sense at all so after doing a little bit research I found out that its because the /etc/passwd file is very much out of date and was showing date from 1970.

To fix that…

Simple save the /etc/passwd file with the current date using the superuser previliges and then retry GCC installation which hopefully will not give any problem after this change has been done.

-Shoaib
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: , ,

Windows 7 – My experience

May 10, 2009 5 comments

I finally got the time to get it working in a VM and this is what I saw of it…

– On the performance side, yes it looks much much better then Vista but nothing like XP

– Good drivers compatibility as I didnt find any problems with any of the devices

– It has the most ugliest taskbar that you can think of, for the way it handles the multiple open windows and seriously it really was the most annoying part for me or I guess I am much more used to Ubuntu and one can never expect anything innovative or creative from M$.

– I couldn’t find Quicklaunch option, it would be good if some M$ techie could give a way around that?

Spending just like 30 minutes, I thought of just sticking to the old XP installation that I have for home use and stay away from the new version which only I would say a little behaved twin of Vista.


Shoaib Mir
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: ,

Quakelive on Linux

April 8, 2009 Leave a comment

Its just not understandable when you see Quakelive for Windows but nothing like a native Linux installation. It simply sucks for me as I dont have a dual boot with the crappy old Windows on it.

I just tried installing Quakelive on Linux and it went sweeet, so wanted to share if it could help someone.

I have Ubuntu 8.1 with Wine 1.0.1, the process is something like this:

–> Install Firefox for Windows, and Flash Player for Windows using Wine on Ubuntu

–> Now browse to Quakelive.com using the Windows based Firefox, log in and then it will ask to download the Quakelive MSI. Dowload the MSI installer and use Wine for its installation.

–> Once this is done, restart Firefox, browse to Quakelive and it will update a few files which might take a while and once thats done you are all ready to get into Quakelive.


Shoaib Mir
shoaibmir[@]gmail.com

Categories: Operating Systems Tags: ,