Coder Social home page Coder Social logo

ikifar2012 / remote-backup-addon Goto Github PK

View Code? Open in Web Editor NEW
30.0 4.0 4.0 300 KB

Automatically create and backup HA snapshots using SCP

Dockerfile 7.04% Shell 92.96%
hacktoberfest home-assistant homeassistant hassio backup backup-script rclone rsync rsync-backup scp

remote-backup-addon's Introduction

remote-backup-addon's People

Contributors

dependabot[bot] avatar ikifar2012 avatar patman15 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

remote-backup-addon's Issues

The use of 'snapshots' is deprecated, please use 'backups' instead!

When upgrading HA CLI I received the following warning and crash:

image

The use of 'snapshots' is deprecated, please use 'backups' instead!

Breaking change

More info here:

https://developers.home-assistant.io/blog/2021/08/24/supervisor_update

After further investigation I will need to make the switch from snapshots to backups.

This is a breaking change and will require users to upgrade to Home Assistant Core 2021.9.0 or later in order to continue using the addon

Non-issue-issue

Since we are in a developer cycle here, I'll bring this up.
Not a problem really, just think there is room for improvement.
In this log, you will see that the add-on worked fine, did all it's work. The local backup happen in the HA server, but the remote device is off. It continues making the rsync and everything only to throw it out as there is nowhere to go.

Perhaps it could check if the target is alive before it does more than the local snapshot and throw a flag that the remote server is down somehow?

I don't know that this is at all feasible or even needed, just something that may enhance functionality.

s6-rc: info: service legacy-services successfully started
[info] Adding SSH key
[info] SSH key added
[warn] Creating local backup: "ChaloupkaAbode_backup 2022-08-25 06-18"
[warn] 
 Excluded folders: 
 media
---------------
[warn] 
 Excluded addons: 
 a0d7b954_plex
----------------
[info] Creating partial backup
[warn] Including --folders addons/local --folders homeassistant --folders share --folders ssl  and --addons core_samba --addons a0d7b954_ssh --addons f13797af_tasmobackup --addons core_duckdns --addons core_mosquitto --addons 3490a758_remote_backup --addons cebe7a76_hassio_google_drive_backup --addons a0d7b954_vscode --addons 45df7312_zigbee2mqtt --addons a0d7b954_zwavejs2mqtt --addons 3490a758_tdm --addons a0d7b954_zerotier 
[info] Backup created: 788715de
[info] Copying password-protected 788715de.zip to /media/off/RecoveryBuffalo/Backups/HASupervised on 192.168.108.21 using SCP
  adding: 788715de.tar (deflated 1%)
ssh: connect to host 192.168.108.21 port 22: Operation timed out

scp: Connection closed

[info] Backup copied to /media/off/RecoveryBuffalo/Backups/HASupervised/788715de.zip on 192.168.108.21
[info] Renaming 788715de.zip to ChaloupkaAbode_backup 2022-08-25 06-18.zip
ssh: connect to host 192.168.108.21 port 22: Operation timed out

s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

[FR] Add boolean available for HA automations

A 'Nice to Have' would be some exported boolean that HA can used to tell me if the last back-up was successful.
I recently had a 12 day stretch where the back-up had a problem and I did not know it.

As another thought, possibly a sensor that lists the time/date the last successful backup occurred could also be useful.

Sometimes the old Linux machine I have my drive spinning on locks up, and I will get the snapshot but it will not send it off the main instance, and I would like to capture / remedy that when it happens.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

devcontainer
.devcontainer/devcontainer.json
dockerfile
remote-backup/Dockerfile
github-actions
.github/workflows/publish.yaml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • docker/login-action v3
  • peter-evans/repository-dispatch v3
.github/workflows/test.yaml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
regex
remote-backup/build.yaml
  • ghcr.io/hassio-addons/base/aarch64 16.0.1
  • ghcr.io/hassio-addons/base/amd64 16.0.1
  • ghcr.io/hassio-addons/base/armhf 16.0.1
  • ghcr.io/hassio-addons/base/armv7 16.0.1
  • ghcr.io/hassio-addons/base/i386 16.0.1

  • Check this box to trigger a request for Renovate to run again on this repository

parse error: Invalid numeric literal

Hi! Thanks for creating this add-on. I'm trying it now, and it looks it won't work for me.

My set-up: trying to back-up via SSH to my back-up server, which is a regular SSH server. But error seems to happen before even attempting to connect to that server. Here is the log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Remote Backup
 Exploit snapshots and SCP/rsync to create remote backups to specified server
-----------------------------------------------------------
 Add-on version: 4.2.8
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.5  (aarch64 / odroid-n2)
 Home Assistant Core: 2022.8.6
 Home Assistant Supervisor: 2022.08.5
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Adding SSH key
Creating local backup: "Automated backup 2022-08-30 21:54"
time="2022-08-30T21:54:37+03:00" level=error msg="Unexpected server response"
parse error: Invalid numeric literal at line 1, column 11
[cmd] /run.sh exited 4
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

[FR] Add ability to remove folders / files from back-up thru rsync

While running rsync in the add-on It goes thru and backs-up several files that do not necessarily need to have a backup. DB files and some log files in config, cache files from the TDM add-on, and others.

