0

http://mapledyne.com/ideas/2015/8/4/reset-lost-admin-password-for-raspberry-pi

I follow this guide and the many that there are available to reset my password for my raspberry pi. However when it boots up in the terminal it shows this message which might be relevant or not

/bin/sh 0 can't access tty

But I can't use the keyboard. Booting up normally into my Raspberry PI, keyboard works fine. It is a bluetooth keyboard from logitech if it makes a difference, connected via USB adapter.

Anrpiu9
  • 9
  • 1
  • 1
  • 2
  • 1
    "Open the file 'cmdline.txt' and add 'init=/bin/sh' to the end. This will cause the machine to boot to single user mode." -> RUBBISH. Sort of. But don't do this. You need to edit some files on the root filesystem to reset the password: https://raspberrypi.stackexchange.com/q/24770/5538 – goldilocks Jun 19 '18 at 15:58
  • I tried this approach as well, but the problem is that this is what the folder structure looks like

    https://ibb.co/n90nKd

    Do I need to mount the sd card or run something in linux?

    – Anrpiu9 Jun 19 '18 at 16:07
  • Not necessarily -- you just need a system that can read and write to ext4 filesystems. MS Windows by default cannot, but I think there is software you can add for that. – goldilocks Jun 19 '18 at 16:12
  • ok, but how do I locate the shadow file? The link I posted is literally whatever is in my sdcard – Anrpiu9 Jun 19 '18 at 17:28
  • No, the stuff in the link is what you could literally see on the SD card using a system that cannot read ext4 filesystems. That's a very small (<100 MB) vfat partition that contains firmware, OS kernels, and some configuration stuff. The bulk of the OS is on a much bigger (2+ GB) ext4 partition, but if the tool you are using can't read it, it will either say there is some big partition it cannot read, or it will just pretend it doesn't exist. Anyway, I'd try Ingo's answer first. – goldilocks Jun 19 '18 at 22:56

2 Answers2

5

You tried to boot with init=/bin/sh appended to /boot/cmdline.txt but it seems it does not initialize the keyboard. Instead you can append this to cmdline.txt:

systemd.unit=emergency.target

Special systemd units explains:

In many ways booting into emergency.target is similar to the effect of booting with "init=/bin/sh" on the kernel command line, except that emergency mode provides you with the full system and service manager, and allows starting individual units in order to continue the boot process in steps.

There is a big chance to have the usb keyboard initialized with this. If it does not work you can also try booting with:

systemd.unit=rescue.target

It will boot into single user mode.

Ingo
  • 42,107
  • 20
  • 85
  • 197
0

This message

/bin/sh 0 can't access tty

itself isn't a problem. Just try another USB keyboard. Not all keyboards work with rpi. The Apple keyboard, USB id 1c4f:0002, doesn't.

With the lucky keyboard, just press enter and see the prompt.