Raspberry Pi

From FedoraProject

Jump to: navigation, search



This documentation describes the installation of the latest version of Fedora on a Raspberry Pi/Pi2/Pi3. We will install an official ARM Image, that is actively maintained by the Fedora project, like the i386/x86_64 platform. Because the kernel shipped with Fedora doesn't support all Raspberry devices and features of their chipsets, we will replace it with the original Raspberry kernel.

This documentation can be used by experts, as well as by beginners. You don't need to know anything about compiling nor have a deep knowledge about the Raspberry architecture. A basic knowledge of Linux should be sufficent to follow and understand all steps. Package updates on the Raspberry running Fedora are installed, as you are used to it, via dnf. Due to the fact that we use the original Raspberry firmware, updates of these are handled differently. However it is also just one simple command: rpi-update.

To keep the guide simple, we use a minimum of partitions (root, boot, swap). It's up to you to create further partitions on your SD card.



FedBerry is a new project founded in 2015, to support Fedora on Raspberry Pi 2 B models. See http://fedberry.org/ for further details.


The Seneca Centre for Development of Open Technology produced a Fedora remix, called Pidora. This distribution isn't actively maintained at the moment. The latest version is Pidora 20, which is based on Fedora 20 (support ended already in June 2015). If you're looking about information and how to install Pidora, check out the Pidora homepage http://pidora.ca/.


Pignus continues where Pidora left off and provides a current Fedora experience on older Raspberry Pi hardware. Models A, A+, B and Zero are all supported with Fedora 23. More information can be found at https://pignus.computer


For preparation of the SD card:

  • Computer running Linux or Unix
  • SD card reader
  • Knowledge of the device name of the SD card reader.
This documentation considers /dev/mmcblk0 as the SD card device, /dev/mmcblk0p1 as the first partition on it, /dev/mmcblk0p2 as the second, and so on.

Downloading the Fedora ARM image

Visit the Fedora ARM homepage and download the image of your choice. Don't forget to validate the image, to ensure it was downloaded correctly and not modified. In the following we describe the installation/usage of the "Fedora Server" image. The steps, except the filenames of the image files, won't differ.

Preparing the SD card

We won't write the image file to the SD card directly, because it is less flexible, due to a preconfigured static partition layout. An other reason is that the image file provided by Fedora needs some adaptations anyway, to work on a Raspberry Pi.

Creating a Custom Partition Layout

  • Start "fdisk" to modify the partition layout of the SD card
# fdisk /dev/mmcblk0
  • Print the current partition table of the SD card
fdisk> Command (m for help): p
  • If there are any existing partitions, delete them by using the "d" command for each. Example:
fdisk> Command (m for help): d
       Selected partition 1
       Partition 1 has been deleted.
  • The Raspberry Pi only boots from the first partition of an SD card, that needs additionally be FAT32 formated. This partition will be mounted to /boot/ later and contains the kernel, 2nd stage bootlader, etc. A size of 128 MB is sufficient.
fdisk> Command (m for help): n
       Partition type
          p   primary (0 primary, 0 extended, 4 free)
          e   extended (container for logical partitions)
       Select (default p): p
       Partition number (1-4, default 1): 1
       First sector (32-31422463, default 32): 
       Last sector, +sectors or +size{K,M,G,T,P} (32-31422463, default 31422463): +128M        

       Created a new partition 1 of type 'Linux' and of size 128 MiB.
fdisk> Command (m for help): t
       Selected partition 1
       Partition type (type L to list all types): b
       Changed type of partition 'Linux' to 'W95 FAT32'.
  • Create a swap partition. Depending on your needs, 256 MB should be sufficient for most users.
fdisk> Command (m for help): n
       Partition type
          p   primary (1 primary, 0 extended, 3 free)
          e   extended (container for logical partitions)
       Select (default p): p
       Partition number (2-4, default 2): 2
       First sector (262177-31422463, default 262177): 
       Last sector, +sectors or +size{K,M,G,T,P} (262177-31422463, default 31422463): +256M

       Created a new partition 2 of type 'Linux' and of size 256 MiB.
fdisk> Command (m for help): t
       Partition number (1,2, default 2): 2
       Partition type (type L to list all types): 82

       Changed type of partition 'Linux' to 'Linux swap / Solaris'.
  • Create a root (/) partition. If you don't plan to create any further partitions on the SD card, you can assign the remaining space, like we do in the following
fdisk> Command (m for help): n
       Partition type
          p   primary (2 primary, 0 extended, 2 free)
          e   extended (container for logical partitions)
       Select (default p): p
       Partition number (3,4, default 3): 3
       First sector (786466-31422463, default 786466): 
       Last sector, +sectors or +size{K,M,G,T,P} (786466-31422463, default 31422463): 

       Created a new partition 3 of type 'Linux' and of size 14.6 GiB.
  • Verify the partition layout (sizes, type and that the FAT32 boot partition is the first one)
