Thursday 26 April 2018

Job for smb.service failed because the control process exited with error code. Redhat 7 or RHEL 7

Job for smb.service failed because the control process exited with error code.

I just recently installed the samba server on my Red Hat Linux 7 / RHEL 7 operating system server. After configuration when I have taken restart of samba service, I have got the above error. Due to this samba service not running on my linux machine.

[root@localhost~]# systemctl restart smb.service

I will reveive below error

Job for smb.service failed because the control process exited with error code.
See "systemctl status smb.service" and "journalctl -xe" for details.

So in such case, first I have checked the my samba configuration is ok or not, to do this, please run the below command.

#smbstatus

the above command gives me the below output.

"WARNING: Ignoring invalid value 'share' for parameter 'security'
Can't load /etc/samba/smb.conf - run testparm to debug it"

That's means something wrong in my samba configuration.

So open the /etc/samba/smb.conf file and commented the below line which starts with security.

#security = server

now again run the smbstatus command which gives the new output.

[root@localhost~]# smbstatus

Samba version 4.2.10
PID     Username      Group         Machine            Protocol Version
------------------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

If you are getting such output that means now your configuration is ok, now please restart the samba service again.

[root@localhost~]# systemctl restart smb.service

[root@localhost~]# systemctl status smb.service
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2018-04-26 16:19:34 BST; 12h ago
 Main PID: 4719 (smbd)
   Status: "smbd: ready to serve connections..."
   CGroup: /system.slice/smb.service
           ├─4719 /usr/sbin/smbd
           ├─4720 /usr/sbin/smbd
           ├─4721 /usr/sbin/smbd
           └─4722 /usr/sbin/smbd

Apr 26 16:19:33 localhost.redhat.com systemd[1]: Starting Samba SMB Daemon...
Apr 26 16:19:33 localhost.redhat.com systemd[1]: smb.service: Supervising process 4719 which is not our child. We'll most likely not notice when it exits.
Apr 26 16:19:34 localhost.redhat.com smbd[4719]: [2018/04/26 16:19:34.173413,  0] ../lib/util/become_daemon.c:124(daemon_ready)
Apr 26 16:19:34 localhost.redhat.com systemd[1]: Started Samba SMB Daemon.
Apr 26 16:19:34 localhost.redhat.com smbd[4719]:   STATUS=daemon 'smbd' finished starting up and ready to serve connections

Job for nfs-server.service failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details. Resolution

On Red Hat Linux 7 operating system, some time you will get below NFS service failed error message.

"Job for nfs-server.service failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details."

The above error occur when you are taking restart of nfs service.

# systemctl restart nfs.service
Job for nfs-server.service failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details.
Resolution

# systemctl status nfs-server.service
nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-04-27 09:56:08 IST; 8s ago
  Process: 21370 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 21366 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 21362 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 21273 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 2714 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
 Main PID: 21273 (code=exited, status=0/SUCCESS)

Apr 27 09:56:07 localhost.redhat.com systemd[1]: Starting NFS server and services...
Apr 27 09:56:08 localhost.redhat.com exportfs[2714]: exportfs: Failed to resolve foobar.com <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Apr 27 09:56:08 localhost.redhat.com exportfs[2714]: exportfs: Failed to resolve foobar.com <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Apr 27 09:56:08 localhost.redhat.com systemd[1]: nfs-server.service: control process exited, code=exited status=1
Apr 27 09:56:08 localhost.redhat.com systemd[1]: Failed to start NFS server and services.
Apr 27 09:56:08 localhost.redhat.com systemd[1]: Unit nfs-server.service entered failed state.
Apr 27 09:56:08 localhost.redhat.com systemd[1]: nfs-server.service failed.

To resolve such issue you need to follow the below process.

You need to check which NFS version rpm is installed on the server.

#rpm -qa | grep nfs

the above command show you the installed nfs version.

Normally the above error occur due to lower version on nfs, so to resolve the issue you need to upgrade the nfs version.

installed the latest nfs rpm nfs-utils-1.3.0-0.33.el7 or later

#yum install nfs

The above command upgrade the nfs rpm, or you can download the manually rpm file and installed it through rpm -uvh command.

After that restart the nfs service again.

# systemctl restart nfs.service

it is started successfully, you can check the status via below command.

# systemctl status nfs.service

[root@localhost ~]# systemctl status nfs.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
  Drop-In: /run/systemd/generator/nfs-server.service.d
           └─order-with-mounts.conf
   Active: active (exited) since Thu 2018-04-27 03:47:57 IST; 18h ago
  Process: 32477 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 32472 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS)
  Process: 32469 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 32477 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Apr 26 03:47:57 localhost systemd[1]: Starting NFS server and services...
Apr 26 03:47:57 localhost systemd[1]: Started NFS server and services.

How to update and upgrade ESXi host

Please find the below steps and command to update and upgrade the ESX host.

You need to understand first, the update and upgrade both are different thing in case of ESX.

Update means you have update the VMware release build.

Upgrade means you have upgrade the VMware version like 5.0 to 6.0 

Please find the below command to update the VMware release build:

# esxcli software vib update -d /vmfs/volumes/updates/VMware-ESXi-5.1.0-Update3-2323236-HPE-510.9.5.0.30-Apr2016-depot.zip

It is asking for reboot please press true and reboot the esx host gracefully, once the host reboot successfully check the new release build. 

Please find the below steps to upgrade the ESX host:

Now we need to upgrade the ESX host from 5.1.0 to 5.5.0 , to perform this task please follow the below steps

Take a remote console of this ESX host from ILO.

Copy the VMware-ESXi-5.5U1-Rollup_2ISO.iso

attached the iso with remote console

boot the ESX host with attached iso VMware-ESXi-5.5U1-Rollup_2ISO.iso

When esx boot this iso during upgrade process it is asking for you 3 option, please select the below option.

Upgrade the ESX host with keeping existing datastore.

Once the upgrade will be successfully, please login on the esx host and check the latest version and all service will working fine.

Please let me know if you have any question regarding this upgrade issue.

Tuesday 24 April 2018

How to add linux host in Active Directory (AD) domain

Before performed such work, please collect the below information:-

Host: Server name which need to be add in AD
DA account: .da account which used to add server to domain
Domain name

Please find the below process step by step to add a server in to AD:-

[root@localhost ~]# hostname localhost.redhat.com

[root@localhost ~]# adinfo

Not joined to any domain
Licensed Features: Enabled

[root@localhost ~]#  adjoin -u xyz.da --name localhost -a localhost.redhat.com -w redhat.com

xyz.da@REDHAT.COM's password:
Using domain controller: redhat01.redhat.com writable=true
Join to domain:redhat.com, zone:Auto Zone successful
Centrify DirectControl started.
Loading domains and trusts information
........................

Note: .da account required to add server in domain

How to install or upgrade VMware Tools on linux server

You need to login on the server where you need to install or upgrade the vmware tool.

Check the status of vmtools from vcenter GUI & Servers.

/etc/vmware-tools/services.sh status

Please follow the below steps to install or upgrade the VMware Tools:-

1.    From vsphere select the virtual machine on which vmtools need to be installed and then Choose VM > Install VMware Tools.

2. As root mount the VMware Tools virtual CD-ROM image to /mnt

mount /dev/cdrom /mnt

3. go to /tmp and untar the installation file.

cd /tmp
tar zxf /mnt/VMwareTools-x.0.0-<xxxx>.tar.gz

4. Run the VMware Tools installer:

cd /tmp/vmware-tools-distrib

./vmware-install.pl -d
 
Unmount of the VMware Tools virtual CD-ROM image is done automatically.

Login to server as root and run below command to start the services:

/etc/vmware-tools/services.sh start


Run below command to check the status of vmtools:

/etc/vmware-tools/services.sh status

Uninstall the vmtools by running below command:

/usr/bin/vmware-uninstall-tools.pl

Tuesday 6 February 2018

How to Set a Solaris 11 Machine's NIS Domain Name

If domainname command not showing any output then you need to check either defaultdomain or NIS domain is configured or not.

Steps which we need to follow to set the NIS domain name as describe below.

1. Please run  "cat /etc/defaultdomain" command and check the output that domain is set or not.

    #domainname

The above command shows you the current domain name on the server, if no output is display you need to set the domain by below command.

   #domainname UNIX

Run the below command to check the output again.

   #domainname
   UNIX

You can see the output. All the above command is used for checking and setting the domain name on the Solaris operating server.

2. If you want to set the domain using NIS, then first please check the NIS/DOMAIN service is running or not

root@sun:~# svcs status nis/domain
STATE          STIME    FMRI
disabled       18:20:04 svc:/network/nis/domain:default

In my Solaris machine, currently NIS domain services is stop, we will start it later once we will configured the NIS domain name on the Solaris server.

3. Now you need to configure the NIS domain for your machine ( in my case - UNIX is my domain name)

root@sun:~# svccfg -s svc:/network/nis/domain setprop config/domainname = UNIX

If you see the above command, "svccfg" command is used to configure the domain and set the proper properties.

4. In the final step once the configuration has been completed you need to refresh & enable the NIS domain service again.

root@sun:~# svccfg -s nis/domain:default refresh
root@sun:~# svcadm enable nis/domain

You can check the NIS domain service status as describe in step 2. 

5. Now you can verify the domain name using below command so we can ensure that the NIS domain name has been set successfully. 

root@sun:~# domainname
UNIX
The above command output show "UNIX" domain name which we set during the configuration, so using these above method we can easily set the NIS domain name on the Solaris operating server.

Monday 5 February 2018

How to start/stop and enable/disable Firewall on Redhat 7 Linux system

In RHEL7, to stop/start and enable/disable the firewall is quite different from RHEL6. In Red hat 7 "firewalld" named service we used for local firewall. Please find the below example step by step to check the firewall status.

How to check status of RHEL7 firewall:

[root@localhost ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since Thu 2018-02-05 12:37:47 IST; 0 months 1 days ago
Main PID: 332 (firewalld)
CGroup: /system.slice/firewalld.service
           └─332 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Feb 05 12:37:47 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 05 12:37:49 localhost systemd[1]: Started firewalld - dynamic firewall daemon.

In the above status firewall is by default enable on the linux system. It is enable automatically when system restart or on.

How to Stop and Start RHEL7 firewall:
 
Please use the below commands to start stop the firewall on redhat linux 7 operating system. 

[root@localhost ~]# service firewalld stop
Redirecting to /bin/systemctl stop  firewalld.service
Stopped firewall will start again after system's reboot.

[root@localhost ~]# service firewalld start
Redirecting to /bin/systemctl start  firewalld.service

How to Disable and Enable RHEL7 firewall:

If you want to disable permanently firewall so that after reboot it is not enable again, please use the below command.

[root@localhost ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

If you want to enable the firewall again run please use the below command.

[root@localhost ~]# systemctl enable firewalld
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/basic.target.wants/firewalld.se