List for troubleshooting Process and threads on Linux

To the get the sum of all threads running in the system:

ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'

To get the number of threads for a given pid:

ps -o nlwp <pid>

Locate a Process

top

or

ps

To display all process names, use the following command –

$ ps -e

List the process associated with  a service/program

ps aux | grep my_service /  PID

To Kill a Process

kill PID

To see the thread count of process, use the following command-

$ cat /proc/<pid>/status

Initial Network Setup with UBUNTU Server Main steps to configure newtwork services on Linux Ubuntu Server

How do I change the hostname without a restart?

sudo hostname your-new-name

Assigning a static IP to Ubuntu Server

vi /etc/network/interfaces

Example:

auto eth0
 iface eth0 inet static

address 192.168.1.128
 netmask 255.255.255.0
 network 192.168.1.0
 broadcast 192.168.1.255
 gateway 192.168.1.1

How to disable IPv6 in Ubuntu?

vi /etc/sysctl.conf

insert the following lines at the end:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Linux Proxy Server Settings – Set Proxy For Command Line

env | grep -i proxy

check the file :

cat /etc/apt/apt.conf
cat /etc/environment

To Modify contents of file (remove everything from apt.conf for no proxy and only proxy sentences from environment)!

sudo nano /etc/apt/apt.conf
sudo nano /etc/environment
Acquire::http::Proxy "http://proxy.site.com:8080";

Manually edit DNS in Ubuntu

sudo nano /etc/resolvconf/resolv.conf.d/base

Add your DNS to the file :

nameserver 8.8.8.8
nameserver 8.8.4.4

Update resolv configuration:

sudo resolvconf -u

Setting up NTP on Ubuntu

sudo apt-get install ntp ntpdate

sudo nano /etc/ntp.conf

server myserverdnsname1 or IP
server myserverdnsname2 or IP
server myserverdnsname3 or IP

sudo service ntp start

sudo ntpd -gq

watch ntpq -cpe -cas

Grab you Ubuntu server HERE

How to Install and Configure Linux NTP Server and Client NTP is a protocol that allows computers to synchronize time over networks for an accurate time

Install ntp

The ntp package contains utilities and daemons that will synchronize your computer’s time to Coordinated Universal Time (UTC) via the NTP protocol and NTP servers. The ntp packageincludes ntpdate (a program for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time). Install the ntp package:

# yum install ntp

How do I configure an NTP Client?

Simply open /etc/ntp.conf file, enter:

# vi /etc/ntp.conf

Make sure the following line exists:

server ntp.server.com

Configure an NTP Server

If you have lots of server and desktop system, configure your own NTP server. Your NTP server contacts a central NTP server,provided by your ISP or a public time
server located at ntp.org, to obtain accurate time data. The server then allows other machines on your network to request the time data. Our sample setup:

192.168.1.5 ==> CentOS / Fedora / RHEL NTPD Server.
202.54.1.5 ==> ISP remote NTP server.
192.168.1.0/24 ==> NTP clients including desktop systems.

First, install and enable ntpd on 192.168.1.5:

# yum install ntp
# chkconfig ntpd on

Now open /etc/ntp.conf:

# vi /etc/ntp.conf

Make sure the following line exits:

restrict default ignore

Above will deny all access to any machine, server or client. However, you need to specifically authorized policy settings. Set it as follows:

restrict 202.54.1.5 mask 255.255.255.245 nomodify notrap noquery
server 202.54.1.5

Replace 202.54.1.5 and mask with actual remote ISP or ntp.org NTP server IP. Save and close the file.

Configure NTP clients to access your NTP Server

Now, you need to allow legitimate NTP clients to access the Server. For example, allow 192.168.1.0/24 network to synchronize to this server located at 192.168.1.5. Open /etc/ntp.conf and add policy as follows:

# Hosts on local network are less restricted.
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

Update your firewall settings, open /etc/sysconfig/iptables.

# vi /etc/sysconfig/iptables

Add the following line, before the final LOG and DROP lines for the RH-Firewall-1-INPUT chain:

-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 123 -j ACCEPT

Save and close the file. Finally, start ntpd:

# service ntpd start
# service iptables restart
# netstat -tulpn

Usefull Command for check NTP

1) Check if the date (year, month, day, hour, minute, second) is allign

# date

2) List active peers server

# ntpq -nc peers

3) edit ntp.conf

# vi /etc/ntp.conf

4) restart NTPd Deamon

# /etc/init.d/ntpd restart

5) Force update

# ntpdate -u ntp.server.com (ir IP)

How to Check if Your Linux System is 32-bit or 64-bit Tricks and tips to find the architecture of a running linux machine

It’s always a good idea to know some basics about the operating system you’re running on your computer. For example, you may need to know whether you’re running a 64-bit or 32-bit system so you know which file to download for a program you want to install.

We will show you several different ways of checking whether your Linux system is 32-bit or 64-bit. Some provide additional information beyond whether the system is 32-bit or 64-bit.

The first two methods involves the “uname” command, which prints system information to the screen. If you want more information than just whether your system is 32-bit or 64-bit, type the following command and press Enter.

uname –a

