Updates and Rollbacks

The latest image builds are available here.

Upgrade to the Latest Image

Display the status of the currently running deployment:

$ rpm-ostree status

The rpm-ostree command is used to manage the atomic system tree used by the Fedora IoT images. The update command is an alias for the upgrade command.

View the options with:

$ rpm-ostree upgrade --help
Usage:
  rpm-ostree upgrade [OPTION…]

Perform a system upgrade

Help Options:
  -h, --help                      Show help options

Application Options:
  --os=OSNAME                     Operate on provided OSNAME
  -r, --reboot                    Initiate a reboot after operation is complete
  --allow-downgrade               Permit deployment of chronologically older trees
  --preview                       Just preview package differences
  --check                         Just check if an upgrade is available
  -C, --cache-only                Do not download latest ostree and RPM data
  --download-only                 Just download latest ostree and RPM data, don't deploy
  --upgrade-unchanged-exit-77     If no upgrade is available, exit 77
  --sysroot=SYSROOT               Use system root SYSROOT (default: /)
  --peer                          Force a peer-to-peer connection instead of using the system message bus
  --install=PKG                   Overlay additional package
  --uninstall=PKG                 Remove overlayed additional package
  --version                       Print version information and exit

Check for available updates:

$ sudo rpm-ostree upgrade --check
Receiving metadata objects: 0/(estimating) -/s 0 bytes... done
AvailableUpdate:
        Version: 29.20190211.0 (2019-02-11T13:18:27Z)
         Commit: 5eb0553c02a8035a02f030c7fb8d5c6727d1ecb2700dade4b767363acfcab8e4
   GPGSignature: Valid signature by C2A3FA9DC67F68B98BB543F47BB90722DBBDCF7C
           Diff: 25 upgraded

Preview the package differences:

$ sudo rpm-ostree upgrade --preview

If you wish, you can download the packages only and not deploy them with:

$ sudo rpm-ostree upgrade --download-only

To apply the OSTree update deltas available on CDN use the following command:

$ sudo rpm-ostree upgrade

Due to the atomic nature of the OS, you will have to reboot into the new image to have the updates take effect:

$ systemctl reboot

Rollback to a previous tree

The rpm-ostree utility keeps two deployments available. Both have an entry in the bootloader menu. The new updated entry with be the default. If necessary, you can choose the other entry to boot into the previous deployment.

The timeout for GRUB2 to display the menu is very short at only one second. Pressing the space bar or an arrow key when the menu appears will interrupt the timeout and allow you to choose another entry. The ENTER key will boot the selected image.

To permanently switch back to the previous deployment:

$ sudo rpm-ostree rollback

Like with the upgrade, a system reboot will be required. You can use the systemctl reboot command or you can include the --reboot option when you issue the rollback command:

$ sudo rpm-ostree rollback --reboot
More information about Bootloading with GRUB2 can be found in the Fedora Quick Docs.
More information about the rpm-ostree command can be found in the upstream Administrator Handbook

Automatic updates

A rpm-ostreed service is available to monitor for upgrades automatically.

To enable automated updates edit the /etc/rpm-ostreed.conf file. The options available are as follow:

  • The 'none' option disables automatic updates. This is the default policy.

  • The 'check' option downloads enough metadata to display available updates with rpm-ostree status.

  • The 'stage' option downloads, unpacks and stages the update which will be finalized on a reboot.

  • The 'apply' option is the same as stage but also initiates the reboot to the new version.

# cat /etc/rpm-ostreed.conf
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# For option meanings, see rpm-ostreed.conf(5).

[Daemon]
AutomaticUpdatePolicy=check
#IdleExitTimeout=60

Next we need to enable the appropriate services:

systemctl reload rpm-ostreed
systemctl enable rpm-ostreed-automatic.timer --now

We should now be able to see the state of automatic updates in the status:

# rpm-ostree status
State: idle
AutomaticUpdates: stage; rpm-ostreed-automatic.timer: last run 4min 22s ago

The rpm-ostreed-automatic.service and rpm-ostreed-automatic.timer control frequency of checks and upgrades. More information is available in the man pages or this blog post