Java Runtime Environment: which java platform is used and what version
openHAB version: 3.1
I would like to make a backup with sudo openhab-cli backup. However when executing the command I always get the message:
Error executing command: login failed
I am sure the password is right. However I even changed the password in users.properties back to a plaintext password and it still does not work. As mentioned above, I run openhab in a Docker Container.
sudo is an OS command which looks into the /etc/sudoers file ( for commands that are defined to executed for sudo execution of specific users ) and it uses /etc/passwd resp. /etc/shadow for passwords that are defined on OS level.
uses.properties contains definitions on application level which is not appropriate for the sudo command.
Why? You are using Docker. Just zip up the volumes that you’ve mounted to the container and you’re backed up.
If running in a container, one should learn the container way of doing things. For example,
sudo doesn’t even exist in the official openHAB Docker container. It’s not needed. The usual way to run a command in a container is something like docker exec -it openhab whoami. Run that and you’ll see you are already running as root.
openhab-cli doesn’t even exist in the official openHAB Docker container. The container uses a manual installation for openHAB so no scripts or utilities are registered and made available in the path. However, docker exec -it openhab runtime/bin/backup does exist and will execute the same backup script as openhab-cli. restore exists too.
Notice, all of those commands are executed using docker exec -it. When running with a container, nothing on the host exists inside the container (unless you put it there) and nothing inside the container exists outside it (unless you expose it). (Yes this is an over simplification.) That’s the whole point of containers
Thank you for your answer. I was indeed reading one of your older posts in the forum where I then figured that openhab-cli is not working as you were mentioning it there. However I did not got to the point that I was successful with the backup. In the end I want to achieve a backup of my openhab configuration as I am trying to migrate my openhab instance to openhabian on a rasperry PI and I do not want to create everything manual again. So I was trying to use the backup function of openhab. I will try with your proposed suggestion. Thanks a lot.