LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

fix(install/gpu):Fix docker not being able to leverage the GPU on systems that have SELinux Enforced

Open Bloodis94 opened this issue 7 months ago • 2 comments

Description

Tested on a fresh Fedora Cloud Edition VM with a fresh seed.iso (nocloud), with the prerequisite of having docker and lspci installed now the script bring the VM from 0 to full GPU acceleration.

This fix include:

  • Introduced a function to enable SELinux container_use_devices boolean for GPU access in containers.
  • Configured NVIDIA Container Runtime in Docker and ensured the runtime is activated by restarting Docker.
  • Applied changes conditionally for relevant distributions like Fedora, RHEL, CentOS, Rocky, and openSUSE.
  • Added a user confirmation prompt for enabling SELinux changes to address security implications.

This PR fixes # Docker not being able to access an Nvidia GPU and failing with: Failed to initialize NVML: Insufficient Permissions

Signed commits

  • [x] Yes, I signed my commits.

Bloodis94 avatar Apr 26 '25 16:04 Bloodis94

Deploy Preview for localai ready!

Name Link
Latest commit 40883c410db074bd887753c903f7717d5be7241c
Latest deploy log https://app.netlify.com/sites/localai/deploys/680e229926dc120008f71f0b
Deploy Preview https://deploy-preview-5252--localai.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 26 '25 16:04 netlify[bot]

Spotted a string that i forgot to change in the new function, will fix later

Bloodis94 avatar Apr 26 '25 19:04 Bloodis94

That's nice, thanks for your contribs @Bloodis94 !

I just had some time on my hands and a dream :smile:, by the way i fixed the typo and the PR is again ready for review

Bloodis94 avatar Apr 27 '25 12:04 Bloodis94