User seems to be deleted

hello everyone,
all of a sudden, I could not login with my user anymore. i still can login with root but my normal user seems to be gone completely… Any idea how that could have happend? Stupid things are possible - I am still rather a beginner… but I just cannot imagine what happend here…

thanks for help,
Thorsten

ls /home
and
ls /home/*

Do you see your user account listed - and files within it?

yes! that is great, already… THANK YOU!!! but why can I no longer log in?

Are you sure you’re getting the password right? Perhaps caps-lock is on?

That I don’t know.

You could try to set a (new) password on that account - and then try again to log in to it.

So: you are root (at the moment)?
passwd the_name_of_your_user

set one - the same or a different one - it doesn’t matter

I doubt it. Think twice again what you did last before it happened.

I know I did something and I am far from blaming my system… but I really cannot think of something :frowning:

@beermad : yes 100% sure.
@Nachlese : I reset the password but still cannot log in…

Actually, I can now not even login as root anymore???

To know more info about your user, run getent passwd and be sure your user is on the list. If not, your user has been deleted. To make things easier you can also run getent passwd | grep your_user changing your_user for your user name.

Then run sudo passwd -S your_user and tell us if there is a P, L or NP after the user name in the output (with password, locked or no password).

If you have a Manjaro usb drive, boot from it and then use manjaro-chroot -a to repair your system.

sudo passwd -S my_user says user is not available :frowning:

EDIT:
login as root works again - I seem to have updated my root passwd before when i wanted to change the user passwd :frowning:

EDIT:
I now added a line for my user following the syntax from /etc/passwd File: What It Is & How to Use It | Knowledge Base by phoenixNAP

now the command brings:

gatt P 2023-05-26 0 99999 7 -1

does that help? was that a good approach?

Mod Edit: Merged consecutive posts

Can you log in now with user gatt? Run su - gatt to test it.

If not, can you run these two commands and post the output (no sensitive info shown)?

sudo cat /etc/passwd | grep gatt
sudo cat /etc/shadow | grep gatt

If the user was deleted, may be easier re-create with sudo useradd -M gatt, then sudo usermod -d /home/gatt to set the previous home folder.

1 Like

You missed the path from the files, so unless the pwd is /etc it won’t work.

cat /etc/passwd | grep gatt

@haitifox

passwd defaults to the current user, so if you want to change another user’s password then you need to specify a valid user.

2 Likes

Fixed, thanks!

1 Like

Also useless use of cat. :wink:

grep gatt /etc/passwd
2 Likes

I encountered this error once with the system of a friend after an big update - login was only possible as root and all users were gone but the /home directories were still there.

I had to useradd the users again and I could chown the existing /home directories to the newly added users, so no harm done.
But I could not think of any way how this could have happened.

But some time later I caught the error before it happened on another system: While doing the update, pacnew-checker had found a new config file which was empty! This would have erased all users on the system. I cannot recall exactly which file it was, unfortunately.

I saw this on the second system because I helped with the update and /usr/bin/meld all pacnew-checker issues. That’s when I saw that there was this empty .pacnew file.
On the first system, I was called after the error had already occured, so I can only guess that it was the same issue there.

Something must have gone wrong during the update, maybe one mirror had an empty file or the file got corrupted during download… Don’t know.

Since I did not find any similar post on the forum, I shrugged it off as a freak incident.

Were pacnews not already mentioned?

If not … then heres a quick check;

sudo pacman -Syu pacman-contrib
pacdiff -o

The first line makes sure to have the correct packages, the second will print any existing pacnew or pacsave files.

For how to manage them etc see

The best way being;

DIFFPROG=meld pacdiff -s

( use v to view and merge as needed )


This is a concerning anecdote.
But if it were widespread I might expect more reports of such an issue.
Which may mean it was not a problem of the upgrade itself or packages in general.
In the large scheme of things I guess we would prefer if it was a sporadic download problem. :sweat_smile:

Probably /etc/passwd.pacnew:wink: — I merged this one without looking properly and had to fix things via chroot. in other words, create new passwords for root and user(s).

2 Likes

Jup, I guess that was the file.

Anyway, it was good reminder to always check carefully whenever pacnew-checker pops up.
:smile:
… and also to drive that lesson home to “my” users.

1 Like

Have you already thought about the possibility of backup and (automatic) snapshots?

Here in the forum there are a whole series of posts with tips and instructions. :footprints:

1 Like

It is great and all that @wuschel109 seems to have solved their problem -
but the feedback of the OP @haitifox is somewhat lacking specificity.
Not sure whether their problem is solved or whether there is progress.

1 Like