Fedora 33 chroot or rootfs install?

I’m interested in installing Fedora 33, but in my experience the fedora installers (and really everything red hat based) have been pretty hard to use for me. Is there any way to install from chroot, either with dnf on a live environment or with a rootfs tarball? I can’t find anything about on the distro’s main page or documentation.

There obviously is because that’s how their Live ISO does the Install Locally option. But that said, I don’t know how you would trigger that yourself.

Doing it with DNF is good enough to get something like a Docker or other container image going. But without Anaconda (their installer app) it isn’t going to have the correct partitions, filesystems, kernels or boot setup. DNF has a chroot option called --installroot I think.

I really don’t see how hacking around like that would be easier than running the Live ISO and doing the install normally.

1 Like

Anaconda is simpler to use and has more features than other GUI installers I’ve seen (especially Ubiquity). Not sure if there’s any manual installers, all I know that you can do is change tty, partition the disk, then switch tty back and just set which partition is which (which isn’t what you are looking for, sorry).

1 Like

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:

passwd
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.

5 Likes

These days I never install on metal. I do it in a VM with the drive passed through. Can’t disconnect from the internet :stuck_out_tongue:

I’ve found fedora easy to install and upgrade for years. However 33 is now BTRFS by default and while I use BTRFS I have not tried the new installer and I wont upgrade till im sure the gnome extensions I use have caught up. Again a VM to test.

https://docs.fedoraproject.org/en-US/docs/

Not sure when last you tried the installer, but the last time I installed was using F27(?) and it was pretty easy to use. You might wanna try it first, and if it doesn’t work out you can still try alternatives.