What is the most secure way to revert Mycodo to a previous version?

All in the title.
As my usage of conditional controllers may be border line and as my programs used to work and do not anymore, I need to check if they still work on the previous version.

A full backup is created during every upgrade that can be restored on the Backup Restore page. This is likely the safest way to revert to a previous version.

1 Like

Restauration in progress to what was working on 2022-06. That’s great every thing is restaured as a whole, mycodo version and user data.

But after a while, it seems it has not finished:


[2023-08-06 10:56:00] 
[2023-08-06 10:56:00] #### Restore of backup /var/Mycodo-backups/Mycodo-backup-2022-06-25_22-09-47-8.13.10 initiated 2023-08-06_10-56-00 ####
[2023-08-06 10:56:00] #### Stopping Daemon and HTTP server ####
[2023-08-06 10:56:22] /home/pi/Mycodo/mycodo/scripts/mycodo_backup_restore.sh: ligne 39: apachectl : commande introuvable
[2023-08-06 10:56:23] 
[2023-08-06 10:56:23] #### Running initialization
[2023-08-06 10:56:23] 
[2023-08-06 10:56:23] #### Creating mycodo user
[2023-08-06 10:56:23] useradd: user 'mycodo' already exists
[2023-08-06 10:56:23] L'utilisateur ��mycodo�� appartient d�j� au groupe ��adm��.
[2023-08-06 10:56:24] L'utilisateur ��mycodo�� appartient d�j� au groupe ��dialout��.
[2023-08-06 10:56:24] L'utilisateur ��mycodo�� appartient d�j� au groupe ��i2c��.
[2023-08-06 10:56:24] L'utilisateur ��mycodo�� appartient d�j� au groupe ��kmem��.
[2023-08-06 10:56:25] L'utilisateur ��mycodo�� appartient d�j� au groupe ��video��.
[2023-08-06 10:56:25] gpio:x:997:pi,mycodo,homeassistant
[2023-08-06 10:56:25] L'utilisateur ��mycodo�� appartient d�j� au groupe ��gpio��.
[2023-08-06 10:56:26] 
[2023-08-06 10:56:26] #### Compiling mycodo_wrapper
[2023-08-06 10:56:27] 
[2023-08-06 10:56:27] #### Creating symlinks to Mycodo executables
[2023-08-06 10:56:28] 
[2023-08-06 10:56:28] #### Creating files and directories
[2023-08-06 10:56:28] 
[2023-08-06 10:56:28] #### Setting permissions
[2023-08-06 10:56:35] 
[2023-08-06 10:56:35] #### Setting permissions
[2023-08-06 10:56:42] 
[2023-08-06 10:56:42] Backing up current Mycodo from /home/pi/Mycodo to /var/Mycodo-backups/Mycodo-backup-2023-08-06_10-56-00-8.15.8...Done.
[2023-08-06 10:56:42] 
[2023-08-06 10:56:42] Restoring Mycodo from /var/Mycodo-backups/Mycodo-backup-2022-06-25_22-09-47-8.13.10 to /home/pi/Mycodo...Done.
[2023-08-06 10:56:42] Moving env directory...Done.
[2023-08-06 10:56:52] 
[2023-08-06 10:56:52] #### Running initialization
[2023-08-06 10:56:52] 
[2023-08-06 10:56:52] #### Creating mycodo user
[2023-08-06 10:56:52] useradd: user 'mycodo' already exists
[2023-08-06 10:56:53] L'utilisateur ��mycodo�� appartient d�j� au groupe ��adm��.
[2023-08-06 10:56:53] L'utilisateur ��mycodo�� appartient d�j� au groupe ��dialout��.
[2023-08-06 10:56:53] L'utilisateur ��mycodo�� appartient d�j� au groupe ��i2c��.
[2023-08-06 10:56:54] L'utilisateur ��mycodo�� appartient d�j� au groupe ��kmem��.
[2023-08-06 10:56:54] L'utilisateur ��mycodo�� appartient d�j� au groupe ��video��.
[2023-08-06 10:56:54] gpio:x:997:pi,mycodo,homeassistant
[2023-08-06 10:56:54] L'utilisateur ��mycodo�� appartient d�j� au groupe ��gpio��.
[2023-08-06 10:56:55] L'utilisateur ��pi�� appartient d�j� au groupe ��mycodo��.
[2023-08-06 10:56:55] L'utilisateur ��mycodo�� appartient d�j� au groupe ��pi��.
[2023-08-06 10:56:55] 
[2023-08-06 10:56:55] #### Compiling mycodo_wrapper
[2023-08-06 10:56:56] 
[2023-08-06 10:56:56] #### Creating symlinks to Mycodo executables
[2023-08-06 10:56:56] 
[2023-08-06 10:56:56] #### Creating files and directories
[2023-08-06 10:56:57] 
[2023-08-06 10:56:57] #### Setting permissions
[2023-08-06 10:57:02] 
[2023-08-06 10:57:02] #### Setting permissions
[2023-08-06 10:57:05] 
[2023-08-06 10:57:05]

Here are the running processes:

root@raspberrypi:/var/log/mycodo# ps aux | grep mycodo
root       592  0.0  0.4  24148 16164 ?        Ss   08:17   0:05 /var/mycodo-root/env/bin/python -m gunicorn --workers 1 --worker-class gthread --threads 2 --timeout 300 --pid /var/run/mycodoflask.pid --bind unix:/usr/local/mycodoflask.sock start_flask_ui:app
root      9626 30.9  1.5 184772 61756 ?        Ssl  11:04   3:32 /var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_daemon.py
root      9668  1.4  1.3  76576 54640 ?        S    11:04   0:09 /var/mycodo-root/env/bin/python -m gunicorn --workers 1 --worker-class gthread --threads 2 --timeout 300 --pid /var/run/mycodoflask.pid --bind unix:/usr/local/mycodoflask.sock start_flask_ui:app

I cannot connect to mycodo via the browser anymore.

After reboot, the system is not accessible. Here are the running processes:

root@raspberrypi:~# ps aux | grep mycodo
root       598  0.8  0.4  25312 17152 ?        Ss   11:25   0:01 /var/mycodo-root/env/bin/python -m gunicorn --workers 1 --worker-class gthread --threads 2 --timeout 300 --pid /var/run/mycodoflask.pid --bind unix:/usr/local/mycodoflask.sock start_flask_ui:app
root       726  5.6  1.4  77776 55540 ?        S    11:25   0:11 /var/mycodo-root/env/bin/python -m gunicorn --workers 1 --worker-class gthread --threads 2 --timeout 300 --pid /var/run/mycodoflask.pid --bind unix:/usr/local/mycodoflask.sock start_flask_ui:app
root      1713 39.6  1.5 176784 61192 ?        Ssl  11:26   0:57 /var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_daemon.py

Execute this to fix any issues:

sudo ~/Mycodo/mycodo/scripts/upgrade_post.sh

As I am in panic because I will not be in for vacation in a few days, I have reinstalled from scratch, but I have a backup of this morning. I am going to restore it and see. If it does not work, I will try your solution. Anyway, it has to work tonight or my plants will die, I have no backup solution to water.

After a restore, the daemon is out of order (red color on top left corner for “Raspberry pi - 8.15.8”). I don’t know if I have to wait or do something else. I have asked for the landing page and I get orange “impossible to check the daemon” or something like this. Version is still 8.15.8, expected is 8.13.10… I was too empressed, this is 8.13.10 now.

Running this command after restoring any version will make all necessary dependency checks.

Hi Kyle, I could water this morning :grinning:.

1 Like