Fedora 37 nspawn(chroot on steroids) on VF2

Get the fedora riscv64 image:

wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz
unxz Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz

Here’s what’s inside that image:

parted Fedora-Developer-37-20221130.n.0-nvme.raw.img print
Model:  (file)
Disk /var/home/davidm/ksplay/Fedora-Developer-37-20221130.n.0-nvme.raw.img: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start   End     Size    File system  Name    Flags
 1      17.4kB  734MB   734MB   ext4         boot    legacy_boot
 2      734MB   10.7GB  10.0GB  ext4         rootfs

Plunk that onto the VisionFive 2 nvme and overwrite the nvme boot partition with VF2 boot partition contents.

rsync --archive Fedora-Developer-37-20221130.n.0-nvme.raw.img davidm@192.168.2.53:/home/davidm/
wipefs --all /dev/nvme0n1
dd if=./Fedora-Developer-37-20221130.n.0-nvme.raw.img of=/dev/nvme0n1 bs=4M status=progress conv=fdatasync

now extend the 10GB partition table to all the space on the nvme…256GB

parted /dev/nvme0n1 print free
Warning: Not all of the space available to /dev/nvme0n1 appears to be used, you can fix the GPT to use all of the space (an extra 479146672 blocks) or continue with the current setting? 
Fix/Ignore?
I answered Fix

Model: OSC PCIe 256GB (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start   End     Size    File system  Name    Flags
 1      17.4kB  734MB   734MB   ext4         boot    legacy_boot
 2      734MB   10.7GB  10.0GB  ext4         rootfs
        10.7GB  256GB   245GB   Free Space

Now remove the first partition on the nvme. We don’t want to use the existing fedora /boot because it was configured for the hifive unmatched with different boot binaries.

parted /dev/nvme0n1 rm 1

Now resize the nmve’s remaining partition to take all the rest of the nvme:
parted /dev/nvme0n1 resizepart 2 100%

Tell ext4 filesystem that we resize from 10G to 256GB:

e2fsck -f /dev/nvme0n1p2
resize2fs /dev/nvme0n1p2

Now because we need to use systemd services, we won’t chroot. We gonna do the equivalent within the systemd ecosystem with a tool called systemd-nspawn found in the systemd-container package. We’ll install that.
apt-get install systemd-container

Mount the nvme

mount /dev/nvme0n1p2 /mnt

I’ve got a few helper scripts.

to create pseudo filesystem mountpoint dirs

cat myMakeChrootPseudoFSDirs.sh
set -x
mkdir -p /mnt/dev
mkdir -p /mnt/dev/pts
mkdir -p /mnt/proc
mkdir -p /mnt/sys
mkdir -p /mnt/run
set +x

mount pseudo filesystems on the /mnt nvme device.

cat myMountForChroot.sh 
set -x
for i in dev dev/pts proc sys run; do mount -B /$i /mnt/$i; systemctl daemon-reload; done
# for i in dev dev/pts proc sys run; do umount /mnt/$i; systemctl daemon-reload; done
set +x

and unmount pseudo filesystems on the /mnt nvme device.

cat myUnmountAfterChroot.sh
set -x
# for i in dev dev/pts proc sys run; do mount -B /$i /mnt/$i; systemctl daemon-reload; done
for i in dev dev/pts proc sys run; do umount /mnt/$i; systemctl daemon-reload; done
set +x

NOW make those pseudo filesystem dirs
./myMakeChrootPseudoFSDirs.sh

For nspawn, unlike just chroot,
ensure pseudo filesystems not mounted beforehand because nspawn will do it on invocation.
./myUnmountAfterChroot.sh

Now here’s the running of the systemd equivalent of chroot allowing you to manage systemd services within the container/chroot:
systemd-nspawn -D /mnt /sbin/init
I think this is better:
systemd-nspawn --bind=/boot:/boot -D /mnt /sbin/init
because it allows fedora to see the vf2’s /boot partition

named is not the name service.
NetworkManager takes care of it.

nmcli con show end0

Can’t resolve dns names to ip addresses so we need to do the following:

sudo rm /etc/resolv.conf
sudo vi /etc/resolv.conf

Make it the same as what’s in the debian sdcard’s /etc/resolv.conf

cd /etc/yum.repos.d
GET RID OF ALL .repo files except fedora-riscv-koji.repo
edit fedora-riscv-koji.repo
enable=1

If you got this far, the dnf update/upgrade should work. It did for me.

dnf update
dnf upgrade

And you’re good, now you have a Fedora 37 nspawn that feels like a chroot, but isn’t :slight_smile:

I hope this helps to get us a bit closer for an official vf2 Fedora 37 Workstation image along with an official fedora silverblue 37 image.

3 Likes

dnf install gcc clang

gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@fedora-riscv ~]# clang --version
clang version 15.0.4 (Fedora 15.0.4-1.1.riscv64.fc37)
Target: riscv64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Maybe you would like to see the under-the-hood riscv64 assembly:

