RSS
 

CentOS Problem Mounting CIFS Share

21 Jul

I was in the process of migrating a system from Fedora 10 to CentOS 5.6 when I ran into some difficulties. As part of the process I needed to move some scripts that relied on CIFS shares being mounted to work correctly. I copied the /etc/fstab entries over to the CentOS 5.6 box and ran a mount -a to test before rebooting. Unfortunately I was greeted with the following errors:

[root@server ~]# mount -a
mount: wrong fs type, bad option, bad superblock on //X.X.X.X/sharename,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

mount: wrong fs type, bad option, bad superblock on //Y.Y.Y.Y/sharename,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[root@server ~]# dmesg | tail
 CIFS VFS: No username specified
 CIFS VFS: cifs_mount failed w/return code = -22
 CIFS VFS: No username specified
 CIFS VFS: cifs_mount failed w/return code = -22

The solution to this problem for me was to install the samba-client package.

[root@server ~]# yum install samba-client
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.team-cymru.org
 * extras: mirror.cogentco.com
 * updates: mirror.metrocast.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba-client.i386 0:3.0.33-3.29.el5_6.2 set to be updated
--> Processing Dependency: samba-common = 3.0.33-3.29.el5_6.2 for package: samba-client
--> Running transaction check
---> Package samba-common.i386 0:3.0.33-3.29.el5_6.2 set to be updated
--> Processing Dependency: libsmbclient = 3.0.33-3.29.el5_6.2 for package: samba-common
--> Running transaction check
---> Package libsmbclient.i386 0:3.0.33-3.29.el5_6.2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                        Arch                   Version                                Repository                 Size
==============================================================================================================================
Installing:
 samba-client                   i386                   3.0.33-3.29.el5_6.2                    updates                   5.7 M
Installing for dependencies:
 libsmbclient                   i386                   3.0.33-3.29.el5_6.2                    updates                   908 k
 samba-common                   i386                   3.0.33-3.29.el5_6.2                    updates                   6.7 M

Transaction Summary
==============================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 13 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libsmbclient-3.0.33-3.29.el5_6.2.i386.rpm                                                       | 908 kB     00:00     
(2/3): samba-client-3.0.33-3.29.el5_6.2.i386.rpm                                                       | 5.7 MB     00:01     
(3/3): samba-common-3.0.33-3.29.el5_6.2.i386.rpm                                                       | 6.7 MB     00:01     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         4.0 MB/s |  13 MB     00:03     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libsmbclient                                                                                           1/3 
  Installing     : samba-common                                                                                           2/3 
  Installing     : samba-client                                                                                           3/3 

Installed:
  samba-client.i386 0:3.0.33-3.29.el5_6.2                                                                                     

Dependency Installed:
  libsmbclient.i386 0:3.0.33-3.29.el5_6.2                       samba-common.i386 0:3.0.33-3.29.el5_6.2                      

Complete!
 
1 Comment

Posted in Linux

 

Fortigate 620B Rancid Patch For fnrancid

21 Jul

After configuring Rancid to backup the Fortigate 620B, I was getting hourly alerts about config changes due to a few dynamic lines on the Fortinet units. As you can imagine, this is annoying and further creates unnecessary revisions to your CVS or SVN.

The culprits were:

!System time:
#conf_file_version=
and everything between
set private-key "-----BEGIN RSA PRIVATE KEY-----
and
-----END RSA PRIVATE KEY-----"

Here is the patch I created from changes to fnrancid as included with 2.3.6. Credit for the RSA key portion of the fix goes to Gavin McCullagh.

 

Backing Up Fortinet Fortigate Configs With Rancid

08 Jul

I recently deployed a few Fortigate boxes and, like a good admin, decided that we need to keep revision numbered backups of the config in RANCID. So far RANCID has been fantastic tool and saved many a hide on numerous occasions while working with our Cisco, Foundry, and Juniper gear. I expected (pun intended) that the Fortigates ssh enabled cli shouldn’t cause too much of a problem and remembered seeing a few references to it while browsing through some of the files on our RANCID server. Long story short, RANCID 2.3.5 and FortOS 4.x were not playing nice together. I’m guessing RANCID 2.3.5 probably worked with the older FortOS versions but the change to FortOS 4.x incorporated some new characters (namely a pound sign) at the end of the command prompt and fnrancid was called it didn’t know how to handle this and broke. This is fixed in RANCID 2.3.6 so for me the path of least resistance was to upgrade RANCID to the latest stable build.

I don’t have a fancy installation so it was a matter of running the following commands as my rancid user.

wget ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.6.tar.gz
tar -xzvf rancid-2.3.6.tar.gz
cd rancid-2.3.6
./configure --prefix=/path/to/your/rancid/home/   for me this is /usr/local/rancid/ and make sure you have the trailing forward slash
make install

Then you should be done.

router.db should look like this for a fortigate

172.16.33.1:fortigate:up

Assuming you’ve correctly configured your router.db file in terms of specifying your gear and your .clogininfo is correct you should be able to

rancid-run 

and then check the logs to see that everything is working.

 
 

How To Add A Column Of Text To A File With Sed

23 Feb

I found myself needing to review some MS SQL server log files from multiple servers to determine why a mirrored cluster failed over. The data contained in each log file didn’t include the host name of the system. Thus, when I merged the data together into one file I couldn’t tell which server each line of log came from after it was sorted by date/time.

Example log file from each server

2011-02-09 05:09:43.50 spid17s     Database mirroring has been enabled on this instance of SQL Server.
2011-02-09 05:09:48.57 spid19s     The mirrored database "foo" is changing roles from "PRINCIPAL" to "MIRROR" due to Role Synchronization.
2011-02-09 05:09:49.58 spid12s     Bypassing recovery for database 'foo' because it is marked as a mirror database, which cannot be recovered. This is an informational message only. No user action is required.
2011-02-09 05:09:52.40 spid19s     Database mirroring is active with database 'foo' as the mirror copy. This is an informational message only. No user action is required.
2011-02-09 05:10:11.47 spid17s     Bypassing recovery for database 'foo' because it is marked as a mirror database, which cannot be recovered. This is an informational message only. No user

What I wanted to do was inject a [hostname] after the time stamp so that when sorted by date/time I could have a clear indication of what was happening at each of the three servers.

cat sql-server-1.log | sed 's/ / [SQL-SERVER-1] /2' > combined-sql.log
cat sql-server-2.log | sed 's/ / [SQL-SERVER-2] /2' >> combined-sql.log
cat sql-server-3.log | sed 's/ / [SQL-SERVER-3] /2' >> combined-sql.log

Essentially, what is happening in the sed line is that we tell sed to search for the second instance of a space and put the specified string in place.

Be sure to note the difference of redirection operators ‘>’ and ‘>>’. ‘>’ starts writing data at the beginning of the file and will delete anything already in place. ‘>>’ will append the output after the last line of existing data.

Depending on how many log files you needed to combine you may want to script the above section as well. In my case, I only had three servers to deal with so it was quicker to just change the input file and host name manually.

The output looked like this:

2011-02-18 22:22:38.44 [SQL-SERVER-1] spid21s     Error: 1479, Severity: 16, State: 2.
2011-02-18 22:22:38.44 [SQL-SERVER-1] spid21s     The mirroring connection to "TCP://bar:5022" has timed out for database "foo" after 10 seconds without a response.  Check the service and network connections.
2011-02-18 22:22:39.79 [SQL-SERVER-2] spid20s     Error: 1479, Severity: 16, State: 1.
2011-02-18 22:22:39.79 [SQL-SERVER-2] spid20s     The mirroring connection to "TCP://bar:5022" has timed out for database "foo" after 10 seconds without a response.  Check the service and network connections.
2011-02-18 22:22:39.88 [SQL-SERVER-2] spid20s     Database mirroring is inactive for database 'foo'. This is an informational message only. No user action is required.
2011-02-18 22:22:39.89 [SQL-SERVER-2] spid20s     The mirrored database "foo" is changing roles from "MIRROR" to "PRINCIPAL" due to Auto Failover.
2011-02-18 22:22:46.23 [SQL-SERVER-2] spid20s     Database mirroring is inactive for database 'foo'. This is an informational message only. No user action is required.
2011-02-18 22:22:54.58 [SQL-SERVER-2] spid20s     Recovery is writing a checkpoint in database 'foo' (6). This is an informational message only. No user action is required.
 
 

Fun With LT04 Tapes And Code 39 Mod 43

01 Nov

Archiving data off site is a critical part of a disaster recovery / business continuity plan. I ran into an issue where our tape library / backup software was providing us with an email containing the bar code for tapes that were to be shipped off site. The problem was; that data didn’t match what the archival vendor came up with when they scanned the tapes in on their end. It wasn’t a complete mismatch, however our backup software was basically outputting the same thing you see when you look at the tapes label themselves. When the archival vendor scanned them, they were seeing an L4 suffix as well as an additional character that turned out to be the Code 39 Mod 43 checksum (the checksum does not appear on the tape label in human readable form). Once we figured out what that character was, we were able to add a script into our archival system so that the system generated email we get is consistent with what the archival vendor scanned. Now, the problem was that I had quite a few tapes that had previously been shipped off site that needed to be reconciled. In an effort to avoid manually calculating the checksums, which would have been tedious and more importantly would have introduced an element of human error to a vital portion of our DR plan, I wrote some code that others might find useful.

Please download the hyper linked version here. The code refused to play nice with wordpress despite pre or code tags.
mod43

 
 

Mac OS X 10.6.4 Synergy Client Shift Key Not Working?

27 Oct

I use synergy when concurrently working with my desktop and laptop so that I can control both computers via a single mouse and keyboard. If you found this page, you already know what synergy is and like me are probably having an issue with the shift, ctrl, and some other keys not working on a Mac OS X 10.6.4 client (don’t worry we’ll get that fixed in a minute), but for those who aren’t familiar with synergy here is a link to the site and some cliff notes:

http://synergy-foss.org/

Synergy is FOSS that lets you easily share a single mouse and keyboard between multiple computers with different operating systems, without special hardware. All you need is a LAN connection. It’s intended for users with multiple computers, where each system uses its own display.

Ok, now on to solving the problem mentioned above. In my configuration:

Server: Ubuntu 9.10 Karmic 
Synergy Version: synergys 1.3.1, protocol version 1.3
Client: Mac OS X 10.6.4
Synergy Version: synergyc 1.5.0, protocol version 1.3

At the time of this writing the latest version available for OS X on the synergy website referenced above is 1.3.4. Chances are if you’re having the shift key issue, you’re running that version or older too. You need to goto


http://code.google.com/p/synergy-plus/downloads/list

And download 1.5.0-r739

Note, 1.5.0-r739 is considered unstable. For me, it worked fine. I literally couldn’t use the “stable” version that lacked shift key functionality, so for now unstable it is. I’ll update this if I run into any crashes or odd behaviour I may notice from the unstable release.

Just in case you’d like to compare your synergy configuration to a working configuration:

section: screens
	server:
	client1:
end
section: aliases
        client1:
                client2
end
section: links
	server:
		left = client
	client:
		right = server
end	

If you’re wondering why there is an aliases section, it’s because I actually have two laptops that I switch in and out. There is only 1 spot to the left of my workstation that a laptop would sit regardless of which one it is. Also, the terms server, client1, and client2 should be the host names of the systems in your environment.

 
 

How To Remotely Obtain Dell Service Tags On Windows And Linux

01 Oct

Windows:

from a cmd prompt:

wmic bios get serialnumber

Linux

from a terminal:

dmidecode -s system-serial-number
 
 

Review of PCB Solution (Hard Drive Controller Board Repair/Replacement Service)

01 Oct

I have a Western Digital Caviar 80GB HDD that failed about 6 years ago (before I had a strong understanding of RAID, Backup Strategies, etc..). I had some data on the drive that I would have liked to recover, but not important enough to warrant the costly clean room data recovery services. Based on the troubleshooting I did, I knew that the problem was with the controller board and not the internal hardware of the drive. I researched the issue extensively trying to find a low cost solution that would enable me to recover the data on this drive. I learned quite a bit about this particular hard drive and discovered that the problem I had with mine was not so uncommon. One of the chips on the PCB had failed so badly that there was visible burn damage on the chip. I tried hunting on Ebay for a replacement PCB I could swap in that was manufactured around the same time mine was, in an effort to make sure it would have the same firmware. Despite finding a PCB that was made in the same month/year as mine, swapping in the new PCB did not work. The drive would power on and spin but it was not recognized by my PC’s BIOS.  At this point I had given up hope that I’d be able to recover the data but decided to hang on to the drive anyway. A year or so later I was informed about a company called PCB Solution who specializes in PCB service and replacement. I made contact with them, explained my scenario, and soon was shipping them the damaged PCB and the replacement I had purchased from Ebay. About a week later, I had received both of my boards back as well as a tool to screw the board back to the HDD (obviously I already had this since I was able to remove the PCB in the first place but it saved me a trip to the garage). I crossed my fingers and fired up the HDD with the board they had worked on for me. Sure enough, it worked like a charm. I immediately copied my data off the drive incase it didn’t work for long, but it continued to run afterwards without issue. This service was extremely affordable, in fact so affordable that I have no idea how they stay in business at the price they charged me. The issue turned out that the WD Caviar, like other HDDs has a hash on one of  the platters that needs to match with the PCB. They either wrote the new hash to my replacement PCB or transferred the IC that contained the hash to the new board. Either way, they have a very satisfied customer here. If you find yourself in a similar situation contact these guys:

PCB Solution

http://www.onepcbsolution.com/

Kevin - support at pcbsolution dot com
 

Openssh and Cisco ssh_rsa_verify: RSA modulus too small: 512 < minimum 768 bits

30 Sep

When you generate an RSA key on a Cisco device, the default modulus size is 512. If you try to SSH to the router/switch from a linux workstation, you’ll receive the following error.

ssh_rsa_verify: RSA modulus too small: 512; minimum 768 bits
key_verify failed for server_host_key

A workaround is to provide your openssh client with the -1 argument which uses SSH v1 instead of the default v2. That however is not the ideal solution. Unless there is some reason why you specifically need a modulus size of 512, make it 1024 by issuing the following command on the Cisco device:

(config)#crypto key generate rsa

Specify the modulus size of 1024. You may be asked to replace the existing key. Select yes. Now openssh running v2 will happily connect to your Cisco device.

 
 

m4:sendmail.mc:10: cannot open

30 Sep

I was working on a Fedora Core system and needed to make some changes to the sendmail configuration. I made my changes to the /etc/sendmail.mc and when I attempted to use m4 to create a new sendmail.cf I ran into this error:

[root@bb mail]# m4 sendmail.mc > sendmail.cf
m4:sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

The solution was to install the sendmail-cf package

yum install sendmail-cf
 
No Comments

Posted in Linux