SARPi Project - Slackware ARM on a Raspberry Pi


Setting up a wireless network connection on Slackware ARM on a Raspberry Pi

This SARPi mini-project will enable you to setup and configure a wireless network connection using Slackware ARM on a Raspberry Pi. This would suit users in locations where connecting to the network via an Ethernet cable is inconvenient or simply not an option, or if you just want to connect wirelessly as an alternative.

This mini-project will take you through finding out the make/model/version of a USB wireless network adapter if it is unknown, finding out which driver(s) will be required to run a USB wireless network adapter, configuring and setting up a USB wireless network adapter on a Raspberry Pi or (where applicable) configuring and setting up the on-board wireless network interface controller (WNIC) on a Raspberry Pi, installing drivers for a USB wireless network adapter (if required - because Slackware ARM might already include them), loading/removing wireless driver modules, configuring 'NetworkManager' to connect to a wireless network (WLAN), and setting a udev rule for wireless network interface predictable naming.

What's the best wireless solution on the Raspberry Pi?

The Raspberry Pi 3, and later versions, comes with an on-board wireless network adapter (WNIC). So, an additional 'plug-in' USB adapter is not a prerequisite to use a wireless network connection. Although the range and performance of the on-board wireless WNIC on the Raspberry Pi 3 and later versions is generally somewhat lesser than that of many alternative 'plug-in' USB wireless network adapters, you may benefit from doing some testing based on your own hardware and setup. If the wireless router or access point is only a few meters away from your Raspberry Pi then it might not matter. However, you will require a USB wireless network adapter for the Raspberry Pi (1) and 2, as neither of these devices feature an on-board wireless network interface controller (WNIC). Be aware that results can vary from one USB wireless network adapter to another, even when utilising the same chipset. The way of determining which USB wireless network adapter is best suited for your purposes is through a "trial and error" process of experimenting until you find the one which is most successful.

The reason why we cannot say "Use the 'XxXxX' USB wireless network adapter for the best results!" is because there are so many variables and permutations involved in setting up a wireless connection that we couldn't possibly endorse one over the other without testing and comparing results for each and every situation. Imagine what a task that would be! :-P

Wireless, WLAN, Wi-Fi, explained

In networking terminology, 'wireless' is a term used to describe a computer that has no physical wired (e.g. Ethernet cable) connection to the network but is connected via radio waves to maintain communications. A wireless local area network (WLAN) is a term that describes two or more devices which are linked by using wireless networking methods. Wireless networking utilizes specific equipment such as wireless network interface controllers (WNIC), access points (AP), and routers, in place of cables for connectivity. Many people (experts and professionals included) refer to wireless networking as 'Wi-Fi'. However, Wi-Fi® is just one of many trademarked brand names of the Wi-Fi Alliance which includes popular wireless networking technologies that use radio waves to provide high-speed Internet and network connections. 'Wi-Fi' is simply a trademarked phrase that conforms to IEEE 802.11 standards and it's worth noting that not all wireless networking technology is 'Wi-Fi certified™'. A popular misconception is that the term 'Wi-Fi' is short for "wireless fidelity" (due to similarities with the term 'Hi-Fi', which refers to the high-quality reproduction of sound by audiophiles and home audio enthusiasts) which has nothing what-so-ever to do with 'Wi-Fi' but seems to be an easy, and common, mistake to make.

What you will need for this mini-project