fdisk> Command (m for help): p
       Disk /dev/mmcblk0: 15 GiB, 16088301568 bytes, 31422464 sectors
       Geometry: 64 heads, 32 sectors/track, 15343 cylinders
       Units: sectors of 1 * 512 = 512 bytes
       Sector size (logical/physical): 512 bytes / 512 bytes
       I/O size (minimum/optimal): 512 bytes / 512 bytes
       Disklabel type: dos
       Disk identifier: 0xfd0a09fa
       Device          Boot  Start      End  Sectors  Size Id Type
       /dev/mmcblk0p0           32   262176   262145  128M  b W95 FAT32
       /dev/mmcblk0p1       262177   786465   524289  256M 82 Linux swap / Solaris
       /dev/mmcblk0p2       786466 31422463 30635998 14.6G 83 Linux
  • Write changes to the SD card
fdisk> Command (m for help): w
       The partition table has been altered.
       Calling ioctl() to re-read partition table.
       Syncing disks.

Mounting the Fedora ARM Image File

To copy the content of the downloaded image file to the SD card, we need to mount the root partition of the image file to a temporary directory (/tmp/img/)

  • Unpack the downloaded compressed *.raw.xz file
# unxz Fedora-Server-armhfp-23-10-sda.raw.xz
  • Create the temporary mountpoint
# mkdir /tmp/img/
  • Assign a free loop device to the uncompressed image file, for the later mount
# losetup --partscan --find --show Fedora-Server-armhfp-23-10-sda.raw 
The loop device that is shown, is the one assigned to the image file. In the above example this means that /dev/loop0 is mapped to the disk inside the image (like e. g. /dev/sda for a harddrive), while /dev/loop0p1 is the first partition, /dev/loop0p2 the second, and so on.
  • Mount the root partition of the image file read-only to the temporary mountpoint
# mount -r /dev/loop0p3 /tmp/img/
The mounted image file partition can be explored via "ls", "cd", etc.

If you're concerned that /tmp/img/boot/ is empty; this is expected. We will replace the Fedora kernel with the original Raspberry Firmware. That's why the original content of the image boot partition is not required.

Formating the SD Card Partitions

  • Format the boot partition with FAT32
# mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
  • Create a swap space on the swap partition
# mkswap /dev/mmcblk0p2
Setting up swapspace version 1, size = 256 MiB (268431360 bytes)
no label, UUID=3f5a6466-628b-4501-8793-3463982059c6
  • Format the root partition with ext4
# mkfs.ext4 /dev/mmcblk0p3 
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 3829499 4k blocks and 958464 inodes
Filesystem UUID: d94024fb-1ef4-4780-b686-eed66591f73a
Superblock backups stored on blocks: 
       32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done  
