Page 1 of 1

Factory Reset Preserving Root

Posted: Thu Apr 23, 2015 11:51 am
by CloneNum3
Is your wink in an unknown situation but you do have root? Here's a last resort to clean up as much as possible without losing root.

* Your update partition is still OK to the best of your knowledge (currently at 00.08)
* You still have root

Untested... Proceed at your own risk... please report success/failure

[OPTIONAL] Wipe out any/all of your configurations including hubs, lights, etc.

Code: Select all

aprontest --zwave_controller_reset
killall -9 monit hub aprond ZigBeeHACoord lutron-core
rm /database/apron.db
rm /database/lutron-db.sqlite

[Preserving Root]

Code: Select all

touch /database/ENABLE_SSH
cp /root/.ssh/authorized_keys /database/authorized_keys
sed -i 's/reboot/#reboot/g' /root/platform/*.sh
cp /var/www/set_dev_value.php /database/set_dev_value.php # Save for later

[Prepare the update partition if it hasn't already been done... if in doubt, do it again]

Code: Select all

ubiattach -p /dev/mtd2
mkdir /tmp/updater
mount -t ubifs ubi2:rootfs /tmp/updater
sed -i 's/reboot/#reboot/g' /tmp/updater/root/platform/*.sh
cp -r /root/.ssh /tmp/updater/root/
chmod 655 /tmp/updater/root/.ssh
chmod 644 /tmp/updater/root/.ssh/authorized_keys
rm -f /tmp/updater/etc/init.d/S99local
touch /tmp/updater/database_default/ENABLE_SSH
cp /database/authorized_keys /tmp/updater/database_default/
cp /database/set_dev_value.php /tmp/updater/var/www/set_dev_value.php # re-enables the http hack we first used to root

[Delete the version files so your wink gets the update no matter what version you are/were at]

Code: Select all

rm -f /database/cf_*

[Instruct the hub to boot to the update partition next time it boots and reboot]

Code: Select all

echo 1 > /database/DO_UPDATE

Proceed with #### 6. Reboot #### at

End result, if you chose to do the optional step too, your hub should be fully updated and nearly factory except for you'll still have root.