Tuesday, January 8, 2013

NVIDIA @ CentOS 6.3 / Red Hat 6.3

Q: What is the proper procedure to identify, locate, & install the correct nvidia drivers for Centos 6 on a Lenovo W510?
A: Here's a quick sequence, to help the next person, of what I'd recommend, based on what I learned from this thread:

0. Test if you 'need' to install the nvidia driver:
$ locate libvdpau_nvidia.so ==> mine reported nothing found
$ cat ~/.xsession-errors ==> mine reported errors as shown below:
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Note: There should be a better test of 'need'; but this was my only indication that "I" needed the nvidia driver!

1. Identify your kernel version:
$ uname -r
REPORTED:
2.6.32-279.5.1.el6.x86_64
Note: I'm not sure how this is relevant, but somehow it is (I ask others to clarify for us).

2. Identify your graphics card
$ /sbin/lspci -nn | grep VGA
REPORTED:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GT216 [Quadro FX 880M] [10de:0a3c] (rev a2)
Note: I'm not sure how relevant the [10de:0a3c] information is - but some sites indicate it's important.

3. Identify the latest version of the graphics drivers for that kernel version:
a) Go to Nvidia support http://www.nvidia.com/page/support.html
b) Go to download drivers
c) Enter the product type (Quadro), series (Quadro FX Series), and product (not found).
Note: The Quadro FX 880M didn't appear on this list, so I 'chatted' with Nvidia support.
Eventually Nvidia support pointed me to the latest available driver version here:
http://www.nvidia.com/object/linux-display-amd64-304.37-driver.html
Note: You'll compare this latest version & support information with the latest available at El Repo in the next step.

4. Compare the Nvidia version with the latest available El Repo version:
http://elrepo.org/tiki/Driver+Versions
Note: Search for "nvidia" and you'll find the latest version to be "nvidia 295.40".

5. Enable the El Repo repository (if not already installed):
$ sudo rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
$ sudo rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
Note: Skip this step if El Repo is already enabled.

6. Install that latest version from the El Repo repository:
$ sudo yum --enablerepo elrepo install kmod-nvidia
$ sudo yum --disablerepo=\* --enablerepo=elrepo install nvidia-x11-drv-32bit
Note: Do not install from the ATrpms repository!

Or, if you want the absolute latest in the El Repo testing repository:
$ sudo yum --enablerepo elrepo-testing info kmod-nvidia
$ sudo yum --enablerepo elrepo-testing install kmod-nvidia
$ sudo yum --disablerepo=\* --enablerepo=elrepo-testing install nvidia-x11-drv-32bit

7. Reboot

8. Test if you have installed the correct driver:
$ locate libvdpau_nvidia.so
NOW REPORTS:
/usr/lib/vdpau/libvdpau_nvidia.so
/usr/lib/vdpau/libvdpau_nvidia.so.1
/usr/lib/vdpau/libvdpau_nvidia.so.304.37
/usr/lib64/vdpau/libvdpau_nvidia.so
/usr/lib64/vdpau/libvdpau_nvidia.so.1
/usr/lib64/vdpau/libvdpau_nvidia.so.304.37

$ cat ~/.xsession-errors
No longer reports VDPAU errors.

QUESTION:
Is there a better way to test for the lack of the right driver & for the correct installation of the right driver?

Thursday, December 27, 2012

Introduction: Scripting your Brocade Fibre Channel switches

HOW-TO collect data from multiple brocade switches

Got tired as a SAN administrator after logging into all your Fibre Channel switches to perform just one configuration change? Well, I did and I decided to find a way to perform basic configuration tasks by script.
We all know how to remotely manage a Brocade fibre channel switch. If you have lots of time, you are using the WebTools. If you have only minutes left during a working day, you know almost all FabOS commands by heart, connecting to the switches using ssh.
On the top of my wishlist was the possibility to schedule an upload of the switch configuration. That’s why I started with this little project. At least the start was very easy. After spending several hours using ssh to connect to the switches the command to save the config was rapidly written down:
configupload -all -ftp 10.0.0.1,configupload,fcswitch01-today.txt
(For testing purposes the account configupload is configured without a password.)

