The script does the following things (but please read the script yourself before executing it):
- stop the main tedge services
- stop mosquitto
- delete the mosquitto database
- delete internal tedge state
- delete thin-edge.io file based logs and file-transfer cache
Afterwards, it will prompt the user if they wish to reconnect. It also directs the user to delete the device (and all child managed objects) from the cloud before reconnecting.
Copy the tedge-reset.sh script to the device, and then run the following commands:
sudo chmod a+x ./tedge-reset.sh
sudo ./tedge-reset.shWhen deleting the device from the cloud, if you're using go-c8y-cli, then you MUST use the --cascade option to ensure that all of the child devices are also deleted, otherwise it can result in unlinked services and child devices.
Below shows an example of the correct usage to delete the device and all of its child devices and services.
c8y devices list --name "example01" | c8y devices delete --cascadeIn the event that you have deleted the device managed object and not the child devices and services, then you will have to manually delete them using the following command where all inventory managed object which are owned by the device's user are searched for then deleted (note: that the owner has the device_ prefix):
WARNING: Please verify the find results before deleting it to ensure the query is returning the expected amount of inventory managed objects!
c8y inventory find --owner "device_example01" --includeAll | c8y inventory delete