# Create assembler code:
gcc --verbose -S -fverbose-asm -g -O2 swapBits.c -o swapBits.s

# Create asm interlaced with source lines:
as -alhnd swapBits.s > swapBits.lst

Some other stuff to see:

as --dump-config
alias = riscv64-linux-gnu
canonical = riscv64-unknown-linux-gnu
cpu-type = riscv64
bfd-target = elf32-littleriscv

Do check out gcc verbose output for Starfive VF2:

gcc --verbose -S -fverbose-asm -g -O2 swapBits.c -o swapBits.s
2 Likes

Does simply adding the cmdline argument ”root=/dev/nvme1n2” (or something like that) not work?

You’re talking about trying that in /boot/boot/extlinux/extlinux.conf
I haven’t tried exactly that, but I’ve tried something using the uuid and it didn’t work.

There’s hope though, via uboot setenv settings, but I need a usb-uart dongle to try it carefully.

The nspawn is a very good alternative since you see the fedora 37 actually going through the init process. It’s better than chroot for sure.

The same approach could be used to run the debian sid from /mnt as well.

All the above is in the hopes to create a fedora silverblue image for the VF2.

I did get answers from the original maintainers for Fedora images on how they do it, but not specific to riscv64.
It’s a great start. Now all we have to do is read and understand the workflow steps.

As I was in the nspawn wanting to get the right configuration before I attempt to do a
dracut --kver,
I navigated to its /boot directory, but it’s empty. Why is /boot empty within the nspawn? In fact there isn’t even a /mnt/boot/ directory on the nvme. So where is nspawn getting its reference for /boot/ if not the /etc/fstab and the cli invocation?

Within the nspawn /etc/fstab, there is an entry that points to the correct sdcard partition with the one an only /boot/ binaries.

SDCARD /etc/fstab

 # cat /etc/fstab
LABEL=BOOTPART /boot vfat defaults,rw,owner,flush,umask=000 0 0
LABEL=rootpart / btrfs defaults,ssd,compress-force=zstd,noatime,nodiratime 0 1
/swap/file.0 none swap sw 0 0

NVME /etc/fstab

 # cat /mnt/etc/fstab
UUID=d9334329-e2ad-4b72-8f5f-b61406e9d461  / ext4    defaults,noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s 0 0

#this uuid didn't work from nspawn
###UUID="E68A-7FF7" /boot vfat defaults,rw,owner,flush,umask=000 0 0
/dev/mmcblk1p2 /boot vfat defaults,rw,owner,flush,umask=000 0 0

I FOUND A WAY:

Rather than doing:
systemd-nspawn -D /mnt /sbin/init

Invoke the nspawn and tell it to bind the host’s /boot as /boot within the container.
systemd-nspawn --bind=/boot:/boot -D /mnt /sbin/init

systemd-nspawn --bind=/boot:/boot -D /mnt /sbin/init
spawned the container and we are able to see the sdcard’s /boot directory. Congrats.

Now let’s try creating an initramfs image that doesn’t hurt the existing files in place. We’ll call it foobar using the current vf2 kernel version.

dracut foobar15Feb2023.img 5.15.0-vf2-260+

Oops errors:

dracut: WARNING: running in hostonly mode in a container!!
dracut: Cannot find module directory /lib/modules/5.15.0-vf2-260+/
dracut: and --no-kernel was not specified

That’s because the koji repos have more recent kernels and kernel modules in them that are not intended for the VF2.
/lib/modules/6.0.10-300.0.riscv64.fc37.riscv64

I’ve got to figure out what I’m going to do to overcome this.
With dnf, how can I pin/freeze/forbid specific packages to prevent them from being installed/updated and conflict with what VF2 wants? We definitely at very least need to compile the kernel and modules at a specific snapshot that starfive VF2 maintainers know is working.

For all the other non-kernel/non-kernel module packages, however we want them to proceed(not-pinned/not-frozen/not-forbidden) to install and behave as usual.

I can appreciate the debian snapshot archive repo frozen to specific day of packages. You can update/upgrade until you’re blue in the face, it will always be updating/upgrading to the same package version LOL. At this particular point in time, it makes sense when you’re debugging an immature product which VF2 is in fact.

Is there such an equivalent fedora snapshot archive repo?

Is there a VF2 fedora repo yet?

I saw a VF1 fedora repo, but it has not been active for a while.
https://fedora.starfivetech.com/koji/index

I installed the root fs from the image linked to above to my nvme and left my boot partition as-is from my Debian install then created a new boot entry pointing to the nvme partition.

I had to update the fstab but except for that it booted up just fine. Amusingly, the wheel group was spelled with a capitol W so my user couldn’t sudo. Took a while to figure that out.

The only other thing I had to do was disable all yum repos except the riscv and change the version from fc37 to fc38 in the repo url since the fc37 repo dir is empty. Dnf updated a bunch of packages and everything still worked fine after reboot.

The upside to this approach is being able to dual boot Debian and Fedora.

1 Like

Mr. Lowrey, please provide more details. I would love to duplicate your success. I was unable to boot off of the nvme partition.

When you said you updated the /etc/fstab, did you update the nmve’s /etc/fstab or the sdcard’s /etc/fstab?
Better yet, what did you put in both ? LOL

You mentioned wheel group was with a capital W in that image. I just checked and it’s definitely lowercase.

[root@fedora-riscv ~]# cat /etc/passwd |grep wheel
[root@fedora-riscv ~]# cat /etc/group |grep wheel
wheel:x:10:riscv,davidm
[root@fedora-riscv yum.repos.d]# cat fedora-riscv-koji.repo 
[fedora-riscv-koji]
name=Fedora RISC-V Koji
baseurl=http://fedora.riscv.rocks/repos/f38-build/latest/riscv64/
enabled=1
gpgcheck=0

[root@fedora-riscv ~]# dnf update
Fedora RISC-V Koji                                                                                                                                                                                            5.4 MB/s |  72 MB     00:13    
Last metadata expiration check: 0:02:13 ago on Thu 16 Feb 2023 02:25:21 PM EST.
Dependencies resolved.

 Problem 1: cannot install the best update candidate for package netcat-1.217-3.fc33.riscv64
  - nothing provides libtls.so.25()(64bit) needed by netcat-1.219-1.fc37.riscv64
 Problem 2: package netcat-1.217-3.fc33.riscv64 requires libtls.so.20()(64bit), but none of the providers can be installed
  - cannot install both libretls-3.7.0-1.fc37.riscv64 and libretls-3.3.2-1.fc33.riscv64
  - problem with installed package netcat-1.217-3.fc33.riscv64
  - cannot install the best update candidate for package libretls-3.3.2-1.fc33.riscv64
  - nothing provides libtls.so.25()(64bit) needed by netcat-1.219-1.fc37.riscv64
==============================================================================================================================================================================================================================================
 Package                                                          Architecture                               Version                                                               Repository                                            Size
