Before coming to Red Hat, I spent nearly a decade as a Systems Administrator. After all that time, I’m still continually discovering tools that would make life as a SysAdmin much easier. One of these utilities is the redhat-support-tool. In this post we'll walk you through using the tool in some real-world scenarios.

What is the Red Hat support tool?

The support tool allows you to interact with the Red Hat knowledge base, support tickets, analyze log files, and even set site-wide configuration options, all from the command line! At first glance, that may not seem like a big deal, but consider these real world scenarios.

You come across some issues getting Nginx to play nice with your Red Hat Enterprise Linux (RHEL) server. You remember that there was a Knowledge Base (KB) article about that very same topic. One problem though: Copy+Paste doesn’t work between your browser and the remote virtual machine (VM) console you are working on. No problem! Install the redhat-support-tool, login to your Access account, search for that KB article, and copy that long command and all its options within your terminal!

Here's another scenario. You’ve run into some issues with a kernel module. You’re stumped. You want to put your support subscription to good use and ask one of our amazing engineers to give you a fresh perspective. No problem! Create a ticket from the terminal of your affected system, run an SOS report, and attach some debug logs all to the same ticket without ever leaving the terminal!

No need to SCP files around, just to upload them via your server’s terminal, avoid mistakes when trying to copy long commands. Cut back on context switching because you never leave your terminal. Saving time on these tasks means more time to sharpen the tools in your tool belt or more time to spend on everyone’s favorite, video conferences! No? No video conferences? OK, fine.

Let's get started with the Red Hat support tool

You may think that a tool this amazing would be hard to set up right? Nope! Let’s start with a vanilla RHEL 8.3 server.

We’re going to install the redhat-support-tool packages. You can use yum or dnf, but make sure your system is up to date before you get started.

[root@rhel8 ~]# dnf install -y redhat-support-tool                                                                                                                                                                                 [38/129]
Updating Subscription Management repositories.                                                                                                                                                                                             
EPEL8 x86_64                                                                                                                                                                                                29 kB/s | 2.4 kB 00:00
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                                                                       29 kB/s | 2.4 kB 00:00
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                                                                    41 kB/s | 2.8 kB 00:00
Dependencies resolved.
=============================================================================================================================================================================================================================================$
 Package                                                Architecture                       Version                                                          Repository                                                    Size
=============================================================================================================================================================================================================================================$
Installing:                                                                                                                                                                                                                               

 redhat-support-tool                                    noarch                             0.11.2-2.el8                                                     rhel-8-for-x86_64-appstream-rpms                             236 k
Installing dependencies:                                                                                                                                                                                                                  

 libxslt                                                x86_64                             1.1.32-5.el8                                                     rhel-8-for-x86_64-baseos-rpms                                250 k
 python3-lxml                                           x86_64                             4.2.3-1.el8                                                      rhel-8-for-x86_64-appstream-rpms                             1.5 M
 python3-pip                                            noarch                             9.0.3-18.el8                                                     rhel-8-for-x86_64-appstream-rpms                              20 k
 python3-setuptools                                     noarch                             39.2.0-6.el8                                                     rhel-8-for-x86_64-baseos-rpms                                163 k
 python3-webencodings                                   noarch                             0.5.1-6.el8                                                      rhel-8-for-x86_64-appstream-rpms                              27 k
 python36                                               x86_64                             3.6.8-2.module+el8.1.0+3334+5cb623d7                             rhel-8-for-x86_64-appstream-rpms                              19 k
 redhat-support-lib-python                              noarch                             0.11.2-1.el8                                                     rhel-8-for-x86_64-appstream-rpms                             229 k
Installing weak dependencies:                                                                                                                                                                                                             

 python3-beautifulsoup4                                 noarch                             4.6.3-2.el8.1                                                    ITG_EPEL8_EPEL8_x86_64                                       185 k
 python3-cssselect                                      noarch                             0.9.2-10.el8                                                     ITG_EPEL8_EPEL8_x86_64                                        40 k
 python3-html5lib                                       noarch                             1:0.999999999-6.el8                                              rhel-8-for-x86_64-appstream-rpms                             214 k
Enabling module streams:                                                                                                                                                                                                                  
 python36                                                                                      3.6                                                                                                                                                                                                                                                                                                                                                                 

Transaction Summary                                                                                                                                                                                                                       

=============================================================================================================================================================================================================================================
Install  11 Packages                                                                                                                                                                                                                      

                                                                                                                                                                                                                                          

Total download size: 2.9 M                                                                                                                                                                                                                

Installed size: 11 M


<<< Output Cropped >>>

