Troubleshooting issues in Linux - The scientific way !!
The scientific method consists of these steps:
Let us understand this with a simple example of web server not working -
Problem given: webserver not working, error connection refused from port 80
Step 1. Collect relevant information:
Info collected : a) connection refused from port 80
Step 2. Create an accurate problem statement:
webserver is not running because Apache is unable to bind to the specified IP address and port 82.
Step 3. Formulate testable hypotheses :
The problem can occur due to one of the following reasons :
Step 4. Test each hypothesis & Step 5. Record and analyze the test results :
ausearch -m AVC is a command used to search for audit events related to Access violations in an audited Linux system. AVC violations occur when a process attempts to perform an action that is not allowed by the system's security policy.
We can easily see that port 82 is denied the binding permission.
If you want to see more human friendly information about the violation alert and probable workaround and suggestion on the same - you can use sealert command on the default audit log file location:
The issue is identified now !! port 82 does not have the required SELinux port context for using the httpd service.
Step 6. Fix and verify the problem resolution :
This time the httpd service restarts successfully.
Verify the results :
But it does not work from other server in the same network :
Notice the error : No route to host
That means you need to check whether the firewall allows the port 82 to connect to outside the server:
Now check from the other server whether you can curl or not the servera webserver :
That's it ! You are now an awesome linux troubleshooter !!
What a beautiful example/lesson!!! So many nice pieces were addressed - especially my favorite, SELinux!
Being able to troubleshoot an issue on a Linux system is the ultimate measure of a
Sys Admin!!! The ability to configure things is certainly important, but when a system
isn't functioning, installation and configuration ain't possible.
As was illustrated so very well in the example, it's so important to know your
commands, and how to decipher the information that they provide.
Love this exposition!!!!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.