I was attempting to remove pacnew files, and I think I must have overwritten the wrong one. now when I try to use sudo I get the message
sudo pacdiff -f
sudo: you do not exist in the passwd database
If I go to manjaro settings manager, there are no users or admin, and I am not permitted to add any.
I suspect there might be a way to insert this info, but I do not know how.
I am still able able to interact with manjaro despite not having any users. I do have Timeshift, if that is the easiest option.
If I recall correctly:
among the .pacnew files was one that changed/added one or more system users. /etc/passwd.pacnew
If you simply overwrote your /etc/passwd file with this /etc/passwd.pacnew
then your user account does not exist anymore
and as a consequence you cannot log in anymore.
You can restore the file from it’s backup copy /etc/passwd- (note the minus sign at the end)
But you need to be root to do this - which means you cannot do it without booting from USB.
But I also just noticed I somehow skipped the passwd part of this.
It is still unclear which actions caused this problem in the first place, but a broken /etc/passwd is also possible.
You may wish to check it;
cat /etc/passwd
And it should have an entry for your user like this;
A similar (but different, hashed) entry should also exist in your /etc/shadow file … if any or all of these are missing then we need to take some other actions.
I think the most recent /etc/passwd.pacnew was the one that changed root’s shell from /bin/bash to /usr/bin/bash. Being now only 33 bytes in size, I think the current passwd file is just that one line.
That sounds like exactly what happened. your command gave me no result.
Where do I find the backup copy-- do you mean from Timeshift or somewhere else?
[patience ~]# persephone:x:1000:1000:persephone:/home/persephone:/bin/bash
-bash: persephone:x:1000:1000:persephone:/home/persephone:/bin/bash: No such file or directory
This confirms it - you need to boot from USB - that is probably the easiest way.
Then you can mount your root partition and copy /etc/passwd- to /etc/passwd
and you are done.
I’m not allowed to post two times in a row without someone else in between - so it took me a while to edit my post.
the prompt # usually shows that you are root and should be able to do this from this terminal
I thought there was maybe a typo, but that didnt work either
[patience ~]# cp /etc/passd- /etc/passwd
cp: cannot stat ‘/etc/passd-’: No such file or directory
[patience ~]# cp /etc/passwd- /etc/passwd
[patience ~]# persephone:x:1000:1000:persephone:/home/persephone:/bin/bash
-bash: persephone:x:1000:1000:persephone:/home/persephone:/bin/bash: No such file or directory