Dec 18, 2013

Not able to login Jenkins ? Locked yourself by messing security ? How to disable security in Jenkins

Rarely we end up locking ourself in jenkins so that we couln't login Jenkins.


For example -

If you enable security before creating an account, you end up being access denied with out any login account in hand.
























Jenkins throws error like

javax.servlet.ServletException: hudson.security.AccessDeniedException2: anonymous is missing the Overall/Administer permission

This can be solved by editing the config.xml  and disabling the security by changing

<useSecurity>true</useSecurity>

into 

<useSecurity>false</useSecurity>

You can refer this url from Jenkins - https://wiki.jenkins-ci.org/display/JENKINS/Disable+security



Dec 13, 2013

How to Fix error 'Could not determine the server's fully qualified domain name, using 127.0.0.1 '

Problem:

[root@spa ~]# service httpd start
Starting httpd: httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for S erverName
                                                           [  OK  ]
[root@spa ~]#

solution:

Edit /etc/httpd/conf/httpd.conf
and search for ServerName and add
ServerName localhost

How to reset passwords in perforce

From time to time, it is inevitable that users will forget Perforce passwords. A Perforce superuser can set a new password for any user with:

    Release 99.1 and later:

        p4 passwd username

    (Perforce will prompt the superuser for a new password for user username.)

C:\Users\mohan>p4 passwd thangam
Enter new password:
Re-enter new password:
Password updated.

How to delete the changelist and workspace of another user ( clean ex-employee workspace to reclaim space and license )


this will give you the pending changes on the client

p4 changes -c user_workspace

this will delete the pending change list of your choice

p4 change -d

after that, you can delete the client using

p4 client -d user_workspace

How to overwrite symbolic links in unix

You can overwrite symbolic links by using -f to the default command