That’s the beginning. Let’s now connect to the switch to execute this command. I choose to use Expect as a programming language. With this language it is very easy to respond on interactive commands, like snmpconfig. The idea is to build a framework, that can be used for all kinds of commands you can execute on a fibre channel switch. In Expect, you can connect to a Brocade switch using ssh with the command
spawn ssh -l admin fcswitch01
The nice part of Expect is in my opinion, you can describe what you will see. So what will happen, when setting up a ssh connection to fcswitch01 using the account admin? You will be asked to enter your password. So you can describe that as follows.
expect "*password: "
Now you can send your password within the script.
send "password\r"
The \r represents a hard return. If the password of the admin account is really “password”, you now will be logged on into the switch.
Again, you have to describe what the output of the ssh terminal, would be if you logged on by yourself. Afterwards, you can issue the command you want to execute. Finally you have to exit the session in a decent manner. This would be scripted as follows.
expect "*admin> "
send "configupload -all -ftp 10.0.0.1,configupload,fcswitch01-today.txt\r"
expect "*admin> "
send "exit\r"

At this point we have written a script that allows us to upload a switch configuration of a particular switch. Unfortunately a fibre channel SAN mostly consists of multiple switches. We don’t want to have one script per switch. We need to use some variables in the script and make the script more general. Besides that, I don’t think the presence of the account and the password in the script is a safe way.
To enhance the script, I usually use three text files. One is containing all the switches in the fabrics and the file is called switches.txt. For naming purposes I make sure name resolution is working for the switches. If customers don’t want to add them to DNS, I always edit the hosts file of the management server. A second file user.txt only contains the account used for login. In the third file password.txt the associated password is written.
The three files are opened read-only at the first three lines of the script:
set file [open ~/tools/switches.txt r]
set pass [open ~/tools/pass/password.txt r]
set account [open ~/tools/pass/user.txt r]

The user and password are put into a variable, so we can use that variable in the script. We use the command gets for it. gets reads one line of the text file.
gets $pass admpw
gets $account admin

Next to do, is to go to the file switches.txt and read one line after another and perform some actions to the switch. That is done in the following way.

while 1 {
if {[gets $file fcsw] == -1} break
commands
}
At the end I usually declare another variable in which the current date is set. I will use this date in the filename for the switch config.
set date [timestamp -format %Y%m%d]
When we combine al this programming, we will get the following script. I normally use this script every night to have a daily backup of all switch configurations.
set file [open ~/tools/switches.txt r]
set pass [open ~/tools/pass/password.txt r]
set account [open ~/tools/pass/user.txt r]
set date [timestamp -format %Y%m%d]
#--
gets $pass admpw
gets $account admin
#--
while 1 {
if {[gets $file fcsw] == -1} break
#--
spawn ssh -l $admin $fcsw
expect "*password: "
send "$admpw\r"
expect "*$admin> "
send "configupload -all -ftp 10.0.0.1,configupload,$fcsw-$date.txt\r"
expect "*$admin> "
send "exit\r"
}

The beauty of this script is maybe not the programming, but the reusability of it. Replace the command of the configupload with any other command you need to execute. This is a very fast way to make sure you have consistent configurations of all your switches. I will attach a script in which snmp settings are configured. You can also see how you can deal with interactive commands also with Expect.

Tuesday, December 11, 2012

HOW-TO: Qualcomm Gobi 2000 under linux


yum -y install gcc
cd /tmp
wget http://www.codon.org.uk/~mjg59/gobi_loader/download/gobi_loader-0.7.tar.gz
tar xvzf gobi_loader-0.7.tar.gz && cd gobi_loader-0.7
make && sudo make install
cp /lib/udev/rules.d/60-gobi.rules  /etc/udev/rules.d
/

Now you have to get the firmware images from the Lenovo website. This is a windows executable- get the latest and greatest directly from the Lenovo support page or here. You will have to extract the contents - either you have a Windows(R) machine running somewhere, or use wine for it...  yeah, I know...

The installer will extract the firmware files into %Program Files%\QUALCOMM\Images\Lenovo\.

Now you will see several directories named 0-12, and UMTS. According to the information found on this thinkwiki page, they break down as follows:

Dir Image Dir Image
0 Vodafone Image 1 Verizon Image
2 ATT Image 3 Sprint Image
4 T-Mobile Image 6 Generic UMTS Image
7 Telefonica Image 8 Telecom Italia Image
9 Orange Image 12 DoCoMo Image
UMTS Default Firmware

Now, use your imagination to get the best out of your WWAN - for me the UMTS ran fine on 5 not listed (south-, centralamerican and asian) operators, too - but that may vary. Obviously, should your operator be listed, choose the according directory and then substitute below's with your favourite directory "id" (e.g. 2 or 12 or UMTS or...):

http://www.thinkwiki.org/wiki/Qualcomm_Gobi_2000

how to activate GSM modem:

