Root password change reverted after reboot

sudo passwd

changes the admin password (that is the user used to create the system with) not the password for root. Anything related to root does not require sudo and will mess things up (as Ubuntu expects you meant the admin user when using sudo).

change the root password.

You change to root using

sudo -i

(requires the admin password) and then change the password for root with:

password

Mind that Ubuntu is not meant to be used with root. If you want that it is better to change to a system that does use that out of the box. Using root on Ubuntu can have unwanted side effects. sudo is a slight improvement over using root when it comes to security: hackers need your admin account name and the password. Using root means the former is known to all.