I have a problem with dietpi, it ran ok last weeks, and even some days ago; I don’t know what happened from yesterday, but today I can’t login anymore. The “dietpi” user completely dissapeared (it doesn’t exist in /etc/shadow and /etc/passw files) and I’m stuck in with login console requests but my old password or default passwords are not working.
Tried some things from this forum and other links, like modifying the shadow file, modifying the dietpi.txt options, but none worked.
I’m desperate since I had an official app and a DB on this dietpi, and I thought this OS would be very stable, as this situation didn’t happened to me with any other OS.
Before this, on the last day, I was configuring the wifi inner chip from RPI, repedeately using the dietpi-config to do this (it didn’t wanted in the first time, I had to do it with an external widi dongle, and after that, it saw the inner dongle chip as well). So all that I did was some dietpi-config → network settings and some multiple restarts. Then, maybe (I’m not sure) a accidental power interrupt and this was all. Today, like I explained, it boots up ok, but I can’t log in. And, btw, it says “mariabdb NOT started” (which I would want to debug but I can’t, I can’t enter the system, but this error is strange).
Please help me !
First of all, there is no function in DietPi who could delete user dietpi, because this is a user required for some functionality and therefor part of DietPi core. Loosing the root password is as well not an issue of DietPi. And I need to disagree with your statement about instability of DietPi related to loosing passwords.
I guess you are running a Raspberry Pi? If yes, you could have a look to following post. https://dietpi.com/forum/t/reset-password-for-login/6581/5
Wondering how the case of yours can happen: Did you move your DietPi userdata and/or the root filesystem to an external drive? Probably the external drive has connection our powering issues and it is booting somehow an old root filesystem from the SD card then. Although the UUID/PARTUUID wouldn’t match so not such a fitting expansion.
Or, the more troublesome expansion: Your server has been hacked. And the dietpi user has been intentionally removed by the attacker to lock you out.
Probably I was attacked, I don’t know. The fact is what I described.
But now, what is the solution ?, as I read lots and lots of dietpi forum (this forum) pages and nothing seems to work for me.
Can I recover this data with a fresh install of dietpi ? Meaning to overwrite a fresh install with the data I have on the corrupted system.
did you followed the link I shared above?
basically this should allow to reset the root password.
Yes, it worked, with some minor fstab fixes, and suceeded to login with root on a normal boot (removed init=/bin/sh), so thanks for that.
But when trying to do a “sudo su dietpi” it says: “user dietpi does not exist or the user entry does not contain all the required fields”.
Tried sudo useradd dietpi, it says the group dietpi already exists.
Tried sudo useradd dietpi dietpi, it says “the user dietpi does not exist”.
Something is corrupted probably because of the sdcard I’m assuming, but I do not know how to fix this user.
Should a remove and re-add user work ?
could you share following
Yes, I suceeded recreating dietpi user and group, then I had to recreate mysql user and group.
Then I see I’m having problems with apt, it says _apt user is not an existent user, so very strange.
So, the files you requested are:
systemd-network:x:103:103:systemd Network Management:/:/usr/sbin/nologin
systemd-timesync:x:101:101:systemd Time Synchronization:/:/usr/sbin/nologin
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
and for the
yes the users are not as they should be. On my system it is like this
and the related groups
On a default DietPi system, dietpi user id and groups should be 1000. In your case, the user dietpi has the assigned ID’s 100:65534. This would match my user _apt
User and group id for mysql depends on your system and could be different. But at least I should not be 1000 as user id.
Yes, mysql should be a system user (ID lower than 1000), now it is a login user, for “dietpi” the other way round (which is why login failed). Looks like somehow these three users for rotated (e.g. as of a file corruption and incorrect repair). You could try to rotate the UIDs and primary GIDs back as they should be via usermod.
The dietpi and mysql user were added by me today. They were completely missing in those two files until today. I will try to correct those numbers manually to see if the things are getting corrected.
Thanks for the comparison. Are these three (dietpi, _apt, mysql) the only differences you see in your /etc/passwd file ? Do you have some more users missing from my file ?
I changed both files with the info provided by Joulinar and after a restart, mariadb seems to be started succesfully, which was my whole purpose. It seems everything (and hope) is ok again right now.
Thanks for all the help.
I will try to configure some system backup method from now on. I was thinking into using raspiBackup but I see diepi has something similar ?!
you could use dietpi-backup. Best to create your backup on an external medium like a USB pen drive or similiar.