Getting Fedora 21 on the Raspberry Pi 2

The recent release of the Raspberry Pi 2 uses a newer version of the ARM architecture spec, the ARM Cortex-A7 uses ARMv7 whereas the previous model ARM11 uses ARMv6. The great thing about this is the majority of Linux distros already provide an Image for this architecture. More importantly, Fedora already have images.

There is a slight caveat to the above statement however, that being they won’t just work with the Pi 2. The process isn’t that difficult either just a few steps:

  1. Download the image you require, for this we’ll go with the Fedora 21 minimal – http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Images/armhfp/Fedora-Minimal-armhfp-21-5-sda.raw.xz
  2. Flash the image to an SD card xzcat Fedora-Minimal-armhfp-21-5-sda.raw.xz |dd of=/dev/mmcblk0 bs=1M
  3. Make sure the card is unmounted
  4. fdisk the card:
    1. remove partition 1
    2. add a new partition where the old partition 1 was, with type B (FAT32)
    3. write and exit
  5. mkfs.vfat /dev/mmcblk0p1
  6. Clone the Pi firmware repository – git clone https://github.com/raspberrypi/firmware.git
  7. Mount the card again
    1. mkdir /mnt/sdcard
    2. mount /dev/mmcblk0p3 /mnt/sdcard
    3. mount /dev/mmcblk0p1 /mnt/sdcard/boot
  8. Copy the contents of the boot directory from the repository you just cloned to the new boot directory and the kernel modules to the lib/modules directory on the main root partition
    1. cp -r firmware/boot/* /mnt/sdcard/boot/
    2. cp -r firmware/modules/3.18.7-v7+/* /mnt/sdcard/lib/modules/
  9. Edit the fstab file to reflect the new UUID of the partition and change from being an ext to a vfat type
    1. blkid /dev/mmcblk0p1 – this will give the UUID of the partition
    2. vi /mnt/sdcard/etc/fstab and edit the line which contains /boot to contain the above info
  10. Create a /mnt/sdcard/boot/cmdline.txt file containing the following:

    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait

  11. Create a /mnt/sdcard/boot/config.txt file containing the following:
    #uncomment to overclock the arm. 700 MHz is the default.
    arm_freq=700# NOOBS Auto-generated Settings:
    hdmi_force_hotplug=1
    config_hdmi_boost=4
    overscan_left=24
    overscan_right=24
    overscan_top=16
    overscan_bottom=16
    disable_overscan=0
    core_freq=250
    sdram_freq=400
    over_voltage=0
  12. save and close any open files on the sd card then unmount and ensure all writes are complete
    1. umount /mnt/sdcard/boot
    2. umount /mnt/sdcard
    3. sync
  13. You should now be able to remove the SD card from your PC and boot it in your new shiny Raspberry Pi 2

I’m sure it won’t be long before dedicated images are available, but for now this seems to work for me. I haven’t tried any more than the minimal install, with these your mileage may vary.

Note: Please remember this will only work on the newer Raspberry Pi 2.

Update:

Extra steps suggested by Tim Bosse

14. Install rpi-update.
Install binutils and tar.

Download and setup rpi-update.

# curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update && sudo chmod +x /usr/bin/rpi-update

15. Run rpi-update as root.

I find this is important to run any time you get kernel updates from Fedora repos.

I have a wireless USB dongle that I use.

16. Install NetworkManager-wifi and NetworkManager-tui (because I find nmcli not so much fun).

I’ve created an image based on steps 1-13 it’s fairly rough and ready so YMMV

https://jfarcher.fedorapeople.org/Fedora-Minimal-armhfp-rpi-21-5-sda.raw.xz

  • Tim Bosse

    Thanks for this. Following your guide worked well. I added a few steps to get things working better for me.

    14. Install rpi-update.
    Install binutils and tar.

    Download and setup rpi-update.

    # curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update && sudo chmod +x /usr/bin/rpi-update

    15. Run rpi-update as root.

    I find this is important to run any time you get kernel updates from Fedora repos.

    I have a wireless USB dongle that I use.

    16. Install NetworkManager-wifi and NetworkManager-tui (because I find nmcli not so much fun).

  • Any chance you’d consider dd’ing up the finished product and putting it somewhere for download?

  • Tim, thanks for that I’ll add those to the main post.

    Scott, yes I was planning to create an image and upload somewhere.

  • I’ve put an image up https://jfarcher.fedorapeople.org/Fedora-Minimal-armhfp-rpi-21-5-sda.raw.xz
    root password is initially blank so will need setting, also Tims steps will need adding.

    • John Rowan

      Thanks for the instructions. I have Pi 2 with 64GB sd card, it boots to the text login prompt but the USB keyboard isn’t interacting. I unplugged keyboard, plugged into another USB port, it displays on the screen that the keyboard is recognized but still doesn’t work. I unplugged the power, restarted and succeeded after several attempts at corrupting requiring CTRL-D or root password, can’t do either. Tried ssh-ing in but don’t know root user password, tried fidora but that doesn’t work.

      • John Rowan

        Is there a way to modify config.txt or cmdline.txt to invoke single user mode?

  • Bruce

    Thanks for this, Jon. I was just dd’ing the Fedora 21 Workstation image to a micro SD when I found this article. It boots up, Gnome starts, and it presents the language option screen. But for some reason I couldn’t get my mouse or keyboard to work. I probably need to try a different mouse/keyboard combination.

  • Bruce, did you modify the workstation image to get it to boot or did you just DD it?

  • Bruce

    Sorry, I wasn’t too clear. Yes, I modified the image per your instructions, although I commented out the arm_freq line in config.txt. I did not follow Tim’s instructions. I’ll see if the networking is functional and see if I can dig through the system logs.

  • Cool, be interested to hear your progress. The workstation image was my next adventure.

  • Bruce

    Wilco.

    As expected, the network is firewalled off. But I was able to extra the systemd log by copying it off the micro SD and doing:

    journalctl –full –file=system.journal > system.journal.txt

    It looks like the USB is fine, and it’s just an xorg configuration issue:

    Feb 21 16:57:01 localhost kernel: usb 1-1.4: new full-speed USB device number 10 using dwc_otg
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: New USB device found, idVendor=046d, idProduct=c52b
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: Product: USB Receiver
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: Manufacturer: Logitech
    Feb 21 16:57:01 localhost kernel: input: Logitech USB Receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:046D:C52B.0007/input/input3
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0007: input,hidraw0: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input0
    Feb 21 16:57:01 localhost kernel: input: Logitech USB Receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:046D:C52B.0008/input/input4
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0008: input,hiddev0,hidraw1: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input1
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0009: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input2
    Feb 21 16:57:01 localhost mtp-probe[26262]: checking bus 1, device 10: “/sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.4”
    Feb 21 16:57:01 localhost mtp-probe[26262]: bus: 1, device: 10 was not an MTP device
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) config/udev: Adding input device Logitech USB Receiver (/dev/input/mouse0)
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) No input driver specified, ignoring this device.
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) This device may have been added with another device file.

    That’s a bit surprising, because I thought xorg had got to the point where it would work without configuration in most cases. Should be reasonably easy to move on, though.

  • LennyC

    Extremely useful post. Thanks a bunch to you and others for all the great info.

  • Bruce

    I was able to get things working further:
    – Mount the rootfs from the micro SD on a PC
    – cd to the root of the mounted rootfs
    – symlink the multi-user systemd target:
    ln -sf /usr/lib/systemd/system/multi-user.target etc/systemd/system/default.target
    – Edit etc/passwd to remove the x from the root user, thereby clearing the root password
    – Unmount the rootfs, remove the micro SD
    – Boot the Pi 2 with the micro SD, which will start in text mode
    – Find a keyboard that works (I only had one of three work)
    – Log in as root
    – Change the root password
    – Install openssh-server to allow remote login in future
    – Run through Tim’s rpi-update steps
    – Now remove the /etc/systemd/system/default.target symlink
    – Reboot

    It should boot into the gnome initial setup. The USB keyboard and mouse compatibility is definitely improved after running rpi-update.

    In actual fact I rebooted before removing the symlink, and manually changed to the graphical.target “runlevel”. I then went through the gnome setup (though the resolution was wrong), rebooted, and everything was working.

    It’s pretty slow, but it does work. I need to look into what rpi-update actually does, and how far the Pi support is from getting into the master Linux kernel sources.

  • Ravi Sreeram

    I renamed the file as “Fedora-Minimal-armhfp-rpi-21-5-sda.img” after unzip and on windows 7 use “Win32DiskImager”. It works ( hope someone is looking for it )

    • Daniel Gonsalv

      Ravi,

      Where can I find the .img file?

      Blessings

    • Erick Tovar

      I was looking for something just like this, thank you so much 🙂

  • I took the image and got a fairly complete XFCE desktop environment with Midori, Abiword, Gnumeric, and GIMP… all fitting on a 4GB microSD card… with about 450MB of free space on /.

    Sound doesn’t work for me so I’m not sure how to get that to work. Says no sound device found. The Fedora kernel gets installed but doesn’t get used. I’m ignorant on how to get stuff to /boot as I know nothing about ARM booting… nor the Raspberry Pi 2 specifically.

    Comments about potential future builds:

    1) /boot is 500MB. That is a bit big. Maybe 250MB or 100MB?

    2) It has a swap partition that is 122MB. I know the Raspbian distro also has a swap partition… but some in IRC have nagged me about how bad swap on SD cards is with wearing them out faster. Should we really have a swap partition?

    3) I installed LibreOffice, Firefox, Inkscape, xchat, and pidgin… but had to pull that stuff back out to get it to fit on a 4GB card with some free space left. If you have a bigger card, put the card into a desktop system and use gparted and resize /. Then you’ll have plenty of room to install whatever you want.

    I know there is Pidora but their mailing list (so far as I cn tell) has been dark for a while. I’m not sure how long it will take them to catch up to the Pi 2… so this isn’t a bad start.

  • Tim Bosse

    Scott,

    1) After somebody posted to the fedora-devel list regarding this blog entry, I happened across a message from the fedora-arm list as I was perusing their discussions that talks about how to resize root. Check it out at https://lists.fedoraproject.org/pipermail/arm/2015-March/009206.html.

    2) I am not a smart man when it comes to needing swap, but running out of memory is never good. If you are concerned about it, maybe move swap to a USB drive? I had to do a bit of research to decide how I felt and found a document that may be of interest. Read about it at https://www.kernel.org/doc/gorman/html/understand/understand016.html.

    It sounds like the fedora-arm folks are going to attempt to build their own image and have started working on it themselves. If I had time and ability to keep up, I would join their efforts. The message talking about their image is at https://lists.fedoraproject.org/pipermail/arm/2015-February/008992.html.

  • I have probably run your procedure for installing Fedora021 on the Raspberry Pi 2 Model B fifty times now and seem to have two problems.

    The F-21 minimal .img you made works, but when I add X and xfce the display comes up as expected however I have no keyboard or mouse control and haven’t been able to find why?

    This morning I ran the process using Fedora-Xfce-armhfp-21-5-sda.raw.xz. Again I have no keyboard or mouse, additonally the password has not been set so I can not access it via ssh. The only way to shut it down is to pull the power plug.

    Another thing that is probably related, this is F-22beta and dev notation is typically /dev/sdf.
    But when I do:
    ]# gedit /mnt/sdcard/boot/cmdline.txt
    I get:
    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait

    If I change it to root=/dev/sdf3 the boot process does not complete, left unchanged, my resutls are as described above.

    Any thoughts appreciated,

    Bob

    • I am replying to my own mssage –

      With help resulting from the Fedora mailing list I was able to deal with the password problem by putting a known password from another computer in /etc/shadow while working with Fedora-22 arm. Then I was ablt to login via ssh as root and enter a user id. and password. That produces a usable F-22 via ssh but with a few problems.

      I guess what I really need help with is the “cmdline.txt” file:

      [root@box10 bobg]# cat /mnt/sdcard/boot/cmdline.txt
      dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait

      Fedora is using the notation /dev/sdfx, and /dev/mmcblk0px does not work. root=/dev/mmcblk0p3 does not look correct, although it is the only thing that seems to “sort of” work. Logically it would seem to want to be rooot=/dev/sdf3 but that causes the boot to fail and I really don’t understand what is happening here?

      Does anyone have any suggestions or thoughts about this?

      Bob — bobgoodwin@wildblue.net

      • Is it possible to use the UUID of the partition?

      • Stewart Samuels

        Bob,

        I am using the Fedora-KDE-armhfp-22-3-sda.raw.xz image. The problem you are having with root= in the cmdline.txt file is that there should only be 1 line in this file, not two as it appears above in Jon Archer’s step 10. That is, append the second line to the end of the first line with a space between “tty1” and “root=”. Also, the root= value needs to be “/dev/mmcblk0p3”, as the boot up loader looks for this. It appears the boot loader at this point is not Fedora.

        By making this change, I was able to boot up to graphics mode after adding a root password and setting my Timezone. However, like you, now that the KDE desktop login screen comes up, I lose my keyboard and mouse. I don’t know if Tim Bosse’s rpi-updates will cure this but that’s what I am looking to try next.

        • Stewart Samuels

          Update to my earlier response.

          After creating a static network address so I could ssh into my raspberry pi 2, I was successfully able to install the binutils and perform the rpi-update as suggested by Tim. Upon reboot, the system boots completely to the KDE Plasma login screen and I have both mouse and keyboard. The system is slow to bring up the KDE desktop upon login but be patient. It all seems to be working. I was able to bring up a terminal and installed firefox.

          More experimentation is required, but so far it is more or less what I expected.

  • Fred

    I can’t get the image to boot, is this the correct way to write it?
    xz -d Fedora-Minimal-armhfp-rpi-21-5-sda.raw.xz
    sudo ddrescue -d -D –force Fedora-Minimal-armhfp-rpi-21-5-sda.raw /dev/sdc

    • if sdc is your sd card then that looks plausible, although I’m not as familiar with the ddrescue switches. Have you tried with plain old dd?

  • markcarter

    how to install fedora 22 or centos 7 in raspberry 2??

    • Fedora 22 images are available now, the process should be very similar. I believe CentOS images are also being worked on.

  • Job

    Hi, first of all. Thanks for the clear description. I’m able to complete all steps succesfully. However, I can’t seem to get it to boot. Whatever I put after root= in cmdline.txt, I always get Kernel Panic: VFS : Unable to mount root fs on unknown-block (0,0).

    Any suggestions? I have tried “/dev/mmcblk0p3″ , ” /dev/sdb3″ , “/dev/sda3” and the UUID. None of them make the pi boot into Fedora.

    • Hi,
      Not sure why it isn’t booting, although it definitely won’t be sdb or sda. You are best using the UUID of the partition and this should work.
      you have formatted the partition with the specified filesystem (ext4)?
      I haven’t tested this process in a while but it should be still the same.

    • Stewart Samuels

      Job,

      See my reply to Bob Goodwin above. I ran into this issue as well. Do as I suggested to Bob and you should get past this in the boot process.

    • mike

      Hi, any solution on this? I have the same problem.. by the way, thanks for this much helpful posts and info.

  • Hi all,
    I haven’t revisited this since Fedora 21, I guess I should really. Also as Bob suggested the mailing lists are probably a better place for help as there are quite a number of people working on the Pi.
    You can sign up here: https://admin.fedoraproject.org/mailman/listinfo/arm
    or visit the archives here: https://lists.fedoraproject.org/pipermail/arm/
    Sorry I can’t be of more help but this was more of a “can it be done” process than a “this is how to do it”.

  • I’ve written up an update that works for F22 and F23 Beta1. It resolves the problem I had with Jon’s otherwise wonderful directions where the mouse and keyboard didn’t work. It also covers the cmdline.txt entry needed to avoid the Kernel Panic: VFS : Unable to mount root fs.
    https://chisight.wordpress.com/2015/10/19/fedora-22-or-23-on-raspberry-pi-2/