Description

This article provides information on how to remove a configuration lock which can affect committing a new configuration on the SRX

Symptoms

In some cases, a commit attempt might fail with the following errors:

error: remote lock-configuration failed on node0

error: configuration database locked by ...

Solution

There can be different reasons for this issue to occur. Here is just one example.

When a user connects to the CLI, there is a process called mgd which will spawn a new child process for that user. This can be checked from the shell.

1. The user logs in:

root@SRX1% cli
{primary:node0}
root@SRX1>

2. A new mgd process is created:

root@SRX1% ps auxww | grep mgd
root 1271 0.0 2.6 43028 26876 ?? S 6:52AM 0:01.58 /usr/sbin/mgd -N
root 3159 0.0 0.3 43068 2768 ?? Ss 10:37AM 0:00.03 mgd: (mgd) (root)/dev/ttyp1 (mgd)  <<<<< this process is created

3. The user will now want to commit something and will go into configuration mode:

root@SRX1> configure exclusive
warning: uncommitted changes will be discarded on exit
Entering configuration mode

{primary:node0}[edit]
root@SRX1#

4. At this point, something goes wrong, and the user gets disconnected (for some unrelated reason). The user tries to log in again and finds that the node failed over. He still needs to commit his changes.

{primary:node1}
root@SRX2> configure
warning: Clustering enabled; using private edit
warning: uncommitted changes will be discarded on exit
Entering configuration mode

{primary:node1}[edit]
root@SRX2# set interfaces ge-13/0/4 description test

{primary:node1}[edit]
root@SRX2# commit and-quit
node0:
error: configuration database locked by: root terminal u0 (pid 3159) on since 2016-12-15 10:20:02 UTC, idle 00:01:40 exclusive {secondary:node0}[edit]
Users currently editing the configuration:
root terminal u0 (pid 3159) on since 2016-12-15 10:20:02 UTC, idle 00:01:40
exclusive {secondary:node0}[edit]
node1:

error: remote lock-configuration failed on node0

This issue can also occur on a standalone SRX. When the user logs in, he will see a message similar to this one:

root@SRX> configure
Entering configuration mode
Users currently editing the configuration:
root terminal p0 (pid 2304) on since 2016-12-13 17:04:05 UTC, idle 1d 17:09
exclusive [edit]

In some cases, when he tries to commit a change, he will also get a message saying the system cannot lock the configuration.

The solution in this case is to clear the lock set by that mgd process. In the case of a standalone SRX, the administrator will issue the following command on the affected SRX:

root@SRX> clear system commit
No commit scheduled

root@SRX> configure
Entering configuration mode <<<< the lock has been removed


[edit]
root@SRX#

When a cluster is used, the recommended action is to use this command on both nodes:

{secondary:node0}
root@SRX1> clear system commit
No commit scheduled

{primary:node1}
root@SRX2> clear system commit
No commit scheduled

{primary:node1}[edit]
root@SRX2# commit and-quit
node0:
configuration check succeeds
node1:
commit complete
node0:
commit complete.                 <<<< commit is successful
Exiting configuration mode

 

Modification History

2020-03-26: Article reviewed for accuracy; it is valid and accurate