/lib/udev/gobi_loader -2000 /dev/ttyUSB0 /lib/firmware/gobi
 

Friday, November 9, 2012

Tuesday, October 2, 2012

How to mount remote windows partition (windows share) under Linux

Procedure to mount remote windows partition (NAS share)
1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux
2) Login to Linux as a root user (or use su command)
3) Create the required mount point:
# mkdir -p /mnt/ntserver
4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver
Use following command if you are using Old version such as RHEL <=4 or Debian <= 3:
# mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver
5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l
Where,
  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //ntserver/download : Windows 2000/NT share name
  • /mnt/ntserver Linux mount point (to access share after mounting)

Monday, October 1, 2012

HOW-TO enable multipathing on RedHat Linux 5.x

In Red Hat Enterprise Linux 5, device-mapper-multipath is installed by default. This is a change from Red Hat Enterprise Linux 4. If a third party multipathing solution is in use, device-mapper-multipath should be disabled to avoid any conflict between the multiple multipathing technologies. But RedHat multipathing is NOT ACTIVATED by default and you must enable it.

To enable it, modify the setting in /etc/sysconfig/mkinitrd/multipath file by changing MULTIPATH from NO  to YES
        MULTIPATH=YES

By default, /etc/multipath.conf has all devices blacklisted. If this default configuration has been changed, the change should be reverted. Comment out following three lines:
        # Blacklist all devices by default. Remove this to enable multipathing
        # on the default devices.
        blacklist  {

               devnode "\*"       
        }
Then reboot. Enable the multipathd on boot and start it by
        chkconfig mutipathd on
        service multipathd start
At this time, you should be able to see multiple connections to the LUNs on the storage array if everything set correctly and you can verify it using   "fdisk -l". You should see  some newly enabled "dm-??" devices.  Also run "/sbin/multipath -ll" command and should see the path to each device. i.e. the path mpath2 for device dm-7 pointing to two devices sdj and sdx.   
     mpath2 (3600a0b80004879f0000004064a5b5d9f) dm-7 SUN,CSM200_R
     [size=50G][features=1 queue_if_no_path][hwhandler=1 rdac][rw]
    \\\\\\_ round-robin 0 [prio=200][active]
     \\\\\\_ 0:0:1:2 sdj  8:144  [active][ready]
     \\\\\\_ 1:0:1:2 sdx  65:112 [active][ready]
     \\\\\\_ round-robin 0 [prio=0][enabled]
     \\\\\\_ 0:0:0:2 sdc  8:32   [active][ghost]
     \\\\\\_ 1:0:0:2 sdq  65:0   [active][ghost]

You should see I/O activities on both sdj and sdx when  running dd test on dm-7.

Rescan the SCSI bus w/out rebooting

To add or remove a SCSI device explicitly, or to re-scan an entire SCSI bus without rebooting a running system:



Red Hat Enterprise Linux 4 or 5:

To rescan an entire SCSI bus and re-register all devices found:
When dealing with fibre attached storage, it is necessary to issue a LIP (loop initialization primitive) on the fabric:
shell> echo "1" > /sys/class/fc_host/host#/issue_lip

Replace the “#” with the number of the SCSI bus to be rescanned.

Note: Issueing a LIP (above) on Red Hat Enterprise Linux 5 is all that is needed to rescan fibre
attached storage. Once the LIP is issued, the bus scan may take a few seconds to complete.

To rescan all other SCSI attached storage, a rescan should be issued:
shell> echo "- - -" > /sys/class/scsi_host/host#/scan

Replace the “#” with the number of the SCSI bus to be rescanned.

In addition to re-scanning the entire bus, a specific device can be added or deleted for some versions or Red Hat Enterprise Linux as specified below.

Red Hat Enterprise Linux 4 or 5:

To remove a single existing device explicitly
shell> echo 1 > /sys/block//device/delete

Red Hat Enterprise Linux 3 or 4:

To add a single device explicitly:
shell> echo "scsi add-single-device    " > /proc/scsi/scsi
To remove a device explicitly:
shell> echo "scsi remove-single-device    " > /proc/scsi/scsi
Where are the host, bus, target, and LUN numbers for the device,as reported in /sys (2.6 kernels only) or /proc/scsi/scsi or dmesg. These numbers are sometimes refered to as “Host”, “Channel”, “Id”, and “Lun” in Linux tool output and documentation.

How to use DiskSpd to simulate Veeam Backup & Replication disk actions

This HOW-TO contains information on how to use Microsoft© DiskSpd to simulate Veeam Backup & Replication disk actions to measure disk pe...