• A Raspberry Pi running Slackware ARM.
• A USB wireless network adapter, similar to these or these (NB: only if you're not using the Raspberry Pi's on-board WNIC).
• An understanding of your USB wireless network adapter make/model/chipset (if applicable - see line above).
• Linux drivers for your USB wireless network adapter (NB: only if Slackware ARM doesn't already include them).
• The SSID and password of the wireless network (WLAN) that you'll be connecting to.

Slackware ARM includes drivers for many wireless devices but cannot practically accommodate them all. If you have a USB wireless network adapter that is not already supported then all hope is not lost! Most USB wireless network adapters are supported under Linux so it's just a case of searching for drivers on the manufacturer's website, or elsewhere on the Internet.

For the purpose of this mini-project we are running Slackware ARM current on a Raspberry Pi 4 [4GB] with the hostname 'torq'. Your setup doesn't have to be identical as this mini-project covers all currently available versions of Slackware ARM. Please bear in mind throughout that we will be giving examples that contain specific results which will be, more than likely, different to yours and we will also be using different hardware than you. The examples are meant only as a guide where you need to substitute any relevant information/details/results for your own, where applicable.

Getting started

First of all, it's a good idea to make sure your Slackware ARM system is fully up to date. If you haven't already, you should update now before continuing with this mini-project. You can easily do this by running 'slackpkg' commands. A system reboot may be required.

We will be working from the command line, but you can choose to work from a terminal in your preferred desktop environment (KDE, Xfce, etc.), whatever suits you. It really makes no difference to the end result.

Secondly, consider your setup and how you are going to connect wirelessly. This mini-project covers two options;
1. Using a wireless USB network adapter (a.k.a. 'wi-fi dongle' or 'USB dongle') which connects to a USB port on a Raspberry Pi.
2. Using the on-board wireless network interface controller (WNIC) on a Raspberry Pi 3 and 4.

If you're going to be using your own wireless USB network adapter then you should plug it in to a USB port before powering on the Raspberry Pi. Be mindful that you may also need Linux drivers for it. A little research may be required in order to find out which drivers are needed to run your wireless USB network adapter, if you don't already know or have them. In this case power on your Raspberry Pi (with the wireless USB network adapter plugged in), log in as 'root' user, and continue with this mini-project.

Using the on-board Raspberry Pi wireless network controller (WNIC)

If you're planning on using the on-board Raspberry Pi wireless network interface controller (WNIC) then you can skip to the section: How do I load/remove the Raspberry Pi WNIC drivers on Slackware ARM?

Using a plug-in USB wireless network adapter

A thing to note on the Raspberry Pi 3 and later versions when using your own USB wireless network adapter is to disable the on-board wireless network controller (WNIC) before going any further. Unless you have a use and purpose for it, it's just going to get in the way and take up unnecessary resources.

First check to ensure no wireless network interfaces are active on your system:

root@torq:~# ifconfig -a

Disable any active wireless network with 'ifconfig <ID> down', etc.

root@torq:~# ifconfig wlan0 down

To remove the 'brcmfmac' module use the following command:

root@torq:~# rmmod brcmfmac

Completely disable the on-board Raspberry Pi wireless network interface controller (WNIC) at boot time by adding 'dtoverlay=disable-wifi' setting to the '/boot/config.txt' file:

root@torq:~# echo "dtoverlay=disable-wifi" >> /boot/config.txt

The on-board Raspberry Pi Bluetooth can be disabled at boot time in the '/boot/config.txt' file by adding 'dtoverlay=disable-bt' setting to the '/boot/config.txt' file:

root@torq:~# echo "dtoverlay=disable-bt" >> /boot/config.txt

Next time the system is (re)booted the on-board Raspberry Pi wireless network controller will be disabled and will never interfere with any USB wireless network adapters that are added. These settings can be #commented out, or removed, in order to enable the on-board RPi wireless functionality once more. The same applies with the on-board Bluetooth. These 'dtoverlay' settings in the '/boot/config.txt' file will have no impact on any USB wireless network adapter(s) which are connected to the system.

If you had any wireless interfaces active (e.g. wlan0 or wlan1) due to the 'brcmfmac' module being loaded then it's going to be easier if you reboot the system right now. You can easily pick up from the next section again after you login as 'root' user.

How to find out the make/model/version of (anonymous) USB wireless network adapters

For example, if you have acquired a USB wireless network adapter without any software CD/DVD or information/knowledge of which make/model/chipset it is then you might be feeling quite bemused about how to go about locating the driver(s) for it, or what to look for. Don't worry (yet) because there are ways and means of finding out. There are quite a few USB devices around these days which do not have any markings to indicate the manufacturer or brand, or model/version, or which chipset the device utilises.

At the SARPi Project, we purchased some USB wireless network adapters like this from eBay which arrived in cellophane bags with no indication of who made them or which model they were, with only a 'CE Mark' sticker on them (which we jokingly said meant "Cud-be Enything"). This is a prime example of a USB device which carries no information about what it is.

However, in this situation you can use the 'lsusb' command and it should give you some information about what the device is. We plugged one of our incognito wireless USB devices into a Raspberry Pi and ran the 'lsusb' command. Here's the results:

So, our USB wireless network adapter has been identified as a 'Ralink Technology Corp. RT5370 Wireless Adapter' on 'Bus 001' and has been designated as 'Device 003' with vendor/product 'ID 148f:5370'. We've added the pointer in the screenshot to make it obvious which one it is because, depending on how many USB devices you have connected, this could be quite a large and potentially confusing list. Now we can easily find out if we need drivers for it, or if Slackware already supports this device.

Sometimes you do not get any direct details or this much information but there is usually always some piece of information given that you can use. Such as the 'Bus 001 Device 003: ID 148f:5370' - which has '148f' as a vendor ID (which is Ralink Technology Corp.) and '5370' as a product ID in our case. You'd be very unfortunate not to get something back from the 'lsusb' command which you can use in order to hunt down the specifications of any USB device you have connected in this manner.

Incidentally, the 'lsusb' command not only works for USB wireless network adapters but also for most other USB devices you'll connect. You might want to try that sometime with any USB devices you have laying around.

Another way of doing this would be to power on your Raspberry Pi without a USB wireless network adapter plugged in, and after logging in as 'root' user, run the 'dmesg | tail' (piped) commands. Then connect your USB wireless network adapter to the Raspberry Pi and you should see some relevant information appear on the screen. Using the 'lsusb' command method is more informative and a better way of doing it.

If you do find yourself with a USB device that cannot easily be identified, which may be an issue on occasion, try using 'lsusb -v' which gives a more verbose result. Then there's 'lsusb -vv' if you require a greater verbose output. Ultimately, you could use the actual Universal Serial Bus ID to get shedloads of info with the 'lsusb -vv -s 001' command. If all that fails, it might be worth plugging the device in to a Windows/Debian/Ubuntu system to see if it's recognised on there and/or software drivers are automatically downloaded for it.

You could potentially waste a lot of time with some anomalous wireless devices and if such a device has been given to you (e.g. because someone else couldn't manage to get it working) then it might make more sense to throw it away and obtain one which has better support. At the end of the day it's your time and effort and only you can decide if it's worth it, or not. ;-)

How to find out which Linux driver is needed for a USB wireless network adapter

Once you have identified your USB wireless network adapter it's a case of running the 'lsusb -t' command and, if it's already supported, Slackware ARM will list which driver is used for the device. The 'lsusb -t' command basically dumps the physical USB device hierarchy as a tree. In the screenshot below, on USB Bus 1 Port 4, you can see 'Dev 3' (i.e. Device 003) shows 'Driver=rt2800usb' and this is the Linux driver which Slackware ARM will use for our wireless USB device. Yours may be different here, depending on the adapter you're using.

When you know the Device ID, you can then use 'lsusb -D /dev/bus/usb/<bus_id>/<device_id>' to exclusively display information about that USB device. This extra data can be very useful for understanding the exact specifications. The following screenshot is the information on our 'Ralink RT5370' USB wireless network adapter.

If no driver is shown, then it's time to do some research and rummaging around on the Internet as you'll need to locate the correct driver(s) yourself. It's always a good idea to look at the manufacturers website first, as most companies do provide Linux drivers for their hardware these days. Then there's the official Linux wireless wiki which is the main source of documentation for the Linux wireless (IEEE-802.11) subsystem and a truly fantastic resource. If another Linux distribution (e.g. Fedora or Ubuntu) supports the wireless device in question you could always borrow the drivers from there. It's not uncommon for one distribution to have compiled drivers for a particular piece of hardware when others haven't. Drivers are drivers and when they work on one Linux distribution they can usually be transplanted seemlessly onto another, so that's always worth investigating. When all other avenues of investigation have been non-productive or unsuccessful, you can try using Google to find out which Linux driver is required to run your wireless USB device. A lot of users choose this route this as their first option anyway.

Where are Linux drivers located on my Slackware ARM system?

Linux drivers on Slackware ARM are located in the '/lib/modules/$(uname -r)/kernel/drivers' directory. Where 'uname -r' is the kernel version you currently have installed. This is just another way of saying '3.10.18' or '4.2.6', but used this way you will always get to the correct directory no matter what. For instance, if you have upgraded your system and not removed old kernel '/lib/modules' files, etc. there could be several directories which contain similar files, but your system should only be using one of them. Within the drivers directory there are dozens of folders containing drivers for hardware devices on your Slackware ARM system, of which networking, and wireless, are included. Wireless drivers can be found in the '/lib/modules/$(uname -r)/kernel/drivers/net/wireless' directory. See the example below if you're not quite sure what 'uname -r' means or how it works.

The kernel version on our Slackware ARM current system is '5.4.50-v7l-arm', which is the kernel provided by the SARPi3 installer. Yours will most probably be different.

How do I compile and install wireless device drivers myself for Slackware ARM?

It's standard practice to include all documentation within any software, not just Linux. You should refer to that documentation. Yes, some RTFM is required, as with all things in Slackware, and Linux in general. Usually it's a case of running 3 commands; ./configure, make, and make install, but not invariably. It's always best to read the documentation that accompanies the software. If no documentation is included than you really have to ask "How valid/reliable/legitimate/authentic/bona fide is this software?"

How do I load my wireless device drivers on Slackware ARM?

Once you have installed your USB wireless network adapter drivers you need to load the driver 'module' into the kernel so it can be used. The trick here is knowing the exact name of the driver module in question. At this stage of the mini-project it should be more than clear to you which driver is required to run your USB wireless network adapter.

So, to load a module into the kernel you use the 'modprobe' command. In our case we would do it like this:

root@torq:~# modprobe rt2800usb

If you make a mistake and load the wrong module, use the 'rmmod' command to remove it.

root@torq:~# rmmod rt2800usb

To inspect the contents of any module use the 'modinfo' command.

root@torq:~# modinfo rt2800usb

NB: Here you would substitute 'rt2800usb' for the name of the driver module for your own USB wireless network adapter. Unless your device features the same or similar chipset that requires the rt2800usb module to run it, then it will be the same, obviously.

If you would like to know more details about managing driver modules, refer to the 'man' (manual documentation) pages within Slackware ARM by using the commands; man modprobe, man rmmod, man modinfo, etc.

How do I load/remove the Raspberry Pi WNIC drivers on Slackware ARM?

The Raspberry Pi on-board wireless network interface controller (WNIC) driver is Broadcom's 'brcmfmac' module. To load the Raspberry Pi on-board wireless network interface controller (WNIC) driver use this command:

root@torq:~# modprobe brcmfmac

To remove the Raspberry Pi on-board wireless network interface controller (WNIC) driver use this command:

root@torq:~# rmmod brcmfmac

Configuring your wireless network interface controller (WNIC)

So, with your wireless network interface controller (WNIC) drivers installed and loaded it's time to make your Slackware ARM system capable, and ready, to connect to a wireless network (WLAN). First you should make sure that the drivers are loaded correctly. So type the following command:

root@torq:~# lsmod

If you're using the on-board WNIC on a Raspberry Pi 3 or later version then 'brcmfmac' should feature in the 'lsmod' output and it should look something like this:

If you're using a USB wireless network adapter on a Raspberry Pi, bearing in mind the driver modules for your own wireless USB device will probably be different, then it should look something like this:

You might be aware that the network interface controller (NIC) on your Raspberry Pi is named 'eth0' by your Slackware ARM system. It could also be 'eth1' or 'eth2' depending how you have things setup. However, the wireless network interface card (WNIC) will be named 'wlan0', or 'wlan1', or 'wlan2', and so forth. So, check if the wireless interface exists by typing the following command:

root@torq:~# iwconfig wlan0

You should see something similar to the following:

If you do not see the interface listed then something went wrong. You need to go back and check your configuration again.

If you can see the 'wlan0' interface then you need to fire it up (i.e. enable it). Type the following:

root@torq:~# ifconfig wlan0 up

Now your 'wlan0' interface should be active and you can check this by typing the following command:

root@torq:~# iwlist wlan0 scan

You should see either; a wall of text scrolling down your screen with various available wireless connections (i.e. access points), or just your own. If you are in a location with many WLANs within range then it's not surprising that you will detect them. To view the results line by line you can use the 'iwlist wlan0 scan | less' (piped) commands. However, as long as your own is listed within the results that's all you're concerned with. Here's our example output from the command:

So, if you can see that there's at least your own WLAN within that list (look for the ESSID:"name/identity" of your wireless network) then you are well on your way to setting up a wireless network connection.

Starting NetworkManager

The software you'll use for connecting to wireless networks is called 'NetworkManager' which is already included with Slackware. NetworkManager attempts to make networking configuration and operation as painless and automatic as possible, and can automatically connect to known wired and wireless networks, checking the availability of devices while trying its best to provide connectivity to the host, and can manage several network connections in parallel. It is a highly flexible network configuration tool that can be utilised in a number of ways; GUI (KDE, Xfce, Gnome), text user interface (nmtui), and command line (nmcli). For more information on NetworkManager read the man pages and the NetworkManager project website.

NetworkManager is a daemon which tails your system dbus messagebus to manage network connections. This daemon can be automatically ran at boot by making the 'rc.networkmanager' script executable.

Enable the '/etc/rc.d/rc.networkmanager' daemon to run at boot time with the following command:

root@torq:~# chmod +x /etc/rc.d/rc.networkmanager

Now start the 'rc.networkmanager' daemon with the following command:

root@torq:~# /etc/rc.d/rc.networkmanager start

If you ever need to manually stop the 'rc.networkmanager' daemon use the following command:

root@torq:~# /etc/rc.d/rc.networkmanager stop

You can check the 'rc.networkmanager' daemon is active and running with the following command:

root@torq:~# /etc/rc.d/rc.networkmanager status
NetworkManager is currently running

Do a check that 'ifconfig' and 'NetworkManager' agree on the 'wlan0' interface MAC address with the 'ifconfig wlan0' and 'nmcli device show wlan0' commands, like in the following screeenshot:

We can see from our results that the MAC address of our 'wlan0' interface is '9a:95:13:63:32:91' and all looks good. Make a note of your MAC address here because you'll need it if you want to use a network interface predictable naming udev rule.

Setting up and connecting to a wireless network (WLAN) with NetworkManager TUI

The 'nmtui' command runs a curses-based TUI application for interacting with NetworkManager. This TUI application is navigated using the TAB key, cursor keys, and the Enter key. You can also use the key that corrsponds to the activity with a leading capital letter. For example; the E key to select 'Edit connection' and Q key to select 'Quit', on the menu.

So run the 'nmtui' command now and you will be presented with the NetworkManager TUI:

root@torq:~# nmtui

Press the Enter key when 'Edit a connection' is highlighted. Then press the TAB key or use the cursor keys to move/cycle the highlight to 'Add' and press the Enter key. Here you will add a new wireless connection to NetworkManager.

Press the TAB key or use the cursor keys to move/cycle the highlight to 'Wi-Fi' and press the Enter key.

Use the TAB key or cursor keys to move/cycle through the text fields.
• Enter a Profile name - this can be any name you want to give to this wireless network connection. We chose the name "SARPi_WLAN".
• Enter the SSID of your wireless connection - this is the name of the wireless network you will be connectiing to.
• Select the Security certification of the wireless network you will be connecting to. We chose "WPA & WPA2 Personal".
• Enter the Password of the wireless network you will be connectiing to.
• Move the highlight down to the bottom and select <OK> and then press the Enter key to finish.

Use the TAB key or cursor keys to move/cycle down to the bottom and highlight <Back> and then press the Enter key to return to the NetworkManager TUI activity menu.

Next highlight Activate a connection and press the Enter key.

Next highlight the Wi-Fi connection you have just configured and press the Enter key to activate it.

After a brief few seconds of handshaking...

You should see that your wireless connection is now active.

Use the TAB key or cursor keys to move/cycle down to the bottom and highlight <Back> and then press the Enter key to return to the NetworkManager TUI activity menu.

Next highlight Quit, or press the Q key, and press the Enter key to exit NetworkManager TUI.

Now use the 'ifconfig wlan0' and 'iwconfig wlan0' commands to verify that everything looks good with your newly configured wireless network connection:

NetworkManager saves any stored connections in the '/etc/NetworkManager/system-connections/' directory.

For further and more in-depth information relating to your network interfaces you can use Networkmanager's command line tool 'nmcli' which is used to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status. For example:

root@torq:~# nmcli device
root@torq:~# nmcli device show wlan0
root@torq:~# nmcli connection
root@torq:~# nmcli connection show <WLAN Profile name>

NetworkManager is a very easy and flexible network configuration tool to use. 'nmcli' is a command-line (CLI) tool for controlling NetworkManager. 'nmtui' is a curses-based text user interface (TUI) application for interacting with NetworkManager. See the man pages on how to best use the NetworkManager tools and commands.

Many Slackware [ARM] users may have installed 'wicd' in the past for managing their wireless networks. Unfortunately, 'wicd' has been removed from the Slackware package tree because it is no longer maintained, is potentially insecure, and doesn't work with Python versions newer than 2.7.18. As stated in the Slackware current x86_64 ChangeLog on 01 Aug 2020. NetworkManager is a more than adequate replacement for 'wicd'.

Wireless network interface predictable naming

To ensure your wireless network connection remains stable, over time and any reboots, it's possible to create a udev rule to retain the same interface name and MAC address. This is prudent if you like to keep things simple and want to avoid future headaches. You'll need to edit an existing persistent network rule file for your 'wlan0' interface.

Using your preferred text editor (we're using 'nano') open the following file:

root@torq:/# nano -w /etc/udev/rules.d/70-persistent-net.rules

It should look similar to this:

In our screenshot example above, the 'net device' is the Ethernet interface 'eth0' and the 'USB device 0x148f:0x5370' is the wireless interface 'wlan0' persistent network rules.

What you need to do is change the order of the rules around so that your 'wlan0' is above 'eth0' to give it priority, and you also need to enter your own 'wlan0' interface MAC address (that you made a note of earlier) into the 'ATTR{address}' section of the 'wlan0' rule. If you don't have the MAC address of your wlan0 interface, run the 'ifconfig wlan0' command to find out what it is. These are the only changes you should make at this point. Save and exit the file when you're done.

Taking into consideration that the contents of the '/etc/udev/rules.d/70-persistent-net.rules' file will include your own settings and not the ones shown here as an example, it should end up looking similar to this:

Any changes to the /etc/udev/rules.d/70-persistent-net.rules file will require a reboot of the system to take effect.

If you've made any changes you should save and exit the '/etc/udev/rules.d/70-persistent-net.rules' file and reboot your system. So do that now and check over your network settings once you've logged back in. If every thing has gone according to plan...

That's it! You're all done. If you have followed this mini-project and have successfully managed to connect your Raspberry Pi running Slackware ARM to a wireless network (WLAN) using NetworkManager then contratulations are in order. Well done indeed!

Thanks and credits

Thank you for taking the time to go through this SARPi mini-project. We hope that it has been useful and perhaps somewhat educational along the way.

Many thanks also to the Slackware Team for their constant work and efforts, especially Stuart Winter (a.k.a. MoZes) who mainly manages and maintains Slackware ARM. Without these guys we wouldn't have such a wonderful operating system to use. Also many thanks to 'TheTKS' for his suggestion that this mini-project be revised and updated [08 Aug 2020]. <3

Back to Top


Updated: 2021-04-06 12:46:18 UTC

Disclaimer: The SARPi Project website is for non-commercial and general information purposes only. The content is provided by Penthux.NET and while we endeavour to keep information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or any information, software, products, services, or related graphics which is available on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will Penthux.NET be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website or any of its contents. Through this website you are able to visit other websites which are not under our control. Penthux.NET has no influence over the nature, content or availability of any external URLs. The inclusion of any URLs does not necessarily imply a recommendation or endorsement of any content therein. Every effort is made to ensure the SARPi Project website remains accessible. However, Penthux.NET takes no responsibility for, and will not be liable for, the SARPi Project website being temporarily unavailable due to technical issues beyond our control. Penthux.NET is in no way affiliated with Slackware Linux, Inc, or the Linux Foundation, or the Raspberry Pi Foundation, or any of their members, trustees, partners, or associates.


Accept!
SARPi Project uses cookies for website traffic & data analysis. [ Cookie Policy ]