Tuesday, July 6, 2010

Getting Fedora 13 going

I thought it is the time to use a Linux systems for my day to day work. I have used Linux enough for testing and office work, but never as my desktop. Since I did not work on Linux lately, it was a good way to keep up with new developments. All the distros looks good and solid, so selecting one was not an easy task! I considered Ubuntu, Suse and Fedora. Ubuntu was probably the most user friendly system and it has the live CD (boot from the CD and get a fully working Linux system). Suse is from Novell, and Fedora from Redhat. Since Redhat is stronger in the server market, it made sense for me to use Fedora. There was a good comparison of distros at http://distrowatch.com/dwres.php?resource=major.

Took a while to download the 3.5 GB iso image, which consumed a considerable chunk of my data allowance. Installation was smooth and basic things were working. But the graphics/media support was not very encouraging. There was no flash player so youtube was out, and the highest screen resolution was 1024x768 with the Radeon x1300 card I had. It was a project to get them going. With my monitor set to native resolution of 1680x1050, it was like a stamp!.

ATI (AMD) does not seems to be supporting Linux well, there were discussions all over the web on this. The drivers provided by ATI are as-is, there were no fixes or updates. Many others who had this issue seems to solve it with mesa-dri-drivers-experimental package. The post
http://www.if-not-true-then-false.com/2010/howto-install-ati-drivers-mesa-3d-dri-experimental-on-fedora-12-linux was very helpful. I decided to try the Fedora 12 version instead of the newest. Installing it with yum with the following command line was trouble free.

yum install mesa-dri-drivers-experimental

Though the installation was error free, there was no change. When try to change the screen resolution, it was always giving 3 options, highest being 1024x768. Suggestions to look at the /var/log/X11.0.log was a good advice, since this shows what files it is using for configuration. Based on the information found in the net, next step is to look at the configuration file, /etc/X11/xorg.conf. This was not possible since there was no such file!

The command

Xorg -configure

suppose to create the file xorg.conf, but it didn't. However, doing this after shutting down the XWindows with

su
init 3

did create the file.However, trouble was not over - still it was showing the same resolution options, and looking at the newly created xorg.conf revealed that it did not contain entries for higher resolutions. New resolution parameters can be inserted to the file, but it should contains specific sync frequencies etc. That's where the command gtf comes in! When run with the desired resolution, it outputs the correct modeline command.

[Krish@kr-fedora ~]$ gtf 1680 1050
# 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz

Modeline "1680x1050_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync

This modeline entry has to go to Monitor section of xorg.conf. Then the resolution to the Screen section.
Section "Monitor"
Identifier "Monitor0"
VendorName "Philips"
ModelName "Brilliance 200w"
ModeLine "1680x1050_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1680x1050"
EndSubSection
EndSection
Other than this, some values in device section also modified (Videoram, depth etc.) but again not sure if that's necessary.

Something else I noticed was my Philips monitor takes 1680x1050 and 1400x1050 both as native resolutions, but the former is better than latter. The latter looks little smudged.

Good part of the day is already gone but still it did not work! Out of options, I just selected a lower resolution to see how it looks like. Then when I went back to set it higher - bravo, here I have my native resolution listed! Looks like going to a new resolution triggered a refresh.

Getting flash going was difficult too. Installing the package from Adobe site didn't work, but using

yum intall flash-plugin

installed it correctly. However, still it does not work with Chrome, but works well with FF.

Start searching for a solution for Chrome. There was a very good wiki page at http://fedoraproject.org/wiki/Flash. They gave precise instructions to get it going. Basically, by copying (linking) the firefox plugin to chrome plugin folder.

- on 32-bit, create a symbolic link that tells Chrome how to find the 32-bit plugin:

sudo ln -s /usr/lib/mozilla/plugins/libflashplayer.so /opt/google/chrome/plugins/libflashplayer.so

- on 64-bit, create a symbolic link that tells Chrome how to find the 64-bit plugin:

sudo ln -s /usr/lib64/mozilla/plugins-wrapped/nswrapper_32_64.libflashplayer.so /opt/google/chrome/plugins/nswrapper_32_64.libflashplayer.so

After restarting Chrome - everything is working! for the moment :-)

Monday, June 21, 2010

Adding Winpe boot to Windows 7 boot menu