The following information is printed to the screen in the following order: kernel name, network node hostname, kernel release, kernel version, machine hardware name, processor type, hardware platform, operating system. You can find out what the Linux kernel is and what it does at How-To Geek.

The machine hardware name lists whether your system is 32-bit (“i686” or “i386”) or 64-bit (“x86_64”). Notice that the processor type and hardware platform also indicates 32-bit or 64-bit.

To use the “uname” command to only find out whether your system is 32-bit or 64-bit, type the following command and press Enter.

uname –m

This displays only the machine hardware name and indicates, as above, whether your system is 32-bit (“i686” or “i386”) or 64-bit (“x86_64”).

The “arch” command is similar to the “uname -m” command and prints to the screen whether your system is 32-bit (“i686”) or 64-bit (“x86_64”). Type the following command and press Enter.

arch

You can also use the “file” command with a special argument (“/sbin/init”) to find out whether your system is 32-bit or 64-bit. Type the following command and press Enter.

file /sbin/init

The following output is printed to the screen. The text outlined in red indicates whether your system is 32-bit or 64-bit.

No Guest OS Heartbeats are being received error Troubleshooting Migration compatibility warning: No guest OS heartbeats are being received, from local or remotely

Symptoms
When performing a vMotion migration, this compatibility warning is displayed:

Migration from source_server: No guest OS heartbeats are being received. Either the guest OS is not responding or VMware tools is not configured properly.

No guest OS heartbeats are being received
No guest OS heartbeats are being received

Resolution

This warning indicates that the VMware Tools are either not installed or are not running in the virtual machine.

This message is safe to ignore when performing a migration.

Workaround
To workaround the warning, perform one of these options:

  1. Ensure that the VMware Tools are installed in the virtual machine before performing a migration;
  2. Ensure that the virtual machine has been running long enough for the operating system to be completely started before performing a migration.
  3. Restart the VMware Tools service.

For Linux virtual machine, open shell/terminal and run the command:

  • /etc/init.d/vmware-tools restart

or

  • /etc/vmware-tools/services.sh restart

or

  • service vmware-tools {start|stop|status|restart|force-reload}

For Windows virtual machine, frm RDP session or directly on machine:

  1. Click Start > Run, type services.msc, and press OK.
  2. Right-click VMware Tools Service and click Restart.

You can execute a remote restart of the “VMtools” service from remotely using SC command from command prompt:

sc.exe config “[servicename]” obj= “[.\username]” password= “[password]”

SC Syntax

DESCRIPTION:
 SC is a command line program used for communicating with the
 Service Control Manager and services.
USAGE:
 sc <server> [command] [service name] <option1> <option2>...

The option <server> has the form "\\ServerName"
 Further help on commands can be obtained by typing: "sc [command]"
 Commands:
 query-----------Queries the status for a service, or
 enumerates the status for types of services.
 queryex---------Queries the extended status for a service, or
 enumerates the status for types of services.
 start-----------Starts a service.
 pause-----------Sends a PAUSE control request to a service.
 interrogate-----Sends an INTERROGATE control request to a service.
 continue--------Sends a CONTINUE control request to a service.
 stop------------Sends a STOP request to a service.
 config----------Changes the configuration of a service (persistent).
 description-----Changes the description of a service.
 failure---------Changes the actions taken by a service upon failure.
 failureflag-----Changes the failure actions flag of a service.
 sidtype---------Changes the service SID type of a service.
 privs-----------Changes the required privileges of a service.
 qc--------------Queries the configuration information for a service.
 qdescription----Queries the description for a service.
 qfailure--------Queries the actions taken by a service upon failure.
 qfailureflag----Queries the failure actions flag of a service.
 qsidtype--------Queries the service SID type of a service.
 qprivs----------Queries the required privileges of a service.
 qtriggerinfo----Queries the trigger parameters of a service.
 qpreferrednode--Queries the preferred NUMA node of a service.
 delete----------Deletes a service (from the registry).
 create----------Creates a service. (adds it to the registry).
 control---------Sends a control to a service.
 sdshow----------Displays a service's security descriptor.
 sdset-----------Sets a service's security descriptor.
 showsid---------Displays the service SID string corresponding to an ar
bitrary name.
 triggerinfo-----Configures the trigger parameters of a service.
 preferrednode---Sets the preferred NUMA node of a service.
 GetDisplayName--Gets the DisplayName for a service.
 GetKeyName------Gets the ServiceKeyName for a service.
 EnumDepend------Enumerates Service Dependencies.

The following commands don't require a service name:
 sc <server> <command> <option>
 boot------------(ok | bad) Indicates whether the last boot should
 be saved as the last-known-good boot configuration
 Lock------------Locks the Service Database
 QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
 sc start MyService

example:

(check status of the service)
sc \\you_server_name_or_ip query “vmtools”

(Stop the service)
sc \\you_server_name_or_ip query “vmtools”

(Start the Service)
sc \\you_server_name_or_ip query “vmtools”

From another server on the domain open a command prompt and type the following.
From another server on the domain open a command prompt and type the following.

Results

validation succeed
validation succeed

If your issue continues to exist, reinstall VMware Tools to ensure that you are on the latest version.