Experimenting with Migrating from Fedora Workstation to Fedora Silverblue

Cross-posted from https://blog.calebwoodbine.com/experimenting-with-migrating-from-fedora-workstation-to-fedora-silverblue/

📰 Introduction

The desktop has always been an important decision point for my digital life. Where all my work gets done, my daily flows and the ecosystems I choose to adopt.

Since somewhere around 2019, Fedora has been my desktop distro of choice. I ran Fedora Workstation back then and switched to Fedora Silverblue at the end of 2019.

Whilst both are fine OSes; however with Silverblue in particular I found that the power of the reliability of an image based OS enabled me to focus on things like work instead of system maintenance.

🚀 The objective

Migrate or replace an existing Fedora Workstation install to a Fedora Silverblue deployment.

Important things are to

  • retain as much basic system config as possible
  • retain accounts and user data
  • make the process simple (considering all things)

(more things?)

Given it's a highly experimental thing, there will always be some level of expectation that some things will either be lost or not the same.

2️⃣ A tale of two architectures

The way these two OSes operate and are laid out is fairly different.

Fedora Workstation:

  • system file system is read+write
  • dnf used for package updates
  • home folder in /home
  • system package upgrades take place on reboot or manually on a live system

Fedora Silverblue:

  • system file system is read-only
  • the OS is state-managed through OSTree under the hood
  • packages are managed through rpm-ostree and it's OSTree integration
  • home folder in /var/home
  • system upgrades take place on reboot (experimental apply-live available. Read more here: https://coreos.github.io/rpm-ostree/apply-live)
  • file system layout (things of note)

    /home
    soft symlink to /var/home
    /ostree
    for the OSTree repo and deploy
    /sysroot
    the path to the real root filesystem
    /usr/local
    soft symlink to /var/usrlocal for per-machine programs and stuff
    /var
    all the system state, including home and roothome

💻 A thought-filled hack

Please note that this process is potentially harmful, irreversible and is a hack.

github.com/ublue-os/upgrade-tools

Here are some lines taken out of the silverblueize.sh script. Please note that these steps are only to visualise the process and if you wish to be daring and migrate in this way to please refer to the script in the repo above.

1️⃣. create an OSTree repo in the root filesystem

ostree admin init-fs /

now you'll find a /ostree folder in the root filesystem

2️⃣. add the Fedora remote (kind of like with git)

ostree remote add \
    fedora https://ostree.fedoraproject.org \
    --set=gpgkeypath="/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-38-$(uname -m)" \
    --set=contenturl=mirrorlist=https://ostree.fedoraproject.org/mirrorlist"

Fedora ships with the public keys for the various versions Fedora's repos. Now it's configured to know the Fedora OSTree remote.

3️⃣. pull the OSTree branch into the repo

ostree --repo=/ostree/repo pull "fedora:fedora/38/$(uname -m)/silverblue"

This one take a while, but will vary depending on internet connection.

4️⃣. Ensure that the directories exist which are required for an OS deploy

ostree admin os-init fedora

Prepares the folders in the root filesystem for OSTree.

5️⃣. Make the branch be live on reboot

ostree admin deploy --os=fedora --karg-proc-cmdline "fedora:fedora/38/$(uname -m)/silverblue"

Similar to git checkout, now the version which was pull earlier is now ready to boot.

6️⃣. Copy across a few important system configs

for i in /etc/fstab /etc/default/grub /etc/locale.conf /etc/ostree/remotes.d/fedora.conf; do
      cp "${i}" "${OSTREE_DEPLOY_ROOT}/${i}"
done

may add some more things here later but this seems to make it work

7️⃣. Remap the mount home folder to the new expected location

sed -i -e 's, /home , /var/home ,g' "${OSTREE_DEPLOY_ROOT}/etc/fstab"

no place like home!

and… that's pretty much it!

After the script and a reboot, you'll be put into the emergency shell. Just press enter to continue. Not sure why it appears.

Now you'll be prompted to create a user account. Go ahead with the same username as matching in the home folder.

✨ You made it to Silverblue! ✨

🤔 Things to consider

  • the previous install of Fedora Workstation is still kinda around and may be used in the boot process

  • reaching out to Fedora maintainers at Red Hat for interest, direction and roadmap considerations

    • is it on the roadmap to migrate users from Fedora Workstation to Fedora Silverblue or future versions?

There are some uncertainties

  • are there remaining Fedora Workstation files install on disk? (e.g /usr/bin)

    • UPDATE: yes, those files may also be depended on too
  • why does it prompt for user account creation again?
  • non-standard/non-default partition configs

🚪 That's all folks!

Please reach out if this has helped you or if you have any ideas where to take this process!

Inspired by the work of https://asamalik.fedorapeople.org/fedora-docs-translations/en-US/fedora-silverblue/installation-dual-boot

Shout-out to Jorge Castro (https://github.com/castrojo) for interest in furthering the idea and providing a space in the ublue community!

check out how the installer deploys Silverblue here https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/modules/payloads/payload/rpm_ostree/installation.py