When I boot the linux,
dpkg-reconfigure openssh-server fails and the booting gets stopped there. But when i press ctrl+c it resumes the booting with dpkg-reconfigure failed.
dpkg-reconfigure openssh-server should not routinely run at every boot. It probably runs because some update procedure was interrupted. Verify that your system disk is not 100% full.
You should then run
sudo dpkg-reconfigure openssh-server or equivalent manually, and allow it to run to completion. If it produces any error messages, troubleshoot those errors.
When the command completes successfully, it should automatically make a record in the package management database that the
openssh-server package is now fully configured, and so it should no longer attempt to reconfigure it at every boot.