Source: https://community.online.net/t/reset-root-password-via-console/1724/3
I solved this problem, found a hint here: https://github.com/scaleway/initrd/tree/master/Linux 184.
Here is what I did:
- Edit the “Tags” field in the server definition and add “INITRD_POST_SHELL=1” as one (or the only) tag.
- Reboot the server
- Wait until you get a shell
- Run:
chroot /newroot
- Change your password using passwd
passwd root
- CTRL-d to resume booting.
- Test your new password.
- Remove “INITRD_POST_SHELL=1” from your tags
I still managed to do it! What's the problem: I have an old version of ubuntu (16.04 lst xenial), just adding a tag was not enough. What I did before proceeding with the algorithm described above:
open the console and go to the instance settings advanced settings -> boot mode -> use bootscript -> select "x86_64 longterm 4.14 latest" -> save after that, proceed to the algorithm described at the very beginning of the discussion: add the tag INITRD_POST_SHELL=1, overview - > console, reboot instance, change the password in the terminal that opens after the system boots, and so on.