home-assistant / addons

:heavy_plus_sign: Docker add-ons for Home Assistant
https://home-assistant.io/hassio/
Apache License 2.0
1.51k stars 1.47k forks source link

Git pull cannot setup deployment_key after update to 7.14.0 #3525

Closed klatka closed 5 months ago

klatka commented 5 months ago

Describe the issue you are experiencing

Log: [Info] Start adding SSH key [Info] Setup deploymentkey on id_ed25519 /run.sh: line 35: /.ssh/id_ed25519: No such file or directory

run.sh: line 35: echo "$line" >> "${HOME}/.ssh/id${DEPLOYMENT_KEY_PROTOCOL}"

Seems like HOME var is empty. Any way to fix it?

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

Git pull

What is the version of the add-on?

7.14.0

Steps to reproduce the issue

  1. Setup up git pull with deployment key
  2. Start git pull add-on

System Health information

System Information

version core-2024.3.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.20-haos
arch x86_64
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4995 Installed Version | 1.34.0 Stage | running Available Repositories | 1415 Downloaded Repositories | 69 HACS Data | ok
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.03.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 46.5 GB disk_used | 33.2 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Git pull (7.14.0), Terminal & SSH (9.10.0), MariaDB (2.6.1), Matter Server (5.4.1), Grafana (9.2.1), InfluxDB (5.0.0), PS5 MQTT (1.3.3), Ring-MQTT with Video Streaming (5.6.3), Whisper (2.0.0), Piper (1.5.0), File editor (5.8.0), WireGuard (0.10.2), Cloudflared (5.1.7), Z-Wave JS UI (3.4.1), ESPHome (2024.2.2), Mosquitto broker (6.4.0), Tautulli (4.0.1), Node-RED (17.0.10), Zigbee2MQTT (1.36.0-1), Silicon Labs Multiprotocol (2.4.4), openWakeWord (1.10.0), Music Assistant BETA (2.0.0b120), Duck DNS (1.16.0), motionEye (0.20.0), room-assistant (2.20.0), AdGuard Home (5.0.5), NGINX Home Assistant SSL proxy (3.9.0), Advanced SSH & Web Terminal (17.2.0)
Dashboards dashboards | 4 -- | -- resources | 45 views | 13 mode | yaml
Recorder oldest_recorder_run | 20. November 2023 um 22:46 -- | -- current_recorder_run | 23. März 2024 um 11:41 estimated_db_size | 8330.69 MiB database_engine | mysql database_version | 10.6.12
Spotify api_endpoint_reachable | ok -- | --

Anything in the Supervisor logs that might be useful for us?

No response

Anything in the add-on logs that might be useful for us?

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
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Check SSH connection
[Warn] No valid SSH connection for git@github.com
[Info] Start adding SSH key
[Info] Setup deployment_key on id_ed25519
/run.sh: line 35: /.ssh/id_ed25519: No such file or directory
/run.sh: line 35: /.ssh/id_ed25519: No such file or directory
/run.sh: line 35: /.ssh/id_ed25519: No such file or directory
chmod: /.ssh/config: No such file or directory
chmod: /.ssh/id_ed25519: No such file or directory
[Info] Local git repository exists
[Info] Git origin is correctly set to git@github.com:xx/yy.git
[Info] Start git fetch...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[Error] Git fetch failed
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

Additional information

No response

LordPsycho202 commented 5 months ago

Experiencing the same thing. HA 2023.3.3, all versions match as above.

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
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Check SSH connection
[Warn] No valid SSH connection for git@gitlab.folden-nissen.com
[Info] Start adding SSH key
[Info] Setup deployment_key on id_rsa
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
/run.sh: line 35: /.ssh/id_rsa: No such file or directory
chmod: /.ssh/config: No such file or directory
chmod: /.ssh/id_rsa: No such file or directory
[Info] Local git repository exists
[Info] Git origin is correctly set to git@gitlab.folden-nissen.com:rnissen/ha-config.git
[Info] Start git fetch...
Permission denied, please try again.

Permission denied, please try again.

git@gitlab.folden-nissen.com: Permission denied (publickey,password).

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[Error] Git fetch failed
zipkid commented 5 months ago

The plugin script has not changed in 3 years. It seems to be caused by the $HOME env variable not being set, probably by one of these changes in 7.14.0

derobert commented 5 months ago

Also, just found out, due to the way this addon "handles" errors, that means any attempt to set it up in a recent HA just rm -Rf's the entire configuration and SQLite database.

I restored from backup, so I just lost some history. But should an addon this fragile (and dangerous) really be an official add-on in the add-on store? Seems like it should be removed until fixed and the error handling improved.

TheRealWaldo commented 5 months ago

I also see the same thing; it works fine after reverting (restoring the backup of) 7.13.1.