Installed:
  libxslt-1.1.32-5.el8.x86_64            python3-beautifulsoup4-4.6.3-2.el8.1.noarch   python3-cssselect-0.9.2-10.el8.noarch python3-html5lib-1:0.999999999-6.el8.noarch        python3-lxml-4.2.3-1.el8.x86_64
  python3-pip-9.0.3-18.el8.noarch        python3-setuptools-39.2.0-6.el8.noarch    python3-webencodings-0.5.1-6.el8.noarch   python36-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64   redhat-support-lib-python-0.11.2-1.el8.noarch
  redhat-support-tool-0.11.2-2.el8.noarch

Complete!
[root@rhel8 ~]#

After our package and its dependencies are installed, let’s get logged into our Red Hat Access account. We can do this one of two ways.

One is by passing the command a string of arguments or via the support tool’s shell. The first option is awesome for creating tickets and uploading files. It’s not as recommended as a login process because then your Red Hat Access password would be stored in your terminal history in plain text. For now, let's start with the shell, type redhat-support-tool and then configure our username.

[root@rhel8 ~]# redhat-support-tool
Welcome to the Red Hat Support Tool.
Command (? for help): config user itguyeric
Command (? for help):

No news is good news! We have our username set. Now, what options do we have? Type a ? and hit Enter. It’ll show the full list from attaching files, searching for kerneldebugs.

Command (? for help): ?

Documented commands (type help <topic>):
========================================
addattachment Use the 'addattachment' command to add an attachment to a case.
addcomment    Use the 'addcomment' command to add a comment to a case.
analyze       Use the 'analyze' command to analyze Python or Java errors contained in output from either Python or Java applications. Only the first occurrence of the error in the output will be analyzed. All other types of
              files/output are unsupported with the 'analyze' command.  The 'diagnose' command supports arbitrary file types. The 'btextract' command is specifically targeted for kernelcore file analysis.
btextract     Use the 'btextract' command get a kernel stack backtrace and other related information from a kernel core dump file. The default behavior is to issue 'bt -a'; however, there are a variety of other 'crash' commands that
              can be run.
config        Use the 'config' command to set or get configuration file values.
diagnose      Use the 'diagnose' command to send a file, a directory containing files, or plain text to Red Hat for analysis.
e             Exit the program.
findkerneldebugs Use the 'findkerneldebugs' command to search and install available debug images.  Wildcards are allowed.  (requires root user privileges)

<<< Output Cropped >>>

search        Use the 'search' command to search the entire knowledge base for solutions with given keywords, a log message, program configuration variables, etc.
shell         Execute a shell command. You can also use '!'.
Command (? for help):

We mentioned configuring Nginx. Let’s see what we can find about Nginx and SELinux. Redhat-support-tool will ask us for our password. I chose not to save mine. This is probably your best bet, especially if your server is in a shared environment. However, if you do want to save your support tool configuration, it's all saved in a configuration file at:

~/.redhat-support-tool/redhat-support-tool.conf

Command (? for help): search nginx selinux
Please enter the password for itguyeric:
Save the password for itguyeric in /root/.redhat-support-tool/redhat-support-tool.conf (y/n): n

Type the number of the solution to view or 'e' to return to the previous menu.
 1 [3109871:VER] Can I use a Custom SSL Certificate instead of the Self-Signed SSL Certificate Generated by Ansible Tower ?
 2 [3618371:VER] What is the meaning of "avc: denied { nosuid_transition }" message in audit log?
 3 [4546511:VER] imfile: rsyslog doesn't handle files after log rotation occurred
 4 [4889221:VER] Why I Am Getting 502 Error When Accessing Ansible Tower UI  and 'Permission denied while connecting to upstream' in Ansible Tower's Nginx Logs ?
 5 [5513411:UNV] How to configure a reverse proxy with the stream module in Nginx?
 6 [3686271:WIP] 403 Forbidden Error in Nginx when using CIFS mount
 7 [4318691:VER] Change the default Openshift router ports (80 and 443) when using native LB in front of them
 8 [1532013:WIP] RSA modulus is not a positive number

No more solutions to display
Select a Solution: 2

Type the number of the section to view or 'e' to return to the previous menu.
 1 Title
 2 Issue
 3 Environment
 4 Resolution
 5 Root Cause
 6 Diagnostic Steps
 7 Display all sections
End of options.
Section:

The Knowledge Base returns a list of solutions. Type the number of the solution we want to read up on, then we’re going to hit ‘4’ to see what the resolution was:

Resolution
===============================================================================
Follow the instructions in the **Diagnostic Steps** section. If this is a match, proceed further.

### Case where the affected binary is not distributed by Red Hat

