-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behaviour: failed to dial libvirt #1004
Comments
Digging a little deeper, I have this in my log file:
acl on file file seems to be ok: srwxrwxrwx 1 root root 0 Feb 23 18:29 /var/run/libvirt/libvirt-sock |
What is your sshd configuration ? |
Config file of sshd_config is quite basic : PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no
Subsystem sftp internal-sftp No additional config in .ssh directory user 'user' |
Hi @itwars You need to add the user to libvirt group as follows: for example, in main.tf: Then, on the physical host which you wish to deploy your VM in, you should add the user to libvirt group: You can verify that, by checking it in /etc/group: I hope it will fix your issue. |
Hi @LavBU is actually member of libvirt + qemu |
Hi @itwars If you are able to run this from where terraform is running on towards the remote host: It means you are using SSH key to access the host. Therefore, you should add that SSH key to authorized_keys file for your user that is defined in that host, for example: Should show you that SSH key. Lavi |
Hi @LavBU virshOn the localhost (192.168.10.201) both are ok:
From a remote host (192.168.10.202 to 192.168.10.201) it's ok too:
terraform applyOn the localhostTerraforming from 192.168.10.201 to 192.168.10.201 failed with:
From remote hostIt's OK from 192.168.10.202 to 192.168.10.201 terraform deploy my VM! I know, I know it's an old version
So as a summary:virsh:
terraform:
|
H @itwars try to check the system log when that fail: Lavi |
During the 'apply' I got this error:
Checking my socket, permissions are good?
|
See this for some ideas:
https://askubuntu.com/questions/345218/virt-manager-cant-connect-to-libvirt
From: Vincent RABAH ***@***.***>
Sent: Wednesday, March 8, 2023 4:39 PM
To: dmacvicar/terraform-provider-libvirt ***@***.***>
Cc: Lavi Buchnik ***@***.***>; Mention ***@***.***>
Subject: Re: [dmacvicar/terraform-provider-libvirt] Strange behaviour: failed to dial libvirt (Issue #1004)
@LavBU<https://urldefense.com/v3/__https:/github.com/LavBU__;!!NknhfzgzgQ!wDEE_QKb1GNHzuLCCP-IvXbOP_KiA80ksq0rYHr6uEZNLRx4_5nBLwyGqlopn2GmwbO2o94qDoXcCmnOZkyuiVV7D8p3uw$>
During the 'apply' I got this error:
Mar 8 15:34:24 nodeX1 auth.info sshd[5305]: Accepted publickey for user from 192.168.10.201 port 34474 ssh2: RSA SHA256:xxxxxxxxxxxxx
Mar 8 15:34:24 nodeX1 auth.info sshd[5307]: Received request to connect to path /var/run/libvirt/libvirt-sock, but the request was denied.
Checking my socket, permissions are good?
srwxrwxrwx 1 root root 0 Mar 5 12:33 /var/run/libvirt/libvirt-sock
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/dmacvicar/terraform-provider-libvirt/issues/1004*issuecomment-1460260876__;Iw!!NknhfzgzgQ!wDEE_QKb1GNHzuLCCP-IvXbOP_KiA80ksq0rYHr6uEZNLRx4_5nBLwyGqlopn2GmwbO2o94qDoXcCmnOZkyuiVXfpT2MUw$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A2VNY6EUNECUFQJRNFUVW53W3CKZZANCNFSM6AAAAAAVF6H5HM__;!!NknhfzgzgQ!wDEE_QKb1GNHzuLCCP-IvXbOP_KiA80ksq0rYHr6uEZNLRx4_5nBLwyGqlopn2GmwbO2o94qDoXcCmnOZkyuiVVW31FVvg$>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
Confidentiality note: This e-mail may contain confidential information from Clarivate. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this e-mail is strictly prohibited. If you have received this e-mail in error, please delete this e-mail and notify the sender immediately.
|
Hello @LavBU, I've tested every anwsers without luke... Still stuck! |
I recently came across a similar experience. I needed an SSH key pair that did not have a passphrase. The public key needed to be in the remote user's
|
I can separately confirm that this feature works fine with this provider. We recently upgraded some of our orchestration operating libvirt on remote machines to version 0.7.1 of the provider without any issue (with terraform version 1.2.9). Like MattSnow-amd mentioned, your issue is most likely an ssh setup issue for the user running terraform. You need to ensure that whichever user runs terraform has proper passwordless ssh access to the libvirt user on the remote machine and you need to do this specifically for the environment in which terraform is running (ex: if you run terraform from a container, it may be that the container doesn't have the right ssh keys setup for example). |
Hello,
And I've also rollout every ssh key on all my cluster! OK with my 2 Ubuntu hosts, fail with my 4 Alpine hosts. @Magnitus- : just to refresh the context the issue doesn't exist from remote, it's only happen from local server! |
Hello, |
@itwars Yeah, if you are confident about your ssh setup, it might be an obscure alpine incompatibilities. My understanding is that they use a lot of different lighter dependencies to make everything smaller which I know can cause some compatibility issues from my superficial usage of it in docker containers. Unless specific constraints force my hand, I'm happy to stick with Ubuntu/Debian as it just makes my life a lot simpler operationally (there are just so many things to work on and so little time), so I won't be of much help here but it seems they are well underway to troubleshooting this in the thread you linked. Best of luck. |
Hooray! After digging deeper I've compare /etc/ssh/sshd_config line by line between ubuntu and alpine, and finally found the "guilty" line of configuration. |
On the very host both commands works fine (localhost ip is 192.168.10.201):
When terraforming using it's ok too:
But when terraforming using, it's not good:
The text was updated successfully, but these errors were encountered: