Ubuntu – I have no account in ubuntu


I just bought a new laptop with ubuntu installed on it. When i first turned on the laptop ubuntu started with an error and restarted. Then when it turned on again i only had the guest session option. I've tried, but i can't use sudo in the terminal:
Sudo: unable to change to root gid: operation not permitted
Sudo: unable to initialize policy plugin
I tried the recovery path too, but i don't have a username and can't do anything. I can only go in guest session.
Please help, sorry if this is something obvious to do, it's my first time opening ubuntu.

Best Answer

reset root password :

While boot press shift and choose recovery mode :

drop to root shell then use following commands :

mount -o rw,remount /
passwd root

to add new user use :

adduser username

and choose a password for the user