===== Installing Fedora (release or rawhide) on Raspberry Pi 4 =====
===== Step 1: Writing image =====
These steps can be done on an x86_64 Fedora system with a micro-sdcard reader/writer. I recommend the latest Fedora release.
* Fedora39: fetch Fedora-Minimal* from https://kojipkgs.fedoraproject.org/compose/39/latest-Fedora-39/compose/Spins/aarch64/images/
dnf install -y arm-image-installer
# Our directory for storing images etc.
WORKDIR="/home/chris/Downloads/raspi"
# Our microsd-card device
OUTDEV="/dev/mmcblk0"
cd $WORKDIR
fedora-arm-image-installer \
--image \
--target=rpi4 --media $OUTDEV --resizefs
===== Step 2: Fedora setup =====
### Mount the card
mkdir -p $WORKDIR/mnt
mount ${OUTDEV}p3 $WORKDIR/mnt
mount ${OUTDEV}p2 $WORKDIR/mnt/boot
mount ${OUTDEV}p1 $WORKDIR/mnt/boot/efi
cd $WORKDIR/mnt
# set your root-password to 'fedora'
sed -ie 's,^root.*,root:$6$g1sdJY/CulQKzQmS$heAUJV60eTr1HQtTTR188WlA/vOTj6LPuKA7JB1wKEgPiW1qX2gPJHU8lLhSL8KeKgx.hGgUvQ4uzW6JQ68u40:18388:0:99999:7:::,' etc/shadow
# As an alternative, execute 'vi etc/shadow' and manually
# change the password hash to something else.
echo 'PermitRootLogin yes' >>etc/ssh/sshd_config
echo pi4.local >etc/hostname
echo '127.0.0.1 pi4.local pi4' >>etc/hosts
rm -f etc/localtime
ln -s /usr/share/zoneinfo/Asia/Tokyo etc/localtime
### Let's set a static IP
# Need to update with the details for the connection file.
# mkdir -p etc/NetworkManager/system-connections
# vi etc/NetworkManager/system-connections/tokyo-lan.nmconnection
# chcon system_u:object_r:NetworkManager_etc_rw_t:s0 \
# etc/NetworkManager/system-connections/tokyo-lan.nmconnection
# chmod 600 etc/NetworkManager/system-connections/tokyo-lan.nmconnection
# Disable the initial-setup and other unneeded services
rm -f etc/systemd/system/multi-user.target.wants/initial-setup.service
rm -f etc/systemd/system/multi-user.target.wants/abrtd.service
rm -f etc/systemd/system/multi-user.target.wants/abrt-journal-core.service
rm -f etc/systemd/system/multi-user.target.wants/abrt-oops.service
rm -f etc/systemd/system/multi-user.target.wants/abrt-vmcore.service
rm -f etc/systemd/system/multi-user.target.wants/abrt-xorg.service
rm -f etc/systemd/system/multi-user.target.wants/cups.service
rm -f etc/systemd/system/multi-user.target.wants/nfs-client.service
rm -f etc/systemd/system/multi-user.target.wants/vboxservice.service
rm -f etc/systemd/system/multi-user.target.wants/vmtoolsd.service
rm -f etc/systemd/system/multi-user.target.wants/ModemManager.service
rm -f etc/systemd/system/multi-user.target.wants/rngd.service
rm -f etc/systemd/system/multi-user.target.wants/avahi-daemon.service
rm -f etc/systemd/system/multi-user.target.wants/auditd.service
rm -f etc/systemd/system/multi-user.target.wants/smartd.service
rm -f etc/systemd/system/multi-user.target.wants/libvirtd.service
rm -f etc/systemd/system/multi-user.target.wants/remote-fs.service
rm -f etc/systemd/system/sysinit.target.wants/multipathd.service
rm -f etc/systemd/system/sockets.target.wants/multipathd.socket
cd ..
umount $WORKDIR/mnt/boot/efi
umount $WORKDIR/mnt/boot
umount $WORKDIR/mnt
You should now be able to boot the Pi4 with the sdcard into Fedora, it takes some time. Login via ssh should then be possible.
===== Step 3: First steps on the Fedora installation =====
cat >>~/.bashrc</etc/rc.local< '/proc/sys/vm/dirty_writeback_centisecs'
# power saving for wlan and usb chips
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
EOT
chmod +x /etc/rc.local
/etc/rc.local
ln -s /etc/rc.local /etc/rc.d/rc.local
# To get further ideas about services we do not need
systemd-analyze plot >file.svg
# For my use cases:
systemctl disable lmsensors firewalld
# If required for debugging:
# vi /etc/default/grub
# GRUB_CMDLINE_LINUX="console=tty0 audit=0 selinux=0"
# grub2-mkconfig -o /boot/grub2/grub.cfg
# update
dnf -y update