Setting up Arch Linux on Raspberry Pi 3B+ (1) – wifi setup


I used the PINN to install the Arch Linux on the SD card. The process is quite straight forward. Here’s the link to the PINN project: https://github.com/procount/pinn


After installation, I need wifi to get on internet. Arch Linux provides a nice wiki covering every aspects. Here’s a stripped down version of what’s needed on a RPi3b+.

  1. Device driver: the wifi on RPi3b+ comes with the Cyprus chip. It is neither PCI nor USB. So the lspci -k and lsusb -v command on the wiki didn’t return anything useful in my case. But ip link shows that I have lo, eth0 and wlan0, so apparently the driver was loaded correctly. If anyone knows which modules provides the driver for the wifi here, welcome to tell me in the comments
  2. If the wlan0 is not activated. Activate it:
    # ip link set interface up

    I receive 2 returns saying IPv6 ADDRCONF(NETDEV_UP): wlan0: link is not ready and brcmfmac: power management disabled. But wait for a second, linux returns that the link becomes ready. If you check again (ip link), you will see the wlan0 is now activated.

  3. (Quote from Arch Linux’s wiki:) To verify that the interface is up, inspect the output of the following command:
    # ip link show interface
    3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
        link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff
    

    The UP in <BROADCAST,MULTICAST,UP,LOWER_UP> is what indicates the interface is up, not the later state DOWN.

  4. Here I switch to follow the WPA guide. BE CAREFUL HERE: After creating the conf file, I found that I need to run wpa_cli -i wlan0. Without the -i option, the wpa_cli command connects to “p2p-dev-wlan0” instead of “wlan0”. Based on the name, the “p2p-dev-wlan0” is a p2p interface, but I am not sure what it does exactly, welcome to comment if you know about it. Anyway, if wpa_cli connects to the “p2p-dev-wlan0”, you can follow the wiki’s guide through without any error. But you will find that the scan and scan_result won’t return anything and enable_network won’t do anything. In the end, wlan0 are still not connected to your wifi network. Here’s step-by-step:
    # wpa_cli -i wlan0
    > scan  % wait for a few seconds here for the scan to finish
    OK
    <3>CTRL-EVENT-SCAN-RESULTS
    > scan_results
    bssid / frequency / signal level / flags / ssid
    00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] MYSSID
    11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ANOTHERSSID
    > add_network
    0
    > set_network 0 ssid "MYSSID"
    > set_network 0 psk "passphrase"
    > enable_network 0
    <2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]
    > save_config
    OK
    
  5. If you are saving your wifi passphrase in the wpa_supplicant.conf file, remember to chmod 640 wpa_supplicant.conf so that you are not letting the world know about your passphrase!
  6. Run dhcpcd wlan0 to get a dynamic IP address and start surfing!

Now we verified that everything works on a low level. I want to auto connect to network on boot, and switching between profiles automatically (home/office/other environment).

I choose to use netctl because it is part of the base group, i.e., it should be already part of the system. Here’s the official guide. Here’s what I did:

# cd /etc/netctl/

# wifi-menu -o

Then follow the GUI screen guide to finish the wifi setup, and verify that the connection is good:

# ping www.ibm.com

Then install the wpa_actiond package. Noted that you might need to update the system first pacman -Syu. Then run pacman -S wpa_actiond, otherwise it might will throw 404 error.

Next, important:

  • If you have previously enabled a profile through netctl, run netctl disable profile to prevent the profile from starting twice at boot.
  • Warning: Do not enable concurrent, conflicting network services. Use systemctl --type=service to ensure that no other network service is running before enabling a netctlprofile/service.

After you double check that there’s no other network services running, nor will be loaded on boot, start this service:

# systemctl enable netctl-auto@wlan0.service

Replace wlan0 with your own wifi interface name.

You can further verify everything is still working after reboot by systemctl reboot then ping something.

One thought on “Setting up Arch Linux on Raspberry Pi 3B+ (1) – wifi setup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.