Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 7. Using the command-line assistant to debug or troubleshoot system issues


Use the command-line assistant powered by RHEL Lightspeed to request troubleshoot information for issues on your system.

To troubleshoot your system, ask a question by using the following syntax: c + "<question>". For example:

  • $ c "how to troubleshoot network errors"
  • $ c "I cannot access my server with SSH. Can you give me a list of things to troubleshoot?"
  • $ c "I am failing to start sssd process"
  • $ c "I need to boot into a different kernel"
  • $ c "how to troubleshoot SSHD failing to start"
  • $ c "how do I find all the files in the /etc that have been modified in the last hour"
  • $ c "I am failing to start sssd process"

You can use the command-line assistant powered by RHEL Lightspeed to troubleshoot an SSHD service that fails to start.

You can use these command-line assistant features:

  • The command-line assistant includes an optional terminal capture feature to reference the output of previous commands.
  • You can use the assistant for piping data into the command-line assistant.

Prerequisites

  • You have enabled the command-line assistant.
  • You have root access to your system.

Procedure

  1. Check the SSHD status and restart it.

    $ sudo systemctl status ssh
    $ sudo systemctl restart ssh
  2. Enable the optional command-line assistant terminal capture feature:

    $ c shell --enable-capture
  3. Use the -w 1 "your_question" option to specify to include the output from the last command that was run.

    $ c -w 1 "what_is_this"
    • If you specify the number 2, that references the output from the second-to-last command. This is also true for the additional numbers.
    • You can also specify a prompt to run with the command and ask "help me understand the output", and reference the output with the error, so that the command-line assistant understands that you are asking for more details on what the error is.

      The command-line assistant processes the request and provides several possible solutions. In the example, you can use the suggestion to run the journalctl -xeu sshd.service command to check the log files.

  4. Run that journalctl command and check the log files to identify potential issues.

    $ journalctl -xeu sshd.service
  5. Ask the command-line assistant to generate a command on how to fix this typing error.

    $ c "what is the command that I can use to change 'Porrt' to 'Port' in the /etc/ssh/sshd_config file?"
  6. Run the command suggested by the command-line assistant as a sudo user. For example:

    $ sudo sed -i s/Porrt/Port/g /etc/ssh/sshd_config

Verification

  • Restart the SSHD service and check the status of the SSHD.

    $ sudo systemctl restart sshd
    $ sudo systemctl status sshd

7.2. Using the command-line assistant to troubleshoot SELinux issues

You can troubleshoot SELinux issues by using the command-line assistant. The example troubleshooting process demonstrates the diagnostic capabilities of the command-line assistant.

Prerequisites

  • You have enabled the command-line assistant.
  • You have root access to your system.

Procedure

  1. Check the httpd package version and identify the ports on which the web server accepts incoming requests:

    $ sudo rpm -qa httpd
    httpd-2.4.62-2.fc40.x86_64
    $ cat /etc/httpd/conf/httpd.conf | grep Listen
    Listen 80
  2. Restart the httpd service and check for errors:

    $ systemctl restart httpd
    $ sudo journalctl -xeu httpd.service
    Job for httpd. Service failed because the control process exited with error code.
  3. Use the command-line assistant to troubleshoot the service failure and check SELinux status:

    $ c "why did httpd fail to start"
    $ c "selinux httpd port"
    $ sudo sestatus
  4. Check the SELinux context for httpd and ask the command-line assistant for guidance:

    $ sudo cat /usr/share/selinux/targeted/contexts/httpd_var_run_t
    No such file or directory
    $ c "i don't have a httpd_var_run_t contexts"
  5. Set the SELinux context and configure the port as suggested by the command-line assistant:

    $ sudo chcon -R -t httpd_var_run_t
    $ c "selinux won't let httpd listen on port 12345"
    $ sudo semanage port -a -t httpd_port_t -p tcp 12345
  6. If you receive a ValueError, ask the command-line assistant and apply the suggested fix:

    $ c "how do I fix ValueError: Type httpd_port_t is invalid, must be a port type"
    $ sudo ls -Z /usr/sbin/httpd
    $ chcon -t httpd_exec_t /usr/sbin/httpd
    $ sudo setenforce 1
  7. Restart httpd and enable network connections if the service still fails:

    $ sudo systemctl restart httpd
    $ c "how do I enable httpd to listen on port 12345 selinux"
    $ sudo setsebool -P httpd_can_network_connect=1
  8. If the service fails again, check the journal and search for SELinux denials:

    $ journalctl -xeu httpd
    $ c "An ExecStart= process belonging to unit httpd.service has exited."
    $ sudo ausearch -m AVC,USER_AVC -ts recent
  9. Enter the AVC denial output to the command-line assistant for analysis:

    $ c "avc: denied {name_bind} for pid=7184 comm="httpd" src=12345 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0"
  10. Add the port to the correct SELinux type to resolve the binding error:

    $ sudo semanage port -a -t http_port_t -p tcp 12345

Verification

  • Restart the httpd service and check the status of httpd.service:

    $ sudo systemctl restart httpd
    $ No error
    $ sudo systemctl status httpd.service

    The server is configured, up and running, and listening on port 443, port 12345.

Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben