How to force Fedora to run as a live-CD

We have a business need to run Fedora 31 on an Intel PC installed on an NVMe drive. That is all easy enough and poses no problems.

The issue is that, for security reasons, we have a switch which sets the drive to read-only. On a previous computer, this wasn’t an issue - Fedora simply booted up in read-only mode.

But there is something different about the way this is implemented - we THINK that the difference is that the kernel is unaware that it’s a read-only drive. So it attempts to write it during boot - and it fails. At some point during boot, this is considered a fatal error and it enters the emergency console, and we are unable to get any further.

Is there a way to configure/install Fedora such that it forces it to boot as though it’s a live-CD, or otherwise doesn’t need to write to the drive?

Ideally we would like to be able to to switch between writeable and read-only on the same install - but we can probably work around not having that option.

Do you mean the 5 year old fedora 31?

Since Fedora 31 is EoL and no longer supported, I tested a Fedora 41 VM with RO storage.
It can boot and allows to log in using this GDM tweak:

for DIR in lib log
do sudo tee /etc/systemd/system/\
var-${DIR}-gdm.mount << EOF > /dev/null
[Unit]
Description=/var/${DIR}/gdm
[Mount]
What=tmpfs
Where=/var/${DIR}/gdm
Type=tmpfs
Options=uid=gdm,gid=gdm
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable var-${DIR}-gdm.mount
done

BTW, you can emulate RO storage like this:

sudo systemctl mask systemd-remount-fs.service
sudo systemctl reboot

Yes. For complicated business reasons, the support we have from the hardware vendor for drivers is Fedora 30-32. Problem is they don’t support the RO mode with the OS.

Thanks - will give that a try. Although note that we haven’t managed to properly recreate the scenario using a VM, because the way the RO is implemented in hardware is different to how it would normally be done

The troubleshooting should look like this:

  • Attempt to boot in RO mode.
  • Collect and analyze the log.
  • Isolate the failing parts:
    • Emulate RW mode with tmpfs mounts.
    • Tune service-specific parameters.