Corosync Cluster Engine exiting with status 8 – Failed to start

The below error can occur when one tries to create a new HA cluster with pcs package. Corosync fails to start with the below description.

Corosync error

The error can be resolved by editing /etc/hosts file and by commenting the first two lines for localhost. At the end I appended a new line that maps localhost with a specific IPv4 IP but this could be unnecessary.

After that when one tries to create and enable the cluster the result would be successful.