// Module included in the following assemblies:
//
// * support/troubleshooting/troubleshooting-operator-issues.adoc

:_mod-docs-content-type: PROCEDURE
[id="troubleshooting-disabling-autoreboot-mco-cli_{context}"]
= Disabling the Machine Config Operator from automatically rebooting by using the CLI

[role="_abstract"]
To avoid unwanted disruptions from changes made by the Machine Config Operator (MCO), you can modify the machine config pool (MCP) using the OpenShift CLI (oc) to prevent the MCO from making any changes to nodes in that pool. This prevents any reboots that would normally be part of the MCO update process.

[NOTE]
====
See second `NOTE` in xref:../../support/troubleshooting/troubleshooting-operator-issues.adoc#troubleshooting-disabling-autoreboot-mco_troubleshooting-operator-issues[Disabling the Machine Config Operator from automatically rebooting].
====

.Prerequisites

ifndef::openshift-rosa,openshift-dedicated[]
* You have access to the cluster as a user with the `cluster-admin` role.
endif::openshift-rosa,openshift-dedicated[]
ifdef::openshift-rosa,openshift-dedicated[]
* You have access to the cluster as a user with the `dedicated-admin` role.
endif::openshift-rosa,openshift-dedicated[]
* You have installed the OpenShift CLI (`oc`).

.Procedure

* To pause or unpause automatic MCO update rebooting:
. Update the `MachineConfigPool` custom resource to set the `spec.paused` field to `true`.
+
.Control plane (master) nodes
[source,terminal]
----
$ oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/master
----
+
.Worker nodes
[source,terminal]
----
$ oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/worker
----

. Verify that the MCP is paused:
+
.Control plane (master) nodes
[source,terminal]
----
$ oc get machineconfigpool/master --template='{{.spec.paused}}'
----
+
.Worker nodes
[source,terminal]
----
$ oc get machineconfigpool/worker --template='{{.spec.paused}}'
----
+
.Example output
[source,terminal]
----
true
----
+
The `spec.paused` field is `true` and the MCP is paused.

. Determine if the MCP has pending changes:
+
[source,terminal]
----
# oc get machineconfigpool
----
+
.Example output
----
NAME     CONFIG                                             UPDATED   UPDATING
master   rendered-master-33cf0a1254318755d7b48002c597bf91   True      False
worker   rendered-worker-e405a5bdb0db1295acea08bcca33fa60   False     False
----
+
If the *UPDATED* column is *False* and *UPDATING* is *False*, there are pending changes. When *UPDATED* is *True* and *UPDATING* is *False*, there are no pending changes. In the previous example, the worker node has pending changes. The control plane node does not have any pending changes.
+
[IMPORTANT]
====
If there are pending changes (where both the *Updated* and *Updating* columns are *False*), it is recommended to schedule a maintenance window for a reboot as early as possible. Use the following steps for unpausing the autoreboot process to apply the changes that were queued since the last reboot.
====

* Unpause the autoreboot process:

. Update the `MachineConfigPool` custom resource to set the `spec.paused` field to `false`.
+
.Control plane (master) nodes
[source,terminal]
----
$ oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/master
----
+
.Worker nodes
[source,terminal]
----
$ oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/worker
----
+
[NOTE]
====
By unpausing an MCP, the MCO applies all paused changes and reboots {op-system-first} as needed.
====
+
. Verify that the MCP is unpaused:
+
.Control plane (master) nodes
[source,terminal]
----
$ oc get machineconfigpool/master --template='{{.spec.paused}}'
----
+
.Worker nodes
[source,terminal]
----
$ oc get machineconfigpool/worker --template='{{.spec.paused}}'
----
+
.Example output
[source,terminal]
----
false
----
+
The `spec.paused` field is `false` and the MCP is unpaused.

. Determine if the MCP has pending changes:
+
[source,terminal]
----
$ oc get machineconfigpool
----
+
.Example output
----
NAME     CONFIG                                   UPDATED  UPDATING
master   rendered-master-546383f80705bd5aeaba93   True     False
worker   rendered-worker-b4c51bb33ccaae6fc4a6a5   False    True
----
+
If the MCP is applying any pending changes, the *UPDATED* column is *False* and the *UPDATING* column is *True*. When *UPDATED* is *True* and *UPDATING* is *False*, there are no further changes being made. In the previous example, the MCO is updating the worker node.