Since rsync has the ability natively to exclude files. I would make good use of a line on the config that would feed this info to the rsync command-line to ignore certain folders and files.

Some of these files are cache files in the TDM add-on, for instance, that are never needed to be backed up.

Screenshot_2021-11-06_00-11-47

The issue is 3 fold.

  • the long list of files pushes the logging off the screen and I cannot ever go to the beginning of the log to see if all was OK or the versions, etc.

  • There is no need to back these up and take space on the back-up drive.

  • This will speed up the process not having to back-up the database file, for instance.

no backup file created

I finally got SSH working properly from the HA server to my NAS. That was a permissions issue on .ssh and .authorized_keys on the server. Just including that for completeness.

Now when I try to run Remote Backup the log shows it will create a full backup but then creates null.tar or null.zip, depending on whether or not I have a zip password set. No backup file is ever created and thus never uploaded.

Please note that I've intentionally obscured the server name but it is accurate in the config and log.

Config:
custom_prefix: Automated_backup
debug: false
exclude_addons: ""
exclude_folders: ""
friendly_name: true
keep_local_backup: "3"
rclone_copy: false
rclone_enabled: false
rclone_remote: ""
rclone_remote_directory: ""
rclone_restore: false
rclone_sync: false
remote_directory: /mnt/main_data_pool/main_data_dataset/backups/HASSOS
rsync_enabled: false
rsync_exclude: ""
rsync_host: ""
rsync_password: ""
rsync_rootfolder: hassio-sync
rsync_user: ""
rsync_verbose: false
ssh_enabled: true
ssh_host: ..com
ssh_host_key_algorithms: ""
ssh_key: id_rsa
ssh_port: "22"
ssh_user: terri
zip_password: ""

Log:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh

Add-on: Remote Backup
Automatically create and backup HA backups using SCP

Add-on version: 2022.7.2
You are running the latest version of this add-on.
System: Home Assistant OS 8.4 (amd64 / qemux86-64)
Home Assistant Core: 2022.8.0
Home Assistant Supervisor: 2022.08.3

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[info] Adding SSH key
[info] SSH key added
[warn] Creating local backup: "Automated_backup 2022-08-11 21-33"
[info] Creating full backup
[info] Backup created: null
[warn] Copying null.tar to /mnt/main_data_pool/main_data_dataset/backups/HASSOS on ..com using SCP
Warning: Permanently added '..com' (ED25519) to the list of known hosts.
scp: stat local "null.tar": No such file or directory
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

I have also tried shortening the custom prefix to just "hass". Didn't help.
HASSOS is running on a robust TrueNAS server in a Ubuntu VM.

Issue with spaces in remote path

Version info:

 Add-on version: 2022.5.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.6  (amd64 / qemux86-64)
 Home Assistant Core: 2022.4.5
 Home Assistant Supervisor: 2022.05.2

We are using SCP to copy to a remote Mac server. The path needs to be escaped, as it has spaces in it. The add-on does use quotes for the path, so I can simply enter the path into the config file. However, if I do not escape, then the following error is shown:

scp: ambiguous target

If I do escape the string, then the move of the tar to the friendly name then breaks, as you cannot mix quotes and escaped spaces together.

SFTP port number other than 22 fails

Remote Backup fails when setting the SFTP port number om my DSM to 222 and remote_port in the config also to 222. Log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and transfer HA backups using SFTP (SCP), rsync, or rclone (experimental)
-----------------------------------------------------------
 Add-on version: 2022.9.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.0  (amd64 / qemux86-64)
 Home Assistant Core: 2022.9.7
 Home Assistant Supervisor: 2022.09.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[19:36:03] INFO: Adding SSH configuration.
[19:36:04] WARNING: No password set, creating a local backup without password.
[19:36:04] INFO: Creating partial backup: "Automated backup 2022-10-05 19-36"
[19:36:04] NOTICE: Excluded folder(s):
media
share
[19:36:05] NOTICE: Excluded addon(s):
core_mariadb
core_ssh
core_mosquitto
[19:36:41] INFO: Backup created: ff68e4c5
[19:36:41] INFO: Copying backup using SFTP/SCP.
[19:36:41] WARNING: SFTP transfer failed, falling back to SCP.
[19:36:41] ERROR: Error copying backup ff68e4c5.tar to /Backup/BackupHA on 192.168.178.160.
jq: error (at :1): Cannot index array with string "result"
jq: error (at :1): Cannot index array with string "data"
[19:36:42] FATAL: Cloning backup(s) to remote host 192.168.178.160 failed! See log for details.
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

The add-on works flawlessly when setting both ports back to 22.

Is this a problem??

Back-up appears to be working fine, but I spotted something that seems odd.
This is my 'up north' instance, very vanilla no exclusions for the backup, a few exclusions in the rsync.

