Troubleshooting SSH agents that appear connected but remain offline in Jenkins

Last Reviewed:2026-07-29()
2 minute readKnowledge base

Symptoms

Users may experience one or more of the following when SSH agents fail to appear online in the CloudBees CI controller UI:

  • Agent SSH logs show Agent successfully connected and online from the agent side, but the agent remains offline in the controller UI.

  • Newly named agents connect successfully, but previously existing agent names fail to come online.

  • Controller logs contain java.nio.file.FileSystemException: Operation not permitted during agent launch.

  • Restarting the controller or deleting and recreating the agent node configuration does not resolve the issue.

Diagnosis/Treatment

Check controller logs for SlaveComputer#kill() errors

When an agent is relaunched, CloudBees CI calls SlaveComputer#kill() to clean up the prior agent session before establishing a new connection. If this cleanup step fails, the launch is aborted before the SSH connection is even attempted, which explains why the agent-side logs show a successful connection while the controller never registers it as online.

  1. Retrieve the agent-specific log from the controller. Navigate to Manage Jenkins  Nodes, select the affected agent, then click Log.

  2. Look for errors similar to the following near the start of the most recent launch attempt:

    java.nio.file.FileSystemException: /var/jenkins_home/logs/slaves/<agentname>: Operation not permitted at sun.nio.fs.UnixException.translateToIOException(UnixException.java:100) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ... hudson.remoting.Channel$3 run SEVERE: Unexpected termination of the channel
    ▼
  3. If this error is present, the root cause is a filesystem permission problem on the $JENKINS_HOME/logs/slaves/<agentname>/ directory on the controller host. Proceed with the checks below.

Check directory ownership

The logs/slaves/ directory and its subdirectories must be owned by the OS user running the CloudBees CI controller process.

  1. On the controller host, check the ownership of the affected agent log directory:

    ls -la $JENKINS_HOME/logs/slaves/
    ▼
  2. Verify the owner matches the user running the Jenkins process (for example, jenkins).

  3. If the ownership is incorrect, restore it with:

    chown -R jenkins:jenkins $JENKINS_HOME/logs/slaves/
    ▼
  4. Retry the agent launch and confirm it appears online in the controller UI.

Check for immutable file attributes

On Linux systems, the chattr utility can mark files or directories as immutable, preventing any modifications even by the owning user.

  1. Check for immutable flags on the agent log directory:

    lsattr -R $JENKINS_HOME/logs/slaves/<agentname>/
    ▼
  2. If any entries show the i flag (for example, ----i--------), remove the immutable attribute:

    chattr -R -i $JENKINS_HOME/logs/slaves/<agentname>/
    ▼
  3. Retry the agent launch.

lsattr and chattr are not supported on all filesystems and may return Operation not supported on some systems. On XFS, for example, use xfs_io -c "lsattr" and xfs_io -c "chattr -i" as equivalents.

Check SELinux context

On RHEL or CentOS systems with SELinux enforcing, incorrect file contexts can cause permission denials even when POSIX ownership is correct.

  1. Check whether SELinux is enforcing:

    getenforce
    ▼
  2. If the output is Enforcing, check the security context of the directory:

    ls -laZ $JENKINS_HOME/logs/slaves/
    ▼
  3. If the context appears incorrect, restore the default context:

    restorecon -Rv $JENKINS_HOME/logs/slaves/
    ▼
  4. Retry the agent launch.

To confirm the permission fix is the root cause, try connecting an agent using a brand-new name that has no existing entry under $JENKINS_HOME/logs/slaves/. If the new agent comes online successfully while the original name does not, the issue is confirmed to be in the existing log directory for that agent name.

References

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.