Friday, September 30, 2011

Tesla C2075 not detected by Nvidia control panel after installing Driver 275.89

Me and my friend brought two Tesla card for one of our HPC project. To my surprise after installing the new driver (Win7 64bit) for the Tesla C2075 compute board, Nvidia Control Panel won't start and gives out an error "You are not currently using any Display attached to an Nvidia GPU". But the windows device manager was listing it properly as a working card and there was no error in the system logs. It was really puzzling. 

After some time fiddling with the settings and Googling I found this Autodesk forum, which says that by default the new Win 7 driver sets TCC bit ON. So I started a command line in administrative mode and navigated to C:\Program Files\NVIDIA Corporation\NVSMI folder and issued the following command to disable the settings.

nvidia-smi.exe -dm 0

A reboot was required. And guess what the control panel started working as it was supposed to. Woooh ! it was a great relief coz I thought the board might have gone bad.

Monday, September 5, 2011

Show message on X desktop from cron.

Following will show an info message "Hello World" on the default desktop every hour.

0 * * * * DISPLAY=:0.0 /usr/bin/zenity --info --text "Hello World"

Tuesday, August 23, 2011

CUPS : Adding Job Accounting Number for UTAX printer CD 1120

Here is a simple step that I used to get the Job Accounting information or PIN working with UTAX CD 1120 printer.
  • Download the driver for UTAZ CD 1120 printer from here
  • Unzip it to a folder in your home directory. 
  • Open the PPD file corresponding to your printer (In my case UTAX_TA_CD_1120_English.PPD) using a text editor for example 'vi' 
  • Search for the keyword "Accounting". You will reach a line similar to "*OpenUI *KMManagement/Job Accounting: PickOne"
  • Move your cursor three or four line below. Your cursor should be now at line reading
    • *KMManagement MG0000/0000: "(0000) statusdict /setmanagementnumber get exec"
  • Edit the line and replace 0000 to what ever your printer accounting ID is.
  • Once editing is done, save the file and close.
  • As a precaution restart the cups daemon. /etc/init.d/cups restart.
  • Now starting adding the printer, selecting the newly edited PPD as the driver.
  • Once the installation is over, option the printer configuration gui and select Job Settings.
  • Scroll down where you can see Accounting information. Select your printer ID from the Job Accounting list.
  • Save the changes and send a test page. It should work now.

Thursday, July 28, 2011

Compiling Nvidia driver for Debian Squeeze 64bit.

Update (2) : It seems that the display driver fails to load with
dlopen: /usr/lib/xorg/modules/extensions//libglx.so: wrong ELF class: ELFCLASS64
----
----
dlopen: /usr/lib/xorg/modules/drivers//nvidia_drv.so: wrong ELF class: ELFCLASS64
After some googling, I found that the my system was installed with 32bit userland libraries (blame it on the DVD that came with my linux magazine), even though I have a amd64bit kernel.

So I re-installed the machine with the amd64 netinstall official CD downloaded from Debian, installed all necessary packages (list is given below), and re-run the installer again. Of-course, before running the installer, I have switched off GDM3 and added the black-list-configuration.
Packages
binutils
linux-headers-2.6.32-5-amd64
build-essential


cat /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0
As expected every thing now compiles normally (appart from the CC error, which can be corrected by setting CC env variable to /usr/bin/gcc-4.3, but  I didn't do that), all libraries and drivers were installed correctly and my Xorg works great, no error in /var/log/Xorg.0.log

All my posts regarding Nvidia driver is now invalid. Learned a good lesson also, read, read, read the documentation, specially the Nvidia's.
___________________________________________________________________________________

Update (1) : no need for all the below mentioned changes, set the CC environment variable with "-m64"  and re-run the installer directly.
# export CC="/usr/bin/gcc-4.3 -m64"
# ./NVIDIA-Linux-x86_64-275.21.run
Finally I was able to compile the latest version of Nvidia 64bit driver (NVIDIA-Linux-x86_64-275.21) for my Debian Squeeze 64bit. I was getting errors like

/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/conftest.h:38:2:
error: # error acpi_walk_namespace() conftest failed!
/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/conftest.h:42:2:
error: # error pci_dma_mapping_error() conftest failed!
In file included from /tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/nv.c:13:
/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/nv-linux.h:248:2:
error: #error "NV_PCI_DMA_MAPPING_ERROR() undefined!"
/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/nv-linux.h:253:6:
warning: "NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT" is not defined
/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/nv-linux.h:255:8:
warning: "NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT" is not defined
/tmp/selfgz13934/NVIDIA-Linux-x86_64-275.21/kernel/nv-linux.h:261:2:
error: #error "NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT value unrecognized!"

later I found out that the kernel/configtest.sh is failing to compile acpi_walk_namespace and acpi_walk_namespace and thus was unable to create object file configtest$$.o. 

So I tried an easy way by modifying the configtest.sh file. First I extracted the driver file using the command 

# ./NVIDIA-Linux-x86_64-275.21.run -x

This will create a folder named NVIDIA-Linux-x86_64-275.21 in the current folder. Change directory to ./NVIDIA-Linux-x86_64-275.21/kernel and modify the configtest.sh file. Below is the diff output for the same.

index 5b10bb1..eb5d192 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -955,7 +955,7 @@ compile_test() {
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c

-            if [ -f conftest$$.o ]; then
+            if [ ! -f conftest$$.o ]; then
                 rm -f conftest$$.o
                 echo "#define NV_ACPI_WALK_NAMESPACE_PRESENT" >> conftest.h
                 echo "#define NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT 6" >> conftest.h
@@ -1105,7 +1105,7 @@ compile_test() {
             $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c

-            if [ -f conftest$$.o ]; then
+            if [ ! -f conftest$$.o ]; then
                 echo "#define NV_PCI_DMA_MAPPING_ERROR_PRESENT" >> conftest.h
                 echo "#define NV_PCI_DMA_MAPPING_ERROR_ARGUMENT_COUNT 2" >> conftest.h
                 rm -f conftest$$.o

The idea is very simple, just added an ' ! ' to the " if " condition, where configtest.sh checks if the file configtest$$.o exists or not. Also please not that on Debian Squeeze the NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT takes only 6 arguments not 7. 

rerun ./nvidia-installer from the root folder where you extracted the Nvidia driver files.

Hope this would solve issues with Nvidia driver for some one.

Friday, July 22, 2011

Alsa Mixer - Unmute from command line.

Here are the commands that can be used to unmute audio on an Ubuntu system.

amixer set PCM  100% unmute
amixer set Headphone  100% unmute
amixer set Master  100% unmute

Found useful for alarm.

Sunday, July 10, 2011

How to reduce the size of a LVM2 loggical volume

For example to reduce the size of a logical volume /home to 10 GB, follow the commands listed below.

# umount /home
# resize2fs /dev/VolGroup00/homevol 10G
# lvreduce -L 10G /dev/VolGroup00/homevol
# fsck -f /dev/VolGroup00/homevol
# mount /home

Friday, July 8, 2011

Perl one liner for In-Place editing.

Three perl single liner for In-Place editing. In all of the cases, the command replaces all occurrence of word 'target' with 'replace'.

With backup.
$ perl -pe 's/target/replace/g' < input.txt > output.txt
$ perl -i.bak -pe 's/target/replace/g' inout.txt
With out backup. 
$ perl -i -pe 's/target/replace/g' input.txt

Wednesday, June 15, 2011

Sharepoint/RTM Demo VHD on Vmware Workstation 7.

At last I got the "2010 Information Worker Demonstration and Evaluation Virtual Machine (RTM)" working on my vmware workstation 7. Thanks to this Vmware Community post and this link on sanbarrow.com

Here is the procedure that I used.
  • Convert the VHD image to VMDK (SCSI Disk) using Starwind V2V converter. It took quite amount of time to convert the disk. 
  • Created a new virtual machine with following settings.
    • Custom (advanced) installation.
    • Hardware Compatibility : Workstation 6.5-7.x
    • Guest Operating System Selection : I will install operating system later
    • Guest Operating System : Microsoft Windows , Version : Windows Server 2008 x64
    • Virtual machine name : Windows Server 2008 x64, Location : c:\users\......
    • Number of processors and cores : 1
    • Memory : 1 GB
    • Network Type : NAT
    • SCSI Controller : LSI Logic SAS
    • Disk : Use an existing virtual disk
    • Existing Disk File : (select the VMDK file generated using Starwind V2V converter)
    • Click Next and Click Finish.
  • Boot the system normally. You will mostly end up with Blue Screen Of Death (BSOD). The system will automatically restart and during start up it will offer you to "Launch Startup Repair". Select it and the system will ask you to select the language and then to enter the administrator password. The default password is '[email protected]'. Once you enter it you will be provided with a small window with different options. Select the "Command Prompt" option.
  • A CMD window will open with X:\.... prompt. Type the command "regedit" and press enter, it will provide you with the regular registry editor window.
  • From the list select HKEY_LOCAL_MACHINE a.k.a HKLM and then from the menu select File > Load Hive. Browse to C:\ (or which ever you virtual disk) windows\system32\config and select SYSTEM. It will ask for a name for the new loaded hive, name it p2v.
  • Now find the key 
HKLM\p2v\ControlSet001\services\LSI_SAS

and set the Start REG_DWORD to 0 (it was 3 for me, for some people it was 4). Now select HLKM\p2v and from menu select File > Upload Hive. Select "yes" when asked for confirmation. Close the regedit and restart the VM.

If every thing is ok, you should get the windows 2008 server running by now.

Tuesday, June 7, 2011

gitosis-admin cloning issue.

I was having problem while trying to clone the gitosis-admin repository from the server. Every thing was setup as per the instructions, but it will never get cloned on to my windows client "GIT extensions". It was exiting with an "Access Denied" message. To my surprise it was working perfectly on my Linux and other machines. 

After some head banging, I found that the host name that I was using to connect the repository was already saved as a profile in my putty and was having a different private key assigned to it than the one I should use for gitosis. So I renamed the profile and guess what, it worked like a charm !!!. 

Sunday, June 5, 2011

pfSense custom install.

Just finished building a development environment for customizing pfSense. First ISO is done, installed the image on a virtual machine and was successful. Still have some problems with the default configuration and some other issues. 

Friday, June 3, 2011

USB HDD not detected on windows 7 64bit Home Premium.

Phew .... At last my new USB pendrive and 1 TB USB HDD started working at last. Windows was complaining about "Driver not found" whenever I connected the disk to my laptop - no matter what I do - tried auto detecting, tried troubleshooting tool of windows, tried manual install using "Browse for driver software on your computer" as per the instruction of Seagate, but non worked. 

At last I saw a post regarding Vista on Windows Forum, - http://bit.ly/lcqGca - The answer from GearFyre helped me at-last. Below is the quote from his post.

I found the USB device that was in error and right clicked it to get "update driver".
I chose to find the driver myself and had to browse to the c:\Windows\System32\DriverStore\FileRepository\usbstor.inf_xxxxxxxx directory before it would locate anything.

 Although I gave "c:\windows" when I tried installing the driver manually, windows didn't find the driver. But when I gave the full path to the "usbstor" as directed by GearFyre, it detected everything and installed the driver properly.

Small script to backup IBM Informix raw data from SCO Unix to an FTP server

Yesterday I got access to a broken SCO Unix Server, having IBM Informix database. The database had lots of data on raw disks. Luckily I got the server to boot to single user mode, from there I got access to the locations of files using 'divvy' command.

Auto login to FTP server setup using .netrc in the home directory of user "root"
# sh
# cat > /.netrc <<EOF
machine 192.168.20.100
user ftpuser
pass ftppassword
EOF

Start the backup, first taking the list of files and then looping through the list and while doing the backup using dd. The backed-up file is ultimately moved to an FTP server
# mount /backup
# cd /backup
# find / -name \*data\* -user informix > /tmp/files
# for i in `cat /tmp/files` ; do
>  dd if=/dev/$i of=/backup/$i > /tmp/ddlog
>  echo "bin\nput $i\nquit"|ftp 192.168.20.100
>  rm /backup/$i
> done

Tuesday, May 31, 2011

FreeBSD pkg_add error: Syntax error, Command not found.

Today I had a problem while installing "cvsup" package in my FreeBSD development system. pkg_add was constantly failing to fetch files from the remote repository. Here is the error message that I was getting.

#pkg_add -r cvsup
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz: Syntax error, command unrecognized
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz' by URL

Tried setting the passive mode ftp with 

setenv FTP_PASSIVE_MODE 1

and re-ran the pkg_add command but with out any luck. Then I tried 

#pkg_add -rv cvsup

Which gave me the following verbrose output.

Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz: Syntax error, command unrecognized
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz' by URL
freebsd# pkg_add -rv cvsup
scheme:   [ftp]
user:     []
password: []
host:     [ftp.freebsd.org]
port:     [0]
document: [/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz]
---> ftp.freebsd.org:21
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
<<< 220 Welcome to freebsd.isc.org.
>>> USER anonymous
<<< 331 Please specify the password.
>>> PASS [email protected]
<<< 500 OOPS: cannot change directory:/home/ftp
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz: Syntax error, command unrecognized
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/cvsup.tbz' by URL
pkg_add: 1 package addition(s) failed

With the above detailed error report, it seems that the ftp server at ftp.freebsd.org is not configured well or is broken. So I checked the DNS record of ftp.freebsd.org with;

#dig ftp.freebsd.org
ftp.freebsd.org.        180     IN      A       204.152.184.73
ftp.freebsd.org.        180     IN      A       87.51.34.132
ftp.freebsd.org.        180     IN      A       149.20.64.73

It turned out that there were three hosts associated with ftp.freebsd.org. I randomly picked up one hoping that it will not be same as the one that pkg_add is currently connecting to and set and environment variable

# setenv PACKAGEROOT ftp://149.20.64.73/

and re-ran the command

# pkg_add -r cvsup

and it started installing the packages, including the dependencies.