==============================================================================================================================================================================================================================================
Upgrading:
 annobin-docs                                                     noarch                                     11.09-1.1.riscv64.fc38                                                fedora-riscv-koji                                     94 k
 annobin-plugin-gcc                                               riscv64                                    11.09-1.1.riscv64.fc38                                                fedora-riscv-koji                                    891 k
 binutils                                                         riscv64                                    2.40-2.fc38                                                           fedora-riscv-koji                                    4.7 M
 bison                                                            riscv64                                    3.8.2-3.fc38                                                          fedora-riscv-koji                                    981 k
 cpp                                                              riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    8.9 M
 fedora-gpg-keys                                                  noarch                                     38-0.3                                                                fedora-riscv-koji                                    115 k
 fedora-release                                                   noarch                                     38-0.15                                                               fedora-riscv-koji                                     11 k
 fedora-release-common                                            noarch                                     38-0.15                                                               fedora-riscv-koji                                     21 k
 fedora-release-identity-basic                                    noarch                                     38-0.15                                                               fedora-riscv-koji                                     12 k
 fedora-repos                                                     noarch                                     38-0.3                                                                fedora-riscv-koji                                     10 k
 fedora-repos-modular                                             noarch                                     38-0.3                                                                fedora-riscv-koji                                    9.9 k
 flex                                                             riscv64                                    2.6.4-11.fc38                                                         fedora-riscv-koji                                    295 k
 gcc                                                              riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     28 M
 gcc-c++                                                          riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     11 M
 gcc-gdb-plugin                                                   riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    115 k
 gcc-gdc                                                          riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     13 M
 gcc-gfortran                                                     riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     10 M
 gcc-gnat                                                         riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     16 M
 gcc-go                                                           riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     11 M
 gcc-plugin-annobin                                               riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     30 k
 gcc-plugin-devel                                                 riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    1.3 M
 glibc                                                            riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    1.7 M
 glibc-all-langpacks                                              riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                     18 M
 glibc-common                                                     riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    317 k
 glibc-devel                                                      riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    462 k
 glibc-gconv-extra                                                riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    1.6 M
 glibc-langpack-en                                                riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    566 k
 glibc-minimal-langpack                                           riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                     34 k
 glibc-static                                                     riscv64                                    2.36.9000-25.fc38                                                     fedora-riscv-koji                                    3.2 M
 gmp                                                              riscv64                                    1:6.2.1-3.fc38                                                        fedora-riscv-koji                                    292 k
 gmp-c++                                                          riscv64                                    1:6.2.1-3.fc38                                                        fedora-riscv-koji                                     18 k
 gmp-devel                                                        riscv64                                    1:6.2.1-3.fc38                                                        fedora-riscv-koji                                    173 k
 hostname                                                         riscv64                                    3.23-7.fc38                                                           fedora-riscv-koji                                     27 k
 info                                                             riscv64                                    7.0.1-1.fc38                                                          fedora-riscv-koji                                    175 k
 libatomic                                                        riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     19 k
 libatomic-static                                                 riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     31 k
 libgcc                                                           riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     90 k
 libgccjit                                                        riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    8.3 M
 libgfortran                                                      riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    442 k
 libgfortran-static                                               riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    1.2 M
 libgnat                                                          riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    1.3 M
 libgnat-devel                                                    riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    5.8 M
 libgnat-static                                                   riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    3.1 M
 libgo                                                            riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    6.9 M
 libgo-devel                                                      riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    449 k
 libgo-static                                                     riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                     14 M
 libgomp                                                          riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    298 k
 libgphobos                                                       riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    1.9 M
 libgphobos-static                                                riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    6.3 M
 libmpc                                                           riscv64                                    1.3.1-1.fc38                                                          fedora-riscv-koji                                     72 k
 libmpc-devel                                                     riscv64                                    1.3.1-1.fc38                                                          fedora-riscv-koji                                     11 k
 libstdc++                                                        riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    844 k
 libstdc++-devel                                                  riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    3.0 M
 libstdc++-static                                                 riscv64                                    13.0.1-0.2.2.riscv64.fc38                                             fedora-riscv-koji                                    3.4 M
 libtool                                                          riscv64                                    2.4.7-6.fc38                                                          fedora-riscv-koji                                    595 k
 libtool-ltdl                                                     riscv64                                    2.4.7-6.fc38                                                          fedora-riscv-koji                                     37 k
 libzstd                                                          riscv64                                    1.5.2-3.fc38                                                          fedora-riscv-koji                                    325 k
 libzstd-devel                                                    riscv64                                    1.5.2-3.fc38                                                          fedora-riscv-koji                                     46 k
 make                                                             riscv64                                    1:4.4-1.fc38                                                          fedora-riscv-koji                                    576 k
 mpfr                                                             riscv64                                    4.1.1-2.fc38                                                          fedora-riscv-koji                                    524 k
 mpfr-devel                                                       riscv64                                    4.1.1-2.fc38                                                          fedora-riscv-koji                                     21 k
 procps-ng                                                        riscv64                                    3.3.17-8.fc38                                                         fedora-riscv-koji                                    333 k
 pyproject-rpm-macros                                             noarch                                     1.6.2-1.fc38                                                          fedora-riscv-koji                                     41 k
 python-rpm-macros                                                noarch                                     3.11-7.fc38                                                           fedora-riscv-koji                                     20 k
 python-srpm-macros                                               noarch                                     3.11-7.fc38                                                           fedora-riscv-koji                                     26 k
 python3-rpm-macros                                               noarch                                     3.11-7.fc38                                                           fedora-riscv-koji                                     15 k
 redhat-rpm-config                                                noarch                                     249-1.1.riscv64.fc38                                                  fedora-riscv-koji                                     76 k
 selinux-policy                                                   noarch                                     38.5-1.fc38                                                           fedora-riscv-koji                                     54 k
 selinux-policy-targeted                                          noarch                                     38.5-1.fc38                                                           fedora-riscv-koji                                    6.4 M
 sharutils                                                        riscv64                                    4.15.2-22.fc38                                                        fedora-riscv-koji                                    286 k
 systemtap                                                        riscv64                                    4.8~pre16650659g6a096a7d-1.fc38                                       fedora-riscv-koji                                    8.6 k
 systemtap-client                                                 riscv64                                    4.8~pre16650659g6a096a7d-1.fc38                                       fedora-riscv-koji                                    3.6 M
 systemtap-devel                                                  riscv64                                    4.8~pre16650659g6a096a7d-1.fc38                                       fedora-riscv-koji                                    2.1 M
 systemtap-runtime                                                riscv64                                    4.8~pre16650659g6a096a7d-1.fc38                                       fedora-riscv-koji                                    394 k
 systemtap-sdt-devel                                              riscv64                                    4.8~pre16650659g6a096a7d-1.fc38                                       fedora-riscv-koji                                     73 k
 texinfo                                                          riscv64                                    7.0.1-1.fc38                                                          fedora-riscv-koji                                    1.3 M
 texinfo-tex                                                      riscv64                                    7.0.1-1.fc38                                                          fedora-riscv-koji                                    137 k
 tzdata                                                           noarch                                     2022g-1.fc38                                                          fedora-riscv-koji                                    432 k
 zlib                                                             riscv64                                    1.2.13-2.fc38                                                         fedora-riscv-koji                                     91 k
 zlib-devel                                                       riscv64                                    1.2.13-2.fc38                                                         fedora-riscv-koji                                     45 k
 zlib-static                                                      riscv64                                    1.2.13-2.fc38                                                         fedora-riscv-koji                                    121 k
 zstd                                                             riscv64                                    1.5.2-3.fc38                                                          fedora-riscv-koji                                    478 k