[05:18:16] INFO: Creating local backup with password.
[05:18:16] INFO: Creating partial backup: "SomerHome_backup 2022-09-14 05-18"
[05:18:17] NOTICE: Excluded folder(s):
null
[05:18:17] NOTICE: Excluded addon(s):
null
[05:18:48] INFO: Backup created: 12438fdb
[05:18:48] INFO: Copying backup using SFTP/SCP.
[05:28:21] INFO: Copying backup using rsync.
[05:28:22] NOTICE: Excluded rsync file patterns:
/config/*.db-shm
/config/*.db-wal
/config/*.db
*.tar
keyfile
*.tdm
*.cache
home-assistant*.*
*.moxilla
*.vmc
[05:28:27] INFO: Backup process done!

Notice it still says partial back-up and it lists the things it's ignoring as null. This might be another case of null seeping in from the config.

The config does not mention those 2 excludes, yet it says they are there when the backup happens and are null and a partial backup is the result... (edited)

backup_custom_prefix: SomerHome_backup
backup_friendly_name: true
backup_keep_local: "10"
remote_host: "!secret Eldrad_host"
remote_key: HA_ecdsa
remote_port: 22
remote_user: "off"
rsync_enabled: true
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
  - "*.tar"
  - keyfile
  - "*.tdm"
  - "*.cache"
  - home-assistant*.*
  - "*.moxilla"
  - "*.vmc"
rsync_rootfolder: "!secret EldradB_rsync"
ssh_enabled: true
ssh_remote_directory: "!secret EldradB_path"
backup_password: "!secret EldradB_pass"

Now maybe this is intentional, I don't know. All seems to work. I was just wondering if this is working as intended, or should the absence of config exclude entries mean a complete backup?

In my other instance there are actual excludes...

[06:18:20] INFO: Creating local backup with password.
[06:18:20] INFO: Creating partial backup: "ChaloupkaAbode_backup 2022-09-14 06-18"
[06:18:20] NOTICE: Excluded folder(s):
media
[06:18:20] NOTICE: Excluded addon(s):
a0d7b954_plex
[06:23:05] INFO: Backup created: 00949fbb
[06:23:05] INFO: Copying backup using SFTP/SCP.
[06:23:20] NOTICE: Deleting local backup: 13e42930
[06:23:21] INFO: Backup process done!
rsync_rootfolder: "!secret 74_rsync"
ssh_enabled: true
ssh_remote_directory: "!secret 74_path"
backup_exclude_addons:
  - a0d7b954_plex
backup_exclude_folders:
  - media
backup_password: "!secret backup_password"

I'm thinking if neither exclude entry is in config, then a full backup could be done.

remote_backup_status "ok" while backup did not run successfully

See relevant text from log:

If for whatever reason this error occurs (due to changes in backup destination setup) you will not get a notification of an error in HA.

====================================================================================
[17:34:42] DEBUG: Syncing /addons /addon_configs /backup /config /homeassistant /media /share /ssl
[email protected]: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7]
[17:34:45] ERROR: Error rsyncing folder(s) /addons /addon_configs /backup /config /homeassistant /media /share /ssl to [email protected]:/mnt/pool1/HA-backup: unknown error: 255!
[17:34:45] DEBUG: Rclone disabled.
[17:34:45] DEBUG: Requested API resource: http://supervisor/backups/reload
[17:34:45] DEBUG: Request method: POST
[17:34:45] DEBUG: Request data: {}
[17:34:45] DEBUG: API HTTP Response code: 200
[17:34:45] DEBUG: API Response: {"result":"ok","data":{}}

[17:34:45] DEBUG: Requested API resource: http://supervisor/backups
[17:34:45] DEBUG: Request method: GET
[17:34:45] DEBUG: Request data: {}
[17:34:45] DEBUG: API HTTP Response code: 200
[17:34:45] DEBUG: API Response: {" removed as not relevant to error"],"folders":["share","addons/local","ssl","media"]}}]}}

[17:34:45] INFO: Backup process done!
[17:34:45] DEBUG: Requested API resource: http://supervisor/core/api/events/remote_backup_status
[17:34:45] DEBUG: Request method: POST
[17:34:45] DEBUG: Request data: {"result":"ok","message:":"Backup Automated backup 2024-05-17 17-34 created."}
[17:34:45] DEBUG: API HTTP Response code: 200
[17:34:45] DEBUG: API Response: {"message":"Event remote_backup_status fired."}

Event appears to sends "ok" when the remote copy has failed

When the HASSIO backup s successful but the SSH copy fails due to lack of disk space on the target system the event seems to fire "ok" and not "error"

Log shows that copy failed

scp: write remote "/mnt/sambashare/homeassistant/HASSIO 2023-12-12 01-00.tar": Failure
scp: failed to upload file /backup/7b288617.tar to /mnt/sambashare/homeassistant/HASSIO 2023-12-12 01-00.tar
[02:01:03] WARNING: SFTP transfer failed, falling back to SCP: Invalid command line argument
scp: ambiguous target
[02:01:04] ERROR: Error copying backup 7b288617.tar to /mnt/sambashare/homeassistant on 192.168.1.23:  Invalid command line argument

Remote Backup: Current version: 2023.3.0
Core 2023.12.0
Supervisor 2023.11.6
Operating System 11.1

It is not possible to set backup_keep_local to 'null'

The documentation says:
To keep no local backups set this to null then all backups created will be removed after remote transfer.
It is not possible to set this value to null since that value does not match the regexp for this option. Setting it to blank results in the complaint that the option is missing.

Remote backup always does a full backup

Version info:

- plugin: 2022.5.1
- Home Assistant 2022.7.2
- Supervisor 2022.07.0
- Operating System 8.2
- Frontend 20220707.0 - latest

Plugin ignoring config parameters:

  • exclude_folders
  • exclude_addons

The effect is that the backup does not fit on the disk. I don't want to back up the 'media' directory!
The problem seems to me after the last Home Assistant update.
Unfortunately, the plugin is useless at the moment.

Don't assume RSA key & support ed25519 keys

[16:56:02] INFO: Adding SSH configuration.
Load key "/root/.ssh/id_rsa": error in libcrypto

[16:56:02] INFO: Creating non-encrypted full backup: "Automated backup 2023-12-17 16-56"
[16:56:10] INFO: Backup created: 88c34e30
[16:56:10] INFO: Copying backup using SFTP/SCP.
Load key "/root/.ssh/id_rsa": error in libcrypto

[16:56:13] WARNING: SFTP transfer failed, falling back to SCP: Invalid/incorrect password
Load key "/root/.ssh/id_rsa": error in libcrypto

My key is an ed25519 key.

Known_hosts Question

Any idea how to clear this warning. I've always seen it but it still works.
I thought sending it all to a new server might fix it, it doesn't. I had a server fail so had to reset everything.
I think that it is looking for this file on the HA host maybe. Does this on both of my HA systems.
Nothing broke, but annoying.

s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[06:18:19] INFO: Adding SSH configuration.
[06:18:19] WARNING: Missing known_hosts file! Retrieving public key of remote host 10.10.100.10.
# 10.10.100.10:22 SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
[06:18:20] INFO: Creating local backup with password.
[06:18:20] INFO: Creating partial backup: "ChaloupkaAbode_backup 2022-12-11 06-18"
[06:18:20] NOTICE: Excluded folder(s):
media

Synology SFTP Issue

I tried to fix the double quote issue it worked in my test environment (even with a folder with spaces), with just a single set of quotes but now that I have pushed the update I am getting issues on my main box

[21:21:35] INFO: Copying backup using SFTP/SCP.
scp: dest open "/volume1/backup/home-assistant/backup/Automated backup 2023-01-06 21-20.tar": No such file or directory
scp: failed to upload file /backup/29489512.tar to /volume1/backup/home-assistant/backup/Automated backup 2023-01-06 21-20.tar
[21:21:36] WARNING: SFTP transfer failed, falling back to SCP: Invalid command line argument
scp: ambiguous target
[21:21:36] ERROR: Error copying backup 29489512.tar to /volume1/backup/home-assistant/backup on 192.168.0.9:  Invalid command line argument

[FR] Database Locking for Back-up add-on

I heard that there is a feature in some other back-up programs to 'lock' the database at the time of back-up to prevent corruption in the back-up copy.
Might be a nice addition if you decide a to do a re-write here at some point...

[FR] Add include or .storage folder to rsync

I have noticed that the ".storage" folder is not sent to back-up with the rsync function.
2 ways to make that available would be to add an "include:" section in the config, or just add ".storage" folder because that has all the lovelace and stuff in it and would be nice to have available as a quick back-up.

Backup suddenly stopped working

Happy new year everyone!

I've just looked in my Home Assistent logs and saw that the last backup (automatic backup -> mo, wed, fri at 0200) was not successful.
The addon should copy from home assistant to my diskstation (synology).

I did neither change/update something on home assistent nor on my diskstation.

I get the following error when I try to make a backup:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and transfer HA backups using SFTP (SCP), rsync, or rclone (experimental)
-----------------------------------------------------------
 Add-on version: 2022.12.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.4  (armv7 / raspberrypi3)
 Home Assistant Core: 2022.12.8
 Home Assistant Supervisor: 2022.12.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[15:30:08] WARNING: 
[15:30:08] WARNING: Setting a password is highly recommended!
[15:30:08] WARNING: 
[15:30:08] WARNING: Please set a password in the 'backup_password' option.
[15:30:08] WARNING: 
[15:30:08] WARNING: If unsure, check the add-on manual for more information.
[15:30:08] WARNING: 
[15:30:10] INFO: Adding SSH configuration.
[15:30:11] INFO: Creating non-encrypted full backup: "Automated backup 2023-01-01 15-30"
[15:32:27] INFO: Backup created: d09a3786
[15:32:28] INFO: Copying backup using SFTP/SCP.
scp: dest open ""/NetBackup/Hassio/Automated backup 2023-01-01 15-30.tar"": No such file or directory

scp: failed to upload file /backup/d09a3786.tar to "/NetBackup/Hassio/Automated backup 2023-01-01 15-30.tar"

[15:32:31] WARNING: SFTP transfer failed, falling back to SCP: Invalid command line argument
Permission denied, please try again.
lost connection
[15:32:32] ERROR: Error copying backup d09a3786.tar to /NetBackup/Hassio on diskone.homesys:  Invalid command line argument
[15:32:37] NOTICE: Deleting local backup: ff010044
[15:32:38] INFO: Backup process done!
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

When I try to sftp or scp from the terminal in HA I can send files to the diskstation:

scp -i /ssl/diskOneHassio -v 3ffa4a73.tar [email protected]:/NetBackup/Hassio/test.tar

works as well as

sftp -i /ssl/diskOneHassio [email protected]
sftp> put 3ffa4a73.tar 
Uploading 3ffa4a73.tar to /NetBackup/Hassio/3ffa4a73.tar

My config looks like this:

backup_custom_prefix: Automated backup
backup_friendly_name: true
backup_keep_local: "10"
remote_host: diskone.homesys
remote_key: diskOneHassio
remote_port: 22
remote_user: hassio
rsync_enabled: false
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
rsync_rootfolder: hassio-sync
ssh_enabled: true
ssh_remote_directory: /NetBackup/Hassio

The debug output would be like this:
(seems to be only the end of the output, I don't know how I can retrieve the full log, this is what I got when I download the file from the GUI)):

debug1: Connecting to diskone.homesys [10.77.71.10] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2
debug1: compat_banner: match: OpenSSH_8.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to diskone.homesys:22 as 'hassio'
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:iEzfsoc4rYj047xxHTMbZSxtNOAVYdZLZAE7GVPsMxs
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'diskone.homesys' is known and matches the ED25519 host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /root/.ssh/id_rsa RSA SHA256:d/t020YtXCuwRBp04lAzEDV7Rwywxof3yNqOoJVo7/Q explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /root/.ssh/id_rsa RSA SHA256:d/t020YtXCuwRBp04lAzEDV7Rwywxof3yNqOoJVo7/Q explicit
debug1: Server accepts key: /root/.ssh/id_rsa RSA SHA256:d/t020YtXCuwRBp04lAzEDV7Rwywxof3yNqOoJVo7/Q explicit
Authenticated to diskone.homesys ([10.77.71.10]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts for diskone.homesys / (none)
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts2 for diskone.homesys / (none)
debug1: client_input_hostkeys: hostkeys file /root/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Remote: /var/services/homes/hassio/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /var/services/homes/hassio/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending command: scp -v -t "/NetBackup/Hassio/Automated backup 2023-01-01 16-00.tar"
Permission denied, please try again.
lost connection
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Killed by signal 1.
[16:03:02] ERROR: �[35mError copying backup 4e4b9218.tar to /NetBackup/Hassio on diskone.homesys:  Invalid command line argument�[0m
[16:03:03] DEBUG: Rsync disabled.
[16:03:03] DEBUG: Rclone disabled.
[16:03:04] DEBUG: Requested API resource: http://supervisor/backups/reload
[16:03:04] DEBUG: Request method: POST
[16:03:04] DEBUG: Request data: {}
[16:03:04] DEBUG: API HTTP Response code: 200
[16:03:04] DEBUG: API Response: {"result": "ok", "data": {}}
[16:03:05] DEBUG: Requested API resource: http://supervisor/backups
[16:03:05] DEBUG: Request method: GET
[16:03:05] DEBUG: Request data: {}
[16:03:05] DEBUG: API HTTP Response code: 200
[16:03:05] DEBUG: API Response: {"result": "ok", "data": {"backups": [{"slug": "b77e2531", "name": "Automated backup 2023-01-01 14-46", "date": "2023-01-01T13:46:28.468190+00:00", "type": "full", "size": 32.42, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "d97fee2c", "name": "Automated backup 2023-01-01 15-08", "date": "2023-01-01T14:09:01.811434+00:00", "type": "full", "size": 32.56, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "55657f6e", "name": "Automated backup 2023-01-01 15-16", "date": "2023-01-01T14:16:35.122465+00:00", "type": "full", "size": 32.6, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "65d8ce68", "name": "Automated backup 2022-12-28 02-00", "date": "2022-12-28T01:00:35.075020+00:00", "type": "full", "size": 30.09, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "8e13edfa", "name": "addon_a0d7b954_zwavejs2mqtt_1.4.1", "date": "2022-12-28T19:29:58.037063+00:00", "type": "partial", "size": 0.78, "protected": false, "compressed": true, "content": {"homeassistant": false, "addons": ["a0d7b954_zwavejs2mqtt"], "folders": []}}, {"slug": "d09a3786", "name": "Automated backup 2023-01-01 15-30", "date": "2023-01-01T14:30:12.003679+00:00", "type": "full", "size": 32.67, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "d0113eb7", "name": "Automated backup 2023-01-01 02-00", "date": "2023-01-01T01:00:24.362513+00:00", "type": "full", "size": 30.96, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "3ffa4a73", "name": "addon_3490a758_remote_backup_2022.9.4", "date": "2022-12-30T10:53:15.946897+00:00", "type": "partial", "size": 0.01, "protected": false, "compressed": true, "content": {"homeassistant": false, "addons": ["3490a758_remote_backup"], "folders": []}}, {"slug": "a9320c51", "name": "Automated backup 2023-01-01 14-25", "date": "2023-01-01T13:25:11.170762+00:00", "type": "full", "size": 32.29, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "4e4b9218", "name": "Automated backup 2023-01-01 16-00", "date": "2023-01-01T15:00:34.895926+00:00", "type": "full", "size": 32.8, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt", "core_mosquitto"], "folders": ["share", "addons/local", "ssl", "media"]}}, {"slug": "7609b46a", "name": "Automated backup 2022-12-30 02-00", "date": "2022-12-30T01:00:20.210418+00:00", "type": "full", "size": 30.01, "protected": false, "compressed": true, "content": {"homeassistant": true, "addons": ["a0d7b954_nodered", "core_configurator", "a0d7b954_ide", "core_duckdns", "core_mariadb", "a0d7b954_traccar", "core_ssh", "3490a758_remote_backup", "a0d7b954_phpmyadmin", "a0d7b954_zwavejs2mqtt"], "folders": ["share", "addons/local", "ssl", "media"]}}]}}
[16:03:08] NOTICE: �[36mDeleting local backup: 65d8ce68�[0m
[16:03:08] DEBUG: Requested API resource: http://supervisor/backups/65d8ce68
[16:03:08] DEBUG: Request method: DELETE
[16:03:08] DEBUG: Request data: {}
[16:03:08] DEBUG: API HTTP Response code: 200
[16:03:08] DEBUG: API Response: {"result": "ok", "data": {}}
[16:03:10] INFO: �[32mBackup process done!�[0m
[16:03:10] DEBUG: Requested API resource: http://supervisor/core/api/events/remote_backup_status
[16:03:10] DEBUG: Request method: POST
[16:03:10] DEBUG: Request data: {"result":"ok","message:":"Backup Automated backup 2023-01-01 16-00 created."}
[16:03:10] DEBUG: API HTTP Response code: 200
[16:03:10] DEBUG: API Response: {"message":"Event remote_backup_status fired."}
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Do you have an idea what going on?
Regards
Alex

error during startup

Hi. I'm getting an error during startup, which is probably due to my misconfiguration but I can't tell from the log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and backup HA snapshots using SCP
-----------------------------------------------------------
 Add-on version: 2021.5.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.13  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2021.5.4
 Home Assistant Supervisor: 2021.04.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Adding SSH key
Creating local backup: "hassio-backup- 2021-05-18 14-37"
Backup created: null
Copying null.tar to /mypath on 192.168.1.100 using SCP
Warning: Permanently added '192.168.1.100' (ECDSA) to the list of known hosts.
null.tar: No such file or directory
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I see Backup created: null and think that's what failed, but why? Where is the backup file supposed to be so I can look if it got created?

Here's my config:

ssh_enabled: true
friendly_name: true
custom_prefix: hassio-backup-
ssh_host: 192.168.1.100
ssh_port: 22
ssh_user: username
ssh_key: id_rsa
remote_directory: /mypath
zip_password: ''
keep_local_backup: '2'
rsync_enabled: false
rsync_host: ''
rsync_rootfolder: hassio-sync
rsync_user: ''
rsync_password: ''
rclone_enabled: false
rclone_copy: false
rclone_sync: false
rclone_restore: false
rclone_remote: ''
rclone_remote_directory: ''

Let me know if I can provide any other info to help you help me. Thanks for any suggestions.

Error on renaming the Backup: mv: failed to access XY: Not a directory

Hey folks,

i just installed your addon and it works fine, except one things:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and backup HA snapshots using SCP
-----------------------------------------------------------
 Add-on version: 2021.8.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.3  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2021.9.6
 Home Assistant Supervisor: 2021.09.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Adding SSH key
Creating local backup: "hassio-backup- 2021-09-15 18-02"
Backup created: 3868cec2
Copying 3868cec2.tar to ~/folder on 192.168.178.5 using SCP
Warning: Permanently added '192.168.178.5' (ED25519) to the list of known hosts.
Renaming 3868cec2.tar to hassio-backup- 2021-09-15 18-02.tar
mv: failed to access '/my/folder/hassio-backup- 2021-09-15 18-02.tar': Not a directory
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I am not very into python nor HA-Dev but i think there is an escaping-error in this line:

ssh remote "mv "${REMOTE_DIRECTORY}"/${slug}.tar "${REMOTE_DIRECTORY}"/\"${name}\".tar"

Any suggestions on this?

Inconsistant naming of remote root folders

When the new version came out, this confused me, even though I've used the program years.
Adding something in the ssh remote directory line indicating it needs to be the root folder, like the one is set for rsync, would help clarify what is being asked for here.

Screenshot_20220915_112846

I thought originally it wanted the path to SSL on the remote host or something. Figured it out eventually.

Corrupted backup

Upgraded to 9.0 from 7.2
I use rclone to backup directly to pcloud. Previously worked faultlessly. Now backup folder is OK, but nested folders e.g. homeassistant.tar.gz do not open up - triggers message that not an archive or corrupted.

Bug in Addon - Remote Backup

There seems to be a bug i have generated multiple key pairs, anyhow when you see the config, the remote key is named "id_ecdsa_rpi" but the log is referencing somethign else in the error: "Enter passphrase: Load key "/root/.ssh/id_rsa": incorrect passphrase supplied to decrypt private key"

backup_custom_prefix: Automated backup
backup_friendly_name: true
backup_keep_local: all
remote_host: 192.168.XXX.110
remote_key: **id_ecdsa_rpi**
remote_port: 22
remote_user: root
rsync_enabled: false
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
rsync_rootfolder: hassio-sync
ssh_enabled: true
ssh_remote_directory: hassio-backup
backup_password: xxxxxx

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and transfer HA backups using SFTP (SCP), rsync, or rclone (experimental)
-----------------------------------------------------------
 Add-on version: 2022.12.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.4  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.1.2
 Home Assistant Supervisor: 2022.12.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[03:26:51] INFO: Adding SSH configuration.
**Enter passphrase: Load key "/root/.ssh/id_rsa": incorrect passphrase supplied to decrypt private key**

[03:26:53] INFO: Creating password encrypted full backup: "Automated backup 2023-01-14 03-26"
[03:27:38] INFO: Backup created: 650be57c
[03:27:39] INFO: Copying backup using SFTP/SCP.
[03:27:42] WARNING: SFTP transfer failed, falling back to SCP: Invalid/incorrect password
[03:27:44] ERROR: Error copying backup 650be57c.tar to hassio-backup on 192.168.XXX.110:  Invalid/incorrect password
[03:27:45] INFO: Backup process done!
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Can you maybe advise?
kr

[FR] Add persistant notifications

Thinking while helping someone on the forums today..

If you started a persistent notification when the back-up started, then cleared it when it ended, you would be giving the frontend and operator an indicator that a back-up is happening. Also if the back-up fails, you could directly notify the operator and frontend the same way that an error occurred, with a link maybe to the log, don't know for sure about the link.

I bet this is possible, if nothing else an interesting puzzle to work out in any case.

This would give your add-on an advantage over others.

The feature request asking for such a thing:
https://community.home-assistant.io/t/backup-in-progress-indicator/692356

Does Backup but doesn't save to remote server

Have used this add-on for some time but the recent update gives an error in the logs.
"[info] Backup created: 35c9e120
[warn] Copying 35c9e120.tar to /data/Documents/BACKUPS/Home_Assistant/Odroid on 192.168.1.109 using SCP
Warning: Permanently added '192.168.1.109' (ECDSA) to the list of known hosts.
Permission denied, please try again."

Last working backup was on Dec 23, 2021
Has something changed for ssh key in add-on?
I can ssh into 192.168.1.109 from HA terminal.

HTTP error shows at Startup.

I see this at start-up HTTP Error

-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and backup HA snapshots using SCP
-----------------------------------------------------------
 Add-on version: 4.3.4
 You are running the latest version of this add-on.
parse error: Expected string key before ':' at line 1, column 4
[06:18:07] ERROR: Unknown HTTP error occured
 System:   (amd64 / qemux86-64)
 Home Assistant Core: 0.115.6
 Home Assistant Supervisor: 247
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------

Not sure that it affects anything, but pointing it out in cse it does.

Ideas collection

Hi @ikifar2012!

I was looking pretty long for an addon that would do automatic backup to my NAS but use SSH based data transfer (rsync, scp, ...). So with your addon I found the perfect match. The last days I have played around with it and gathered a few ideas on improvements. Just let me know which of them sound interesting to you:

Code

  1. key-based authentication for rsync, PR#51
  2. use bashio logger instead of own functions, PR#52
  3. introduce log levels to be set by configuration (depends on 2.), PR#52, debug enable as decided in this comment
  4. shorten script by using for loopfor various individual rsync folders, PR#54

Configuration

  1. make ssh_port type port, covered by PR#54
  2. use arrays for excludes of addons/folders, covered by PR#54

Documentation

  1. Clarify a bit which options are used for which type of operation (especially necessary due to code/1)
  2. make clear that due to StrictHostKeyChecking no security is impacted -> think about solution for code
  3. document date-based cleanup function in delete-local-backup (if I saw that correctly in the code) misinterpretation

For almost all I already have an idea, if you let me know which interest you, I would create more pull requests.

Thanks again, you solved one of my longest running issues with backup of HA!

Specify known_hosts and id

I have a custom folder keeping my known_hosts and id file, to persist between updates or reloads.
Is there a possibility change the addon to specify the location of these.
I connect to a couple of hosts passwordless by ssh-copy-id, pulling all kinds of stats.
I want to backup my snapshots/backup folder to one of these hosts.

rsync portion of remote backup is failing

Core 2024.3.3
Supervisor 2024.03.0
Operating System 12.1

I have been using this addon for a while and the rsync function used to work well. I just noticed that the rsync target directory did not have much in it and so I investigated. The logs show the following:

[22:05:03] INFO: Copying backup using rsync.
rsync: [sender] link_stat "/all_addon_configs" failed: No such file or directory (2)
rsync: [sender] link_stat "/homeassistant_config" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1336) [sender=3.2.7]
[22:05:07] ERROR: Error rsyncing folder(s) /addons /all_addon_configs /backup /config /homeassistant_config /media /share /ssl to [email protected]:/storage/homeassistant/hassio-sync: unknown error: 23!

My configuration contains:

remote_host: host.example.org
remote_port: 22
remote_user: root
remote_key: id_rsa
backup_friendly_name: true
backup_custom_prefix: ha-backup-
backup_keep_local: "1"
ssh_enabled: true
ssh_remote_directory: /storage/homeassistant
rsync_enabled: true
rsync_rootfolder: /storage/homeassistant/hassio-sync
rsync_exclude: []

Is something misconfigured?

Friendly Name not working for ~ 2 months

I perform weekly backups. The friendly name feature stopped fully working for me on Sept 13, 2021. The feature partially works as described below. Since the backup completes, this isn't a fatal error. However, the convenience of the friendly name is lost.

Observables:

  • Basic backup function works.
  • The backup file on my Home Assistant is changed to the friendly name.
  • The backup file on the remote backup location works.
  • However, the name of the file on the remote backup location is no longer friendly.

The log below shows the file rename mv failure.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and backup HA snapshots using SCP
-----------------------------------------------------------
 Add-on version: 2021.10.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.5  (aarch64 / raspberrypi3-64)
 Home Assistant Core: 2021.10.5
 Home Assistant Supervisor: 2021.10.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Adding SSH key
Creating local backup: "Automated backup 2021-11-01 03-00"
Backup created: 0de3d5a4
Copying 0de3d5a4.tar to ~/homeassistantbackups on 192.168.0.112 using SCP
Warning: Permanently added '192.168.0.112' (ED25519) to the list of known hosts.
Renaming 0de3d5a4.tar to Automated backup 2021-11-01 03-00.tar
mv: rename ~/homeassistantbackups/0de3d5a4.tar to ~/homeassistantbackups/Automated backup 2021-11-01 03-00.tar: No such file or directory
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Directory listing of ~/homeassistantbackups on remote location

Screen Shot 2021-11-06 at 8 56 48 AM

Scheduled start failing with remote_host missing error

HA Core: 2023.11.2
Supervisor: 2023.11.0
Frontend: 20231030.2
Remote Backup: 2023.3.0

Log

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[12:53:36] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[12:53:36] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[12:53:36] FATAL: 
[12:53:36] FATAL: A required add-on configuration option is missing!
[12:53:36] FATAL: 
[12:53:36] FATAL: Please set a value for the 'remote_host' option.
[12:53:36] FATAL: 
[12:53:36] FATAL: This option is required because:
[12:53:36] FATAL: A target host for copying backups is necessary.
[12:53:36] FATAL: 
[12:53:36] FATAL: If unsure, check the add-on manual for more information.
[12:53:36] FATAL: 
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Configuration, with a value for remote_host configured

backup_custom_prefix: Automated backup
backup_friendly_name: true
backup_keep_local: "10"
remote_host: 10.0.100.50
remote_key: id_nas
remote_port: 22
remote_user: admin
rsync_enabled: false
rsync_exclude:
  - /config/*.db-shm
  - /config/*.db-wal
  - /config/*.db
rsync_rootfolder: hassio-sync
ssh_enabled: true
ssh_remote_directory: /share/MD0_DATA/Backups/hass/
friendly_name: true
custom_prefix: Automated backup
ssh_host: 10.0.100.50
ssh_port: 22
ssh_user: admin
ssh_key: id_nas
remote_directory: /share/MD0_DATA/Backups/hass
zip_password: ""
keep_local_backup: "3"
rsync_host: ""
rsync_user: ""
rsync_password: ""
rclone_enabled: false
rclone_copy: false
rclone_sync: false
rclone_restore: false
rclone_remote: ""
rclone_remote_directory: ""
debug: true

“Subsystem request failed on channel 0”

Hi,

A few days ago I updated the addon from version 2022.5 to 2022.7, and it looks like my back-ups haven’t been successful since then. I haven’t changed any configuration for the addon, or on the remote machine (a NAS). The error shown in the logs mentions “subsystem request failed on channel 0”

Log output:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Remote Backup
 Automatically create and backup HA backups using SCP
-----------------------------------------------------------
 Add-on version: 2022.7.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.2  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.7.6
 Home Assistant Supervisor: 2022.07.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[info] Adding SSH key
[info] SSH key added
[warn] Creating local backup: "AutoBackup 2022-07-23 10-31"
[info] Creating full backup
[info] Backup created: 4c0709f6
[warn] Copying 4c0709f6.tar to /share/Backups/HomeAssistant on 192.168.X.X using SCP
Warning: Permanently added '192.168.X.X' (RSA) to the list of known hosts.
subsystem request failed on channel 0
scp: Connection closed
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

rclone restore not working

I got this error restoring files from rclone:

[19:48:03] INFO: Restoring backups to restore-2023-02-05 using rclone
Usage:
  rclone copyto source:path dest:path [flags]
Flags:
  -h, --help   help for copyto
Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
Command copyto needs 2 arguments minimum: you provided 1 non flag arguments: ["remote:dir /backup/restore-2023-02-05/"]
[19:48:03] ERROR: Error restoring backups from remote:dir!

To solve, in file remote-backup-addon/remote-backup/run.sh, the row 269 should be:

rclone ${DEBUG_FLAG:-} copyto "${rclone_remote_host}:${remote_directory}" "/backup/${restore_name}/"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.