Skip to content
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

Error: failed to connect to the hypervisor #4

Open
S4nfs opened this issue Nov 13, 2021 · 9 comments
Open

Error: failed to connect to the hypervisor #4

S4nfs opened this issue Nov 13, 2021 · 9 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@S4nfs
Copy link

S4nfs commented Nov 13, 2021

I don't know what's causing this error but i have all dependencies installed related with the server and PHP

sudo apt install libvirt-bin virtinst libguestfs-tools php-cli php-gd php-xml php-json
AND
sudo apt install ucspi-tcp

My Dist: Ubuntu 18.4 LTS, Apache Server

Firefox_Screenshot_2021-11-13T13-01-30 197Z

@Jiab77 Jiab77 added the good first issue Good for newcomers label Nov 16, 2021
@Jiab77
Copy link
Owner

Jiab77 commented Nov 16, 2021

Hello @S4nfs, thanks a lot for your interest in my project. Could you please paste the complete error message here?

In the meantime, I'll look at the code and see what could be the cause. Just like that I would say that one of the libvirt related service is not running... 🤔

Can you additionally run this command on the server and make sure that all the related services are running correctly?

$ systemctl status libvirt-bin.service libvirt-guests.service libvirtd.service -l

Last thing about what you've mentioned to have installed ucspi-tcp. This package is not required if you are running PHP version 7.4.x and above. So feel free to remove it.

Maybe what I wrote as documentation was confusing, let me know if that was the case.

Thanks in advance for your help and again for your interest in my project.

Jiab77 added a commit that referenced this issue Nov 17, 2021
 - 📝 Improved install / usage instructions
 - 💡 Added deprecation notice in comments
 - ➖ Dropped support of `tcpserver`
 - This will make the local server much faster on remote access
@S4nfs
Copy link
Author

S4nfs commented Nov 18, 2021

@Jiab77 i really love ur work as i have been working on a similar kinda project & thanks for updating the documentation but i think it's just some another issue.

Here's the error shown in the img:

error: failed to connect to the hypervisor
error: Cannot create user runtime directory '/var/www/.cache/libvirt': Permission denied

PS: Also mine was deployed on the same server with the all those permissions and dependencies.

@Jiab77
Copy link
Owner

Jiab77 commented Nov 18, 2021

@S4nfs, huge thanks for your appreciation of my work. I wish I could spend more time on my projects so that I could finish them and improve them from time to time 😅

Thanks a lot for providing me the full error message. In this case I think you're right and it's not something I could test on my side 'cause I'm only relying on the PHP embedded web server to run the web interface.

Regarding the deployment, I got two working deployments using the PHP embedded web server and then just using the script start-web-server.sh to fire it up. So, I got a local deployment and a remote deployment on a small dedicated server. That's why I didn't encountered similar issues as you did.

What I don't understand in your case is why apparently libvirt is trying to write into your apache web folder under a .cache/libvirt subfolder...

Just to make sure that the issue is not in the code / to isolate it correctly, could you please just try running the script start-web-server.sh and see if you get the same issue?

Otherwise, if you can't, what you can do would be to create that /var/www/.cache folder and set it temporarily to chmod 777 and see under which user the libvirt folder got created. Once done, try to restrict write access to only the related user used to create that libvirt folder.

Also, I don't think that having deployed everything on the same host would be an issue. Basically if you check the code, I'm simply calling the libvirt binaries like virsh, parsing the output and render it in the web interface. And as I just deployed the code in the $HOME folder, I didn't had the same permission issues you had.

I'll try to setup a VM with apache + the nested virtualization enabled and do some tests to understand what caused your issue, debug it and then document my findings + workarounds if possible.

Thanks again for having took the time to report your issue 🙇🏽

@S4nfs
Copy link
Author

S4nfs commented Nov 18, 2021

Firefox_Screenshot_2021-11-18T16-40-15 923Z

Error:

error: failed to connect to the hypervisor
error: Cannot recv data: Connection reset by peer

It do create some files under /.cache/libvirt

Screenshot (38)

I'll figure it out if something's wrong by my side and update you.

@Jiab77
Copy link
Owner

Jiab77 commented Nov 18, 2021

@S4nfs, that's interesting and thank you for sharing details from your side. It's clearly something I didn't experienced 'cause not having used apache as you did but it's something I must document so I'll do the necessary tests too 😉

@Jiab77
Copy link
Owner

Jiab77 commented Nov 18, 2021

Btw, I just checked the progress made by Cockpit and I'm not really sure I should keep working on this project... I made it when Cockpit was still at it's beginning but now, it's already covering what I wanted to achieve.

The only, if I may say "advantage" of my project would be that it does not need a lot of resources and don't alter much the host where it will be deployed where Cockpit is a much bigger solution but covers much more things and certainly much better than I did.

The other reason why this project seemed staled was because I wanted to redraw the web interface under another framework called Fomantic-UI but I could not find enough time to finish the work...

So, at some point if you find that it will ask you too much efforts to make my project working on your server, you should probably try Cockpit then. It should work by default with your current setup.

@mac2net
Copy link

mac2net commented Aug 27, 2023

Just came across this. Yes Cockpit is good, if you are running Linux.

There are reasons to run this from a Mac and in that situation Cockpit is unavailable and the currently available solutions for MacOS do not directly use or manage the open source setup. UTM is the closest but it is based on a fork of Qemu.

@Jiab77
Copy link
Owner

Jiab77 commented Nov 7, 2023

@mac2net I did some research and found a project much more advanced than mine and kinda use the same ideas as mine but in way better 😅

This project is called webvirt made by @kevr.

I haven't tested it but I think you should give it a try and if it does not work for you and only mine does, then I might take the time to improve it and fix existing bugs.

What @kevr made is very advanced but much bigger than what I wanted to do.

My goals are primarilly to offer something light, easy to run and that can run mostly everywhere php and libvirt can be installed in a standalone way.

@Jiab77
Copy link
Owner

Jiab77 commented Nov 7, 2023

@mac2net I forgot that there is another project that follow the same philosophy as mine but it's written in C++ instead of PHP.

This project is called Virtlyst made by @cutelyst.

I haven't tested it neither so I can't tell you if both projects are good or not.

@Jiab77 Jiab77 self-assigned this Nov 7, 2023
@Jiab77 Jiab77 pinned this issue Nov 7, 2023
@Jiab77 Jiab77 unpinned this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants