Follow

Recovering a lost root password ARM

Versions 2.5 & 3.0

Applies to platform: ARM
Last updated: 6th September 2012

This article shows how to recover a root password on ARM devices.

Steps

  • Connect via serial console
  • Power up the system and press any key when required to stop the normal boot process: You'll be dropped in the Marvell U-Boot command line
  • Run the printenv command and copy the last "bootargs=... line you have
...
USB 0: host mode
PEX 0: PCI Express Root Complex Interface
PEX interface detected Link X1
Net:   egiga0, egiga1 [PRIME]
Hit any key to stop autoboot:  0
Marvell>> printenv bootargs
...
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:1M(u-boot)ro,4M(uImage),-(rootfs) rw ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs panic=10 efw_ether=lan1,80:c6:ca:xx:xx:xx;lan2,80:c6:ca:xx:xx:xx;lan3,80:c6:ca:xx:xx:xx;lan4,80:c6:ca:xx:xx:xx;eth1,80:c6:ca:xx:xx:xx
...
  • Edit the line you copied adding the setenv command at the beginning and single keyword at the end.
    Apostrophes are also required for bootargs='...' arguments, check over the example below:

setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:1M(u-boot)ro,4M(uImage),-(rootfs) rw ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs panic=10 efw_ether=lan1,80:c6:ca:xx:xx:xx;lan2,80:c6:ca:xx:xx:xx;lan3,80:c6:ca:xx:xx:xx;lan4,80:c6:ca:xx:xx:xx;eth1,80:c6:ca:xx:xx:xx single'

Warning

Don't copy and paste the above command from this article or from other devices. It is really important you use the MAC addresses assigned to your appliance.
  • Once the command is ready, copy and paste to the Marvell command line, execute it and run the boot command
Marvell>> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:1M(u-boot)ro,4M(uImage),-(rootfs) rw ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs panic=10 efw_ether=lan1,80:c6:ca:xx:xx:xx;lan2,80:c6:ca:xx:xx:xx;lan3,80:c6:ca:xx:xx:xx;lan4,80:c6:ca:xx:xx:xx;eth1,80:c6:ca:xx:xx:xx single'
Marvell>> boot

Note

If you get an error like Unknown command 'lan2,80:c6:ca:xx:xx:xx' - try 'help', you probably didn't add the apostrophes to the setenv command or you misspelled a command earlier, so you need to issue the reset command and start over without typos.
  • You will be dropped to an Endian command line with root privileges where you can run passwd command and reset the root password
root@(none):/ # passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
root@(none):/ # reboot
  •  Finally reboot and you'll have your appliance running exactly like before but with the new root password

 

Have more questions? Submit a request

Comments

  • Avatar
    Dvaki Don

    not that useful at all

    i tried this on my armel board and it didnt work

    here is a better solution in case anyone runs into this problem:

    printenv bootargs - shows variables

    example command - setenv bootargs ${bootargs} 3

    this example appends to variable bootargs and would set the run level to 3

    the solution is to run  

    setenv bootargs ${bootargs} single “init=/bin/bash”

    setenv bootargs ${bootargs} 1 or single 

    works as well but asks for a root mainetenance password so its use less