If you consider using a different filesystem, make sure that its support is compiled into the Raspberry Pi kernel (e. g. XFS support is only available as a module and can't be used for the root filesystem out of this reason).

Mounting the SD Card

  • Create a temporary mountpoint for the SD card
# mkdir /tmp/rpi/
  • Mount the root partition of the SD card to the temporary mountpoint
# mount /dev/mmcblk0p3 /tmp/rpi/
  • Create a /boot/ directory on the root partition of the SD card
# mkdir /tmp/rpi/boot/
  • Mount the later boot partition
# mount /dev/mmcblk0p1 /tmp/rpi/boot/

Populating the Root Partition

  • Copy the content of the image root partition to the SD cards root
# cp -rpv /tmp/img/* /tmp/rpi/
  • Synchronize all caches
# sync

Unmounting the Image File

The Fedora image file isn't required for the later steps any more.

  • Unmount the image file root partition
# umount /tmp/img
  • Detach loop device
# losetup -d /dev/loop0

Setting up the fstab File

WARNING: In the following step we adjust the fstab on the SD card in it's temporary mountpoint. Make sure, that you don't edit the /etc/fstab on your local system instead, to prevent boot failures of your local operating system!

  • Print the UUIDs of the filesystems on the SD card. They are needed to know in the next steps.
# blkid | grep mmcblk0
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="CA36-2A8E" TYPE="vfat" PARTUUID="fd0a09fa-01"
/dev/mmcblk0p2: UUID="3f5a6466-628b-4501-8793-3463982059c6" TYPE="swap" PARTUUID="fd0a09fa-02"
/dev/mmcblk0p3: UUID="d94024fb-1ef4-4780-b686-eed66591f73a" TYPE="ext4" PARTUUID="fd0a09fa-03"
  • Open /tmp/rpi/etc/fstab with your your favorite text editor (vi/vim, emacs, nano, gedit, etc.)
  • Replace the existing content of the file with the below stated. Adjust the UUIDs to the output of the previous step. Take care about the partition order! It is required, that all partitions, except swap, are listed in an order that allows to build a tree (e. g. / requires to be mounted before /boot, because it contains the mountpoint of /boot/).
UUID=d94024fb-1ef4-4780-b686-eed66591f73a       /       ext4    defaults,noatime  0 0    # mmcblk0p3
UUID=CA36-2A8E                                  /boot   vfat    defaults,noatime  0 0    # mmcblk0p1

UUID=3f5a6466-628b-4501-8793-3463982059c6       swap    swap    defaults,noatime  0 0    # mmcblk0p2
  • Save the changes

Populating the /boot Partition

  • Download and unzip the latest firmware from the Raspberry repository:
# curl -L -o raspberry-firmware.zip https://github.com/raspberrypi/firmware/archive/master.zip
# unzip raspberry-firmware.zip
  • Copy /boot content (kernel, 2nd stage bootloader, etc.)
# cp -r firmware-master/boot/* /tmp/rpi/boot/
  • Copy kernel modules
# cp -r firmware-master/modules/* /tmp/rpi/lib/modules/
  • Create a cmdline.txt in the /boot/ folder of your SD card (/tmp/rpi/boot/cmdline.txt). This file is mandatory and used to pass arguments to the kernel. Add the following content to that file:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
  • The last step is optional: The Raspberry Pi uses a file called config.txt on the boot partition to store system configuration parameters (/tmp/rpi/boot/config.txt in the temporary mounted SD card). Usually those parameters are set/changed in a BIOS, that doesn't exist on a Raspberry Pi. See the Raspberry Pi documentation about config.txt for further information and parameter descriptions. Even if the file is optional, it allows to modify certain settings. The following is an example config.txt used on a Raspberry Pi 2 B:
# Enable audio (loads snd_bcm2835) for kernel 4.4+
# Enable HDMI audio

Unmounting the SD Card

  • Unmount the SD card partitions
# umount /tmp/rpi/boot/
# umount /tmp/rpi/
  • Synchronize all caches
# sync

Booting Fedora

  • Insert the SD card into the Raspberry Pi
  • Make sure, you're having a keyboard and monitor connected
  • Power on the Raspberry Pi
  • If everything was done correctly, you will see Fedora booting into the "Initial setup wizzard"
  • Finish the wizard and reboot, to boot into your Fedora ARM installation

First Steps

  • Configure your network, if no IP assignment via DHCP exists
  • Set the local time. Since the Raspberry Pi doesn't have a realtime clock (RTC), you need to ensure that the local time is set correct after every reboot! A correct time is necessary, e. g. for validating SSL certificates. You can configure ntpd to synchronize time or do it manually:
# date -s "29 Feb 2016 11:05:00"
  • Remove the Fedora kernel packages. They are not needed, due to the fact that we boot the kernel provided by the Raspberry Pi vendor.
# dnf remove kernel kernel-core kernel-modules
  • Update the system
# dnf update

Raspberry Pi Firmware Updates

The Hexxeh / rpi-update project provides a script that updates the Raspberry Pi firmware (kernel, modules, etc.) to the latest version. See the project homepage about further details.

Installing rpi-update

  • Install dependencies
# dnf install binutils git tar
  • Install rpi-update
# curl -L -o /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update
# chmod +x /usr/bin/rpi-update

Updating the Raspberry Pi Firmware

The firmware (kernel, etc.) can easily be updated by running:

# rpi-update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
This update bumps to rpi-4.1.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168    0   168    0     0    221      0 --:--:-- --:--:-- --:--:--   221
100 49.2M  100 49.2M    0     0  1111k      0  0:00:45  0:00:45 --:--:--  974k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 4.1.18-v7+
 *** depmod 4.1.18+
 *** Updating VideoCore libraries
 *** Using HardFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to 0d25b1c25d135090269ff74dc94dac0d31dcbcf9
 *** A reboot is needed to activate the new firmware

If a new kernel was installed, a reboot is required.

Configuring the Raspberry Pi 3 On-board Wi-Fi

The Raspberry Pi 3 is shipped with an on-board Wi-Fi chip. To enable:

$ cd /lib/firmware/brcm/
$ curl -O https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.bin
$ curl -O https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.txt
  • Reboot the Raspberry to load the firmware.
  • Install the Network Manager text user interface and Wi-Fi support:
# dnf install NetworkManager-tui NetworkManager-wifi
  • You are now able to configure the Wi-Fi device using the "nmtui" tool:
  • Select "Edit a connection"
  • Select "Add" and choose the connection type "Wi-Fi"
  • In the following dialog, set the correct values for your network. Specify "wlan0" in the "Device" field.
Select "Automatically connect", if the Wi-Fi connection should be established at boot time.
  • Save your changes by clicking "OK".
  • To activate the connection without reboot:
  • Start "nmtui" tool again
  • Select "Activate a connection"
  • Connect to your Wi-Fi network.