Here's the scenario: your laptop is approaching 13 years of age, the internal NIC has suddenly stopped working, but you don't want to give up here. You uninstall Arch Linux and install Windows 10 just to check that the NIC is actually not functioning anymore—which it isn't. You buy a USB Wi-Fi NIC Adapter, carelessly not checking if the vendor's drivers have been mainlined into the Linux kernel. You boot into an Arch Linux live session and you don't have an internet connection.

Here's what you do next.


  • You need another computer with Arch Linux installed, either on hardware or in a virtual machine, with an internet connection.
  • You need a USB flash drive or other storage device you can easily move between both of these computers.
  • Patience.


Testing the Adapter and Compiling Your Wi-Fi Drivers

Plug the adapter into your Arch Linux computer with an internet connection. Preferably, one without a Wi-FI-capable NIC, but don't worry if you don't have one of these. Open a terminal and type lsusb. You need to find the name of the network adapter device; mine was a NetGear A6150.

Next, open a browser and go to your search engine, searching something like "Netgear A6150 Linux". Hopefully, you find something like this: https://github.com/RinCat/RTL88x2BU-Linux-Driver

The Netgear A6150 (and other devices listed on this Github page) runs on a Realtek driver that has not been included in the kernel (for whatever reason). This package is unlikely to be in your official repositories, so we're going to have to compile it ourselves. Fortunately, this is rarely difficult.

Fortunately, this driver has a well-maintained AUR package that you can see here: https://aur.archlinux.org/packages/rtl88x2bu-dkms-git/

This makes the compilation process a cinch. If you find a driver without an AUR package, you'll need to either write a PKGBUILD yourself or compile it using the repository's instructions. If you can't find a driver for the device at all, you're out of luck, and you'll need to return the network adapter. This is, however, unlikely. At the very least, even without Wi-Fi, you can still get Arch Linux installed by following this guide.

Make a directory such as ~/builds with mkdir and cd into it.

Clone the PKGBUILD repo:

git clone https://aur.archlinux.org/rtl88x2bu-dkms-git.git

(Obviously replacing this URL with the AUR package for your particular Wi-Fi driver)

cd into the cloned directory. Ensure you read the PKGBUILD for a basic sanity check. Run makepkg -si to sync any missing dependencies and install the package. Enter your password after it's done compiling. You'll need to reboot your computer after this as it's a driver loaded by the kernel at boot time.

You should now have an internet connection via Wi-Fi on your computer and you've ensured that the adapter actually works with the right driver. You can try running ip a to check whether the network interface is up and running if you are doing this on a computer that already has a Wi-Fi network adapter. The package we just created and installed is what we're going to install on the old laptop.

Creating a Local Repository

This section has been adapted from https://wiki.archlinux.org/title/Offline_installation

The easiest way to install the necessary packages offline is to create a local repository on a computer with an internet connection. This is where your flash drive comes in. Plug it in and open a partitioning application like GParted or Disks. You could also use fdisk or cfdisk. Backup any data you want to keep and delete the existing partitions. Create one new partition that is ext4. If you don't do this, a lot of packages won't download successfully because exFAT, NTFS, or FAT32 filesystems do not support the characters used in a lot of Arch Linux package names for file names—namely, the colon.

Next, open a terminal, cd into the topmost directory of the flash drive, and create a new directory with mkdir called "packages". This is the directory that we will be using to host our custom package repository.

Create another directory in the topmost directory of the flash drive called "builds" and move your builds directory for the Wi-Fi driver here. We'll use this to install Wi-Fi drivers after we install Arch Linux.

Make another directory called "blankdb" at /tmp/blankdb. We need this directory to ensure that pacman downloads all of the necessary dependencies instead of referencing your host machine's package repository, which already has many packages installed.

Now, we're going to start downloading the necessary packages. Make sure you're in the "packages" directory you just created. The packages that you install with the following command will be based on the dependencies that you need to build for that Wi-Fi driver, but I've also included some of my recommendations. Take note of the listed dependencies in the PKGBUILD, and use the following command as a template:

pacman -Syw --cache-dir . --dbpath /tmp/blankdb base base-devel linux linux-headers dkms bc git systemd mkinitcpio vim grub sudo networkmanager iwd mpv vlc

This command will download these packages and all the required dependencies to your current directory, along with their signature files. Once you're done, delete all of the *.sig files, because we don't need them and they'll cause errors later on:

rm *.sig

Lastly, we need to create the repository database with repo-add. Make sure you're in the "packages" directory and execute the following:

