Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Greenboot: Automate rollbacks for atomically updated systems

August 12, 2024
Eliane Pereira Eric Curtin Micah Abbott Sayan Paul
Related topics:
Edge computingOpen source
Related products:
Red Hat Enterprise LinuxRed Hat Enterprise Linux for Edge

Share:

    In mid-July, a faulty configuration update caused a significant global IT disruption, leading to transportation delays, point-of-sale issues, telecommunications outages and more. Affected machines entered a boot loop or boot recovery mode, rendering them inoperative; this underscores  the critical need for robust automated recovery mechanisms in IT infrastructure. One answer being iterated upon by the open source community is Greenboot, which is currently available in Red Hat Enterprise Linux (RHEL) for Edge, Red Hat In-Vehicle Operating System and Fedora IoT.

    Greenboot is designed to automatically recover from failed upgrades by integrating with systemd and atomically updated distros. It acts as a guardian for your system’s health, so that if an update goes awry, the system can automatically rollback to a previously working state. Here is how Greenboot can help prevent outages similar to July’s global disruption.

    Automated health checks and rollbacks

    Greenboot performs health checks every time the system boots. It uses scripts to verify critical components and services, verifying that they are functioning as expected. If any health check fails, Greenboot can automatically rollback the system to a previous, stable state, minimizing downtime.

    Customizable health checks

    Administrators can define custom health checks tailored to their specific system needs. These checks can be categorized into mandatory checks that must pass for the system to be considered healthy and optional checks, whose failure will not trigger a rollback but will be logged as a failure.

    Integration with systemd and OSTree

    By leveraging systemd for service management and OSTree for version control, Greenboot provides a powerful, integrated solution for maintaining system health. The ability to create and manage bootable system snapshots enables Greenboot to rollback effectively if an update causes issues.

    How Greenboot works

    Greenboot follows a structured approach to manage system health:

    1. System boot

    2. Health check outcomes

    3. Rollback

    System boot

    During boot, Greenboot runs health check scripts that are located in /etc/greenboot/check/required.d and /etc/greenboot/check/wanted.d. The scripts in required.d must pass for the boot to be successful, while failures in wanted.d are logged but do not trigger a rollback.

    Health check outcomes

    • Success: If all required health checks pass, Greenboot executes any scripts in /etc/greenboot/green.d to finalize the boot process.

    • Failure: If any required health check fails, Greenboot runs scripts in /etc/greenboot/red.d to attempt corrective actions before rebooting. If the issue persists after several retries, Greenboot triggers an OSTree rollback to the previous stable version.

    Rollback mechanism

    In the event of repeated failures, Greenboot uses rpm-ostree rollback --reboot to revert the system to the last known good state. This ensures that the system can recover from failed updates without manual intervention. In the case where Linux userspace may not be reached effectively, the bootloader maintains boot counters, to automatically rollback after a number of failed boots.

                                  +-------------------------+
         +----------------------->|     System Boot         |
         |                        +-----------+-------------+
         |                                    |
         |                                    |
    +--------+                                |
    | reboot |                                |
    +--------+                                |
         ^                                    |
         |                                    |
    Yes  |                                    v
         |                        +-------------------------+
         |        boot_counter == |        -1 ?             |
         +------------------------+-----------------------+-+
                                                          |
                                                          | No
                                                          v
                                                 +-------------------------+
                                                 | Continue boot process   |
                                                 +-----------+-------------+
                                                             |
                                                             v
                                               +--------------------------+
                                               | greenboot-healthcheck    |
                                               +-----------+--------------+
                                                           |
                                                           v
                                              +--------------------------+
                                              | Run health check scripts  |
                                              | in `required.d` and       |
                                              | `wanted.d` directories    |
                                              +-----------+--------------+
                                                          |
                                                          v
                                      +---------------------------+
                         Any required | Script failed ?           |
                          +-----------+---------------------------+
                          | No                             | Yes
                          v                                v
           +--------------------------+     +--------------------------+
           |  Boot successful         |     |  Call `redboot.target`   |
           +-----------+--------------+     +-----------+--------------+
                       |                              |
                       v                              v
          +-----------------------------+   +--------------------------+
          | Reach `boot-complete.target`|   | redboot-task-runner      |
          +-----------+-----------------+   | runs `/usr/libexec/      |
                      |                     | greenboot/greenboot red` |
                      v                     +-----------+--------------+
          +-----------------------------+               |
          | greenboot-grub2-set-success |               v
          | unsets `boot_counter` and   |   +--------------------------+
          | sets `boot_success` to 1    |   | Run scripts in `red.d`   |
          +-----------+-----------------+   +-----------+--------------+
                      |                                 |
                      v                                 v
          +-----------------------------+   +--------------------------+
          | greenboot-task-runner runs  |   | greenboot-status.service |
          | `/usr/libexec/greenboot/    |   | creates MOTD with error  |
          | greenboot green` to run     |   | details                  |
          | scripts in `green.d`        |   +-----------+--------------+
          +-----------+-----------------+               |
                      |                                 v
                      v                     +--------------------------+
          +-----------------------------+   | redboot-auto-reboot      |
          | greenboot-status.service    |   | checks if manual         |
          | creates MOTD with success   |   | intervention is needed,  |
          | message                     |   | if not, reboots system   |
          +-----------------------------+   +--------------------------+

    Conclusion

    Greenboot offers a robust, automated solution to manage system health and recover from update failures, reducing the risk of downtime and operational disruptions. By leveraging customizable health checks and integration with systemd and OSTree, Greenboot can effectively mitigate the impact of faulty updates, helping your systems to remain reliable and resilient. Whether managing a few servers, many edge devices or many vehicles, Greenboot is an essential tool for maintaining uptime and system integrity in today’s complex IT environments.

    Related Posts

    • What's new in Red Hat Enterprise Linux 9.4?

    • Scale testing image-based upgrades for single node OpenShift

    • Best practices: Using health checks in the OpenShift 4.5 web console

    • Using Kubernetes readiness and liveness probes for health checks with ASP.NET Core 2.2 on OpenShift

    • How Ansible automates JBoss Web Server updates and upgrades

    • Build and manage Red Hat Device Edge images with Ansible

    Recent Posts

    • A deep dive into Apache Kafka's KRaft protocol

    • Staying ahead of artificial intelligence threats

    • Strengthen privacy and security with encrypted DNS in RHEL

    • How to enable Ansible Lightspeed intelligent assistant

    • Why some agentic AI developers are moving code from Python to Rust

    What’s up next?

    Share graphics_system commands

    systemd Commands cheat sheet

    Bob Reselman
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue