I need to reset a forgotten RPI OS password. In order to do that I need to insert the SD card to the computer and edit the cmdline.txt file. It is not anywhere on the SD card root folder or any of the subfolders.

These are the files that I can find on the SD card

  • (DIR) defaults
  • (DIR) os
  • bootcode.bin
  • recovery.cmdline
  • recovery.elf
  • recovery.img
  • recovery.rfs
  • riscos-boot.bin
  • config.txt
  • (DIR) etc

cmdline.txt is residing in /boot which is a separate FAT partition on the SD card (that's the way with my Arch Linux but to my knowlegde the same for other distributions). If that SD card is read at a Windows PC this should be the only partition directly visible in the explorer.

EDIT: As we are now discussing NOOBS, same rules apply, with just more than one possible /boot partition on the card. Other than for RISC OS these partitions will still be VFAT but Windows cannot directly access them. Best way to go: mount with Linux.

Note that on NOOBS (from "NOOBS bootup (low-level)"):

When the Raspberry Pi is powered on with a NOOBS card inserted, it:

  1. Loads and runs bootcode.bin from the FAT-format /dev/mmcblk0p1, exactly as it does for standalone images. (This behaviour is built into the BCM2835's internal firmware on all Pis, and so can't be changed.)
  2. bootcode.bin then spots that start.elf is missing, so it loads and runs recovery.elf instead.
  3. Running recovery.elf then switches the firmware into "NOOBS mode" - it uses recovery.img instead of kernel.img, recovery.cmdline instead of cmdline.txt, and it sets the root filesystem to recovery.rfs.

In case that's not clear, this is why you don't have a start.elf, which the normal distros do. It means that you should use the recovery.cmdline file (in your question) instead of cmdline.txt

  • So you're saying that to access the FAT partition I need to read the SD card on a Linux machine? – PrashanD Feb 9 '15 at 17:35
  • No, no. This partition can be read/written both with linux and windows. The folder you describe in your question is most likely exactly this partition! – Ghanima Feb 9 '15 at 17:39
  • It seems that I'm accessing the NOOBS partition and not the boot partition. The label of the partition is RECOVERY and there is no cmdline.txt to be found anywhere – PrashanD Feb 9 '15 at 17:43
  • 1
    Ok, I see. I am not familiar with NOOBs. But github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained sounds pretty interesting. But the /boot partition(s) are still FAT and should be able to be accessed? – Ghanima Feb 9 '15 at 17:50
  • Ok, I think that windows will refuse to access multiple partitions on removable drives. – Ghanima Feb 9 '15 at 18:03

Some Raspberry Pi SD cards contain a bug where the wrong partition is mounted as /boot.

You probably find that:

  • cmdline.txt and/or config.txt are not present in /boot
  • changes to these files seem to not take effect

https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained#noobs-os-installation mentions two FAT partitions. The files you list belong to the RECOVERY partition (/dev/mmcblk0p1), not boot partition (e.g. /dev/mmcblk0p5).

As this is a bug that's been fixed, rather than change /etc/fstab manually, the simplest option is to update your Raspberry Pi:

$ sudo apt-get udate
$ sudo apt-get upgrade

On the bootup of raspberry pi press Shift button , it will take you to recovery mode, there you can see the option Edit Config.

In that you can select cmdline.txt

The original content should look like

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

At the end of it add the following text


Thats it!

You are ready to go, Hit the ok button !

In the next bootup of Pi You will be asked to enter the new Password

Hope this helps


While booting, press Shift+up and it will take you to the recovery console. the cmdline.txt file is editable from one of the tabs


The cmdline.txt file you are looking for is found in /boot.bak

the file contents is this:

dwc_otg.lmp_enable=0 console-ttyAMAO,115200 console=tty1 root=/dev/mmcblk0p2 ro rootfstype=ext4 elevator=deadline rootwait logo.nologo loglevel=1 quiet

The answer posted by Akash on Jul 22, 2016 was most useful for me. I did run into something that I wanted to add to what he said, because it seems something has changed with the latest Raspbian update.

After the pi starts booting and you hold shift to enter setup mode, it brings you to a recovery mode GUI. Here you can access the config.txt file that is mentioned.

I was not able to get anywhere with adding init=/bin/sh to the end of the file. When I did, the boot would hang.

I had read on some other sites that people were instead adding single to the end of the file. I tried that and it worked. This time, when it booted, it ended up at a command line (instead of booting into Pixel). From there I did:

sudo raspi-config

and was able to get back to the configuration screen to change my password again.

How I messed up the password is still a mystery, but I think it had to do with using the numeric keypad while typing the password at the command line and it may have had NumLock disabled...

Hope this helps somebody (it'll probably be my future self).

  • I am not certain that the, now default, systemd still allows you to start up a single bash shell instead of the normal system - it may be that the maintenance or single mode startup is only applicable to a system with a sysV init configured {my Desktop Debian PC for instance is configured for a dual-init but I never allow systemd to boot - hell I do not even know if it would properly and on that grub actually fills out the init= with /lib/sysvinit/init or /lib/systemd/systemd as required - so you can see how dropping in /bin/sh might work there}. – SlySven Dec 22 '17 at 4:58

This is what I did. Hold shift to open recovery mode on bootup. Hit the edit config, then click on cmdline.txt. Add word single to end. Hit exit. On bootup, will stop at root command line. enter sudo raspi-config. Select second option, change user passwd. Then, finish and halt system. Re-boot then hold shift again. Delete word 'single' from cmdline.txt and boot system. login with updated password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.