第 7 章 Using the command-line assistant to debug or troubleshoot system issues
You can use the command-line assistant powered by RHEL Lightspeed to request information on how to troubleshoot the issues that you face 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:
- An optional terminal capture feature in the command-line assistant to reference the output of previous commands when interacting with the command-line assistant.
- Piping data into the command-line assistant.
Prerequisites
- You have enabled the command-line assistant.
- You have root access to your system.
Procedure
Check the SSHD status and restart it.
$ sudo systemctl status ssh $ sudo systemctl restart sshEnable the optional command-line assistant terminal capture feature:
$ c shell --enable-captureUse 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.servicecommand to check the log files.
Run that
journalctlcommand and check the log files to identify potential issues.$ journalctl -xeu sshd.serviceAsk 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?"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