https://ubuntuforums.org/showthread.php?t=1772894
Hi,
I faced the same problem when I tried to recover my Ubuntu password following the tutorial on:
http://www.psychocats.net/ubuntu/resetpassword
Looking for a solution, I read and try all the stuff from other forums
where mainly they diagnose problems of inconsistency between /etc/shadow
and /etc/passwd files, but that was not the problem. The problem was
that the system was started as read only, so the passwd command cannot
modify the above mentioned files. The solution was very simple. I ran
the following command:
# mount -rw -o remount /
Then I just executed the passwd command with the corresponding username
and it worked as charm. Try this before anything else. I hope it saves
some time for somebody else.