Installing dependencies:
 fedora-repos-rawhide                                             noarch                                     38-0.3                                                                fedora-riscv-koji                                    9.7 k
 fedora-repos-rawhide-modular                                     noarch                                     38-0.3                                                                fedora-riscv-koji                                    9.8 k
 pyproject-srpm-macros                                            noarch                                     1.6.2-1.fc38                                                          fedora-riscv-koji                                     14 k
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
 libretls                                                         riscv64                                    3.7.0-1.fc37                                                          fedora-riscv-koji                                     37 k
Skipping packages with broken dependencies:
 netcat                                                           riscv64                                    1.219-1.fc37                                                          fedora-riscv-koji                                     34 k

Transaction Summary
==============================================================================================================================================================================================================================================
Install   3 Packages
Upgrade  82 Packages
Skip      2 Packages

Total download size: 209 M
Is this ok [y/N]:

Thank you for you tips. Cheers.

These dnf group commands don’t show much.

dnf group list
dnf group install "C Development Tools and Libraries"
dnf group install "Development Tools"
dnf group install "Container Management"

The output from all this:

Module or Group 'C Development Tools and Libraries' is not available.
Module or Group 'Development Tools' is not available.
Module or Group 'Container Management' is not available.
Error: Nothing to do.

Still early days.

