Fedora 33 chroot or rootfs install?

I was curious how well this would work so I decided to try it to see if I could get a working system. these are the steps a took.

I first created the partition table for a basic setup and set my partitions:

parted /dev/sdd mklabel gpt
parted /dev/sdd mkpart ESP fat32 1MiB 512MiB
parted /dev/sdd mkpart primary 512MiB 1536MiB
parted /dev/sdd mkpart primary 1536MiB 100%
parted /dev/sdd set 3 boot on
mkfs.fat -F 32 -n EFI /dev/sdd1
mkfs.ext4 -L boot /dev/sdd2
mkfs.ext4 -L fedora /dev/sdd3

I then mounted them at /mnt/fedora:

mkdir /mnt/fedora
mount /dev/sdd3 /mnt/fedora
mkdir /mnt/fedora/boot
mount /dev/sdd2 /mnt/fedora/boot
mkdir /mnt/fedora/boot/efi
mount /dev/sdd1 /mnt/fedora/boot/efi

Now we can install the base system with:

sudo dnf --installroot=/mnt/fedora --releasever=33 install system-release

and a desktop/system environment (list of available environments can be found with dnf grouplist -v but i went with fedora workstation:

dnf --installroot=/mnt/fedora install @workstation-product-environment

then I installed some packages for grub and efi:

dnf --installroot=/mnt/fedora install grub2 grub2-efi-x64 grub2-efi-x64-modules shim-x64 efibootmgr

and started my chroot:

mount -v --bind /dev /mnt/fedora/dev
mount -vt devpts devpts /mnt/fedora/dev/pts -o gid=5,mode=620
mount -vt proc proc /mnt/fedora/proc
mount -vt sysfs sysfs /mnt/fedora/sys
mount --bind /sys/firmware/efi/efivars/ /mnt/fedora/sys/firmware/efi/efivars

chroot /mnt/fedora /usr/bin/env -i  \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin     \
    /bin/bash --login

from here I created my /etc/fstab using nano:

UUID=a917845e-2704-44d9-a445-7164ebe9740c   /           ext4    x-systemd.device-timeout=0 1 1
UUID=2e0b30e0-2fb7-43c1-8e1d-0252ec630ffc   /boot       ext4    defaults                   1 2
UUID=C68D-067F                              /boot/efi   vfat    umask=0077,shortname=winnt 0 2

and installed grub and made the config:

grub2-install --boot-directory=/boot /dev/sdd --efi-directory=/boot/efi --target=x86_64-efi
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

In most cases this should work though I was having trouble getting grub to boot my system (was possibly clashing with my host fedora os or something?) so I decided to just do it manually a systemd-boot and copied over the kernel, initramfs and the loader entries that grub was using to my efi partition.

bootctl install
cp vmlinuz-5.8.16-300.fc33.x86_64  initramfs-5.8.16-300.fc33.x86_64.img config-5.8.16-300.fc33.x86_64 efi/
cp loader/entries/a67e1ab82e084f11ab29a75316198f7c-5.8.16-300.fc33.x86_64.conf efi/loader/entries/

set the password and groups for root and my user:

useradd michael
passwd michael
usermod -a -G wheel michael

now all I had todo was unmount my chroot and boot the system:

umount /mnt/fedora/dev
umount /mnt/fedora/dev/pts
umount /mnt/fedora/proc
umount /mnt/fedora/sys/firmware/efi/efivars
umount /mnt/fedora/sys
umount /mnt/fedora/boot/efi
umount /mnt/fedora/boot
umount /mnt/fedora

All this was enough to get a bootable system with Fedora Workstation with one caveat in that I had to set selinux=0 in my kernel boot flags as selinux was preventing it from starting services and I’m not familiar enough with selinux to try and fix that.

Overall would not recommend doing this if you want a stable system but hey it does work.