mirror of
https://github.com/smittix/intercept.git
synced 2026-05-28 10:44:45 -07:00
fix: Remove apt rtl-sdr conflict and always unload DVB modules on Pi
Two bugs caused RTL-SDR dongles to be deaf after setup on Raspberry Pi: 1. The apt `rtl-sdr` package was left installed alongside the Blog drivers, creating a binary/library ambiguity. Anything linking or calling the apt binaries in /usr/bin used the non-V4-aware library from /usr/lib instead of the Blog drivers in /usr/local. Fix: remove the apt package immediately after a successful Blog driver build. 2. `blacklist_kernel_drivers_debian` returned early with "already present" without ever running `modprobe -r`, so dvb_usb_rtl28xxu could remain loaded and hold the device in DVB mode (rtl_test sees the USB device but the tuner is unconfigured). Fix: always run the module unload loop regardless of whether the blacklist file is new. Also add `update-initramfs -u` so the blacklist survives reboots. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
33
setup.sh
33
setup.sh
@@ -1315,6 +1315,16 @@ install_rtlsdr_blog_drivers_debian() {
|
|||||||
$SUDO udevadm trigger || true
|
$SUDO udevadm trigger || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove the apt rtl-sdr package to prevent binary/library conflicts.
|
||||||
|
# The apt package installs to /usr/bin and /usr/lib; keeping it alongside
|
||||||
|
# the Blog drivers (in /usr/local) causes ambiguity and can silently
|
||||||
|
# result in the wrong (non-V4-aware) library being loaded.
|
||||||
|
if dpkg -l rtl-sdr 2>/dev/null | grep -q "^ii"; then
|
||||||
|
info "Removing apt rtl-sdr package to prevent library conflicts with Blog drivers..."
|
||||||
|
$SUDO apt-get remove -y rtl-sdr >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
$SUDO ldconfig
|
||||||
|
|
||||||
ok "RTL-SDR Blog drivers installed successfully."
|
ok "RTL-SDR Blog drivers installed successfully."
|
||||||
info "These drivers provide improved support for RTL-SDR Blog V4 and other devices."
|
info "These drivers provide improved support for RTL-SDR Blog V4 and other devices."
|
||||||
warn "Unplug and replug your RTL-SDR devices for the new drivers to take effect."
|
warn "Unplug and replug your RTL-SDR devices for the new drivers to take effect."
|
||||||
@@ -1348,24 +1358,35 @@ blacklist_kernel_drivers_debian() {
|
|||||||
|
|
||||||
if [[ -f "$blacklist_file" ]]; then
|
if [[ -f "$blacklist_file" ]]; then
|
||||||
ok "RTL-SDR kernel driver blacklist already present"
|
ok "RTL-SDR kernel driver blacklist already present"
|
||||||
return 0
|
else
|
||||||
fi
|
info "Blacklisting conflicting DVB kernel drivers..."
|
||||||
|
$SUDO tee "$blacklist_file" >/dev/null <<'EOF'
|
||||||
info "Blacklisting conflicting DVB kernel drivers..."
|
|
||||||
$SUDO tee "$blacklist_file" >/dev/null <<'EOF'
|
|
||||||
# Blacklist DVB-T drivers to allow rtl-sdr to access RTL2832U devices
|
# Blacklist DVB-T drivers to allow rtl-sdr to access RTL2832U devices
|
||||||
blacklist dvb_usb_rtl28xxu
|
blacklist dvb_usb_rtl28xxu
|
||||||
blacklist rtl2832
|
blacklist rtl2832
|
||||||
blacklist rtl2830
|
blacklist rtl2830
|
||||||
blacklist r820t
|
blacklist r820t
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# Unload modules if currently loaded
|
# Always unload modules if currently loaded — this must happen even on
|
||||||
|
# re-runs where the blacklist file already exists, since the modules may
|
||||||
|
# still be live from the current boot (e.g. blacklist wasn't in initramfs).
|
||||||
|
local unloaded=false
|
||||||
for mod in dvb_usb_rtl28xxu rtl2832 rtl2830 r820t; do
|
for mod in dvb_usb_rtl28xxu rtl2832 rtl2830 r820t; do
|
||||||
if lsmod | grep -q "^$mod"; then
|
if lsmod | grep -q "^$mod"; then
|
||||||
$SUDO modprobe -r "$mod" 2>/dev/null || true
|
$SUDO modprobe -r "$mod" 2>/dev/null || true
|
||||||
|
unloaded=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
$unloaded && info "Unloaded conflicting DVB kernel modules from current session."
|
||||||
|
|
||||||
|
# Bake the blacklist into the initramfs so it survives reboots on
|
||||||
|
# Raspberry Pi OS / Debian (without this the modules can reload on boot).
|
||||||
|
if cmd_exists update-initramfs; then
|
||||||
|
info "Updating initramfs to persist driver blacklist across reboots..."
|
||||||
|
$SUDO update-initramfs -u >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
ok "Kernel drivers blacklisted. Unplug/replug your RTL-SDR if connected."
|
ok "Kernel drivers blacklisted. Unplug/replug your RTL-SDR if connected."
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user