3

I would like to reset the password of my raspberry pi 4 4gb running Ubuntu server 20.04, most tutorials involve adding init=/bin/sh to cmdline.txt, however when I do this I get a kernel panic.

Roughly along the lines of:

/bin/sh: splash: No such file or directory

Kernel Panic - not syncing: Attempted to kill init!…

2 Answers 2

14

I would put the sd card into another machine, mount the disk and edit the file /etc/shadow to remove the password; delete the characters between the first and second colons in the file. Save the file and eject the sd card. The user will no longer have a password and you can boot the pi log in and set one up.

1
  • has the right answer, but isn't /bin/sh supposed to go last? This sounds like you put it before splash.
    – Andrea
    Commented May 13, 2022 at 14:38
2

Mount it on another rpi(or any linux box with qemu-user-static installed).
mount --bind the /dev /sys and /proc directories.
chroot into it.

References:
https://wiki.debian.org/QemuUserEmulation
https://wiki.debian.org/chroot

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 14, 2022 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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