Recently I setup CentOS on the Raspberry pi 2. Now we’re going to be installing a modern Fedora 23 desktop on the Raspberry Pi 3. I’ve used the Pi 2 instructions from chisight’s blog post so original credit goes to him – I’ve modified them and added some things.
You’ll need a few things to get started, we’ll be using a Fedora Desktop ARMv7 spin. I’ll be using XFCE as it’s my desktop of choice but you can substitute this for one you like. Note that we’ll be using the Raspberry Pi Kernels here and not the upstream, latest Fedora Kernels – if you’re interested in the latter please check out David Todd’s blog here.
- Raspberry Pi 3 Model B (Quad Core 1.2GHz)
- Fedora XFCE or similar F23 image for ARMv7
- A decent USB hub or power source
- An SD card for installing Fedora
- Another Linux or OSX computer with an SD card reader
Download/Prep Fedora Image and SD Card
We’ll be doing an image-based approach here, but I’m told that U-Boot does support PXE now so kickstart may be an option in the future.
Identify your SD Card Device
In Fedora and EL-based distributions SD cards are usually mmcblk0. If you’re unsure run this command below before inserting your SD card, it never hurts to double check.
Assuming /dev/mmcblk0 is your correct SD card you’ll download and write out the image. I’m using the XFCE Desktop spin image below, substitute as needed.
wget http://mirror.karneval.cz/pub/linux/fedora/linux/releases/23/Images/armhfp/Fedora-Xfce-armhfp-23-10-sda.raw.xz xzcat Fedora-Xfce-armhfp-23-10-sda.raw.xz | dd of=/dev/mmcblk0
Note: the above image location was a closer mirror to me in Europe. You may want to pick a better mirror location and adjust accordingly if download speeds are slow.
Partition Magic and Expansion
At this point your SD card will have the F23 image written to it, but to boot we’ll need a vfat primary partition in partition 1. We’ll want to expand the root partition as well since our SD card is probably larger than the Fedora image and we’ll need to swap XFS for EXT4 since it’s not supported.
echo -e "p\nt\n1\nb\nd\n3\nn\np\n3\n`fdisk -l /dev/mmcblk0|tail -1|tr -s ' '|cut -d' ' -f2`\n\np\nw\n"|fdisk /dev/mmcblk0; sync; partprobe
Now you’ll want to format the new primary partition as vfat.
Lastly, you’ll want to check and resize the 3rd partition as copying an image into any larger disk will make the partition table assume the size of the image. We resized it in the previous step but we’ll need to issue the resize command to finalize things.
e2fsck -f /dev/mmcblk0p3 resize2fs /dev/mmcblk0p3
Copy Raspberry Pi Boot Files
You’re not done yet, you’ll need the Raspberry pi uboot and kernel images. We’re going to create a mounted directory structure and copy these files from the Raspberry Pi repository.
mkdir /mnt/sdcard mount /dev/mmcblk0p3 /mnt/sdcard mount /dev/mmcblk0p1 /mnt/sdcard/boot
Next we’re going to download the files, copy things in place and remove any extraneous files that we don’t need.
unzip master.zip firmware-master/boot/* -d /mnt/sdcard/boot/ mv /mnt/sdcard/boot/firmware-master/boot/* /mnt/sdcard/boot/ rm -rf /mnt/sdcard/boot/firmware-master unzip master.zip firmware-master/modules/*-v7+/* -d /mnt/sdcard/lib/ mv /mnt/sdcard/lib/firmware-master/modules/*-v7+/ /mnt/sdcard/lib/modules/ rm -rf /mnt/sdcard/lib/firmware-master/
Edit fstab on Mounted Media
You’ll need to modify the /etc/fstab on the mounted SD card, first get the UUID of the first vfat partition we made earlier.
blkid -s UUID /dev/mmcblk0p1
Note the UUID, it should be a very short string, for it looked like:
UUID=016B-1F2F /boot vfat defaults,noatime 0 0
Edit your /mnt/sdcard/etc/fstab with the UUID like above, substituting for your UUID.
Create Boot Lines
You’ll need a few other options passed to cmdline.txt to boot things properly. The following command should take care of it. Note: even if you used /dev/sdc or similiar instead of /dev/mmcblk0 above you’ll still want to leave this /dev/mmcblk0p3 like below, as this is how the Raspberry Pi will see it’s device.
echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 \ root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait"\ >/mnt/sdcard/boot/cmdline.txt
Force Full HD over HDMI
In the next few steps we’ll be doing as much prep work while our SD card is still mounted so when we boot up for the first time there’s nothing to do post-install.
cat <<EOF>/mnt/sdcard/boot/config.txt disable_overscan=1 hdmi_force_hotplug=1 hdmi_group=1 hdmi_mode=16 EOF
Setup Raspberry Pi Update
rpi-update is a useful utility that will sync the latest kernel and firmware/boot files to your Raspberry Pi. Let’s get this in place
wget -O /mnt/sdcard/usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update chmod +x /mnt/sdcard/usr/bin/rpi-update
Setup Wifi Firmware & Modules
Currently the wifi does not work out of the box without some newer firmware, particularly the non-free firmware. Fix it by plopping these files into /lib/firmware. In future rpi updates this should be resolved.
First, grab the firmware files
wget -O /mnt/sdcard/lib/firmware/brcm https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.bin wget -O /mnt/sdcard/lib/firmware/brcm https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.txt
Setup the module to load on boot
printf "# load wifi\nbrcmfmac\n" > /mnt/sdcard/etc/modules-load.d/brcmfmac.conf
Set Root Password
This will set your root password, you can skip this step if your first boot will be hooked up to a monitor (as it will boot to run level 5 with the “first” boot screen allowing you to set things like account passwords, timezone, etc.). If you’re running headless or with a non-graphical image you’ll want to perform this.
read -s -p "Enter password: " pass echo -n root:$pass | chpasswd -c SHA512 -R /mnt/sdcard
Unmount SD Card
At this point you’re ready to unmount the SD card.
umount /mnt/sdcard/boot umount /mnt/sdcard sync
Now you’re ready to insert the SD card into your Raspberry Pi and boot it up. The next set of steps will take place once you gain access to your booted up Raspberry Pi.
If you’re using a Fedora Desktop spin or Workstation image you’ll boot into the Fedora firstboot screen where you can set things up like time, users, etc. Proceed to open a root terminal to continue the setup.
First Boot: Update Fedora & RPI
You’ll want to pull down the latest updates from both Fedora and the Raspberry Pi.
dnf update rpi-update
Fix: Sound Issues
If you have issues with sound you may need to perform this:
cat <<EOF>/etc/modules-load.d/snd_bcm2835.conf #load Raspberry Pi sound module snd_bcm2835 EOF
Now load the BCM chipset driver
Despite generally not caring for firewalld and the over-engineered approach to “zones” I’ve found it does not work reliably on ARMv7 in either CentOS or Fedora. Let’s remove it and move back to trusty old iptables.
systemctl stop firewalld systemctl mask firewalld
Install the iptables service.
dnf install iptables-services
Now set things up.
systemctl enable iptables service iptables save
Now edit your firewall rules like a sane human in /etc/sysconfig/iptables and when you’re done you can save them.
systemctl start iptables.service
One downside of the ARMv7 architecture for now is some 3rd party packages won’t be available. You can build these from source most of the time however, but it doesn’t hurt to search places like rpmfind or other 3rd party sources if you trust them.
For example you might want to use the synergy program to share a mouse/keyboard with your fresh new ARMv7 Fedora 23 desktop.
wget funcamp.net/w/synergy-1.6.2-3.fc23.armv7hl.rpm rpm -ivh synergy-1.6.2-3.fc23.armv7hl.rpm
Issue: Bluetooth not Working
The only thing that didn’t work for me was bluetooth, but I didn’t spend much time on it. It’s still missing firmware similar to the wifi above as the device is not recognized on Fedora. I’ve posted on the forums to see if others had luck as well as IRC however other people report it working on Debian Jessie.
Update: Bluetooth is working now as of 2016-07-04 via updates provided by rpi-update.
modprobe btbcm systemctl start bluetooth
Known Issue: SD Card
I’ve seen an occasional issue on my host Linux machine where I formatted the SD card that it would cache the partition information of the SD card no matter if it was ejected and rescanned and only a reboot would show the correct geometry to continue. If any of the above commands fail try rebooting the machine with the SD card inserted before proceeding and retry them.
Also, I’ve managed to get my SD card into such a state that only the SD card firmware rewriter could supposedly fix it. I was able to insert it into a digital camera instead and a quick erase did the trick, again I had to reboot the host machine reading it for the partition table information to be read correctly.
Here’s my Fedora 23 desktop running on the Raspberry pi 3. I’ve been able to stay at around 500-600MB of memory (out of 1GB) usage running Firefox, Plank, a few terminals open and other miscellaneous things with synergy connected to my primary work desktop and x11vnc. It’s light and tight but the Pi 3 seems to handle average Linux desktop tasks well with a lightweight desktop environment.
Mounting it .. Anywhere
Due to it’s small size and minuscule power usage you can leave the Raspberry Pi powered on pretty much all the time. You can also fit it pretty much anywhere. In haste I’ve duct-taped my Raspberry Pi 3 Fedora 23 desktop to the back of my desk. So sketchy looking!