Hassio 0.61 Snapshot Service

How add in GUI in configuring automation to do schedule snapshot and add to name date created snapshot ?

@mr_bjerre

I can’t quite get Remote Backup Add-On to authenticate. I get an authentication error in the log file.

Backup created: f25b58f4
Copying password-protected f25b58f4.zip to ~/hassio-backups on 10.0.1.76 using SCP
  adding: f25b58f4.tar (deflated 1%)
Warning: Permanently added '10.0.1.76' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from 10.0.1.76 port 22:2: Too many authentication failures
Disconnected from 10.0.1.76 port 22
lost connection

To debug this, I confirmed that I can ssh into my host remote machine. However, that uses a password instead of a KEY. I confirmed my PRIVATE KEY by re-entering it a second time. Am I using a supported encryption? Any other suggestions?

Any help is appreciated.

Also for reference, my Configuration is typical:

{
  "ssh_host": "10.0.1.76",
  "ssh_port": 22,
  "ssh_user": "USERNAME",
  "ssh_key": [
    "-----BEGIN RSA PRIVATE KEY-----",
    "Proc-Type: 4,ENCRYPTED",
    "DEK-Info: AES-128-C.........",
    "",
    "FIRST_LINE_HERE_WITH_KEY_INFO",
    "....",
    "LAST_LINE_HERE_WITH_KEY_INFO",
    "-----END RSA PRIVATE KEY-----"
  ],
  "remote_directory": "~/hassio-backups",
  "zip_password": "password_protect_it",
  "keep_local_backup": "3"
}

The private key is in the wrong format. If you use puttygen, load the key and copy and paste from here:

image

I made the change to the key as recommended, but it still fails to authenticate.

To attempt to debug this further, I made my own stand alone run.sh script based on the run.sh in the Remote Backup. When I execute my run.sh test script, to my surprise I was prompted for a password. In other words, it isn’t using the key alone. It is still requiring user interaction, which I think is not intended. When I enter the password, it completes the script and copies a test dummy file correctly.

I am trying to remote into a iMac. I wonder if there is some minor changes for the Mac OSX that make it not work with the current configuration.

Any other ideas or recommendations for further debug?

If you are prompted for a password it is not using the key… your ssh session is maybe using the wrong key?

The public key goes in the ssh settings and the private key goes in your ssh connection. Make sure your “USERNAME” is the username you are trying to connect with.

My config for the dropbox addon is:

{
  "oauth_access_token": "token",
  "output": "/home-assistant-backups/",
  "keep_last": 5
}

Your config looks different… are you trying to mix the ssh addon settings with the dropbox addon settings?

The standard ssh addon settings would look like this:

{
  "authorized_keys": [
    "ssh-rsa AKDJD3839...== my-key"
  ],
  "password": ""
}

None of these look like the example you posted…

@DavidFW1960

I am evaluating backup options. My current assessment is that I don’t want backups on the internet. So, I am opting to backup hassio from my raspberry pi to a local iMac on an internal network. In the future, as I gain more experience with the system, I may choose to shift to an internet backup.

I am not currently using @danielwelch DropBox Backup Addon.
I am now successfully using @mr_bjerre Remote Backup Addon which uses SCP but only with key without passphrase.

After further investigations, I was using the correct key format for the Remote Backup Add-On, but if failed because I created a key with a passphrase. (NOTE: Creating a passphrase was against advisement of this add-on documentation and I now know that key with passphrase fails authentication.) It failed because there is no ssh-agent running in hassio which then prompts the user to type in the passphrase. Within a script, the keyboard interaction isn’t available and fails.

This see great article is a terrific description of the options for keys with passphrases or without and use of ssh-agent. I have temporarily decided to forego the use a passphase on my keys but only because I sit behind a firewall with no exposed ports and I am operating on an internal network only.

However, I think we should consider requesting an hassio upgrade to permit enabling/disabling of ssh-agent. The hassio community would have to consider any security concerns.

This following thread was very helpful in my investigation and I am referencing it here for others.

Is this still the a valid to create a backup with the date in the name of a snapshot?

Cause this is not working for me, whenever i create a snapshot this way using “node red” or “call service” HA creates a snapshot with a random name.

Does somebody know why this is happening ?

It uses a random name but in the hassio>snapshot panel it shows the name you select.

The date function doesn’t seem to work no matter what type or syntax - for snapshot names… Anything else works fine… But if you need the date as the name… you have it save as nothing, (blank), and it uses the date/time as the name automatically…
But yeah the actual filename is always random.

Seems to work in my automation.

- id: 'backups'
  alias: Make Snapshot & Copy Backups to Dropbox
  initial_state: 'on'
  trigger:
  - platform: time
    at: '03:00:00'
  condition: []
  action:
  - service: hassio.snapshot_full
    data_template:
      name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
  - service: notify.notify 
    data_template:
      message: Created backup named "Automated Backup {{ now().strftime('%Y-%m-%d') }}"
  - delay: '01:00:00'
  - service: hassio.addon_stdin
    data_template:
      addon: 7be23ff5_dropbox_sync
      input:
        command: upload
  - service: notify.notify
    data_template:
      message: Copied all new backups to Dropbox
3 Likes

When you look in your list of snapshots in https://your-homeassistant-url/hassio/snapshots/ page?? That’s so strange… Mine technically “work” as in - it makes that snapshot… but the name contains the syntax/code - doesn’t replace it with the actual date or time…

That’s so strange… What would cause this kind of discrepancy between our two systems? I’ll double check the code, but I’m 99% positive its the same thing. I tested it in templates before I put it on the snapshot name… I also did a completely different syntax which also output correctly in templates, but not in my snapshot… I don’t; get it…

Weird… just recognized that as well.
Snapshots manually created using the service call use the named specified (using nodered it does not work) but the date is still wrong:
image

The real filename is still random as well.

I think that the file name is ALWAYS ‘random’ it is just that the HA UI looks inside the .tar to determine the name the backup was given when it was created.

2 Likes

Ok i guess you are right :slight_smile:
Then i only need to get that date thing fixed.

Maybe something in this json is wrong but i don`t see any error:

{
“name”: “Automated Backup {{ now().strftime(‘%Y-%m-%d’) }}”
}

The following has been working great for me since the snapshot service was introduced and produces snapshots named like “Full_Snapshot_2018-11-26_0.82.1” (visible from within the snapshots page). Of course the file name is still unreadable, but you can sort those by date to get a good idea of what is what.

Note: I have most of my config files broken out separately for ease of maintenance.

configuration.yaml

automation: !include automations.yaml
sensor: !include sensors.yaml


sensors.yaml

- platform: version
  name: Current Hass Version


automations.yaml

- id: maintain_hass.io_backups
  alias: Maintain Hass.io Backups
  trigger:
  - at: '23:00:00'
    platform: time
  condition: []
  action:
  - data_template:
      name: Full_Snapshot_{{ now().strftime('%Y-%m-%d') }}_{{ states('sensor.current_hass_version') }}
    service: hassio.snapshot_full


2 Likes

I will check if that works for me as well.

Update: Same here if i use this as parameter for the service call…

This is what i used for testing:

image

1 Like

Ah, I see now that you are trying to do this from within the GUI editor… that will not work as it looks to be using what you put there as a literal string.

When I look at that automation in the GUI editor, all I see is {}. Unfortunately there is still a number of things you cannot set up from the GUI editor at this time.

First thing is that you will need to paste the example directly into your automations.yaml file (be mindful that the indenting stays identical, yaml is very picky about spacing).

Second thing is that you need to either create the sensor that the automation is using (sensor.current_hass_version) or remove that section from the automation

_{{ states(‘sensor.current_hass_version’) }}

or it will fail for sure.

2 Likes

Ahh yes - thats why it wasn’t working for me also… I don’t know why I didn’t try it direct through the yaml file…

Thank you