Linux Hardware Hotplug Events: Optimizing GPU Detection for Ollama & LM Studio

TL;DR Linux hardware hotplug events let your system detect and configure GPUs automatically when they appear or change state. For local LLM deployments with Ollama and LM Studio, proper hotplug handling ensures your models can leverage GPU acceleration without manual intervention after driver updates, system reboots, or hardware changes. The kernel’s udev subsystem monitors hardware events and triggers rules stored in /etc/udev/rules.d/. When a GPU appears, udev can restart services, update environment variables, or notify applications. For Ollama running as a systemd service, a udev rule can trigger a service restart when NVIDIA or AMD GPUs become available, ensuring the OLLAMA_NUM_GPU environment variable reflects the current hardware state. ...

March 6, 2026 · 9 min · Local AI Ops
Buy Me A Coffee