How To Reset the Operating System on a Tonido Plug 2 To Factory Defaults

This guide will show you how to restore the operating system (rootfs) on the Tonido Plug 2’s internal flash (NAND) to its original factory settings. To do so, you will delete the existing operating system and replace it with a fresh install. The process is very similar to setting up a USB drive to boot the plug.

This not the same as flashing the plug with a new image and it will not change any U-boot settings.

Why is this useful?

  • If you’ve installed or updated software on the plug’s internal NAND and it is causing problems.
  • If you’ve deleted, corrupted or otherwise messed up parts of the operating system.
  • If your plug is full and nothing seems to fix it.
  • You just want that new plug smell again.

This procedure will delete everything on the internal flash including any user files and configurations. It will not affect files stored on USB or SATA drives.

This procedure must performed from a USB boot.
If you do not have a USB stick with the Tonido OS on it, STOP now and make one.

Basic Reset

1. Check to ensure the plug is booting from a USB stick. You MUST boot from a USB stick to perform this restoration.

Use the following command:

df -h /

The output should be similar to this:

Filesystem            Size  Used Avail Use% Mounted on
rootfs                3.8G  669M  2.9G  19% /

You can see that this plug is booted from a 4GB USB stick. If you see 512MB under “Size” then you are still booting off the internal flash.

2. SSH into the Tonido Plug.

3. Attach to the internal flash (NAND) drive.

 ubiattach /dev/ubi_ctrl -m 3

4. Mount the internal flash drive

 mount -t ubifs ubi0:rootfs /mnt/

5. Navigate to the mounted internal flash drive.

 cd /mnt

About the next step:
Once the rootfs is removed, the Tonido Plug will no longer boot from its internal drive until the remaining steps have been completed.

6. Remove the operating system (rootfs) and all files on the internal flash.

 rm -rf *

7. Get a fresh copy of the Tonido operating system image.


8. Make sure the checksum is correct.

 md5sum rootfs.tar.gz
 2f02407d8161acc42ccac0e6815f04c5 rootfs.tar.gz

9. Untar the image.

 tar zxvf rootfs.tar.gz

10. Delete the compressed rootfs image to save space.

  rm rootfs.tar.gz

11. Unmount the internal flash.

  cd /
  umount /mnt

12. Shutdown.

  shutdown now

13. Power down the Tonido Plug, remove the USB drive, power up again.

14. Wait 5 minutes for the plug to finish booting. When the red LED turns completely blue, connect to the Tonido Plug from a browser.


15. You can re-associate the plug your account by clicking on the “recover” link and following the prompts.


Fixing a Corrupt NAND Partition

Mess this up and there’s a very good chance you will have a brick on your hands. There are no safety nets here and no clean or easy way to recover a from a NAND screw up if you issue a bad command - such as targeting the wrong device or volume.

Please, only start this process AFTER you have tried to rebuild the rootfs on the NAND using Basic Reset instructions above - AND failed during either the remove step (read only error) or the wget step (write error)

That being said, the process of formatting and rebuilding a moderately corrupt NAND rootfs device is fairly simple.

1. Boot from a USB or SATA drive and SSH into the Tonido Plug.

2. Run:

 apt-get update && apt-get upgrade.

3. Get some info about the NAND. Note if these info commands do not work or do not produce the outputs shown below, STOP - you have other NAND issues that cannot be addressed here.

 Expected output:
 Count of MTD devices: 4
 Present MTD devices: mtd0, mtd1, mtd2, mtd3
 Sysfs interface supported: yes
 cat /proc/mtd
 Expected output:
 dev: size erasesize name
 mtd0: 00180000 00020000 "u-boot"
 mtd1: 00020000 00020000 "u-boot-env"
 mtd2: 00600000 00020000 "uImage"
 mtd3: 1f800000 00020000 "rootfs"

You should see four NAND mtd devices and We will ONLY work on mtd3 - the rootfs device.

4. Make sure mtd3 is detached:

 ubidetach /dev/ubi_ctrl -m 3

Be careful here. Make sure you only target mtd3.

5. Format device mtd3 and rebuild the volume on it.

 ubiformat /dev/mtd3 -s 512
 ubiattach /dev/ubi_ctrl -m 3
 ubimkvol /dev/ubi0 -N rootfs -m

6. Mount the newly formatted NAND volume.

 mount -t ubifs ubi0:rootfs /mnt
 cd /mnt

7. Proceed to step 7 of the Basic Reset.