I started out with the Debian-69 image booting from the sdcard but with the root partition on the nvme.

All I did was create another partition on the nvme so I had nvme0n1p1 with the debian root and nvme0n1p2 for the fedora root.

I attached the fedora image to loop0 via

# losetup /dev/loop0 Fedora-Developer-37-20221130.n.0-nvme.raw.img
# partprobe /dev/loop0
# lsblk --fs /dev/loop0
NAME      FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0
├─loop0p1 ext4   1.0   _/boot 53e7246e-90c3-42c4-b447-3ebc9fe1fdfc
└─loop0p2 ext4   1.0   _/     d9334329-e2ad-4b72-8f5f-b61406e9d461

The fedora root is loop0p2 and so I did this:

dd if=/dev/loop0p2 of=/dev/nvme0n1p2 bs=1M

To boot I just modified extlinux.conf from the debian boot partition to add a new entry for Fedora:

label l2
        menu label Fedora (NVMe)
        linux /boot/vmlinuz-5.15.0-starfive
        initrd /boot/initrd.img-5.15.0-starfive
        fdtdir /boot/dtbs/
        append  root=/dev/nvme0n1p2 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0

The only difference between this and the debian boot entry is the root=/dev/nvme0n1p2.

Before booting, I mounted the fedora root to /mnt and edited /mnt/etc/fstab to look like this:

/dev/nvme0n1p2  /     ext4    defaults,noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s 0 0
/dev/mmcblk1p2  /boot vfat    defaults,noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s 0 0

I could have used UUIDs or LABELs but these block devices are stable and easier for me to work with.

At this point the board will boot fine if you choose the new boot entry from the boot menu (or change the default in extlinux.conf) but I suggest you add a user and add them to the wheel group. When this Fedora instance boots the console output will show you what the root and riscv user passwords are but it might be easier to change them while you’re here.

Assuming I’ve remembered all the steps correctly, and you’ve booted Fedora, the next step is to conf the yum repos.

Disable all repos in /etc/yum.repos.d except for fedora-riscv.repo. You need to edit the repo url in that one to be:

baseurl=http://fedora.riscv.rocks/repos-dist/f38/latest/riscv64/

The change is from f37 to f38 in the path. For some reason f37 is empty.

Now you should be able to dnf as expected. Here’s what I get when I run a few dnf group commands:

# dnf group list
Last metadata expiration check: 3:40:13 ago on Sat 18 Feb 2023 07:14:13 AM EST.
Available Environment Groups:
   Fedora Custom Operating System
   Minimal Install
   Fedora Server Edition
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Deepin Desktop
   Budgie Desktop
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
   i3 desktop
   Sway Desktop
Installed Groups:
   C Development Tools and Libraries
   Development Tools
   RPM Development Tools
Available Groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Budgie
   Budgie Desktop Applications
   Cloud Infrastructure
   Cloud Management Tools
   Compiz
   Container Management
   D Development Tools and Libraries
   Design Suite
   Domain Membership
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   Milkymist
   Network Servers
   Neuron Modelling Simulators
   Office/Productivity
   Python Classroom
   Python Science
   Robotics
   Security Lab
   Sound and Video
   Sway Window Manager (supplemental packages)
   System Tools
   Text-based Internet
   Window Managers
# dnf group install "System Tools"
Last metadata expiration check: 3:41:26 ago on Sat 18 Feb 2023 07:14:13 AM EST.
Dependencies resolved.
==================================================================================================================================
 Package                                Architecture       Version                                  Repository               Size
==================================================================================================================================
Installing group/module packages:
 BackupPC                               riscv64            4.4.0-8.fc37                             fedora-riscv            431 k
 NetworkManager-l2tp                    riscv64            1.20.6-1.fc37                            fedora-riscv            183 k
 NetworkManager-libreswan               riscv64            1.2.16-2.fc37                            fedora-riscv            124 k
 NetworkManager-openconnect             riscv64            1.2.8-3.fc37                             fedora-riscv            544 k
 NetworkManager-openvpn                 riscv64            1:1.8.18-2.fc37                          fedora-riscv            271 k
 NetworkManager-vpnc                    riscv64            1:1.2.8-2.fc37                           fedora-riscv            168 k
 bonnie++                               riscv64            2.00a-6.fc37                             fedora-riscv             83 k
 cifs-utils                             riscv64            6.15-2.fc37                              fedora-riscv             94 k
 libreswan                              riscv64            4.9-1.fc37                               fedora-riscv            1.3 M
 nmap                                   riscv64            3:7.93-1.fc37                            fedora-riscv            5.5 M
 openconnect                            riscv64            9.01-3.fc37                              fedora-riscv            870 k
 openldap-clients                       riscv64            2.6.3-1.2.riscv64.fc37                   fedora-riscv            174 k
 openvpn                                riscv64            2.5.8-1.fc37                             fedora-riscv            652 k
 samba-client                           riscv64            2:4.17.2-2.fc37                          fedora-riscv            675 k
 setserial                              riscv64            2.17-55.fc37                             fedora-riscv             26 k
 tigervnc                               riscv64            1.12.0-7.fc37                            fedora-riscv            313 k
 vpnc                                   riscv64            0.5.3-44.svn550.fc37                     fedora-riscv             90 k
 xdelta                                 riscv64            3.1.0-15.fc37                            fedora-riscv             89 k
 zisofs-tools                           riscv64            1.0.8-28.fc37                            fedora-riscv             28 k
Installing dependencies:
 BackupPC-XS                            riscv64            0.62-9.fc37                              fedora-riscv            109 k
 esmtp                                  riscv64            1.2-20.fc37                              fedora-riscv             50 k
 fedora-logos-httpd                     noarch             36.0.0-3.fc37                            fedora-riscv             16 k
 httpd                                  riscv64            2.4.54-5.fc37                            fedora-riscv             45 k
 httpd-core                             riscv64            2.4.54-5.fc37                            fedora-riscv            1.3 M
 httpd-filesystem                       noarch             2.4.54-5.fc37                            fedora-riscv             13 k
 httpd-tools                            riscv64            2.4.54-5.fc37                            fedora-riscv             78 k
 ldns                                   riscv64            1.8.1-7.fc37                             fedora-riscv            164 k
 libdbi                                 riscv64            0.9.0-20.fc37                            fedora-riscv             48 k
 libesmtp                               riscv64            1.0.6-25.fc37                            fedora-riscv             63 k
 libpskc                                riscv64            2.6.7-4.fc37                             fedora-riscv             34 k
 libxcrypt-compat                       riscv64            4.4.30-1.fc37                            fedora-riscv            103 k
 nmap-ncat                              riscv64            3:7.93-1.fc37                            fedora-riscv            221 k
 par2cmdline                            riscv64            0.8.1-7.fc37                             fedora-riscv            122 k
 perl-CGI                               noarch             4.54-4.fc37.rvre0                        fedora-riscv            198 k
 perl-Net-FTP-AutoReconnect             noarch             0.3-37.fc37                              fedora-riscv             14 k
 perl-Net-FTP-RetrHandle                noarch             0.2-36.fc37                              fedora-riscv             18 k
 perl-Time-ParseDate                    noarch             2015.103-22.fc37                         fedora-riscv             39 k
 pkcs11-helper                          riscv64            1.29.0-2.fc37                            fedora-riscv             65 k
 ppp                                    riscv64            2.4.7-21.0.riscv64.fc29                  fedora-riscv            952 k
 rrdtool                                riscv64            1.8.0-4.fc37                             fedora-riscv            551 k
 rsync-bpc                              riscv64            3.1.3.0-5.fc37                           fedora-riscv            303 k
 stoken-libs                            riscv64            0.92-7.fc37                              fedora-riscv             46 k
 tigervnc-icons                         noarch             1.12.0-7.fc37                            fedora-riscv             23 k
 tigervnc-license                       noarch             1.12.0-7.fc37                            fedora-riscv             16 k
 vpnc-script                            noarch             20220509-2.gite52f8e66.fc37              fedora-riscv             18 k
 xl2tpd                                 riscv64            1.3.17-1.fc37                            fedora-riscv             94 k
 xmlsec1                                riscv64            1.2.34-2.fc37                            fedora-riscv            184 k
