This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Friday, March 4, 2016

Deprecated VMFS Volumes found on host. Please consider upgrading volume(s) to the latest version error in vsphere 6.0

Friday, March 04, 2016 0
The ESXi hosts display a false positive warning:

Deprecated VMFS volume(s) found on the host. Please consider upgrading volume(s) to the latest version

This is a known issue affecting vCenter Server 6.0.

Currently, there is no resolution.

This issue occurs because the version of the filesystem is not known during the initial detection. Therefore, comparing it against the list of valid filesystems does not return a match.

Workaround or Fix :

To work around this issue, restart the management agents on the impacted hosts to clear the warning using the below command.

Services.sh restart

After restarting the management agents on my ESXi 6.0 host, warning about deprecated VMFS volumes on ESXi host is cleared automatically. I hope this informative for you. Thanks for Reading!!!. Be Social and share it in social media, if you feel worth sharing it.


Thursday, March 3, 2016

How can I add more ethernet interface to a guest Linux server after installation?

Thursday, March 03, 2016 0

Add more ethernet interface to a guest after installation

Issue 

When a guest OS was created using virt-manager or virt-install, it created one ethernet interface for the guest. How do I create a second and third interface and attach them to the guest post insatllation?

Resolution
 

Xen

Using virt-manager. (Recommended)
  •     Right Click the Guest in virt-manager and select "Open" an dselect "Hardware" tab
  •     Click on "Add Hardware"
  •     Select "Network" as the "Hardware Type" and click Forward.
  •     Select "Virtual Network" or "Shared physical device" depending upon the requirement. Set fixed MAC address if needed. Select "Hypervisor default" or another appropriate Deivce Model. Click Forward
  •     Then Click "Finish".
  •     New network will be attached to the guest on the next reboot.

By manually editing the guest configuration file. (Not recommended)

    Edit the configuration file for that guest at /etc/xen/guestname and add nic = 2 for two interfaces and or nic = 3 for three interfaces.
    Change the vif = entry.

     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]
     To (For two interfaces)
     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx:xx,

    bridge=xenbr0' ]
     OR To (For three interfaces)
     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx:xx,
    bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]

    For fully virtualised guests it should be as below:

     vif = [ 'type=ioemu,mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0',
    'type=ioemu,mac=xx:xx:xx:xx:xx:xx:xx, bridge=xenbr0',
    'type=ioemu,mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]

    Configure eth1 and eth2 inside the guest OS as usual.

Note: xx:xx:xx:xx:xx:xx needs to be replaced by a unique mac address.


KVM

Using virt-manager.
  •     Right Click the Guest in virt-manager and select "Open" an dselect "Hardware" tab
  •     Click on "Add Hardware"
  •     Select "Network" as the "Hardware Type" and click Forward.
  •     Select "Virtual Network" or "Shared physical device" depending upon the requirement. Set fixed MAC address if needed. Select "Hypervisor default" or another appropriate Deivce Model. Click Forward
  •     Then Click "Finish".
    New network will be attached to the guest on the next reboot.

Wednesday, March 2, 2016

How to find WWPN (world wide port name) WWNN (world wide node name) and of my QLogic card in Linux Server

Wednesday, March 02, 2016
The directory /proc/scsi/qla2xxx/ is not available in Red Hat Enterprise Linux 5, but the informations can now be found in the /sys/class/scsi_host/ tree.

    Locate the file called isp_name in /sys/class/scsi_host/.
    
    # ls /sys/class/scsi_host/*/isp_name

    /sys/class/scsi_host/host1/isp_name

    # ls /sys/class/scsi_host/*/device/fc_host:*/port_name

    /sys/class/scsi_host/host1/device/fc_host:host1/port_name

    # cat /sys/class/scsi_host/host1/device/fc_host:host1/port_name

    0x210000e08b8f9be6
    
    # ls /sys/class/scsi_host/*/device/fc_host:*/node_name

    /sys/class/scsi_host/host1/device/fc_host:host1/node_name

    # cat /sys/class/scsi_host/host1/device/fc_host:host1/node_name

    0x210000e08b8f9be6    

    From that directory, look for port_name& and node_name

Tuesday, March 1, 2016

Running the gcc preprocessor in RHEL

Tuesday, March 01, 2016 0
Issue

In certain situations it is needed to have source code preprocessed by gcc without undergoing the full compilation process. For example, this might be necessary when embedded SQL is included in C or C++ programs and the preprocesssed file will be passed on to another tool which will convert the SQL in native source code.

Resolution


Using the -E parameter with gcc or g++ will produce only the preprocessed source code:

$ gcc -E program.c -o program.preprocessed

The program.preprocessed file will contain the file preprocessed by gcc (Macros will be expanded and all include files will be resolved). This preprocessed

# 131 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 132 "/usr/include/bits/types.h" 2 3 4

These lines are linemarkers that show from which include files specific

$ gcc -E -P program.c -o program.preprocessed

How to resolve : User is unable to change its password and getting error as "You must wait longer to change your password"

Tuesday, March 01, 2016 0
Getting error as "You must wait longer to change your password" while changing user password in Red Hat Enterprise Linux

Issue

    While changing the user password getting following error:

You must wait longer to change your password 
passwd: Authentication token manipulation error

    User is unable to change its password and getting error as "You must wait longer to change your password".
    Copied the user passwd entries from a BSD box. That may be what is causing the problem. However, pwck come back clean.

Resolution

    First check password aging policies/information for user as follows:

# chage -l user 
Last password change: Feb 07, 2011 
Password expires: May 08, 2011 
Password inactive: never 
Account expires: never 
Minimum number of days between password change: 7       <---
Maximum number of days between password change: 90 
Number of days of warning before password expires: 28

If Minimum number of days required for password change is set to 7 days then it will prompt an error message as You must wait longer to change your password while changing password using command passwd
Change the password aging information to linux defaults and try to change the password.
Changing 4th field to '0' will change Minimum number of days between password change to '0' so that user will be able to change its password without any restrictions.
 Make following changes to "/etc/shadow" file as root user:

user:$1$rmOPqlKQ$DMS2VsQuV/LNh8it5jT.N0:15012:0:99999:7:::     <---

OR

Expire the user's password using root account:

# chage -d 0 user

Then check again for password aging information for user:

* # chage -l user 
Last password change: Feb 07, 2011 
Password expires: May 08, 2011 
Password inactive: never 
Account expires: never 
Minimum number of days between password change: 0    <--- 
Maximum number of days between password change: 90 
Number of days of warning before password expires: 28
 

Try to change the password and it should work now.

Root Cause

    The issue mentioned above seems to be due to user password expiry settings are too restrictive.
    Minimum number of days between password change was set to 7 days so password change was not allowed before 7 days. The error You must wait longer to change your password was suggesting the same.

Friday, February 26, 2016

Understand Processes in Linux

Friday, February 26, 2016 0

Understand Processes in Linux

Normal Process

Normal processes are those which have life span of a session. They are started during the session as foreground processes and end up in certain time span or when the session gets logged out. These processes have their owner as any of the valid user of the system, including root.

Orphan Process

Orphan processes are those which initially had a parent which created the process but after some time, the parent process unintentionally died or crashed, making init to be the parent of that process. Such processes have init as their immediate parent which waits on these processes until they die or end up.

Daemon Process

These are some intentionally orphaned processes, such processes which are intentionally left running on the system are termed as daemon or intentionally orphaned processes. They are usually long-running processes which are once initiated and then detached from any controlling terminal so that they can run in background till they do not get completed, or end up throwing an error. Parent of such processes intentionally dies making child execute in background.

Wednesday, February 24, 2016

Repeat a Linux Command Every X Seconds Forever

Wednesday, February 24, 2016 0

Run Linux Command Every Second

In this Article, you will learn a simple scripting techniques to monitor or keep a eye on a particular command in continuously running state  for every 3 seconds by default.

1. Use watch Command

Watch is a Linux command that allows you to execute a command or program periodically and also shows you output on the screen. This means that you will be able to see the program output in time. By default watch re-runs the command/program every 2 seconds. The interval can be easily changed to meet your requirements.
Monitor Memory Usage

“Watch” is extremely easy to use, to test it, you can fire up a Linux terminal right away and type the following command:

# watch free -m

The above command will check your system free memory and update the results of the free command every two seconds.

Monitor Memory Usage in Linux

As seen per the above output, you have a header, displaying information about (from left to right) update interval, command that is being executed and current time. If you wish to hide this header, you can use the -t option.

The next logical question is – how to change the execution interval. For that purpose, you can use the -n option, that specifies the interval with which the command will be executed. This interval is specified in seconds. So let’s say you want to run your script.sh file every 10 seconds, you can do it like this:

# watch -n 10 script.sh

Monitor Logged-In Users, Uptime and Load Average Let’s say you want to monitor logged-in users, server uptime and load average output in continuously phase every few seconds, then use following command as shown:

# watch uptime

Watch Linux Load Average

To exit the command, press CTRL+C.

Here, the 'uptime' command will run and display the updated results every 2 seconds by default.
Monitor Progress of Copy Command

In Linux, while copying files from one location to other using cp command, the progress of data is not shown, to see the progress of data being copied, you can use the watch command along with  du -s command to check disk usage in real time.

2. Use sleep Command

Sleep is often used to debug shell scripts, but it has many other useful purposes as well. For example, when combined with for or while loops, you can get pretty awesome results.

In case this is the first time you hear about the "sleep" command, it is used to delay something for a specified amount of time. In scripts, you can use it to tell your script to run command 1, wait for 10 seconds and then run command 2.

With the above loops, you can tell bash to run a command, sleep for N amount of seconds and then run the command again.

Below you can see examples of both loops:
for loop Example

# for i in {1..10}; do echo -n "This is a test in loop $i "; date ; sleep 5; done

The above one liner, will run the echo command  and display the current date, total of 5 times, with 5 seconds sleep between executions. Here is a sample output:

This is a test in loop 1 Wed Feb 17 20:49:47 EET 2015
This is a test in loop 2 Wed Feb 17 20:49:52 EET 2015
This is a test in loop 3 Wed Feb 17 20:49:57 EET 2015
This is a test in loop 4 Wed Feb 17 20:50:02 EET 2015

You can change the echo and date commands with your own commands or script and change the sleep interval per your needs.
while loop Example

# while true; do echo -n "This is a test of while loop";date ; sleep 5; done

Here is sample output:

This is a test of while loopWed Feb 17 20:52:32 EET 2015
This is a test of while loopWed Feb 17 20:52:37 EET 2015
This is a test of while loopWed Feb 17 20:52:42 EET 2015
This is a test of while loopWed Feb 17 20:52:47 EET 2015
This is a test of while loopWed Feb 17 20:52:52 EET 2015
This is a test of while loopWed Feb 17 20:52:57 EET 2015

The above command will run until it is either killed or interrupted by user It can come in handy if you need to run a command running in the background and you don’t want to count on cron.