Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

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 Device Edge

    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

    • Confidential virtual machine storage attack scenarios

    • Introducing virtualization platform autopilot

    • Integrate zero trust workload identity manager with Red Hat OpenShift GitOps

    • Best Practice Configuration and Tuning for Linux and Windows VMs

    • Red Hat UBI 8 builders have been promoted to the Paketo Buildpacks organization

    What’s up next?

    Share graphics_system commands

    systemd Commands cheat sheet

    Bob Reselman
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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