semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Problem: Failed to install inventory: parsing private key: ssh: no key found

Open sfenzke opened this issue 1 year ago • 8 comments

Issue

My tasks fail while trying to install the inventory. I am using not using additional runners so all tasks are run locally.

Impact

Ansible (task execution)

Installation method

Docker

Database

BoltDB

Browser

Chrome, Safari

Semaphore Version

2.10.7

Ansible Version

No response

Logs & errors

task output:

4:16:35 PM
Task 2147483635 added to queue
4:16:37 PM
Started: 2147483635
4:16:37 PM
Run TaskRunner with template: deploy_app_FKB
4:16:37 PM
Preparing: 2147483635
4:16:37 PM
Updating Repository https://bitbucket.adesso-group.com/scm/acid/deployment.git
4:16:37 PM
From https://bitbucket.adesso-group.com/scm/acid/deployment
4:16:37 PM
 * branch            main       -> FETCH_HEAD
4:16:38 PM
Already up to date.
4:16:38 PM
Failed to install inventory: parsing private key: ssh: no key found
4:16:38 PM
Running playbook failed: parsing private key: ssh: no key found 

docker compose -p semaphore logs:

semaphore  | No additional system dependencies to install
semaphore  | No additional python dependencies to install
semaphore  | Starting semaphore server
semaphore  | Loading config
semaphore  | Validating config
semaphore  | BoltDB /var/lib/semaphore/database.boltdb
semaphore  | Tmp Path (projects home) /tmp/semaphore
semaphore  | Semaphore v2.10.7-6bcf476-1718821016
semaphore  | Interface
semaphore  | Port :3000
semaphore  | Server is running
semaphore  | time="2024-06-21T14:16:35Z" level=info msg="Task 2147483635 added to queue"
semaphore  | time="2024-06-21T14:16:37Z" level=info msg="Set resource locker with TaskRunner 2147483635"
semaphore  | time="2024-06-21T14:16:37Z" level=info msg="Task 2147483635 removed from queue"
semaphore  | time="2024-06-21T14:16:38Z" level=info msg="Stopped running TaskRunner 2147483635"
semaphore  | time="2024-06-21T14:16:38Z" level=info msg="Release resource locker with TaskRunner 2147483635"

Manual installation - system information

No response

Configuration

Task Configuration: image

Additional information

No response

sfenzke avatar Jun 21 '24 14:06 sfenzke

Please try v2.10.8-beta.

fiftin avatar Jun 21 '24 19:06 fiftin

I bumped there Version up to 2.10.8-bet as suggested but unfortunately I still hav the same issue.

12:21:05 PM
Task 2147483634 added to queue
12:21:06 PM
Started: 2147483634
12:21:06 PM
Run TaskRunner with template: deploy_app_FKB
12:21:06 PM
Preparing: 2147483634
12:21:06 PM
Cloning Repository https://bitbucket.adesso-group.com/scm/acid/deployment.git
12:21:06 PM
Cloning into 'repository_1_3'...
12:21:18 PM
Failed to install inventory: parsing private key: ssh: no key found
12:21:18 PM
Running playbook failed: parsing private key: ssh: no key found

sfenzke avatar Jun 24 '24 10:06 sfenzke

Please try to re-enter your keys. Looks like it is broken. It is not first report but I can't reproduce.

fiftin avatar Jun 25 '24 06:06 fiftin

Hello @fiftin,

I tried to do this. I even did a clean redeploy of Version 2.10.8-beta but unfortunately I still have the same issue.

Greeting

sfenzke avatar Jun 27 '24 10:06 sfenzke

any solution here? i have exactly the same problem: Failed to install inventory: parsing private key: ssh: no key found I installed as docker, also local, every time the same

image: docker.io/semaphoreui/semaphore:v2.10.11

rbagia avatar Jul 14 '24 07:07 rbagia

Same issue for me on v2.10.11-d31ebd3-1719395023

hyperbu42 avatar Jul 16 '24 20:07 hyperbu42

Same issue for me on v2.10.11-d31ebd3-1719395023

Igore this - I was creating a new automation user and messed up the format of the private key (with passphrase) when exporting from PuttyGen

hyperbu42 avatar Jul 16 '24 20:07 hyperbu42

Update: Disregard, I was originally making my ssh keys in my password manager, which seems to be the issue. I remade on my Mac with ssh-keygen and those worked perfectly.

~~I've running into the same issue on Semaphore v2.10.22-e44910d-1721658299 with docker and using the RPM on Rocky 9.4.~~