I spent good part of today preparing a new test machine. One thing I always wanted was to have a native WinPE boot in the test machine. This was possible with vista but not with previous versions of Widows. For pre-Vista systems, I had to mess around with bootmanager/ntldr to get this to happen. I used a Windows 7 system today, but don't see any reason why it would not work with Vista.
In test environments, it is useful to have a WinPE boot option in windows boot menu. Booting to WinPE would allow you to look at the filesystem in case if the computer is not booting and more importantly, it will help easy refreshing of the system by restoring a fresh image. Having a PXE server in your network too, would equally be useful in terms of booting to preOS environments.

I had a WinPE build, created using the latest version of WAIK (Windows Automated Installation Kit) . If you don't have WinPE, search for AIK , which is a free download from Microsoft. It is not difficult to build WinPE using WAIK, and lot of help in the net!

This is all I had to do.

Copy boot.sdi file

If you install Windows 7 using the default settings, it would have created a small partition to hold boot files. This is usually 200MB, and no drive letter assigned. If you don't have this small partition, skip step fist and last step. All files will be in C: in that case.

  • Start diskmanager and assign a drive letter to the boot partition
  • Boot files are in the "\boot" folder in that partition. This is a hidden folder, but from a CMD window, you can go to the folder with 'CD \boot' command.
  • Files in the boot are not hidden. It has most of the boot files necessary but not boot.sdi file. Copy this to the \boot folder from WinPE build's boot folder.
  • Now we are done with the hidden partition, go to diskmanager and remove the driver letter for that partition. Otherwise it will continue to mount it all the time.

Copy the .Wim file

The boot image or WinPE, WinPE.wim file can be found in the WinPE built created from AIK. Copy the .wim file from the WinPE build to a convenient location in the system. You may have enough space in the boot partition (it is 200MB but there are no many files), but try to avoid it. You can create a new folder in drive C: and use it to hold your .wim as well as .vhd in time to come! Say your Windows partition is C: and the name of the .wim file is winpe.wim, and copied it to C:\Images.

Add an entry to BCD

Usually, the {ramdiskoptions} entry is not created when installing Windows. Just make sure if it is there or not with the following command.

bcdedit /enum {ramdiskoptions}

If it says "There are no matching objects or the store is empty", that indicates {ramdskoptions} entry has not been created. Create it with the following commands.

bcdedit /create {ramdiskoptions}
bcdedit /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi

Now, create the actual entry with following commands.

bcdedit /create /d "WinPE boot" /application osloader

After successfully creating the entry, this will display the {GUID} of the entry in format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Use that value in the following commands.

bcdedit /set {GUID} device ramdisk=[C:]\Images\winpe.wim,{ramdiskoptions}
bcdedit /set {GUID} osdevice ramdisk=[C:]\Images\winpe.wim,{ramdiskoptions}
bcdedit /set {GUID} systemroot \Windows
bcdedit /set {GUID} detecthal Yes
bcdedit /set {GUID} WinPE Yes

Finally, add it to the current boot options list with

bcdedit /displayorder {GUID} /addlast
Reboot the system and select WInPE boot to boot to WinPE

Surprisingly, you can boot the same machine to 32 bit WinPE as well as 64bit (if the machine is 64bit.) just by using the appropriate WinPE.wim. They can be in the same menu, no other files need change.


Notes:

  • In boot menu, if "Ramdisk Options" is displayed instead of the description of WinPE, remove the description of the {ramdiskoptions} with the following command.

bcdedit /deletevalue {ramdiskoptions} description

  • If booting to winpe fails and says "A required device is not accessible", check if you have copied the boot.sdi file to the correct location.

Sunday, June 20, 2010

Can Windows 7 natively boot Vista VHD?

I spent good part of yesterday trying to natively boot a PC with a Vista VHD. I am impressed with the native VHD boot of Win7. Both experimenting and testing benefit from it. The ability to refresh a machine in around 5 minutes without using any tools is truly amazing. Yes, virtual machine snapshots do it even faster, but you lose a good part of the machines power when using a virtual machine. Specially if you use it for a prolong period, native boot has advantages.

Yesterday I wanted to try natively booting a system from a Vista VHD. There were several posts in the net how you go around doing it, and they seems to be so simple and did not understand why MS does not support it. Step by step instructions I saw is identical to what you do when getting a Win7 VHD to boot natively.

