Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Last active October 11, 2024 00:47
Show Gist options
  • Save lidgnulinux/da4555a6f043cccfd237a7014d2f0950 to your computer and use it in GitHub Desktop.
Save lidgnulinux/da4555a6f043cccfd237a7014d2f0950 to your computer and use it in GitHub Desktop.
Experimental way to install fedora via rootfs archive / the arch way. GRUB kind of work.

Experimental way to install fedora via rootfs archive / the arch way.

Don't ever try this if you don't know what you're doing !

Prerequisites.

  • Any live usb bootable.
  • Fedora rootfs archive, we can get it here. It's better to choose the most update / latest archive.
  • Some partitions, for root system (/), efi (if you have uefi machine) and swap (optional).
  • Basic commandline knowledge.

Steps.

We need to do some steps here, It's not hard at all.

  1. Format and mount partitions.

    $ sudo mkfs.ext4 /dev/vda1
    $ sudo mkswap /dev/vda2
    $ sudo mount /dev/vda1 /mnt/
    $ sudo swapon /dev/vda2
    

    PS : I only use 2 partitions here, you can adjust as you wish.


  2. Download and extract rootfs archive.

    $ cd /mnt
    $ sudo wget -c https://images.linuxcontainers.org/images/fedora/40/amd64/default/20240724_20%3A33/rootfs.tar.xz
    $ sudo tar -xf rootfs.tar.xz
    

    PS : You need to adjust the rootfs link download !


  3. Mount some filesystems and do chroot.

    $ sudo mount -t proc proc proc
    $ sudo mount -o bind /dev dev/
    $ sudo mount -o bind /sys sys/
    $ sudo mount -o bind /run run/
    $ sudo chroot /mnt /bin/bash
    

  4. Edit dnf configuration.

    # vi /etc/dnf/dnf.conf
    

    We need to remove tsflags=nodocs part and add install_weak_deps=False option. It's optional, but if we don't edit the default config, we will end up not having any documentation / docs / manual files and get weak dependencies installed.


  5. Update packages.

    # dnf update
    

  6. Edit fstab.

    # vi /etc/fstab
    

    Example :

    UUID=YOUR_PARTITION_UUID /     ext4    errors=remount-ro       0 1
    UUID=YOUR_PARTITION_UUID swap swap defaults 0 0
    

  7. Set time zone.

    Incorrect time zone sometimes leads to network errors, we need to set it. Adjust it for your local time, for me it's Asia/Jakarta.

    $ timedatectl set-timezone Asia/Jakarta
    

  8. Install grub and dracut package.

    # dnf install grub2-pc dracut
    

    after grub package is installed, we need to disable blscfg feature. After wondering for days, I just found that blscfg was the culprit that causes kernel and initramfs not automatically copied to /boot directory. We can disable blscfg using grub2-editenv command.

    # grub2-editenv - set grub_enable_blscfg=false 
    

  9. Install Kernel.

    Kernel is needed here, obviously .

    # dnf install kernel-core kernel-modules
    

    After kernel and its modules are installed, dracut will automatically generate initramfs file. The kernel files (vmlinuz, config, System.map) also will be copied to /boot directory automatically.


  10. Update and install grub to disk.

    We need to update grub, so our kernel will be listed on grub menu. We also install the grub to /dev/vda disk.

    # grub2-mkconfig -o /boot/grub2/grub.cfg
    # grub2-install /dev/vda
    

  11. Set password (root user).

    We need to set password for our main user / root.

    # passwd
    

  12. Exit chroot and unmount some filesystems.

    We need to exit chroot and unmount some filesystems we mount before.

    # exit
    # umount proc
    # umount dev/
    # umount sys/
    # umount run/
    # cd /
    # umount /mnt
    

  13. Reboot.

    After everything are done, let's reboot !

    # systemctl reboot
    
@lidgnulinux
Copy link
Author

Need to rewrite the steps, also somehow disable blscfg can fix our main problem.

@lidgnulinux
Copy link
Author

It's Confirmed !
Disable blscfg will make kernel, dracut and grub behave normally.

@lidgnulinux
Copy link
Author

Updated !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment