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