Red Hat Enterprise Linux Diagnostics and Troubleshooting
Resolve an issue where two services fail to start at boot.
Outcomes
You should be able to resolve an issue where two services fail to start at boot.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
[student@workstation ~]$ lab start boot-failingservices
Instructions
Your servera machine is set up to serve both web and FTP content with the httpd and vsftpd services. The specification states that both daemons operate simultaneously on the same system.
Your colleague attempted to satisfy this requirement but now both services fail to start at boot time. You are asked to resolve this issue. You are only required to ensure that both services start. You do not need to verify or configure that both services always operate simultaneously.
On the
serverasystem, check the status of thehttpdandvsftpdservices to troubleshoot the issue.Log in to
serveraand switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Check the status of the
httpdservice. Because status lines sometimes contain useful information past the 80-character limit, use the-loption to display full status lines.[root@servera ~]#
systemctl status -l httpd● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/httpd.service.d └─10-dependencies.conf Active:inactive (dead)Docs: man:httpd.service(8) Sep 24 21:50:42 servera.lab.example.com systemd[1]: httpd.service: Found ordering cycle on vsftpd.service/start Sep 24 21:50:42 servera.lab.example.com systemd[1]: httpd.service: Found dependency on httpd.service/start Sep 24 21:50:42 servera.lab.example.com systemd[1]: httpd.service: Unable to break cycle starting with httpd.service/start Sep 24 21:50:42 servera.lab.example.com systemd[1]: vsftpd.service: Found ordering cycle on httpd.service/start Sep 24 21:50:42 servera.lab.example.com systemd[1]: vsftpd.service: Found dependency on vsftpd.service/start Sep 24 21:50:42 servera.lab.example.com systemd[1]: vsftpd.service: Unable to break cycle starting with vsftpd.service/start ...output omitted...Check the status of the
vsftpdservice.[root@servera ~]#
systemctl status -l vsftpd● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/vsftpd.service.d └─10-dependencies.conf Active:inactive (dead)...output omitted... Sep 24 21:50:42 servera.lab.example.com systemd[1]: httpd.service: Unable to break cycle starting with httpd.service/start ...output omitted...
Both services have start dependencies on each other. The
systemctl statuscommand output includes the files that are responsible for the dependencies. View the contents of those drop-in configuration files.From the output of the
systemctl statuscommands, observe that two nonstandard drop-in files were added to the services:/etc/systemd/system/httpd.service.d/10-dependencies.conf/etc/systemd/system/vsftpd.service.d/10-dependencies.conf
View the contents of these two files.
[root@servera ~]#
cat /etc/systemd/system/httpd.service.d/10-dependencies.conf[Unit] After=vsftpd.service Requires=vsftpd.service [root@servera ~]#cat /etc/systemd/system/vsftpd.service.d/10-dependencies.conf[Unit] After=httpd.service Requires=httpd.service
Form a hypothesis of why these two services fail to start.
Both services have a
Requiresdirective for the other service, but this directive ensures only that if one of them is started, then the other is started as well.Both services have an
Afterrequirement on the other service. This requirement causes a cyclic dependency, whichsystemdresolves by not starting these services.
Describe two possible solutions.
Removing both drop-in directories and files entirely, and then reloading
systemd, and finally starting the services. This approach removes all dependencies.Changing one of the two
Afterlines toBeforeensures that the services are always started together, without causing a cyclic dependency.
Attempt to fix this issue by changing the
Afterline for thehttpdservice toBefore.Reload
systemdand start both services to verify.Change the
Afterline for thehttpdservice toBefore. Edit/etc/systemd/system/httpd.service.d/10-dependencies.confto match this text:[Unit]
Before=vsftpd.service Requires=vsftpd.serviceReload the active
systemdconfiguration.[root@servera ~]#
systemctl daemon-reloadStart the
httpd.serviceandvsftpd.serviceservices.[root@servera ~]#
systemctl start httpd.service vsftpd.service[root@servera ~]#
Reboot the
serveramachine to verify that both services successfully start during boot.Reboot
servera.[root@servera ~]#
rebootConnection to servera closed by remote host. Connection to servera closed. [student@workstation ~]$Log in to
serveraand switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Check that the
httpdandvsftpdservices are active.[root@servera ~]#
systemctl status httpd.service vsftpd.service● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/httpd.service.d └─10-dependencies.conf Active:active (running)since Fri 2021-09-24 23:22:35 EDT; 2min 23s ago ...output omitted... ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/vsftpd.service.d └─10-dependencies.conf Active:active (running)since Fri 2021-09-24 23:22:35 EDT; 2min 23s ago ...output omitted...
Return to
workstationas thestudentuser.[root@servera ~]#
exit[student@servera ~]$exit[student@workstation ~]$