Bookmark this page

Lab: Repairing a Non-running Application

Repair a non-running application.

Outcomes

You should be able to successfully repair the non-running application on your machine.

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

This command installs a custom application on your system.

[student@workstation ~]$ lab start compreview-review1

Specifications

  • The custom program application is not functioning properly on the servera system.

    • Troubleshoot and repair the issue, resulting in a functioning application.

    • The application prints the text "Success!" when it is functioning properly.

    • The program command runs the application.

    • The program application relies on a locally running web service.

  1. Troubleshoot and resolve the program application issue.

    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. Attempt to run the program command, and view any messages.

      The runtime linker cannot open the libreadline.so.7 library.

      [root@servera ~]# program
      program: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory
    3. Discover whether any other shared libraries cannot be resolved.

      No other libraries are missing.

      [root@servera ~]# which program
      /usr/bin/program
      [root@servera ~]# ldd /usr/bin/program
      	linux-vdso.so.1 (0x00007ffc55d92000)
      	libreadline.so.7 => not found
      	libc.so.6 => /lib64/libc.so.6 (0x00007f193603f000)
      	/lib64/ld-linux-x86-64.so.2 (0x00007f1936404000)
    4. Identify the package that provides the missing shared library.

      [root@servera ~]# yum provides libreadline.so.7
      Last metadata expiration check: 2:05:19 ago on Fri 12 Nov 2021 02:41:41 PM EST.
      readline-7.0-10.el8.i686 : A library for editing typed command lines
      Repo        : rhel-8.4-for-x86_64-baseos-rpms
      Matched from:
      Provide    : libreadline.so.7
    5. Install the required packages.

      The package is present, but the library that it provides is missing.

      [root@servera ~]# yum install readline
      Last metadata expiration check: 2:06:19 ago on Fri 12 Nov 2021 02:41:41 PM EST.
      Package readline-7.0-10.el8.x86_64 is already installed.
      Dependencies resolved.
      Nothing to do.
      Complete!
    6. Verify the package's files.

      The library file is missing.

      [root@servera ~]# rpm -V readline
      missing     /usr/lib64/libreadline.so.7
    7. Reinstall the package to restore the missing file.

      [root@servera ~]# yum reinstall readline
      ...output omitted...
      Reinstalled:
        readline-7.0-10.el8.x86_64
      
      Complete!
    8. Attempt to run the program command, and view any messages. When prompted, enter a string of characters.

      The application is starting, but presents a new error.

      [root@servera ~]# program
      Enter value: anystring
      Error: application failed to run!
  2. Troubleshoot and resolve the additional program application issue.

    1. View the application's system calls.

      The strace output will pause when it reaches the string input prompt. Press Enter to view the full output.

      The application tries to connect to port 80 on the local system, but the connection is refused.

      [root@servera ~]# strace program
      execve("/usr/bin/program", ["program"], 0x7ffcb6e91dd0 /* 25 vars */) = 0
      ...output omitted...
      connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused)
      write(1, "Error: application failed to run"..., 34Error: application failed to run!
      ) = 34
      exit_group(1)                           = ?
       exited with 1
    2. The application relies on a local web service to be running. Verify whether one is installed.

      [root@servera ~]# systemctl status httpd
      Unit httpd.service could not be found.
    3. Install and start a web server to listen on port 80.

      [root@servera ~]# yum install httpd
      ...output omitted...
      [root@servera ~]# systemctl start httpd
    4. Attempt to run the program command, and view any messages.

      The "Success!" output indicates that the program application is functioning properly.

      [root@servera ~]# program
      Enter value: anystring
      Success!
    5. Return to workstation as the student user.

      [root@servera ~]# exit
      [student@servera ~]$ exit
      [student@workstation ~]$

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade compreview-review1

Finish

As the student user 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 compreview-review1

Revision: rh342-8.4-6dd89bd