Example
mohan@mysys /cygdrive/c/
$ ln -s /tmp/test.sh tumba
mohan@mysys /cygdrive/c/
$ ls -l
total 80
lrwxrwxrwx  1 mohan        Domain Users    5 Oct  9 14:59 tumba -> /tmp/test.sh
mohan@mysys /cygdrive/c/
$ ln -s /tmp/build_env.log  tumba
ln: failed to create symbolic link `tumba': File exists
mohan@mysys /cygdrive/c/


 Now we can overwrite the existing symbolic link by using -f







$ ln -s -f /tmp/build_env.log  tumba
mohan@mysys /cygdrive/c/
$ ls -l
total 80
lrwxrwxrwx  1 mohan        Domain Users    5 Oct  9 14:59 tumba -> /tmp/build_env.log

How to fix perforce error 'Some file(s) could not be transferred from client.'

Problem:
open for read: c:\p4\client_spec.txt: The system cannot find the file specified.
Submit aborted -- fix problems then use 'p4 submit -c 1347493'.
Some file(s) could not be transferred from client.

Cause:
When you try to open a file which does not exist in perforce, it gives above error. First do a p4 add, and then open it.

How to change the binary name from the defalut name setup.exe in Installshield


installshield  - change setup.exe name
release tab-> product configureation -> setup file name(change)

Specify the file name—without the .exe file extension—that InstallShield should use
for the setup launcher file that it generates at build time. If this setting is blank,
InstallShield uses the default value of Setup, and the setup launcher file is called
Setup.exe.

how to format FAT 16 in windows 7


C:\Users\mohan>format G:  /FS:FAT /A:16K
Insert new disk for drive G:
and press ENTER when ready...
The type of the file system is FAT.
Verifying 3835M
The specified cluster size is too small for FAT16/12.

How to Unmount an ISO in linux

To see the list of currently mounted file systems,

#mount

To unmount a mounted iso,






# umount /mnt/iso

assuming that your image is mounted at /mnt/iso

How to mount ISO in Linux using command line

Procedure to mount ISO images under Linux

As Root

1)Create some directory to mount the iso so that you can view it as a regular directory.

             # mkdir -p /mnt/disk

2) Use mount command as follows to mount iso file called disk1.iso:

             # mount -o loop disk1.iso /mnt/disk

Now to see the contents of iso file, Change directory to list files stored inside an ISO image:
            # cd /mnt/disk
            # ls -l


More about loop device

A loop device is a pseudo-device that makes a file accessible as a block device. Loop devices are often used for CD ISO images and floppy disc images. Mounting a file containing a filesystem via such a loop mount makes the files within that filesystem accessible. They appear in the mount point directory using above commands.

how to add files under apache server

In Apache server, add your contents under a directory and create symlink to it under /var/www/html/

or

move your directory under /var/www/html/

How to send mail in linux

mail -s "Hello world" mohan@yahoo.com

Use Control+D to move next item

Execution Failed: "/bin/vi" ".\t1636t37.tmp": The system cannot find the path specified.

Problem:
Execution Failed: "/bin/vi" ".\t1636t37.tmp": The system cannot find the path specified.

Cause:
you are trying to do a p4 edit in cgywin, where p4 is pointing to the windows version  c:\program files\p4.exe so its trying to open textfile in vi using windows p4.exe. Change the default p4  pointing to the cygwinversion and try.

How to check whats running in the perforce server or How to monitor perforce server

Like the 'top' command in Linux which helps us to see what process and commands are running in the system, perforce has 'monitor' command to list the operations running in its system.

It lists the users and their commands currently running in the perforce server

Example -

mohan@vmlinux/cygdrive/c/p4_mohan/user_informatio
5.0/output
# p4 monitor show
 7097 R mohan    00:00:00 monitor
 7098 R rama       00:00:00 labels
 7099 R arus    00:00:00 spec
28435 R perforce   00:30:31 verify

Could not connect to perforce. error 'It is possible that someone is intercepting your connection to the Perforce P4PORT '10.31.64.101:1888''

Error Message:

[mohan@spl ~]$ p4 info
******* WARNING P4PORT IDENTIFICATION HAS CHANGED! *******
It is possible that someone is intercepting your connection
to the Perforce P4PORT '10.11.64.101:1888'
If this is not a scheduled key change, then you should contact
your Perforce administrator.
The fingerprint for the mismatched key sent to your client is8A:BE:F1:B9:DC:E3:50:D1:16:D6:6D:66:BB:AE:0B:26:86:C0:60:DC
To allow connection use the 'p4 trust' command.


Reason:
This happens due to environmental changes like change of ip or mac address etc. It makes the established and stored fingerprint to mismatch. So you have to reestablish the 'trust' with the server again. so we will not be able to run any command.

You have to do this by issuing 'p4 trust -f'

[build@splash ~]$ p4 trust -f
******* WARNING P4PORT IDENTIFICATION HAS CHANGED! *******
It is possible that someone is intercepting your connection
to the Perforce P4PORT '10.11.64.101:1888'
If this is not a scheduled key change, then you should contact
your Perforce administrator.
The fingerprint for the mismatched key sent to your client is8A:BE:F1:B9:DC:E3:50:D1:16:D6:6D:66:BB:AE:0B:26:86:C0:60:DC
Are you sure you want to establish trust (yes/no)? yes
Added trust for P4PORT 'ssl:p4pserver.cmp.com:1888' (10.11.64.101:1888)


Now you can try some p4 commands to verify.

how can I find out the "source" changelist of the newly created branch in perforce?

To see details on source of branch integrated in perforce

After branching from base branch to a new branch, can we find the changelist at which the branch is created from source branch?

You can find it by using the below command with the new branch ( the child branch for whom you are interested to see the history)

p4 changes -i  //depot/child_branch


This will list  the  changes of this branch followed by the changes happened in its parent branch. By describing the changes you can get the particular parent branch name.

Syntax for p4 describe

p4 describe <changelist number>

example-
$ p4 describe 1129671
Change 7129671 by ravis1@project on 2010/06/29 06:51:50

        starting tomcat using "start startup.bat" command

Affected files ...

... //dev/env/atia/eventrepository/install/install.bat#11 edit
... //dev/env/atia/eventrepository/readme.txt#6 edit

Nov 30, 2013

How to fix Perforce error "Can't clobber writable file"

Perforce throwing below error while trying to remove folder from workspace

Error:
 Can't clobber writable file C:\thiagu\Perforce\thiagu_p4server.net_1333\dev-app\Application.Properties

Solution:
when you try to sync a file, perforce expects your files in workspace will have read-only permissions. But if a file is not checkout,(by p4 edit)but has write permission then it will throw the above error. Changing the file to read-only and syncing again will solve the issue. or try removing the workspace and get the latest revision again

Jul 29, 2013

WSAECONNREFUSED (10061) - Connection refused.

Problem:
Connect to server failed; check $P4PORT.
connect: 10.31.64.101:1888: WSAECONNREFUSED

Cause & Solution: 

This problem occurs when you are trying to connect to a server which is not running. May be the network in-between lost, or perforce must  be down due to some reason etc.

check whether the port is running  and  restart perforce server if needed

[root@p4proxyserver4 ~]# netstat -na | grep 1444
tcp        0      0 10.27.60.103:1444           0.0.0.0:*                   LISTEN


In my case it happened that the proxy server which i was trying to connect, could not connect to the main server  which is recently restarted.  So once i restarted the proxy server, i was able to connect to the proxy perforce server fine.

For detailed and related information refer below URL
http://answers.perforce.com/articles/KB_Article/Common-Windows-Server-Network-Errors

Jul 11, 2013

How to abort shutdown scheduled in windows

You may know that we can schedule a shutdown or hibernate after some time by

shutdown /s /t 3600

In case if you want to cancel it,  you can do that by below command,

shutdown /a


For your reference, the complete help details of shutdown command listed below,


C:\Users\mohan>shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /r         Shutdown and restart the computer.
    /g         Shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /e         Document the reason for an unexpected shutdown of a computer.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title

 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Planned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue
E       5       19      Security issue
E P     5       19      Security issue
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown

Apr 17, 2013

error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format

Problem:
error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format

Solution:
if you are compiling in cygwin or unix\linux you can apply dos2uinx on files to remove this issue.


mohan@MOHANTL1C ~
$ dos2unix.exe test.txt
dos2unix: converting file test.txt to Unix format ...

Mar 1, 2013

How to change password in perforce

You can change your password in perforce using p4 cmd 'passwd'. This is same in windows\Linux. Example given below.


C:\Users\mohan>p4 passwd
Enter old password:
Enter new password:
Re-enter new password:
Password updated.

Feb 26, 2013

How to find a system 32 or 64 bit

In any Linux variants either one of this should work ( Redhat, Cent-Os, Ubuntu, Hp-ux, Solaris etc )

[mohan@chinna ~]$ arch
x86_64
[mohan@chinna ~]$ uname -m
x86_64
[mohan@chinna ~]$ getconf LONG_BIT
64


As you can guess, 64 / x86_64 is 64bit system, whereas 32 / i386 / i686  denotes its a 32 bit sytem.


For windows
Right-click MyComputer->Properties

It will bring a window like below image, from that you can check the system type

Feb 25, 2013

How to edit iptables in linux

Problem:
sometimes you may receive below error like

The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: sshd: PID 2992: Accepted publickey for build from 10.69.250.31 port 33344 ssh2.

Solution :
Either Turn off the firewall in linux or add the port 22 as exception in iptables

To disable selinux  edit /etc/sysconfig/selinux    and set SELINUX to disabled.

SELINUX=disabled

I've encountered such problems when the binaries and libraries were not
executable by SYSTEM.
"chmod 755 /usr/sbin/* /usr/bin/*" fixed the problem.

If the problem still exists, add the port to the iptables.

For adding port 22 to the iptables, from shell run

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

or

edit /etc/sysconfig/iptables
and append this line

-A INPUT -p tcp --dport 22 -j ACCEPT
Save and close the file. Restart iptables:
/etc/init.d/iptables restart
or
service iptables restart
Learn more about iptables by
man iptables

Feb 24, 2013

How to add Gnome to a CentOS 6 minimal install

Problem:
sometimes you may receive below error like

The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: sshd: PID 2992: Accepted publickey for build from 10.69.250.31 port 33344 ssh2.

Solution :
Either Turn off the firewall in linux or add the port 22 as exception in iptables

To disable selinux  edit /etc/sysconfig/selinux    and set SELINUX to disabled.

SELINUX=disabled

I've encountered such problems when the binaries and libraries were not
executable by SYSTEM.
"chmod 755 /usr/sbin/* /usr/bin/*" fixed the problem.

If the problem still exists, add the port to the iptables.

For adding port 22 to the iptables, from shell run

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

or

edit /etc/sysconfig/iptables
and append this line

-A INPUT -p tcp --dport 22 -j ACCEPT

Feb 23, 2013

How to Sync Google Calendar, Outlook and iPhone Calendar

Please refer the below url
http://email.about.com/od/googlecalendartips/qt/Sync_Outlook_Google_Calendar_and_iPhone_Calendar.htm

Feb 22, 2013

How to create checksums for all files recursively

To create checksums for all files recursively

find . -type f -exec md5sum "{}" +;

Feb 21, 2013

How to find a machine whether its a physical machine or a Virtual machine in linux.

You can get this information by using a tool called dmidecode. dmidecode  is a tool for dumping a computerâs DMI (some say SMBIOS) ta-
       ble contents in a human-readable format. This table contains a descrip-
       tion  of  the  systemâs  hardware  components,  as well as other useful
       pieces of information such as serial numbers and BIOS revision.  Thanks
       to  this  table,  you  can  retrieve this information without having to
       probe for the actual hardware.

[root@server2 tmp]# /usr/sbin/dmidecode |grep -i "vm"
                Manufacturer: VMware, Inc.
                Product Name: VMware Virtual Platform
                Serial Number: VMware-24 34 c4 76 3b 1a 94 8d-99 08 5d cc 81 04                            17 25
                        VME (Virtual mode extension)
                        VME (Virtual mode extension)
                Description: VMware SVGA II
                String 1: [MS_VM_CERT/SHA1/27d66596a61c48dd323409dfd5126e33f59                           ae7]
               

               
For a physical machine it will be like below

[mohan@server2 storage]# sudo /usr/sbin/dmidecode |grep -i "vm"
                VME (Virtual mode extension)
                VME (Virtual mode extension)
               

Feb 20, 2013

Different options of reverting files in Perforce


p4 revert //...
Revert every file you have open, in every one of your pending changelists, to its pre-opened state.

p4 revert -c default //...
Revert every file open in the default changelist to its pre-opened state.

p4 revert -n *.txt
Preview a reversion of all open .txt files in the current directory, but don't actually perform the revert.

p4 revert -c 31 *.txt
Revert all .txt files in the current directory that were open in changelist 31.

p4 revert -a
Revert all unchanged files. This command is often used before submitting a changelist.

Feb 19, 2013

File checksum utility for windows Xp

File checksum utility for windows Xp






Refer -  http://support.microsoft.com/kb/841290

Feb 18, 2013

This e-mail address is associated with a Nokia Messaging account

Problem
This e-mail address is associated with a Nokia Messaging account


Solution
If you configure mails in Nokia mobiles, your mail address will be linked with your nokia accout. The same email address cannot be configured in another nokia mobile. The solution is to call Nokia customer care and request them to remove the linking for your mail address.

Feb 17, 2013

How to count occurrences of a number or text in Excel

To count occurances of a particular number or words in a range of excel cells use formula

=COUNTIF(range,"pattern")
where range is the excel cells range where you want to search for the pattern. pattern can be numbers or words but it should be within double quotes "".

Example - To count number of occurance of word "present" in cells between A1 to A10. frame the formula like below

ex - COUNTIF(A1:A10,"Present")

also you can wildcard characters in the pattern.
Example   =COUNTIF(A1:A9,"*sent")

Feb 16, 2013

How to find filetype in windows


There is a utility called "file" in unix which determines filetype  of a file. There is no default similar utility available in windows.  After trying few utilities available online, I found this one more helpful.

http://home.fnal.gov/~jklemenc/dl/filetype.zip

Find more description about the tool at http://home.fnal.gov/~jklemenc/filetype.html

I have posted screenshot of an example

C:\Documents and Settings\tig\Desktop>filetype.exe
FileType.exe
  by: Joe Klemencic
  Copyright 2004

Usage:
   FILETYPE.EXE -i [-r] [-o ] [-v] [-?]

                -i - Inspect a single file or all files in a directory
                -r  - Rename the file with the correct extension (-o ignored)
                -o  - Output path for file copies (creates if not exist)
                -v  - Verbose output
                -?  - This help text


C:\Documents and Settings\tig\Desktop>filetype.exe -i  "Reach Out-participants.pdf"
Reach Out-participants.pdf (.pdf) "Adobe PDF File"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  "Perl One Liners.htm"
Perl One Liners.htm (.txt) "Text file"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  SyncToySetupPackage_v21_x86.exe
SyncToySetupPackage_v21_x86.exe (.exe) "Executable File"

C:\Documents and Settings\tig\Desktop>filetype.exe -i  toolsmanual.dvi
Could not identify toolsmanual.dvi, skipping....

C:\Documents and Settings\tig\Desktop>filetype.exe -i  quickCooking.do
quickCooking.do (.pdf) "Adobe PDF File"

Feb 15, 2013

mount error: can not change directory into mount target /mnt/server/


Problem:
mount error: can not change directory into mount target /mnt/server/

Reason:
Either you didn't create your /mnt/server directory or specified it wrong in your mount command.
check the existence of the directory and try the mount command again

Example:
[root@library 20100813143931]# mount -t cifs //192.168.1.2/Release -o username=mohan,domain=priv  /mnt/server/
mount error: can not change directory into mount target /mnt/server/
[root@library 20100813143931]# cd /mnt/server
-bash: cd: /mnt/server: No such file or directory
[root@library 20100813143931]# ls /mnt/
[root@library 20100813143931]# mkdir /mnt/server
[root@library 20100813143931]# mount -t cifs //192.168.1.2/Release -o username=mohan,domain=priv  /mnt/server/
Password:

Feb 14, 2013

Maximum length for naming a file in windows


In the Windows explorer the maximum length for naming a file is 260 characters including the drive letter and folders name.
Because windows has a predefined variable called MAX_PATH and its value is set to 260.


So when you try to create or copy a file it will return below error

cp: cannot create regular file    File name too long

sample filename :
C:\hudson\workspace\dev-project-eventsourcelibrary\project\initial\eventsourcelibrary\tmp\normaliser\etc\devices\nsm\reports\Network\Configuration and Policy Management\viewScreen-Security Management\NetScreen-Security Manager - Authentication and Login Events.xml 

So to avoid either you can reduce the characters by trimming the directories name length or use the "\\?\" prefix so that it will allow upto 32,767 characters.

To know more about this, refer microsoft's naming guide.
url-
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath
----------------

Unicode clients require a unicode enabled server.

Problem: Unicode clients require a unicode enabled server.

If P4CHARSET is set in the client , but the service is not operating in internationalized mode, the service returns the following error message:

Unicode clients require a unicode enabled server.

Solution:
For Perforce services operating in the default (non-Unicode mode), P4CHARSET must be left unset (or set to none) on user workstations.P4CHARSET only affects files of type unicode and utf16; non-unicode files are never translated.

Example:

c:\p4\project\>p4 edit startbuild
Unicode clients require a unicode enabled server.

c:\p4\project>set P4CHARSET=none
c:\p4\project>p4 edit startbuild
//project/startbuild#1 - opened for edit



For Perforce services operating in Unicode mode, P4CHARSET must be set on user machines. If P4CHARSET is unset, but the service is operating in Unicode mode, Perforce applications return the following error message:
Unicode server permits only unicode enabled clients.

c:\p4\project\>set P4CHARSET=UTF-8
c:\p4\project\>p4 edit startbuild
Character set must be one of:
none, utf8, utf8-bom, iso8859-1, shiftjis, eucjp, iso8859-15,
iso8859-5, macosroman, winansi, koi8-r, cp949, cp1251,
utf16, utf16-nobom, utf16le, utf16le-bom, utf16be,
utf16be-bom, utf32, utf32-nobom, utf32le, utf32le-bom, utf32be,
or utf32be-bom
Check P4CHARSET and your '-C' option.

c:\p4\project\>set P4CHARSET=utf8

For further information refer http://www.perforce.com/perforce/r12.2/manuals/cmdref/env.P4CHARSET.html

Feb 13, 2013

How to perform shutdown from command prompt or to schedule shutdown/reboot/logoff in windows

There is a executable which comes default with windows namely, shutdown.exe which can be called in command prompt to shutdown the system.

To perform shutdown immediatly
c:\>shutdown /s /t 00

In this /s if for shutdown, similarly you can use /r for reboot /l for logoff etc.


To shutdown windows in 1 hour
c:\>shutdown /s /t 3600

refer manual for additional options

c:\>shutdown /?