The alpine wiki is a crap .. information is “less” so much people is just losing the patiente..
Before taking any copy from this document check Licensing clarifications at the end.
A “wifi” is a term to short name the Wireless most famous devices, but there are so many devices that are “wireless”, like bluetooh as the most moderns.. (in the past there are others like IR, etc).
The wifi devices are from two kind, the only pure network ones and the hybrid ones, this means that a pure network device just are a device to use linked to a network, but currently bluetooth is a network device but for paired devices, just like point to point, so nomadays curerntly almost any laptop wifi is also a bluetooth device too, we called those for convenience hybrid ones.
Also important, many laptops and special computers, have a hardware button (or switch)
to turn off wireless card, however, sometimes this are a software switch by the vendor,
so we can also be blocked by kernel if the card its well supported. This is only
by the two important requirements, first by using rfkill
(util-linux) and also
if the module of the device is currently well and complete supported hardware.
As any tech piece, we have hardware and software, so then a “wifi” is made by two parts:
rtl8192eu-linux
or r8169
)wpa_supplicant
or iwd
programs)Most linux distros just configures network-manager
package that oversimplified the things,
console setup is bit complicated but easyle covered, currently there is two options for,
the wpa_supplicant
and the newer iwd
from Intel, this last with less usage cases.
Software | UI | WEXT | nl80211 | WEP | WPA/2/3 | WORKING apk alpine version |
---|---|---|---|---|---|---|
wireless_tools | Console | Yes | No | Yes | No | since 3.5 |
iw | Console | No | Yes | Yes | Yes | since 3.5 |
wpa_supplicant | Console | Yes | Yes | Yes | Yes | since 3.0 |
iwd | Console | Yes | Yes | No | Yes | since 3.15 |
network-manager | Con+Gui | Yes | Yes | Yes | Yes | since 3.12 |
connman | Console | No | Yes | Yes | Yes | since 3.12 |
The iwd
packages exits since 3.10 but only since 3.15 has support for right
autentications protocols. The package networkmanager
and his applet are since 3.6 but
only working applet was noted since Alpine 3.12 due right setup of permissions.
Note the
networkmanager
andconnman
packages has wifi management but are only frontend interfaces and relies heavily over theiwd
orwpa_supplicant
backends.
The iwd
claims to be the future of wireless networking on linux, but even this
has unfinished issues, it still doesn’t cover the vast amount of configurations
and has only been tested on common computers just check https://gitlab.alpinelinux.org/alpine/aports/-/issues/13048#note_305688
the mayor feature of alpine is the mayor problem, minimalist and simplicity.
Due the huge problem that represent the hardware, we only will covert software interface, and we will assume you already have the modules already compiled into the kernel, nowadays this is easily handled by installing the firmware packages and only few devices too recents represents minor problems, such instalation is partialy covered as necesary.
Warning if in our telegram channel you called “driver” to a module kernel, you will be punished.. a driver is a person that drive a car! right?
You will need the packages, but if you dont have network how you can grab the packages?
Then you will be offered the possible cases where you will need to configure the Wi-Fi, first, when you do not have cable or telephone internet, second when you have at least external internet and third when you have cable internet:
If you cannot setup wired network, you can use direct download of the packages and later put into your alpine computer, using USB.. this is easy but tedious, cos you need to grab the file and compute the dependeces by searching each package in the web search interface (yew only in the web cos in your alpine you dont have index generated).
wpa_supplicant
with carte.uname -m
as reference but not exact value.This method is most common to cases like tvboxes, raspberrys, or small devices that dont have wired network devices and the ISO/IMG of installation media does not provide all the packages.
This means you already have a local copy of the main repository, or a local copy of all the hole repository of alpine packages, but the x86 (i386) and x86_64 (amd64) installation media provides extended instalation isos that have in the media all the necesary packages and only few are missing.
When you perform the installation, you can grap the package cos the ISO media is already listed as a repository. If not, you can copy the entire repository locally and each need package taken from it manually.
The most easy option is to first use a wired connetion that provides internet, so you can easyle install the necesary packages to perform the wifi setup.
This means you already have the source instalation media as a USB boot phisical medium like USBstick or USBdrive, and can you put it on the installed Alpine linux to later mount and use as source media CDROM repository:
/media/cdrom
blkid
command to identify then/dev/sdg
mount /dev/sdg1 /media/cdrom -t vfat
if not then try /dev/sdg1
echo "/media/cdrom/apk" > /etc/apk/repositories
as rootThis means you already have the source instalation media as a ISO file in a phisical medium like USBstick or USBdrive, and can you put it on the installed Alpine linux to later mount the ISO and use as source media repository:
/mnt
blkid
command to identify then/dev/sdg
mount /dev/sdg1 /mnt -t vfat
cp /mnt/alpine*.iso /
umount /mnt
mount /alpine*.iso /media/cdrom -t iso9660
echo "/media/cdrom/apk" > /etc/apk/repositories
as rootThis means you already have the source instalation media recorded as a CDROM/DVDROM as phisical medium, and can you put it on the optical drive of your computer, this media source ISO CDROM/DVDROM must be the EXTENDED ISO image, and you wil use it as source repository:
mount /dev/cdrom /media/cdrom -t iso9660
echo "/media/cdrom/apk" > /etc/apk/repositories
as rootWireless need a special packages, the package iwd
is available since 3.10 but
ther are two problems for Alpine Linux since 3.10 to 3.15 releases:
So yeah.. we will use the old and fiable methods, later we will provide another tutorial with iwd:
apk add wireless-tools wpa_supplicant linux-firmware util-linux
Those are the minimal packages to work, linux-firmware
is a huge package because at this point
we dont know which firmwares will need for your wifi card so if you already have wired method internet,
just install all the need packages (otherwise you must download a huge amount of packages as linux-firmware-xxx
etc):
apk add wireless-tools wpa_supplicant dbus-libs libnl3 pcsc-lite-libs linux-firmware util-linux arch-install-scripts
Warning since Alpine 3.15 the
rfkill
program is atutil-linux-misc
package, and not in theutil-linux
package cos was splited so we forced witharch-install-scripts
package!
First of all check wich is your interface network device for wireless and is active:
rfkill list
This will show you the current names of the devices only if are wireless, also will show you bluetooh mixed ones, so be care with the name of which device will you use.
wlan0
from such command.Soft blocked
says no
the device can be used or activated.Hard blocked
says no
the device can be used.yes
, run rfkill unblock wifi
but this depends of kernel module supportUse the interface to scan for wireless access points, we need to check and make sure the ESSID you want to connect to appears:
iwlist scanning | grep ESSID
The output will show the available “wifi’s” (SSID’s), lest assume your one is named mywifi
this document will use the SSID named mywifi
to make the practice.
Next, create a “wpa_supplicant” configuration stanza for the wireless access point:
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev" > /etc/wpa_supplicant/wpa_supplicant.conf
wpa_passphrase 'mywifi' 'thepasswordwifi' >> /etc/wpa_supplicant/wpa_supplicant.conf
The commands just help to initialize the configuration file.
This will be a minimal file, but this may need some extra configurarions depending of the network setup or the device using, by example some USB network devices change the MAC address ramdownly that produces problems for routers.. so a complete recommended setup is then:
# recommended, for idetification check wikipedia ISO/IEC country code list
country=VE
# this depends of the alpine package configuration, just use it as is or use /run for:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
# wpa_supplicant initiates scanning of the wifi's (SSID AP) and
# the option 0 is only for special wired and option 2 for specifics purposes
# e.g., with ndiswrapper to enable operation with hidden SSIDs and optimized roaming
ap_scan=1
# Automatic scan for SSID and chosse one if routers are not 100% online
# but ignored if If sched_scan_plans are configured and supported by the driver
# here a delay of 120 seconds will be used on each scan.. if you only have one SSID
# and if you only have good signal (over 80%) just put this to 300
autoscan=periodic:160
# Disable automatic offloading of scan requests (sched_scan) by the module kernel
disable_scan_offload=1
# general MAC address policy default 0 = permanet
mac_addr=0
# 0 = use permanent MAC address for pre-association operations (scanning, ANQP)
preassoc_mac_addr=0
# 0 = use permanent MAC address for GAS operations
gas_rand_mac_addr=0
# now lest improve the SSID wifi setup to connect:
network={
# name of the wifi of the router to connect, the SSID AP
ssid="mywifi"
#psk="thepasswordwifi"
psk=eec720af4bf770f83e9cd7d425d1ced46e0ca7e2df9be8745e4a16f810677ce4
# this tell to wpa to use this before the other that have priority=2 or priority=1
priority=3
# this is an indentification, can be a string name short but no symbols allowed
id_str="mywifi"
}
So then the configuration for a password WPA/WPA2 wifi will be:
country=VE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
autoscan=periodic:160
disable_scan_offload=1
mac_addr=0
preassoc_mac_addr=0
gas_rand_mac_addr=0
network={
ssid="mywifi"
psk=eec720af4bf770f83e9cd7d425d1ced46e0ca7e2df9be8745e4a16f810677ce4
priority=3
id_str="mywifi"
}
So then the configuration for a password less or no-password free wifi will be:
country=VE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
autoscan=periodic:120
disable_scan_offload=1
mac_addr=0
preassoc_mac_addr=0
gas_rand_mac_addr=0
network={
ssid="mywifi"
key_mgmt=NONE
priority=3
id_str="mywifi"
}
Start wpa_supplicant in the foreground to make sure the connection succeeds.
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
This will take the console output when is running, this is just for testing.
just stop by pressing CRTL
and C
key at the same time.
Alpine already has a configuration tool, but is just script that writes to
the /etc/network/interfaces
with pretty limited feature, so again minimalist shit,
lest take own and made master usage of the onfigurations:
lo
interface is present and workingeth0
and maybe eth1
or bothlo
is already present in the /etc/network/interfaces
vi
busybox by default) the file /etc/network/interfaces
auto lo
is first and followed by iface lo inet loopback
or add iteth0
and such kind of devices as iface eth0 inet dhcp
wlan0
part of the network wifi interface but this one must have the SSIDmetric
keyword to determine the device that will be use for internet as primarySo the file will be:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
metric 2
auto wlan0
iface wlan0 inet dhcp
wireless-essid mywifi
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
metric 1
So the bring the interface down to reconnect to the network, and later then start the service of the wireless conecctions, later then confiugure at boot:
ifconfig wlan0 down
/etc/init.d/wpa_supplicant start
rc-update add wpa_supplicant boot
Note : If this errors with
ioctl 0x8914 failed: No error information
, that’sbusybox ip
’s way of saying your wireless radio is rfkill’d, for information on how to unblock your wireless radio; the base installation should havebusybox rfkill
available, check the section check the devices availables.
Warning Hardware buttons to toggle wireless cards are handled by vendor specific kernel modules. Frequently, these are WMI modules. Particularly for very new hardware models, it happens that the model is not fully supported in the latest stable kernel yet. In this case, it often helps to search the kernel bug tracker for information and report the model to the maintainer of the respective vendor kernel module, if it has not happened already.
CC BY-NC-SA: the project allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creators involved. If you remix, adapt, or build upon the material, you must license the modified material under identical terms, includes the following elements:
https://codeberg.org/alpine/alpine-wiki/src/branch/main#license