cannot create VM - [EFAULT] Failed to connect to libvirt

ruhakan

Cadet
Joined
Jan 29, 2024
Messages
3
Version: TrueNAS-SCALE-23.10.1.3
long story short - trying to create a VM on truenas scale. The first VM ever.
creation fails. below tested to create the most simple VM config.
all troubleshooting guides i came across are not valid for version 23. So running out of ideas.

...please help :)

1706781918672.png


1706781937451.png


Error: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 201, in call_method
result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1342, in _call
return await methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/service/crud_service.py", line 169, in create
return await self.middleware._call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1342, in _call
return await methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/service/crud_service.py", line 194, in nf
rv = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 44, in nf
res = await f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 177, in nf
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vms.py", line 198, in do_create
await self.middleware.run_in_thread(self._check_setup_connection)
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1254, in run_in_thread
return await self.run_in_executor(self.thread_pool_executor, method, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1251, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/connection.py", line 71, in _check_setup_connection
self._check_connection_alive() File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/connection.py", line 66, in _check_connection_alive
raise CallError('Failed to connect to libvirt') middlewared.service_exception.CallError: [EFAULT] Failed to connect to libvirt
1706782260934.png
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
Unfortunately I don't know what happened to the jira ticket. Seems like it was deleted?
 

SKiZZ

Dabbler
Joined
Feb 17, 2022
Messages
27
I had the same issue and it turned out to be too many files opened because I worked on setting up apps first before any virtualization. I used these settings.

 
Last edited:

ruhakan

Cadet
Joined
Jan 29, 2024
Messages
3
That did it! Thank you guys.

just to recap:
I set those sysctl values:
sudo sysctl -w fs.inotify.max_user_watches=1048576;sudo sysctl -w fs.inotify.max_user_instances=8192;sudo sysctl -w vm.max_map_count=524288;
and then set the ACL as SKiZZ pointed out.

VM creation works now.
 

SKiZZ

Dabbler
Joined
Feb 17, 2022
Messages
27
That did it! Thank you guys.

just to recap:
I set those sysctl values:

and then set the ACL as SKiZZ pointed out.

VM creation works now.
I think you'll need to do the below for it be persistant. The sudo command makes it so you dont have to reboot.

1706973901407.png
 
Last edited:
Top