Password recovery ?


I have totally forgotten the root password I used on my rpi few months ago. T_T
Is there a way to recover a forgotten pasword or to reset the default root password ? Like in raspian with the cmdline.txt on the SD card.

dietpi is a wonderful OS by the way. Thanks a lot !




Have you tried it? And change root pwd with:

passwd root


Thank you for your reply.

Yes I tried to modify the SD card. But I can’t read the SD card on my computer. Something like “corrupted device…” and I can’t see the files on the card.
I will try again in a few hours and give you more details.

no other solution then ?



:~# lsblk -f -i
NAME        FSTYPE  LABEL    UUID                                 MOUNTPOINT
|-mmcblk0p1 vfat    BOOT     FA16-1610                            /boot
`-mmcblk0p2 ext4             dcded1b7-5f4f-44dc-b738-28376a6a3b11 /

SD Card has 2 partitions:

  • 1st is FAT 32 , Name; “BOOT” - Windows can read and write by default
  • 2nd is Ext4 , Windows can read by default, so it will not show up in “Explorer”

If both file system on your SD Card are corrupt, and another Linux System (e.g. Linux VM or Live CD/USB Boot System) can’t repair it, you can start from the scratch …

Sorry, but I have faster format and burn DietPi image to sd card, let run down a DietPi-Automation Installation, then repairing a file system with a Linux live System or recovering lost passwords …

If you fear of new installation and loosing date, why don’t you use DietPi-Backup and store your User Data like described?


Yes I was runing windows while trying to read the SD card. I will try on linux then.
My project is a minecraft server runing for a few months now so yes I fear a new installation ^^.

I will try again this weekend and let you know.

Thanks for the help




So I tried multiple times the “cmdline.txt” trick but couldn’t succeed.

First it prevented the raspberry to boot. Then I opened the cmdline.txt file again to remove the init=/bin/sh and it booted again (but couldn’t logged on SSH).

Now I don’t know why but this cmdline.txt file is empty. I tried again to add init=/bin/sh but still not booting.
It’s impossible to reset the root password.

Hi all,

Managed to reset the password using the ext2fsd driver (on windows) and method 2 from here