cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 931 Views

Red Hat Linux Interview Series 24

Q.) The httpd service failed to start since a colleague messed up the web configuration and can no longer start it, what will you do in this situation ?

Nov 16 17:58:38 servera.lab.example.com systemd[1]: Starting The Apache HTTP 
Nov 16 17:58:38 servera.lab.example.com systemd[1]: httpd.service: Main process exited, code=exited, status=203/EXEC
Nov 16 17:58:38 servera.lab.example.com systemd[1]: httpd.service: Failed with result 'exit-code'.
Nov 16 17:58:38 servera.lab.example.com systemd[1]: Failed to start The Apache HTTP Server.



[root@servera ~]# ls -la /usr/sbin/httpd
-rw-r--r--. 1 root root 579968 Jan 27  2021 /usr/sbin/httpd

 

Q.) Explain the highlighted parts in the below TOP command output : 

Chetan_Tiwary__0-1729282544576.png

 

Q.) How will you make sure that httpd service is pinned to the first CPU on the Linux system ?

 

Level - L2 and above.

 

I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.

5 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 882 Views

Question:  The httpd service failed to start since a colleague messed up the web configuration and can no longer start it, what will you do in this situation ?

Answer:

My research led me to the following:

"The message code=exited, status=203/EXEC can be an indication of the SELinux policy preventing the execution of the ExecStart value."

More research led me to the manpage for systemd.exec.  On that manpage, is a
table of systemd-specific exit codes.  The information shown for exit code 203 is
as follows:

"The actual process execution failed (specifically, the execve(2) system call).
Most likely this is caused by a missing or non-accessible executable file."

 

Okay, so where would the ExecStart directive be for the httpd service?  It would
be in the unit service file (httpd.service), of course.  The proper value for the
ExecStart directive, in the httpd.service file is  /usr/sbin/httpd.  According to 
information provided in the question, the file /usr/sbin/httpd does exist.  

So, with my research providing two key pieces of information, I decided to 
recreate the issue on a Linux system.  What I did was simply to alter the pathname
value for the ExecStart directive, in the httpd.service file from "/usr/sbin/httpd",
to "/usr/bin/httpd"   ->      ExecStart=/usr/bin/httpd

After making this modification in the httpd.service unit file, I then started the
service, using the command:   # systemctl start httpd

After the httpd service failed to start, I then executed the command
                  #  systemctl status httpd

Wow!  In the output of that command, there were 2 lines that were identical to
the first 2 lines in the question - the only difference being the date and system
hostname.

So, a conclusion that could definitely be drawn here is that the value (pathname)
of the ExecStart directive COULD absolutely be the cause of the httpd service
failling to start!!!!!!!!! 

There could be another reason (or reasons), but the adjustment that I made on
the httpd.service unit file showed that this is very much a possibility for the issue!!!!

 

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 763 Views

@Trevor    ( Interviewer following up on the situation and your answer ) :  "the Selinux settings are all good.  For this scenario focus on the binary listing at the bottom of the logs"

0 Kudos
Trevor
Starfighter Starfighter
Starfighter
  • 880 Views

Question:  Explain the following columns that appear in the output of the 
                    top command:   VIRT,  RES,  SHR

 

Answer:

These three fields are related to memory consumption of the processes.

VIRT” is the total amount of memory consumed by a process. This includes the program’s code, the data stored by the process in memory, as well as any regions of memory that have been swapped to the disk.

RES” is the memory consumed by the process in RAM, 

SHR” is the amount of memory shared with other processes.

 

In keeping with the KISS design principle, that's all I got!!!!

Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 873 Views

Q.) How will you make sure that httpd service is pinned to the first CPU on the Linux system ?

 

Answer:

Step 1:  Edit the httpd.service unit file, by adding the following entry:

                     CPUAffinity=0

Note:  Add this line inside the service definition section.

Step 2: Save the file

Step 3:  Reload the systemd daemon

              #  systemctl  daemon-reload

 

 

That's all folks!

 

 

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 763 Views

@Trevor nice job!

0 Kudos
Join the discussion
You must log in to join this conversation.