Jenkins fails after updating in AWS EC2 machine - amazon-web-services

I have Jenkins installed in an EC2 machine in AWS. I tried to install the slack plugin and it break the other plugins, so I tried updating Jenkins version to make it work again and now I cannot event start it. I get the following message:
Starting jenkins (via systemctl): Failed to start jenkins.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status jenkins.service' for details.
[FAILED]
I have also tried to delete Jenkins completely following this guide: to then reinstall it following the Jenkins in AWS guide. But it is still not working. At some point when I did the journalctl -xe I got this error (I cant remember what I did to get there but at least I saved this log trace):
Unit jenkins.service has begun starting up.
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: Sep 20, 2022 4:39:49 PM executable.Main verifyJavaVersion
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: SEVERE: Running with Java class version 52, which is older than
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: java.lang.UnsupportedClassVersionError: 52.0
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: at executable.Main.verifyJavaVersion(Main.java:145)
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: at executable.Main.main(Main.java:109)
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: Jenkins requires Java versions [17, 11] but you are running wit
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: java.lang.UnsupportedClassVersionError: 52.0
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: at executable.Main.verifyJavaVersion(Main.java:145)
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal jenkins[23035]: at executable.Main.main(Main.java:109)
Sep 20 16:39:49 ip-10-10-3-149.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
-- Subject: Unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has failed.
--
So I though I had finally found the error, I checked the java -version and it was saying java1.8. Therefore I changed it with alternatives --config java and set it to:
java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.amzn2.0.1.x86_64/bin/java)
I have also added this path to /etc/rc.d/init.d/jenkins. Now when I get the java -version I get this:
openjdk version "11.0.16" 2022-07-19 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.0.8-1.amzn2.0.1) (build 11.0.16+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.0.8-1.amzn2.0.1) (build 11.0.16+8-LTS, mixed mode, sharing)
when I try to get the status of jenkins with systemctl status jenkins.service -l I get:
● jenkins.service
Loaded: error (Reason: Invalid argument)
Drop-In: /etc/systemd/system/jenkins.service.d
└─override.conf
Active: failed (Result: start-limit) since Tue 2022-09-20 16:39:49 UTC; 15h ago
Main PID: 23035 (code=exited, status=0/SUCCESS)
Sep 20 16:57:30 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 20 16:57:43 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:15:59 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:20:02 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:23:12 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:23:20 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:24:26 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:30:58 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:31:06 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
Sep 21 07:48:04 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecStop= setting. Refusing.
and when I use journalctl -xe I get:
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-120.scope has finished starting up.
--
-- The start-up result is done.
Sep 21 07:40:01 ip-10-10-3-149.ec2.internal CROND[842]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Sep 21 07:41:28 ip-10-10-3-149.ec2.internal dhclient[3121]: XMT: Solicit on eth0, interval 131610ms.
Sep 21 07:43:39 ip-10-10-3-149.ec2.internal dhclient[3121]: XMT: Solicit on eth0, interval 118630ms.
Sep 21 07:45:38 ip-10-10-3-149.ec2.internal dhclient[3121]: XMT: Solicit on eth0, interval 121300ms.
Sep 21 07:46:59 ip-10-10-3-149.ec2.internal sshd[3483]: Received disconnect from 92.255.85.69 port 28784:
Sep 21 07:46:59 ip-10-10-3-149.ec2.internal sshd[3483]: Disconnected from 92.255.85.69 port 28784 [preaut
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal dhclient[3075]: DHCPREQUEST on eth0 to 10.10.3.1 port 67 (xid
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal dhclient[3075]: DHCPACK from 10.10.3.1 (xid=0x18dc5aad)
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal NET[3542]: dhclient: Locked /run/dhclient/resolv.lock
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal dhclient[3075]: bound to 10.10.3.149 -- renewal in 1618 secon
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal ec2net[3561]: [get_meta] Querying IMDS for meta-data/network/
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal ec2net[3562]: [get_meta] Getting token for IMDSv2.
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal ec2net[3565]: [get_meta] Trying to get http://169.254.169.254
Sep 21 07:47:04 ip-10-10-3-149.ec2.internal ec2net[3570]: [remove_aliases] Removing aliases of eth0
Sep 21 07:47:39 ip-10-10-3-149.ec2.internal dhclient[3121]: XMT: Solicit on eth0, interval 116180ms.
Sep 21 07:48:03 ip-10-10-3-149.ec2.internal sudo[3947]: root : TTY=pts/0 ; PWD=/root ; USER=root ; CO
Sep 21 07:48:03 ip-10-10-3-149.ec2.internal sudo[3947]: pam_unix(sudo:session): session opened for user r
Sep 21 07:48:03 ip-10-10-3-149.ec2.internal systemd[1]: Reloading.
Sep 21 07:48:04 ip-10-10-3-149.ec2.internal systemd[1]: jenkins.service lacks both ExecStart= and ExecSto
Sep 21 07:48:04 ip-10-10-3-149.ec2.internal sudo[3947]: pam_unix(sudo:session): session closed for user r
Sep 21 07:48:09 ip-10-10-3-149.ec2.internal sudo[4019]: root : TTY=pts/0 ; PWD=/root ; USER=root ; CO
Sep 21 07:48:09 ip-10-10-3-149.ec2.internal sudo[4019]: pam_unix(sudo:session): session opened for user r
Sep 21 07:48:09 ip-10-10-3-149.ec2.internal sudo[4019]: pam_unix(sudo:session): session closed for user r
I have tried also the solution in here. I am not sure what else I can try.
UPDATE: this is how my jenkins unit looks like (systemctl cat jenkins):
# /etc/systemd/system/jenkins.service
[Service]
Environment="JENKINS_PORT=8000"
# /etc/systemd/system/jenkins.service.d/override.conf
[Service]
Environment="JENKINS_PORT=8000"

According to the logs, the unit file is missing start and stop scripts which can be confirmed by
systemctl cat jenkins.
According to Jenkins docs, the systemd file needed changes.Copying and overriding the unit file with the one given in the docs can solve the problem.

Related

Mosquitto MQTT Broker Server Failed Reached Start-Request-Limit

I am unable to open Mosquitto beacause I have reached the start/restart limit over a certain period of time:
$ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
Loaded: loaded (/usr/lib/systemd/system/mosquitto.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mosquitto.service.d
└─override.conf
Active: failed (Result: start-limit) since Fri 2023-02-03 21:45:41 UTC; 2h 12min ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Main PID: 543 (code=exited, status=1/FAILURE)
Feb 03 21:45:26 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: mosquitto.service: main process exited, ...RE
Feb 03 21:45:26 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: Failed to start Mosquitto MQTT v3.1/v3.1...r.
Feb 03 21:45:26 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: Unit mosquitto.service entered failed state.
Feb 03 21:45:26 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: mosquitto.service failed.
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: mosquitto.service holdoff time over, sch...t.
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: Stopped Mosquitto MQTT v3.1/v3.1.1 Broker.
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: start request repeated too quickly for m...ce
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: Failed to start Mosquitto MQTT v3.1/v3.1...r.
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: Unit mosquitto.service entered failed state.
Feb 03 21:45:41 ip-172-31-11-142.us-west-1.compute.internal systemd[1]: mosquitto.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
I have the method of:
ps -ef | grep mosquito
sudo kill ####
and it still does not work
I have also attempted to do:
systemctl edit /etc/mosquitto
[Service]
Restart=always
RestartSec=15
StartLimitInterval=150
StartLimitBurst=8

Tomcat Server Loaded errir

I tried to install and start the Tomcat on my AWS EC2 instance.
However, I failed to run tomcat server after installed it.
I followed the following article for that
https://blog.devops4me.com/aws-tutorial-how-to-install-tomcat-in-aws-ec2-install/
And after finished step 6, and reloaded tomcat server, I tried to restart tomcat service like step 7. However, my terminal showed as below:
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service: control process exited, code=exited status=203
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Failed to start Tomcat Server.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
Feb 14 20:17:10 ip-172-31-54-104.ec2.internal systemd[1]: [/etc/systemd/system/tomcat.service:22] Missing '='.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service holdoff time over, scheduling restart.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed to schedule restart job: Unit is not loaded properly: Bad message.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
I don't really understand how this work, and tried to search error on internet, but still doesn't have any clue of how to solve this problem, if anyone can give me a hint, that would be great, thank you!

Error with Ops Agent GCE metadata unauthenticated

Trying to get Ops Agent working and used the following command to install it:
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
I see the following error in the logs of journalctl -u google-cloud-ops-agent-opentelemetry-collector -xn
otelopscol[2706]: 2022-02-06T21:50:36.140Z info exporterhelper/queued_retry.go:215 Exporting failed. Will retry the request after interval. {"kind": "exporter", "name": "googlecloud", "error": "[rpc error: code = Unauthenticated desc = transport: per-RPC creds failed due to error: metadata: GCE metadata \"instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.read%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.write\" not defined; rpc error: code = Unauthenticated desc = transport: per-RPC creds failed due to error: metadata: GCE metadata \"instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.read%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.write\" not defined; rpc error: code = Unauthenticated desc = transport: per-RPC creds failed due to error: metadata: GCE metadata \"instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.read%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmonitoring.write\" not defined]", "interval": "14.115202828s"}
The services otherwise look good and are running but the UI reports that Ops Agent wasn't actually running which I suspect is due to no data being sent back.
Here is the status of running agents:
google-cloud-ops-agent-opentelemetry-collector.service - Google Cloud Ops Agent - Metrics Agent
Loaded: loaded (/lib/systemd/system/google-cloud-ops-agent-opentelemetry-collector.service; static; vendor preset: enabled)
Active: active (running) since Sat 2022-02-05 04:38:41 UTC; 1 day 17h ago
Process: 2690 ExecStartPre=/opt/google-cloud-ops-agent/libexec/google_cloud_ops_agent_engine -service=otel -in /etc/google-clou>
Main PID: 2706 (otelopscol)
Tasks: 9 (limit: 2369)
Memory: 193.6M
CGroup: /system.slice/google-cloud-ops-agent-opentelemetry-collector.service
└─2706 /opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol --config=/run/google-cloud-ops-agent-o>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: /root/go/pkg/mod/go.opentelemetry.io/collector#v0.42.0/exporter/exporterhelper/qu>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: go.opentelemetry.io/collector/exporter/exporterhelper.(*metricsSenderWithObservability).s>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: /root/go/pkg/mod/go.opentelemetry.io/collector#v0.42.0/exporter/exporterhelper/me>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: go.opentelemetry.io/collector/exporter/exporterhelper.(*queuedRetrySender).start.func1
Feb 06 21:55:53 mongo-1 otelopscol[2706]: /root/go/pkg/mod/go.opentelemetry.io/collector#v0.42.0/exporter/exporterhelper/qu>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: go.opentelemetry.io/collector/exporter/exporterhelper/internal.consumerFunc.consume
Feb 06 21:55:53 mongo-1 otelopscol[2706]: /root/go/pkg/mod/go.opentelemetry.io/collector#v0.42.0/exporter/exporterhelper/in>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: go.opentelemetry.io/collector/exporter/exporterhelper/internal.(*boundedMemoryQueue).Star>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: /root/go/pkg/mod/go.opentelemetry.io/collector#v0.42.0/exporter/exporterhelper/in>
Feb 06 21:55:53 mongo-1 otelopscol[2706]: 2022-02-06T21:55:53.145Z info exporterhelper/queued_retry.go:215 Exp>
● google-cloud-ops-agent.service - Google Cloud Ops Agent
Loaded: loaded (/lib/systemd/system/google-cloud-ops-agent.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2022-02-05 04:38:41 UTC; 1 day 17h ago
Process: 2691 ExecStartPre=/opt/google-cloud-ops-agent/libexec/google_cloud_ops_agent_engine -in /etc/google-cloud-ops-agent/co>
Process: 2704 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 2704 (code=exited, status=0/SUCCESS)
Feb 05 04:38:41 mongo-1 systemd[1]: Starting Google Cloud Ops Agent...
Feb 05 04:38:41 mongo-1 systemd[1]: Finished Google Cloud Ops Agent.
● google-cloud-ops-agent-fluent-bit.service - Google Cloud Ops Agent - Logging Agent
Loaded: loaded (/lib/systemd/system/google-cloud-ops-agent-fluent-bit.service; static; vendor preset: enabled)
Active: active (running) since Sun 2022-02-06 15:05:35 UTC; 6h ago
Process: 22138 ExecStartPre=/opt/google-cloud-ops-agent/libexec/google_cloud_ops_agent_engine -service=fluentbit -in /etc/googl>
Main PID: 22144 (fluent-bit)
Tasks: 22 (limit: 2369)
Memory: 29.0M
CGroup: /system.slice/google-cloud-ops-agent-fluent-bit.service
└─22144 /opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit --config /run/google-cloud-ops-agent-fluent-bi>
Feb 06 15:05:35 mongo-1 systemd[1]: google-cloud-ops-agent-fluent-bit.service: Scheduled restart job, restart counter is at 7.
Feb 06 15:05:35 mongo-1 systemd[1]: Stopped Google Cloud Ops Agent - Logging Agent.
Feb 06 15:05:35 mongo-1 systemd[1]: Starting Google Cloud Ops Agent - Logging Agent...
Feb 06 15:05:35 mongo-1 systemd[1]: Started Google Cloud Ops Agent - Logging Agent.
Feb 06 15:05:35 mongo-1 fluent-bit[22144]: Fluent Bit v1.8.12
Feb 06 15:05:35 mongo-1 fluent-bit[22144]: * Copyright (C) 2019-2021 The Fluent Bit Authors
Feb 06 15:05:35 mongo-1 fluent-bit[22144]: * Copyright (C) 2015-2018 Treasure Data
Feb 06 15:05:35 mongo-1 fluent-bit[22144]: * Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
Feb 06 15:05:35 mongo-1 fluent-bit[22144]: * https://fluentbit.io
The issue was due to the VM not having a service account. The solution was to do the following:
create a service account
assign the service account Logs Writer and Monitoring Metric Writer roles
Stop the VM, Edit the VM, set the newly created service account, start the VM
Note that by default a VM has a default service account. In my case I created the VM and explicitely didn't enable any service account hence the issue.

Failed to start Apache after configuring ssl on Amazon Linux2

I'm trying to install ssl certificate on aws ec2(Amazon Linux2). Apache can start properly until I configure ssl following "Step 1: Enable TLS on the server" in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-ami.html
After I make those changes, apache even can not start:
Job for httpd.service failed because the control process exited with error code
I got the following log by typing "journalctl -xe":
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-26.scope has begun starting up.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal CROND[10239]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Removed slice User Slice of root.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Stopping User Slice of root.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Received disconnect from 221.181.185.135 port 21146:11: [preauth]
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Disconnected from 221.181.185.135 port 21146 [preauth]
Jan 27 04:31:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 120170ms.
Jan 27 04:33:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 119290ms.
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Received disconnect from 218.93.208.150 port 29589:11: [preauth]
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Disconnected from 218.93.208.150 port 29589 [preauth]
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: ec2-user : TTY=pts/2 ; PWD=/etc/pki/tls/certs ; USER=root ; COMMAND=/bin/systemct
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session opened for user root by ec2-user(uid=0)
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Unit httpd.service entered failed state.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session closed for user root
Jan 27 04:35:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 130780ms.
I get stuck here for a long time. Anyone can help me please? Thank you in advance.

Can't stop Clamav deamon in Linux

I am trying to stop Clamav service in Linux, but I am not able to do that.
I have installed Clamav in a seperate directory.
When running below command:
$ systemctl stop clamav-daemon
I get this error message:
Warning: Stopping clamav-daemon.service, but it can still be activated by:
clamav-daemon.socket
When running:
$ systemctl status clamav-daemon
I get:
clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/usr/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-04-29 13:23:33 IST; 7s ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Main PID: 32213 (clamd)
Tasks: 1
CGroup: /system.slice/clamav-daemon.service
└─32213 /usr/local/sbin/clamd --foreground=true
Any help will be appreciated. Thanks.
When you are logged in as a normal user which can be understood by seeing the $ sign in your command, clamav won't stop. You need to perform the following command.
It will stop clamav for only logged-in session
$ sudo systemctl stop clamav-daemon
To see the status
$ sudo systemctl status clamav-daemon
It will return:
● clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf
Active: inactive (dead)
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HTML support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> XMLDOCS support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HWP3 support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> Self checking every 3600 seconds.
Aug 20 09:58:53 machine clamd[808]: Thu Aug 20 09:58:53 2020 -> SelfCheck: Database status OK.
Aug 20 10:57:51 machine systemd[1]: Stopping Clam AntiVirus userspace daemon...
Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> --- Stopped at Thu Aug 20 10:57:52 >
Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> Socket file removed.
Aug 20 10:57:52 machine systemd[1]: clamav-daemon.service: Succeeded.
Aug 20 10:57:52 machine systemd[1]: Stopped Clam AntiVirus userspace daemon.
If you have created symbolic link of clamav daemon to start the program automatically when pc boot then you need to remove that link so that clamav shouldn't start automatically
$ sudo systemctl disable clamav-daemon