Installing weak dependencies:
 cifs-utils-info                        riscv64            6.15-2.fc37                              fedora-riscv             20 k
 julietaula-montserrat-fonts            noarch             1:7.222-3.fc37                           fedora-riscv            1.6 M
 mod_http2                              riscv64            2.0.9-1.fc37                             fedora-riscv            141 k
 mod_lua                                riscv64            2.4.54-5.fc37                            fedora-riscv             57 k
Installing Groups:
 System Tools

Transaction Summary
==================================================================================================================================
Install  51 Packages

Total download size: 18 M
Installed size: 64 M
Is this ok [y/N]:

Hope that helps!

2 Likes

This is a great guide, thanks. I only wish we could have a more recent kernel than 5.15.0, but we are waiting on StarFive I guess :frowning:

I can applied incremental patch to 5.15.2, but no further than that because it will conflicts with what Starfive already applied into the source.

I succeeded into booting directly onto the nvme with your instructions.
I have the very same /boot/boot/extlinux/extlinux.conf as yours.
I modified the /mnt/etc/fstab to hold the same information as yours.

It booted up and ran perfectly. I got the network.
I was able to log in without issues.

ISSUE: I modified the baseurl to be identical to yours. Yes the dnf group list displayed the same output as yours.
When I came to install “C Development Tools and Libraries” I feel as though it installed same subset of the usual tools. ditto for “Development Tools”(installed nothing empty package list) and for “Container Management”(installed nothing empty package list).

Your dnf group install "System Tools" does list packages(non empty package list) to install, but that’s not the group I want.

Run dnf group info "C Development Tools and Libraries" and you’ll see the full list of packages that are part of the group. Spot checking shows that all the non-optional packages are already installed so there’s nothing for dnf to do.

You can also add --with-optional to install the optional packages too…

dnf group install --with-optional "C Development Tools and Libraries"

Not all rpms are available for riscv. For example, there is no containerd or podman. There is active development going on so hopefully some of the missing packages will be available soon.

1 Like

Here is the VF2 Fedora 38 dmesg from nvme after booting directly to it:

Yes, I’m seeing more packages when I pass that –with-optional arg. Ok understood active development wip for the missing packages. Thank you llowrey. You’ve been very helpful.

Also davidlt informed me where the package list is for Fedora 38.

https://pagure.io/fedora-comps/blob/main/f/comps-f38.xml.in

Whatever packages that are missing are still wip under development.

I’m still very much impressed with all I can do with the fedora 38 image at present.
I’m astounded I can boot off the nvme on the VF2 now! Thanks to llowrey for that.

I’m feeling closer to a VF2 fedora silverblue as well. The steps to get there are getting found and I’m trying to understand them, my poor little brain. Please note these steps are for the x86_64 image.

https://pagure.io/fedora-qa/os-autoinst-distri-fedora/blob/main/f/tests/_ostree_build.pm
I think the key lines I need to understand more about are these ones:
https://pagure.io/fedora-qa/os-autoinst-distri-fedora/blob/main/f/tests/_ostree_build.pm#_54
https://pagure.io/fedora-qa/os-autoinst-distri-fedora/blob/main/f/tests/_ostree_build.pm#_66
https://pagure.io/fedora-qa/os-autoinst-distri-fedora/blob/main/f/tests/_ostree_build.pm#_78

I think I found all the details for a particular round of tests for ostree_build:

I’m finding these logs to be helpful:

https://openqa.fedoraproject.org/tests/1771475/file/_ostree_build-lorax.log
https://openqa.fedoraproject.org/tests/1771475/file/_ostree_build-ostree.log
All I have to figure out is what all these steps mean LOL

I have no Fedora Silverlue image built. It’s a time-consuming challenge for me.
I did however try a newer Fedora(non-silverblue) 38 image via nspawn recipe above identically and it does behave well enough to give me a shell login and to update/upgrade within the shell successfully to the attached nvme. I use the archlinux vf2 minimal on the sdcard because to boot because it has a correct /boot and /boot/efi there using a well-behaving (on the vf2) kernel as the base :slight_smile: I installed rust and its cli system monitor called “bottom”(cargo install bottom) I also tried the latest async rust web server https://rocket.rs and it behaved correctly as well

Someone in the Fedora forums raised that a CoreOS image may be more useful than Silverblue for most people: