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!…

OskarZyg
  • 55
  • 1
  • 7

2 Answers2

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.

SEWTGIYWTKHNTDS
  • 458
  • 3
  • 8
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

Behrooz
  • 121
  • 4