System Configuration

  1. Generate fstab:

    mkdir -p /mnt/etc/
    genfstab -t PARTUUID /mnt | grep -v swap > /mnt/etc/fstab
    sed -i "s|vfat.*rw|vfat rw,x-systemd.idle-timeout=1min,x-systemd.automount,noauto,nofail|" /mnt/etc/fstab
  2. Install basic system packages:

    dnf --installroot=/mnt \
    --releasever=$VERSION_ID -y install \
    @core  grub2-efi-x64 \
    grub2-pc-modules grub2-efi-x64-modules \
    shim-x64  efibootmgr \
    kernel kernel-devel
    dnf --installroot=/mnt \
    --releasever=$VERSION_ID -y install \$(rpm --eval "%{dist}").noarch.rpm
    dnf --installroot=/mnt --releasever=$VERSION_ID \
    -y install zfs zfs-dracut
  3. Configure dracut:

    echo 'add_dracutmodules+=" zfs "' >> /mnt/etc/dracut.conf.d/zfs.conf
    echo 'forced_drivers+=" zfs "' >> /mnt/etc/dracut.conf.d/zfs.conf
    if grep mpt3sas /proc/modules; then
      echo 'forced_drivers+=" mpt3sas "'  >> /mnt/etc/dracut.conf.d/zfs.conf
    if grep virtio_blk /proc/modules; then
      echo 'filesystems+=" virtio_blk "' >> /mnt/etc/dracut.conf.d/fs.conf
  4. Generate host id:

    zgenhostid -f -o /mnt/etc/hostid
  5. Install locale package, example for English locale:

    dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en
  6. By default SSH server is enabled, allowing root login by password, disable SSH server:

    systemctl disable sshd --root=/mnt
    systemctl enable firewalld --root=/mnt
  7. Chroot:

    history -w /mnt/home/sys-install-pre-chroot.txt
    arch-chroot /mnt /usr/bin/env DISK="$DISK" bash --login
  8. For SELinux, relabel filesystem on reboot:

    fixfiles -F onboot
  9. Build ZFS modules:

    for directory in /lib/modules/*; do
      kernel_version=$(basename $directory)
      dkms autoinstall -k $kernel_version
  10. Generate initrd:

    for directory in /lib/modules/*; do
      kernel_version=$(basename $directory)
      dracut --force --kver $kernel_version
  11. Set locale, keymap, timezone, hostname and root password:

    rm -f /etc/localtime
    systemd-firstboot --prompt --root-password=PASSWORD --force
  12. Set root password, the password set earlier does not work due to SELinux: