Please follow these steps and be sure to have the proper roles to set the root password.
- Go to IAM & Admin
- Select IAM
- Find your user name service account (basically your Google account) and click Edit-member
- Add another role → select ‘Compute Engine’ - ‘Compute Admin’
- Restart your Compute VM
- Open SSH and run the command ‘sudo passwd’
- Enter a brand new password.
Here is the original answer in Stack Overflow