Howto install Fedora on Raspberry Pi 3 headless

in raspberry-pi •  3 months ago

This howto is going to help you install Fedora on your Raspberry Pi 3, we will access the Internet via the built-in WiFi adapter.

I did not have keyboard/monitor, so the setup is done via a serial cable.

Step 0: Prerequisites

IMG_20170910_152206.jpg

  • A Raspberry Pi 3 + microSD card
  • A decent power supply. You'll want at least 2.5A
  • Computer running Fedora + microSD card reader
  • USB to TTL Serial Cable / Console Cable
  • Access to a wireless network

I bought my serial cable from DealExtreme, it is also possible to buy from Adafruit.

Step 1: Download and verify the Fedora image:

Lines that starts with $ is a notion that you should run the command as a regular user.
Do not include the dollar sign in the command. Lines that do not start with dollar sign are output from the previous command.

Download files and import the GPG key from Fedora:

$ mkdir -p ~/fedora-pi
$ cd ~/fedora-pi
$ wget https://download.fedoraproject.org/pub/fedora/linux/releases/26/Spins/armhfp/images/Fedora-Minimal-armhfp-26-1.5-sda.raw.xz
$ wget https://arm.fedoraproject.org/static/checksums/Fedora-Spins-26-1.5-armhfp-CHECKSUM
$ curl https://getfedora.org/static/fedora.gpg | gpg --import

Verify that the checksum file has the correct signature from Fedora:

$ gpg --verify-files Fedora-Spins-26-1.5-armhfp-CHECKSUM
gpg: Signature made Fri 07 Jul 2017 05:13:33 PM CEST using RSA key ID 64DAB85D
gpg: Good signature from "Fedora 26 Primary (26) <fedora-26-primary@fedoraproject.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: E641 850B 77DF 4353 78D1  D7E2 812A 6B4B 64DA B85D

And verify that the checksum of the download image is correct:

$ sha256sum -c --ignore-missing Fedora-Spins-26-1.5-armhfp-CHECKSUM
Fedora-Minimal-armhfp-26-1.5-sda.raw.xz: OK
sha256sum: WARNING: 19 lines are improperly formatted

And if the output is something like this, then you are ready for the next step.

Step 2: Writing image to micro SD card:

$ sudo dnf install -y fedora-arm-installer
$ sudo arm-image-installer --resizefs --image=Fedora-Minimal-armhfp-26-1.5-sda.raw.xz --target=rpi3 --media=/dev/mmcblk0

You will get a prompt and after a while this will be printed:

Installation Complete! Insert into the rpi3 and boot.

Before you unmount your SD card, do this:

Enable UART:

This is only needed if you are using the serial cable as I do.

Mount the VFAT partition and uncomment the enable_uart line in config.txt:

$ sudo mount /dev/mmcblk0p1 /mnt/
$ sudo sed -i '/enable_uart=1/s/^#//g' /mnt/config.txt
$ sudo umount /mnt

.

Mount the boot partition and append "console=tty0 console=ttyS0,115200" to
the line that contains append ro root=UUID="LARGE UUID STRING OF TEXT" in
extlinux/extlinux.conf:

$ sudo mount /dev/mmcblk0p2 /mnt/
$ sudo sed '/append ro root=UUID=/s/$/ console=tty0 console=ttyS0,115200/' /mnt/extlinux/extlinux.conf
$ sudo umount /mnt

Include a missing file that Fedora is not able to redistribute for WiFi

Mount the root partition and copy the missing file:

$ sudo mount /dev/mmcblk0p4 /mnt/
$ sudo curl https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm80211/brcm/brcmfmac43430-sdio.txt -o /mnt/lib/firmware/brcm/brcmfmac43430-sdio.txt
$ sudo umount /mnt

Step 3: Insert SD card into the Raspberry Pi and wire the serial cable:

Connect the black, white and green cable like this:
IMG_20170910_163900.jpg

And insert the SD card on the back of the board:
IMG_20170910_162838.jpg

Install cu and give yourself read/write permission to the serial cable:

$ sudo dnf install -y cu
$ sudo usermod -a -G dialout $(whoami)

You need to logout for Linux to refresh group permission, so do that first or
use sudo.

Then run:

$ cu -l /dev/ttyUSB0 -s 115200

If you get this as output, then you are ready to power on your Raspberry Pi.

Connected.

When Raspberry Pi is powered on, you should see this to your terminal:

U-Boot2017.0(Jun 24 2017 - 17:14:20 +0000)

DRAM:  992 MiB
RPI  Moel B (0xa02082)
MMC:   bcm2835sdhci: 0
reading uboot.nv

** Ubtread "uboot.env" from mmc0:1 **
Using default environment

In:    serial
Out:   lcd
Err:   lcd
No ethernet found.ization Skipped
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 3 USB Device) found
      canning usb fr storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 1 Ethernet Device(s) found
Hit any key to stop autoboot:  0

If you pressed any key during start-up, just enter boot at the U-Boot> prompt.

Continue the installation from here:

Initial setup of Fedora 26 (Twenty Six)

 1) [x] Language settings                 2) [!] Time settings
        (English (United States))                (Timezone is not set.)
 3) [ ] Network configuration             4) [!] Root password
        (Not connected)                          (Password is not set.)
 5) [!] User creation
        (No user will be created)

Step 4: Enable wireless network

$ nmcli device wifi list
*  SI      MODE   CHAN  RATE      SIGNAL  BARS SECURITY  
   Heggheim  Infra  6     54 Mbit/s  35      ▂▄__  WPA1 WPA2
   --        Infra  6     54 Mbit/s  34      ▂▄__  --     
$ nmcli device wifi connect <SSID|BSSID> password <password>

To view your IP address, run:

$ ip address show wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:eb:eb:98:4c brd ff:ff:ff:ff:ff:ff
    inet 192.168.80.109/24 brd 192.168.80.255 scope global dynamic wlan0
       valid_lft 80370sec preferred_lft 80370sec
    inet6 fe80::90fb:5ebd:c44e:936e/64 scope link
       valid_lft forever preferred_lft forever

Here my IPv4 address is 192.168.80.109.

Check that you are connected to Internet

$ curl -Is https://steemit.com/ -L | grep HTTP/
HTTP/1.1 200 OK

Step 5: Final steps

Update all packages:

$ sudo dnf upgrade -y

This will take a while.

Reboot to the latest kernel:

$ sudo reboot

Enjoy

Please let me know in the comment section if you ran into issues, found errors or if you have suggestions/improvements.

References:

https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi
https://arm.fedoraproject.org/verify.html
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/connect-the-lead


About me

I am a volunteer at the Fedora where I maintain Electrum and some other bitcoin related packages.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!