12:25:22 PM Task 2147483644 added to queue
12:25:25 PM Started: 2147483644
12:25:25 PM Run TaskRunner with template: FOO
12:25:25 PM Preparing: 2147483644
12:25:25 PM Cloning Repository ***************************************
12:25:25 PM Failed updating repository: parsing private key: ssh: no key found
12:25:25 PM Running app failed: parsing private key: ssh: no key found

~~I've tried making new keys and re-writing keys, but have the same message. I can see with boltbrowser that the entries for my SSH keys are getting made.~~

~~I am able to update the inventory if I use Login with Password.~~ ~~But I get the same message when trying to download repo with the playbook. I can get around that if the repo via HTTPS (no password) and local paths.~~

~~I've tried a few different configs, but here is the latest attempt:~~ ~~Config file:~~

{
        "mysql": {
                "host": "",
                "user": "",
                "pass": "",
                "name": "",
                "options": null
        },
        "bolt": {
                "host": "/tmp/database.boltdb",
                "user": "",
                "pass": "",
                "name": "",
                "options": null
        },
        "postgres": {
                "host": "",
                "user": "",
                "pass": "",
                "name": "",
                "options": null
        },
        "dialect": "bolt",
        "port": "3000",
        "interface": "",
        "tmp_path": "/tmp/semaphore",
        "ssh_config_path": "",
        "git_client": "",
        "web_host": "",
        "cookie_hash": "*******************",
        "cookie_encryption": "*******************",
        "access_key_encryption": "*******************",
        "email_alert": false,
        "email_sender": "",
        "email_host": "",
        "email_port": "",
        "email_username": "",
        "email_password": "",
        "email_secure": false,
        "ldap_enable": false,
        "ldap_binddn": "",
        "ldap_bindpassword": "",
        "ldap_server": "",
        "ldap_searchdn": "",
        "ldap_searchfilter": "",
        "ldap_mappings": {
                "dn": "",
                "mail": "",
                "uid": "",
                "cn": ""
        },
        "ldap_needtls": false,
        "telegram_alert": false,
        "telegram_chat": "",
        "telegram_token": "",
        "slack_alert": false,
        "slack_url": "",
        "rocketchat_alert": false,
        "rocketchat_url": "",
        "microsoft_teams_alert": false,
        "microsoft_teams_url": "",
        "oidc_providers": null,
        "max_task_duration_sec": 0,
        "max_tasks_per_template": 0,
        "max_parallel_tasks": 0,
        "runner_registration_token": "",
        "password_login_disable": false,
        "non_admin_can_create_project": false,
        "use_remote_runner": false,
        "runner": {
                "api_url": "",
                "registration_token": "",
                "config_file": "",
                "one_off": false,
                "webhook": "",
                "max_parallel_tasks": 0
        },
        "global_integration_alias": "",
        "apps": null
 }

elliotnev27 avatar Jul 25 '24 17:07 elliotnev27

i think this is still an issue. i can generate keys with ssh-keygen -t ed25519 -C "[email protected]" and test with ssh -T [email protected] with sucess on ubuntu server terminal however after adding the contents of the .pub to ansible and github the issue persists

tomshomelab avatar Oct 29 '24 18:10 tomshomelab

I am using docker (latest) and in case this helps narrow down the issue from inside semaphore container I cannot ssh to github using same key that works fine on the docker host :

docker exec -it docker-compose-semaphore-1 /bin/bash
1584dc648854:~$ semaphore version
v2.10.32-f33944e-1729509436
1584dc648854:~$ mkdir -p .ssh && cd .ssh
1584dc648854:~/.ssh$ echo 'ssh-ed25519 <REDACTED>
> ' > gh.pub
1584dc648854:~/.ssh$ echo '-----BEGIN OPENSSH PRIVATE KEY-----
<REDACTED>
-----END OPENSSH PRIVATE KEY-----
' > gh
1584dc648854:~/.ssh$ ssh -T [email protected]
The authenticity of host 'github.com (20.26.156.215)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
[email protected]: Permission denied (publickey).
1584dc648854:~/.ssh$ chmod 400 gh*
1584dc648854:~/.ssh$ ssh-add ~/.ssh/gh.pub
Error loading key "/home/semaphore/.ssh/gh.pub": error in libcrypto
1584dc648854:~/.ssh$ ssh-add ~/.ssh/gh
Error loading key "/home/semaphore/.ssh/gh": error in libcrypto
1584dc648854:~/.ssh$ ssh -T [email protected]
[email protected]: Permission denied (publickey).

EDIT : while I did not manage to SSH from inside the container - my mistake in semaphore key is I had added the public key - no issue once I added the private key...

jguay avatar Nov 01 '24 22:11 jguay