Bookmark this page

Lab: Troubleshooting RPM Issues

Fix a software package issue that is causing a recently installed network service to fail.

Outcomes

You should be able to diagnose and repair package issues that cause a service to fail.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

[student@workstation ~]$ lab start rpm-review

This command installs and modifies packages.

Instructions

The recently installed web server on the servera server displays an error message when it is accessed.

[student@workstation ~]$ curl -4 servera.lab.example.com
curl: (7) Failed to connect to servera port 80: No route to host

Resolve the issue and verify that the servera web server provides web content.

  1. Connect to servera and assess the problem.

    1. Log in to servera and switch to the root user.

      [student@workstation ~]$ ssh student@servera
      ...output omitted...
      [student@servera ~]$ sudo -i
      [sudo] password for student: student
      [root@servera ~]#
    2. View the status of the httpd service.

      The service is down, and error messages suggest that it could not be started.

      [root@servera ~]# systemctl status httpd
      ● httpd.service - The Apache HTTP Server
         Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
         Active: failed (Result: exit-code) since Fri 2021-11-05 17:21:09 EDT; 6min ago
           Docs: man:httpd.service(8)
        Process: 29854 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=203/EXEC)
       Main PID: 29854 (code=exited, status=203/EXEC)
      
      Nov 05 17:21:09 servera.lab.example.com systemd[1]: Starting The Apache HTTP Server...
      Nov 05 17:21:09 servera.lab.example.com systemd[1]: httpd.service: Main process exited, code=exited, status=203/EXEC
      Nov 05 17:21:09 servera.lab.example.com systemd[1]: httpd.service: Failed with result 'exit-code'.
      Nov 05 17:21:09 servera.lab.example.com systemd[1]: Failed to start The Apache HTTP Server.
    3. Because the service was recently installed, use the yum history command to identify recently installed packages. Your output might be different in your classroom environment, so assume that the following packages were recently installed on your system.

      [root@servera ~]# yum history
      ID     | Command line                   | Date and time    | Action(s) | Altered
      --------------------------------------------------------------------------------
           8 | -y install httpd               | 2021-11-05 17:21 | Install   |    9
           7 | -y upgrade                     | 2021-06-14 03:38 | I, O, U   |   33
      ...output omitted...
      [root@servera ~]# yum history info 8
      Transaction ID : 8
      Begin time     : Fri 05 Nov 2021 05:21:03 PM EDT
      Begin rpmdb    : 638:44ed0f50693e8e6bcb82e911467e7370b017ae90
      End time       : Fri 05 Nov 2021 05:21:05 PM EDT (2 seconds)
      End rpmdb      : 647:95b0a71b559ee29fad596689ead593d6de49c93b
      User           : root <root>
      Return-Code    : Success
      Releasever     : 8
      Command Line   : -y install httpd
      Comment        :
      Packages Altered:
          Install redhat-logos-httpd-84.4-1.el8.noarch                           @rhel-8.4-for-x86_64-baseos-rpms
          Install apr-1.6.3-11.el8.x86_64                                        @rhel-8.4-for-x86_64-appstream-rpms
          Install apr-util-1.6.1-6.el8.x86_64                                    @rhel-8.4-for-x86_64-appstream-rpms
          Install apr-util-bdb-1.6.1-6.el8.x86_64                                @rhel-8.4-for-x86_64-appstream-rpms
          Install apr-util-openssl-1.6.1-6.el8.x86_64                            @rhel-8.4-for-x86_64-appstream-rpms
          Install httpd-2.4.37-39.module+el8.4.0+9658+b87b2deb.x86_64            @rhel-8.4-for-x86_64-appstream-rpms
          Install httpd-filesystem-2.4.37-39.module+el8.4.0+9658+b87b2deb.noarch @rhel-8.4-for-x86_64-appstream-rpms
          Install httpd-tools-2.4.37-39.module+el8.4.0+9658+b87b2deb.x86_64      @rhel-8.4-for-x86_64-appstream-rpms
          Install mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64         @rhel-8.4-for-x86_64-appstream-rpms
    4. Verify whether the recently installed packages are complete and unchanged.

      The rpm -V command indicates that the contents and timestamp of /usr/sbin/httpd changed since it was installed.

      [root@servera ~]# rpm -V apr apr-util apr-util-bdb apr-util-openssl httpd httpd-filesystem httpd-tools mod_http2
      ..5....T.    /usr/sbin/httpd
    5. Locate the package that provides the changed file.

      [root@servera ~]# rpm -qf /usr/sbin/httpd
      httpd-2.4.37-39.module+el8.4.0+9658+b87b2deb.x86_64
  2. Permanently fix the issue.

    1. Reinstall the located package.

      [root@servera ~]# yum reinstall httpd
    2. Restart the httpd service.

      [root@servera ~]# systemctl restart httpd

      Verify that the service successfully started.

      [root@servera ~]# systemctl status httpd
      ● httpd.service - The Apache HTTP Server
         Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
         Active: active (running) since Fri 2021-11-05 17:39:23 EDT; 2s ago
           Docs: man:httpd.service(8)
       Main PID: 30140 (httpd)
         Status: "Started, listening on: port 80"
          Tasks: 213 (limit: 11049)
         Memory: 28.7M
         CGroup: /system.slice/httpd.service
                 ├─30140 /usr/sbin/httpd -DFOREGROUND
                 ├─30141 /usr/sbin/httpd -DFOREGROUND
                 ├─30142 /usr/sbin/httpd -DFOREGROUND
                 ├─30143 /usr/sbin/httpd -DFOREGROUND
                 └─30144 /usr/sbin/httpd -DFOREGROUND
      
      Nov 05 17:39:22 servera.lab.example.com systemd[1]: Starting The Apache HTTP Server...
      Nov 05 17:39:23 servera.lab.example.com systemd[1]: Started The Apache HTTP Server.
      Nov 05 17:39:23 servera.lab.example.com httpd[30140]: Server configured, listening on: port 80
    3. Verify that access is allowed to the service port.

      [root@servera ~]# firewall-cmd --list-services
      cockpit dhcpv6-client ssh
      [root@servera ~]# firewall-cmd --add-service=http --permanent
      success
      [root@servera ~]# firewall-cmd --reload
      success
      [root@servera ~]# firewall-cmd --list-services
      cockpit dhcpv6-client http ssh
    4. Return to workstation as the student user.

      [root@servera ~]# exit
      [student@servera ~]$ exit
      [student@workstation ~]$
    5. Verify that the servera web server is providing web content.

      [student@workstation ~]$ curl -4 servera.lab.example.com
      Lab is fixed.

Evaluation

On the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the script until you receive a passing grade.

[student@workstation ~]$ lab grade rpm-review

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish rpm-review

Revision: rh342-8.4-6dd89bd