Re: Resetting the root password on a PiRLP node (or any Pi-based Debian node)


John
 

I'll second the versatility of Notepad++ Dave.
I've used it to paste the content of an email header, save it as *.txt, and the syntax will be true when re-opened with MS notepad.
It's also handy for removing all the >> etc from the email body, and for finding/correcting bad spelling like color {^_-}

Xmas Greets from Down Under

John @ 6163

On 21/12/2019 6:22 am, David Cameron - IRLP wrote:
I finally got it to work. The problem is that if you use "Notepad" under Windows it will add a carriage return without you knowing, and put the required changes on a separate line, which is subsequently ignored by the Pi. That was the case with my setup when I tried. You can try Wordpad instead, or better yet use Notepad++.
Do yourself a favor and download Notepad++. It is a better editor. To edit the config.txt file you will need to use it anyhow.
https://notepad-plus-plus.org/downloads/
At the end of the line in cmdline.txt, add
rw  init=/bin/bash
(note this is different than before, using bash instead of sh)
This will make your cmdline.txt file read as follows, or similar (BUT ALL IN ONE LINE - very important)
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=c4372d80-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rw init=/bin/bash
Under File, choose Save.
There was one other change I had to do as the monitor would not accept the resolution that defaulted. In the config.txt file, there is a line that says:
#hdmi_safe=1
Just remove the "#" from that line so it looks like
hdmi_safe=1
When complete, under File, choose Save.
Then properly "Eject" the SD card from the system, or sometimes the changes are not saved. Put the SD Card back in the Pi.
Also, you have to make sure the HDMI cable is plugged into the port closest to the power input.
Now when you power it up, after seeing a bunch of log info on the screen, press enter and you will get a prompt that looks like:
root@(none):/#
At that prompt, use the command
passwd  root
You may see a prompt come up saying "random: crng init done" in the middle of changing the password, as the random number generator uses keystrokes to set the randomness. Just ignore and keep typing. You have to enter the password the same twice. Also, PLEASE check the number lock and CAPS LOCK on the keyboard, as I imagine these are responsible for a number of password problems.
When it says you are successful in changing the password, type the command:
sync
Then press CTRL-ALT-DEL to reset the pi. Once it shuts off (before it fully reboots), remove the power plug, and pull out the SD card again and put it back in the computer you used to edit the files, and return the two files to their original (cmdline.txt and config.txt)
Now, when you boot the pi, you can log in as root with the new password you set.
David Cameron
VE7LTD

Join IRLP@irlp.groups.io to automatically receive all group messages.