Step 1: Login into your account and open terminal
Step 2: Type the following command to setup password for root account
sudo passwd root
Step 3: Open file /etc/pam.d/gdm-password
sudo nano /etc/pam.d/gdm-password
Step 4: Comment out the following line by placing # infront of it
#auth required pam_succeed_if.so user != root quiet_success
Step 5: Reboot the system
Enable Root Login in Ubuntu 18.04