Set up Arch Linux on Cubieboard 2

May 16, 2015

Install Arch Linux

Update to new kernel

pacman -Syu linux-armv7

Change hostname

hostnamectl set-hostname myhostname

Set up user account

  1. Create an user account and add it to wheel group (an administration group, commonly used to give access to the sudo and su utilities)

     useradd -m -G wheel -s /bin/bash <username>
    
  2. Specify the new user account’s password:

     passwd <username>
    
  3. Edit sudoers list by typing visudo, look for the below line and uncomment it to allow wheel group to execute commands.

     %wheel ALL=(ALL) ALL
    
  4. Allow only users in the group wheel to login to root using su command by edit /etc/pam.d/su and uncomment the line:

     # Uncomment the following line to require a user to be in the "wheel" group.
     auth    required  pam_wheel.so use_uid
    
  5. Deny SSH login to root account: edit /etc/ssh/sshd_config, change #PermitRootLogin yes to no and uncomment the line:

     PermitRootLogin no
    
  6. Restart the SSH daemon:

     systemctl restart sshd
    
  7. Now we can only log in with the created user account and use su or sudo to do system administration.

  8. More details: Users and Groups, Security, Secure Shell

Set up Access Point on wlan0 interface

  1. Install hostapd package

     sudo pacman -S hostapd
    
  2. Create file /etc/hostapd/hostapd.conf

     interface=wlan0
     bridge=br0
     driver=nl80211
     ssid=cubie1
     hw_mode=g
     channel=11
     macaddr_acl=0
     auth_algs=1
     ignore_broadcast_ssid=0
     wpa=3
     wpa_passphrase=cubiepass
     wpa_key_mgmt=WPA-PSK
     wpa_pairwise=TKIP
     rsn_pairwise=CCMP
    
  3. If you have a card based on RTL8192CU chipset, install hostapd-8192cu in the AUR and replace driver=nl80211 with driver=rtl871xdrv and remove bridge=br0. See Install hostapd-8192cu package

  4. Install dnsmasq package for DHCP server

     sudo pacman -S dnsmasq
    
  5. Edit /etc/dnsmasq.conf to:

     # disables dnsmasq reading any other files like /etc/resolv.conf for nameservers
     no-resolv
     # Interface to bind to
     interface=wlan0
     # Specify starting_range,end_range,lease_time
     dhcp-range=10.0.0.3,10.0.0.20,12h
     # dns addresses to send to the clients
     server=8.8.8.8
     server=8.8.4.4
    
  6. Initial wlan0 configuration

     sudo ifconfig wlan0 up 10.0.0.1 netmask 255.255.255.0
    
  7. Run dnsmasq

     sudo dnsmasq
    
  8. Run hostapd as background

     sudo hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf 1> /dev/null
    
  9. More details: Software Access Point, hostapd

Connect to a Wi-Fi on wlan1 interface

  1. Install wpa_supplicant package

     sudo pacman -S wpa_supplicant
    
  2. Configure wpa_supplicant.conf

     sudo wpa_passphrase "<ssid>" "<password>" | tee /etc/wpa_supplicant/wpa_supplicant-wlan1.conf > /dev/null
    
  3. Turn on wlan1 interface

     sudo ip link set dev wlan1 up
    
  4. Initialize wpa_supplicant

     sudo wpa_supplicant -B -i wlan1 -c /etc/wpa_supplicant/wpa_supplicant-wlan1.conf
    
  5. Obtain IP Adress

     sudo dhcpcd wlan1
    
  6. Enable systemd services for connecting Wi-Fi at boot

     sudo systemctl enable wpa_supplicant@wlan1
     sudo systemctl enable dhcpcd@wlan1
    
  7. To customize start up script or look for more details, see: Wireless Network Configuration and WPA Suppliant

Install hostapd-8192cu package

  1. Install base-devel group package

     sudo pacman -S --needed base-devel
    
  2. Create a build directory, for example ~/builds

     mkdir ~/builds
     cd ~/builds
    
  3. Download hostapd-8192 tarball and extract it

     curl -L -O https://aur.archlinux.org/packages/ho/hostapd-8192cu/hostapd-8192cu.tar.gz
     tar -xvf hostapd-8192cu.tar.gz
     cd hostapd-8192cu
    
  4. Make the package

     makepkg -s
    
  5. A tarball should have been created with name hostapd-8192cu-<application version number>-<package revision number>-<architecture>.pkg.tar.xz

  6. Install the created package using pacman:

     sudo pacman -U hostapd-8192cu-0.8_rtw_r7475.20130812_beta-3-armv7h.pkg.tar.xz
    
  7. More details: Arch User Repository, hostapd-8192cu

Discussion, links, and tweets