17 April 2016

[2/2] Install Fedora 23 Minimal version (lightweight) on Raspberry Pi 3

This article explains how to complete installation of the most lightweight Fedora 23 Minimal Version on a Raspberry Pi 3, including full Wifi support, automatic @IP binding connecting to your DHCP server, and various interesting things.
You must follow the instructions of the first part prior to this one.

In addition to the following instructions, you can get some some others on Fedora documentation.

Preparing the first Boot

Before Powering on your Raspberry Pi 3, insert the microSD card (prepared during the first part of this article), plug it to your network (thanks to ethernet cable), plug USB Keyboard, connect to an HDMI monitor (you can use any adapter to DVI or VGA).

First boot - Wizard

First check: as soon as you power on the Raspberry Pi 3, you should see the firmware loading on your monitor.
If it is not the case:

  • ensure microSD card is correctly inserted
  • ensure you properly created the partitions, as explained in the first part article, the first partition must be a primary and FAT32 one
  • ensure you installed the Raspberry firmware in this boot partition

Second check: after firmware loading, you should see Fedora booting and services initialization like you used to see.
If it is not the case:

  • ensure you created properly the /boot/cmdline.txt file (for instance, ensure the root path is exactly specified like that: root=/dev/mmcblk0p3
  • ensure/check your /boot/config.txt file

If all is OK, you will reach the Wizard allowing you to define your locale, create a non-root user ...
Once done, you can reboot your Raspberry Pi 3.

Next boot - Some tips

Update your keyboard layout (keymaps) and/or Fonts

First of all, if you want to change keyboard layout, or fonts (e.g. you chose a bad locale in the Wizard), you can update your /etc/vconsole.conf file.
To know which keymaps are available, you can run
localectl list-keymaps

You can grep the result with a locale (e.g. 'en', 'fr' ...).

This is an example of the /etc/vconsole.conf file contents

For the Fonts, you can follow these instructions (all but instructions about Grub, because Grub is NOT used on the Raspberry Pi 3).

Reboot for any change to take effect.

Update Hostname

Define the hostname of your Raspberry Pi 3 (e.g. rpi)
sudo echo "rpi" > /etc/hostname

Prevent from some errors like 'error while loading shared libraries'

Create a file in /etc/profile.d to define some common paths update (let's call it /etc/profile.d/variousEnvironment.sh)
sudo cat <<EOF /etc/profile.d/variousEnvironment.sh

export PATH=$PATH:/opt/vc/bin
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/vc/lib:$LD_LIBRARY_PATH

Disable IPv6

If you want to disable ipv6 support, you can't do it using modprobe blacklist, or using sysctl tool, because the running Kernel is NOT a Fedora one, but the one embedded in Raspberry Pi 3 firmware.
To disable ipv6, you can add ipv6.disable=1 option in the /boot/cmdline.txt file, for instance
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline ipv6.disable=1 rootwait

Update the operating system

To keep on having the most lightweight installation, you can remove useless (or failing) packages (tips: removing kernel packages will free space on your small /boot partition)
sudo dnf remove kernel kernel-core kernel-modules audit

You can then update your Fedora
sudo dnf update

Update the firmware

Install some more packages
sudo dnf install binutils tar wget

Download the Raspberry Pi Firmware updater, and "install" it as an user binary
sudo wget https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update -O /usr/sbin/rpi-update

If you didn't reboot yet, you can update your environment variables with the file you created in the Tips part
source /etc/profile.d/variousEnvironment.sh

You can check the Firmware version before/after update
sudo vcgencmd version

Update the firmware
sudo rpi-update

You can run this last instruction whenever you want (e.g. in new firmware version's release notes, there are some bugs fix interested for you).
If a new version is installed, reboot your Raspberry Pi 3.

Wifi setup

Install the missing Firmware for the Wifi controller of Raspberry Pi 3
wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.bin -O /lib/firmware/brcm/brcmfmac43430-sdio.bin
wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.txt -O /lib/firmware/brcm/brcmfmac43430-sdio.txt

Ensure it is loaded at boot time
sudo cat <<EOF /etc/modules-load.d/wifi_brcmfmac.conf
# Loads Raspberry Pi 3 Wifi module at boot time.

Install some more packages
sudo dnf install net-tools wireless-tools

Install some more packages if your Wifi Network requires a WPA key (recommended !)
sudo dnf install wpa_supplicant

Otherwise, install some other packages if your Wifi Network requires a simple WEP key
sudo dnf install NetworkManager-wifi

In this guide, the following instructions will consider your Wifi Network requires a WPA key.
If it's not the case, you may consider updating your network for better security, or to look for a simpler guide to setup your Wifi connection with NetworkManager.

Define WPA configuration (replace SSID_NAME by your Wifi Network SSID)
sudo wpa_passphrase SSID_NAME >> /etc/wpa_supplicant/wpa_supplicant.conf
Then enter your Wifi WPA Key

Update the INTERFACES variable in /etc/sysconfig/wpa_supplicant (keep the -i option which is needed by wpa_supplicant)

From now, your Raspberry Pi 3 should be able to connect to your Wifi network, before completing the configuration, you can check it
sudo systemctl start wpa_supplicant
iwconfig wlan0

If everything is OK, iwconfig should show you information like "Access point", "Link Quality" and "Signal Level" as witnesses to a successful connection.
Otherwise, you should check your configuration (e.g. WPA key, wpa_supplicant configuration, wpa_supplicant service status ...).
To check status of wpa_supplicant service
sudo systemctl status wpa_supplicant

It's the good time to update your DHCP server (no matter whether it's a dedicated router, your Internet Provider Box, or a software like dnsmasq ...) to define the @IP you want to bind your Raspberry Pi 3.
You'll find the @MAC of your Raspberry Pi 3 as the ether information, of wlan0 interface
ifconfig wlan0

Once done, you can request the DHCP server to automatically get @IP address
sudo dhclient wlan0 -v

You will see which is the responding DHCP server, which is the @MAC sent by the Raspberry Pi 3, and which @IP address is finally bound to it.

Eventually, you need to setup an user service allowing to automatically call dhclient at boot time as soon as wpa_supplicant service has successfully started.
sudo cat <<EOF /usr/lib/systemd/system/rpiAutoWifi.service
Description=Automatic RPI Wifi Boot Activator

ExecStart=/usr/sbin/dhclient wlan0 -v


Enable the service
sudo systemctl enable rpiAutoWifi

You can then reboot your Raspberry Pi 3, and check everything is OK.
sudo systemctl status wpa_supplicant
sudo systemctl status rpiAutoWifi

If it's OK, you can now enable sshd service, and unplug the ethernet cable definitively.
sudo systemctl enable sshd


Your Raspberry Pi 3 is now ready to be managed remotly by SSH, you should have saved as much space as possible with this most lightweight Fedora 23 installation.

Next articles will explain how to setup Sound and Bluetooth.

The following ones will explain how to install Zwave controller support, and various interesting Domotics Software like OpenHab, Domoticz or Jeedom.

No comments:

Post a comment

Thank you for your visit, let's share your point of view: