Skip to content

Ns81000/Realtek-RTW89-Wi-Fi-Driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Realtek RTW89 Wi-Fi Driver Installer for Kali Linux

Kali Linux Bash License Status

πŸš€ Overview

This is a definitive, automated installation script for Realtek RTW89 series Wi-Fi drivers, specifically optimized and tested for Kali Linux. The script was developed after extensive troubleshooting and combines all successful installation steps into a single, reliable solution.

🎯 What This Script Does

The script automates the complete installation process:

  1. System Preparation: Updates Kali Linux and installs all required dependencies
  2. Source Download: Clones the latest RTW89 driver source code
  3. Intelligent Compilation: Automatically detects and patches known compilation errors
  4. Clean Installation: Performs manual driver installation to avoid installer bugs
  5. Bug Fixes: Corrects known driver filename issues
  6. Driver Activation: Loads and verifies the newly installed driver

πŸ“‹ Supported Hardware

This script supports Realtek RTW89 series Wi-Fi adapters, including:

  • RTL8851BE (Primary target)
  • RTL8852AE
  • RTL8852BE
  • RTL8852CE
  • Other RTW89 series adapters

πŸ”§ Requirements

System Requirements

  • Kali Linux (2023.x or newer recommended)
  • Root/sudo access (required for driver installation)
  • Active internet connection (for downloading dependencies and source code)
  • Minimum 1GB free disk space

Pre-Installation Check

Before running the script, verify your Wi-Fi adapter:

lspci | grep -i wireless
# or
lsusb | grep -i realtek

πŸ“₯ Download & Installation

Method 1: Direct Download

# Navigate to your desired directory
cd ~/Downloads

# Download the script
wget https://raw.githubusercontent.com/Ns81000/Realtek-RTW89-Wi-Fi-Driver/main/install_wifi_final.sh

# Make it executable
chmod +x install_wifi_final.sh

Method 2: Clone Repository

# Clone the entire repository
git clone https://github.com/Ns81000/Realtek-RTW89-Wi-Fi-Driver.git
cd Realtek-RTW89-Wi-Fi-Driver

# Make the script executable
chmod +x install_wifi_final.sh

Method 3: Manual Creation

  1. Copy the script content from install_wifi_final.sh
  2. Create a new file: nano install_wifi_final.sh
  3. Paste the content and save
  4. Make executable: chmod +x install_wifi_final.sh

πŸš€ Usage

Quick Start

# Run with sudo privileges
sudo ./install_wifi_final.sh

Step-by-Step Execution

  1. Open Terminal in Kali Linux
  2. Navigate to the script directory:
    cd /path/to/script/directory
  3. Execute the script:
    sudo ./install_wifi_final.sh
  4. Follow the on-screen prompts
  5. Reboot when installation completes:
    sudo reboot

πŸ“Š Installation Process Details

Phase 1: System Preparation (2-5 minutes)

  • Updates package repositories
  • Upgrades existing packages
  • Installs build-essential, git, kernel headers
  • Installs firmware-realtek package

Phase 2: Source Code Management (1-2 minutes)

  • Removes any existing RTW89 directories
  • Clones fresh source code from lwfinger/rtw89
  • Prepares compilation environment

Phase 3: Intelligent Compilation (2-3 minutes)

  • Attempts initial compilation
  • Auto-detects common compilation errors
  • Automatically patches known issues in mac80211.c
  • Recompiles with fixes applied

Phase 4: Manual Installation (1 minute)

  • Creates proper system directories
  • Copies compiled drivers to system location
  • Fixes filename bugs (renames rtw_.ko to rtw89.ko)
  • Updates module dependencies

Phase 5: Activation & Verification (30 seconds)

  • Loads the rtw89_8851be driver
  • Verifies driver is active
  • Provides success confirmation

πŸ” Technical Details

Key Features

  • Error-Resilient: Continues execution even if intermediate steps fail
  • Intelligent Patching: Automatically fixes known compilation issues
  • Clean Installation: Bypasses problematic automated installers
  • Comprehensive Logging: Color-coded output for easy troubleshooting
  • Safety Checks: Validates root privileges and system compatibility

Files Modified/Created

/lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtw89/
β”œβ”€β”€ rtw89core.ko
β”œβ”€β”€ rtw89pci.ko
β”œβ”€β”€ rtw898851be.ko
└── [other driver files]

Automatic Patches Applied

The script automatically fixes this common compilation error:

// Original (causes error):
static void rtw89_ops_stop(struct ieee80211_hw *hw

// Patched (works correctly):
static void rtw89_ops_stop(struct ieee80211_hw *hw, bool changed)

πŸ› οΈ Troubleshooting

Common Issues & Solutions

❌ "Permission Denied" Error

Solution: Ensure you're running with sudo:

sudo ./install_wifi_final.sh

❌ "Command Not Found" Errors

Solution: Update package lists and install missing dependencies:

sudo apt update
sudo apt install build-essential git

❌ "No Space Left on Device"

Solution: Free up disk space:

sudo apt autoremove
sudo apt autoclean

❌ Compilation Fails

Solution: Install kernel headers for your specific kernel:

sudo apt install linux-headers-$(uname -r)

❌ Driver Loads But Wi-Fi Still Not Working

Solution:

  1. Reboot your system: sudo reboot
  2. Check if firmware is properly installed: sudo apt install firmware-realtek
  3. Verify driver is loaded: lsmod | grep rtw89

❌ Wi-Fi Stops Working After Kernel Update

Problem: Kernel updates remove custom-installed drivers as they're tied to specific kernel versions.

Solution: Reinstall the driver after any kernel update:

# 1. Remove old driver files
sudo rm -rf /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtw89/

# 2. Run the installation script again
sudo ./install_wifi_final.sh

# 3. Reboot
sudo reboot

Prevention: After every apt upgrade that includes kernel updates, remember to reinstall this driver.

Verification Commands

# Check if driver is loaded
lsmod | grep rtw89

# Check Wi-Fi interfaces
ip link show

# Check NetworkManager status
systemctl status NetworkManager

# View kernel messages
dmesg | grep rtw89

πŸ“‹ Post-Installation

Immediate Steps

  1. Reboot your system (highly recommended)
  2. Enable Wi-Fi in network settings
  3. Connect to your wireless network

⚠️ Important: Dual Boot Systems

Critical Notice for Dual Boot Users: If you're running Kali Linux in a dual boot configuration with another operating system (Windows, macOS, or another Linux distribution):

Before booting into Kali Linux:

  1. If you previously booted into your other operating system
  2. Completely shutdown your computer (don't use restart)
  3. Wait for 1 minute after shutdown
  4. Then boot into Kali Linux

Why this is necessary:

  • Other operating systems may leave the Wi-Fi hardware in an inconsistent state
  • A complete shutdown ensures proper hardware reset
  • The 1-minute wait allows capacitors to discharge completely
  • This prevents driver initialization conflicts

Symptoms if you skip this step:

  • Wi-Fi adapter not detected
  • Driver loads but no networks visible
  • Intermittent connection issues
  • Hardware appearing as "disabled" in system settings

Important: Kernel Updates

⚠️ Critical Notice: After any kernel update (via apt upgrade or apt dist-upgrade), you must reinstall this driver. Kernel updates will remove the custom-installed Wi-Fi driver.

After kernel updates:

  1. Delete old driver: sudo rm -rf /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtw89/
  2. Run installation script again: sudo ./install_wifi_final.sh
  3. Reboot: sudo reboot

Verification

After reboot, verify installation:

# Check loaded modules
lsmod | grep rtw89

# Check available interfaces
iwconfig

# Test connectivity
ping -c 4 google.com

πŸ”„ Uninstallation

To remove the installed driver:

# Remove driver files
sudo rm -rf /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtw89/

# Update module dependencies
sudo depmod -a

# Reboot
sudo reboot

🀝 Contributing

Reporting Issues

If you encounter problems:

  1. Run the script with verbose output
  2. Collect system information: uname -a and lspci
  3. Include full error messages
  4. Specify your Kali Linux version

πŸ“ž Support

Resources

Before Seeking Help

  1. Read this entire README
  2. Try the troubleshooting steps
  3. Check if your hardware is supported
  4. Verify you're using a supported Kali version

βš–οΈ License

This script is provided as-is for educational and practical purposes. The underlying RTW89 driver source code follows its original license terms.

⚠️ Disclaimer

  • Backup your system before running the script
  • This script modifies system kernel modules
  • Test in a virtual machine first if possible
  • Use at your own risk on production systems

Made with ❀️ for the Kali Linux community

About

Realtek RTW89 Wi-Fi Driver Installer for Kali Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages