You have to change to file 

nano /etc/shadow

after that you will get something like this


It will look like this

delete all between first and second colons. Then save it.

There after edit another file

nano /etc/pam.d/gdm3

In this file comment 5th line.

auth    requisite
auth    required readenv=1
auth    required readenv=1 envfile=/etc/default/locale
#auth    required user != root quiet_success
@include common-auth
auth    optional
@include common-account
session required
@include common-session
session optional auto_start
@include common-password

Save and reboot your machine. now you can able to login as root without password.

Set your password with following command
root@localhost:~#passwd root