To tell a long story short, it didn't work. At boot up, Windows goes to recovery mode if I have an boot entry to Vista VHD. Surfing the net a bit proved that I'm not alone in that.

After half a day later, my hopes were shattering. There are couple of posts explaining why it can't be done. Well, every thing ever been done on this planet has been put away by someone saying it's not possible. So those posts didn't stop me trying it. However, now I believe it is not possible - at least in the way described in some sites (just adding the VHD to boot menu) but may be there is another way - I will keep trying.

I came across the product VMLight when searching for this. It seems they have a driver that can natively boot any VHD (not only Vista but XP, Linux too). I will try it but I'm not sure if it is really 'native'. Though you boot from a VHD, it is probably using another layer to translate VHD to a SCSI device. This could affect performance but the flexibility you get with the ability to natively boot all current OSs could well worth it.

Thursday, May 20, 2010

SQL upgrade and password case sensitivity

For one of my clients, it was the time to say good bye to SQL 2000. It has been already late to say it but now they are upgrading everything to latest technology, including virtual servers on SAN storage, 2K8R2 etc. and SQL 2008.

I did not want to do an in-place upgrade of 2k3 server and SQL, but restore the database to a fresh 2K8R2 server. Test platform was ready - thanks to virtualization it is so easy to get new servers going - and moving the database was smooth. Everything was good till we start the app, then

18456 severity: 14 State: 8 - Login failed for user 'xxxx' [CLIENT:xxx.xxx.xxx.xxx]

This system is coming from the days where most of the computers did not have a virus guard. The password is not complex so no way we could typed it wrong 100s of times. However, going around that till mid night did not resolve the issue.

In the morning went through all the events with a fresh mind. With all the knowledge gathered from posts in the web it became clear what the issue was. Looking at the binaries confirmed the suspicion, and with a single change it started working.

SQL Server 2000 passwords are not case sensitive. The database had a mixed case password, which is hard coded in the app. After migration, password was set to all lowercase, just like it was typed. Admins were using the password in lowercase for all those years! When passwords become case sensitive by default in newer version, it did not work anymore.

Today, we don't even thinking of hardcoding passwords. We want the user name to be case sensitive let alone the password. We failed to grasp that it was the norm just a few years back. Times are changing and we are forgetful.

Monday, May 17, 2010

Selenium and Visual Studio 2010 C# (CSharp) Express edition

Again, that question - what tool to use for this automation script? It is not a big script so the risk is low even if the selection is not optimal....

Looked at Watir and Selenium. Watir is more command line oriented than Selenium. I was impressed with both as I could execute a single line in interpretive mode and get something to happen in the browser. Amazing!

Selenium had the advantage of having a recorder. It is really handy to get most of the controls without painstakingly going through the source. In couple of sites there was a reference to a recorder for Watir, but never found the tool. This was the main reason to go to Selenium. It didn't take long to realize that the builtin scripting capabilities are not flexible enough to my work. Then, the next stage -went for Selenium RC. It supports many different languages to drive automation. I went for VS C# 2010 Express, which is free from MS.

I was pleasantly surprised of the compatibility of Selenium generated C# script and the VS C#. All I had to do was changing the Target .net framework version in C# project and then copy the class.
  1. After recording, select the 'C# - Selenium RC' from Options->Format. This will generate the C# class for your test.
  2. Note down the class name from 'public class ' statement. This is the name of the test case.
  3. Go to the VS project properties and change the target framework to .Net framework 2.0. This gave me hours of trouble till found!
  4. Remove any references marked with a yellow icon in Solution Explorer, and then any 'using 'statements marked with red underline in program.cs.
  5. From the same dialog, brows and add all the dlls in 'Selenium-dotnet-clientdriver-<ver>' package. This is in Selenium-remote-control <ver>.zip file. I was using version 1.0.3.
  6. Create a new class. Use the name noted in 2. Cut and past the output from Selenium IDE to this class file.
  7. Add the name space of class to program.cs
  8. Simply create the object, and start calling the SetupTest(). Then write your program, you can use/add/edit functions created by Selenium. Call TearDownTest() at the end, which would close everything.
It was a rare situation where two independent software programs agreed with each other so well :-)



Sunday, May 16, 2010

Finally ..

After a much delay, finally managed to start this blog. Well - I was not sure to start it under my name or my company name. End of the day it was not hard to decided as all the common shorten forms of the my name has already been taken, so settled down with company name :-)