While installing Ubuntu OS, you have to create normal user account which do not have admin rights.  As root user password can not be set while installation.

So when you try to change to super user root , you just can’t Login to root because you don’t have the root Password.

To reset the root password , login to the server using the normal user created by you and use the following command

sudo sh

passwd root

OR

su /bin/bash
passwd root

Now you will be able to reste the root password on the system