Please contact the vendor of the affected binary.

### Case where the affected binary is distributed by Red Hat, usually as Red Hat Software Collections (RHSCL)

To allow the transitions to happen, it is necessary to create a custom module, by following the procedure below.

1. Create file `kcs3618371__nosuid_mounts_transitions.te` with content below

~~~
policy_module(kcs3618371__nosuid_mounts_transitions, 1.0)

gen_require(`
     type init_t, httpd_t;
')

allow init_t httpd_t:process2 nosuid_transition;
~~~

In the example above, the affected binary was `nginx` which is supposed to execute in **httpd_t** context.
Since the binary is part of the `rh-nginx116-nginx.service` unit started by `systemd`, we allow the transition from **init_t** to **httpd_t** to happen.                                                                              

**This module must be customized depending on the needs. If in doubt, open a support case with Red Hat and add a reference to this Solution.**                                                                                        

<<< Output Cropped >>>

5. Verify that the service now runs in appropriate context

~~~
# ps -eafZ | grep nginx | grep -v grep
system_u:system_r:httpd_t:s0 root [...] nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
system_u:system_r:httpd_t:s0 nginx [...] nginx: worker process
~~~

In the example above, `nginx` is now running as **httpd_t**, which is the appropriate context.

Pro Tip! Use a terminal utility like Tmux so you can have your resolution and your terminal side by side. You can be scrolling through the resolution in one pane while running the requested commands in the other. If you really want to go crazy, add a third pane and tailing logs to watch your progress!

Using the Tmux Multiplexer to read the resolution steps and live terminal on one screen!

Let’s say, the resolution we found didn’t help. No worries, happens to the best of us, right? Let’s open a case and get some help on this issue from Red Hat Support.  From the support shell, type in opencase. This will trigger a wizard to help us ensure the case gets to the right people with the right information the first time.

Command (? for help): opencase
Do you want to use the default product - "Red Hat Enterprise Linux" (y/N)?:y
 1   5 - ELP
 2   5.0
 3   5.1
 4   5.10
 5   5.11
 6   5.2
 7   5.3
 8   5.4   
<<< Output Cropped >>>
 37  8.2
 38  8.3   
 39  9.0 Alpha                                                               

Please select a version (or 'q' to exit): 38
Please enter a summary (or 'q' to exit): TEST ONLY - No Support Required
Please enter a description (Ctrl-D on an empty line when complete):
I am writing a blog to show SysAdmins how to use the redhat-support-tool.
Stuff breaks. Support helps us fix it!
 1   Urgent
 2   High
 3   Normal
 4   Low                                                                     

Please select a severity (or 'q' to exit): 4
Would you like to use the default (Ungrouped Case) Case Group (y/N)? :y
Would you like to see if there's a solution to this problem before opening a support case? (y/N) N
-------------------------------------------------------------------------------
Support case 02893408 has successfully been opened.

Would you like Red Hat Support Tool to automatically generate and
attach a SoS report to 02893408 now? (y/N) y

We select our product, product version, and enter a summary and description. The wizard asks us for urgency, whether we want to attach it to a group of existing cases, and if we want to run a search for existing solutions. Here’s where things get REALLY sweet! Right from the case wizard, we can generate an SOS report and attach it to the case. Once that case is open, we can even check on its progress. Type getcase and the case number listed above.

Case Details
===============================================================================
Case Number        02893408                            
Case Type:         None                                
Severity:          4 (Low)                             
Status:            Waiting on Red Hat                  
Alternate ID:      None                                

Product:           Red Hat Enterprise Linux            
Version:           8.3                                 
Support Level:     PREMIUM                             
Owner:             Eric Hendricks                      
Red Hat Owner:     New Case Queue                      

Group:             None                                
Opened:            Mon Mar 15 19:25:51 UTC 2021        
Opened By:         Eric Hendricks                      
Last Updated:      Mon Mar 15 19:28:03 UTC 2021        
Last Updated By:   Eric Hendricks                      

Summary:           TEST ONLY - No Support Required     

Ta-da! There is so much this tool can do, and we only covered a small fraction of its functions. The ability to access the massive repository of support information right from your terminal could really help any sysadmin in the midst of fighting through an outage.

Additional Resources

GitHub: Tmux

Red Hat Access: Red Hat Support Tool


About the author

Eric "The IT Guy" Hendricks is a Technical Marketing Manager for Red Hat Enterprise Linux, as well as the host of "Red Hat Enterprise Linux Presents," a podcaster, and open source advocate. Hendricks started out in 2007 as a Systems Administrator specializing in Linux before moving into technical marketing.

Read full bio