repo-add custom.db.tar.gz ./*

This will add all of the files in the directory to a database called "custom.db.tar.gz", and will create several files prefixed with "custom". Ensure that the command worked and that the database was created. After confirming this, you are ready to unmount the flash drive and start installing Arch Linux offline on your other computer.

Note: Don't worry if you've missed a few packages that you need to install; you can always put the flash drive in again and download more. This is the process you need to follow for rebuilding the repository database (there appear to be other ways, but this is the only one that worked for me): download the necessary packages with the same pacman -Syw command as before, and delete all of the custom* and *.sig files. Then, rebuild the repo with the same repo-add command.

In my experience, if the repo-add script faces any errors, it will not build the database. This is why we delete the .sig files and rebuild the entire database instead of attempting to add the new packages to the repo with repo-add -n, as the script will throw errors with packages that are already in the database.

Installing Arch Linux Offline

Continue installing Arch Linux as normal, skipping the "Connect to the Internet" portion, and stopping right after mounting your drive partitions: https://wiki.archlinux.org/title/Installation_guide.

Now, create a directory called "repo" at /mnt/repo, plug in your flash drive, and mount it at /mnt/repo. Edit /etc/pacman.conf and comment out the core, community, extra repositories so that pacman doesn't try to source packages from those repos. Add your custom repository at the bottom of the config file with:

SigLevel = Optional
Server = file:///mnt/repo/

(Courtesy of Arch Wiki)

Synchronise your packages with the new repository with pacman -Sy. Install the necessary packages using pacstrap:

pacstrap /mnt base base-devel linux linux-headers dkms bc git systemd mkinitcpio vim grub sudo networkmanager iwd mpv vlc

Generate an fstab file using UUIDs with genfstab -U /mnt >> /mnt/etc/fstab, edit it with vim or another command-line editor like nano, and delete the line containing your flash drive's UUID and save the file. We don't need to mount the flash drive at boot; this will just cause boot errors if it's not plugged in when Arch tries to boot.

chroot into the system with:

arch-chroot /mnt

Once you're in the system, edit your /etc/pacman.conf again and comment out the core, extra, and community repositories, and add the same cutsom repository again but this time at file:///repo so that you can use it indefinitely:

SigLevel = Optional
Server = file:///repo/

Proceed with the installation as normal. I recommend ensuring that, at the very least, NetworkManager.service is running on next boot. You can do this by running systemctl enable NetworkManager.service

Installing Your Wi-Fi Drivers

Make sure your flash drive is mounted, copy the "builds" directory to ~/builds, cd into the Wi-Fi driver's directory with the package you created, named something like "package_name.pkg.tar.zst" and execute makepkg --install.

Alternatively, you can use pacman -U package_name.pkg.tar.zst if you want to be explicit.


Hopefully, you can now use your network adapter to connect to your Wi-Fi. If you're using the DKMS version of a driver like I am, you don't need to do anything else because it will be recompiled with every kernel update. Don't delete the package.

However, at some point in the future, the driver may stop working. The driver I use has a -git AUR package which is compiled from the master branch of a git repository that is periodically updated but doesn't necessarily see releases. For this reason, the AUR package doesn't usually need to be updated because it will still pull the latest commit from a git repository. So, if the driver stops working after an update, you'll need to create the package again by following the previous steps in this guide.

Cleaning Up

Edit your /etc/pacman.conf file and uncomment the Core, Community, and Extra repositories. If you don't need it anymore, you can also comment out the Custom repository. You may also want to uncomment the multilib repository. Visit https://archlinux.org/mirrorlist/ and generate a mirrorlist based on your preferences, then copy this mirrorlist into /etc/pacman.d/mirrorlist. Now run pacman -Syyu to ensure your system is synchronised with your chosen remote mirrors.

Troubleshooting: Fixing Pacman After Getting an Internet Connection

When you run pacman -Syyu, you may get an error like "error: could not open file /var/ib/pacman/sync/core.db: Unrecognized archive format". This is easily fixed. With your newfound internet connection, visit https://archlinux.org/mirrorlist/ and generate a mirrorlist based on your preferences.

Copy the mirrorlist you generated and paste it into /etc/pacman.d/mirrorlist.

Run pacman -Syyu, and you should now be able to install packages from the mirrors in your mirrorlist.

You may need to delete the .db files at /var/lib/pacman/sync as well if you continue to get errors.


  • No comments available
Comments are closed
Got A Question