Step 1–grab the SD card
Step 1-Remove the SD card
Power down the Pi and remove the SD card. Insert it into your PC.
Turn the raspberry pie off, remove the SD card, and insert it into your computer step 2–edit cmdline.txt
Step 2-Edit cmdline.txt
The boot partition should be visible and contain a file named "Cmdline.txt". Edit this file in a text editor and add the following to the existing text:
The startup section is visible and contains a file named "Cmdline.txt." Edit the text in the editor and insert the following into the end of the existing text
Init=/bin/sh
If The original content was:
If the original text is like this:
Dwc_otg.lpm_enable=0 console=ttyama0,115200 kgdboc=ttyama0,115200 console=tty1 root=/dev/mmcblk0p2 ROOTFSTYPE=EXT4 Elevator=deadline rootwait
It should now look like:
Then the editor should be like this:
Dwc_otg.lpm_enable=0 console=ttyama0,115200 kgdboc=ttyama0,115200 console=tty1 root=/dev/mmcblk0p2 ROOTFSTYPE=EXT4 Elevator=deadline rootwait init=/bin/sh
Make sure it's all one line! Save the text file and eject the SD card from the PC.
Make sure all content is on the same line. Save text content, take out the SD card step 3–reset the Password from pi
Step 3-Reset Password
Insert the card into a Pi which is connected to a monitor and keyboard. Power up the Pi. There May is a delay but you should is presented with a flashing cursor.
Insert the SD card into the raspberry pie (we need to connect the monitor and keyboard here). Turn on the raspberry pie and expect to wait a while before displaying a flashing cursor.
At the prompt type the following command:
After the identifier, enter the following command:
passwd Pi
You'll then be prompted for a new password. Enter it carefully and press the [Return] key. It'll now ask you to retype the password.
You will be prompted to enter a new password, please carefully enter and hit the ENTER key. The system will prompt you to confirm the password again.
passwd Pi
Enter New UNIX Password:
Retype new UNIX Password:
Passwd:password updated successfully
The password has been changed.
So the password is done.
Now type the following commands:
Now enter the following command to synchronize and execute the initialization program
Sync
exec/sbin/init
The Pi would continue to boot with the normal command line prompt.
The raspberry pie will continue to boot.
Shutdown the Pi and power it off.
Turn off the raspberry pie and power off.
sudo halt
Step 4–edit Cmdline.txt
Step fourth-Edit cmdline.txt text
Using the PC edit the "cmdline.txt" file again and remove the "init=/bin/sh" text you added in step 2.
Edit this text again with your computer: Delete the last data we added in step two
You can now return the SD card to your Pi, reboot and use the new password.
Now you can insert the SD card into your raspberry pie, and start again to use the new password.