Unit firewalld.service could not be found - firewalld

iam setting up chef server and chef manage for that i need to stop firewalld,but first of all my error is "Unit firewalld.service could not be found"

Related

Ubuntu Server how to start a service only when VPN is connected and restart it every time i got disconnected

I created a test server when i got a service that need to be started on boot after i got connected to NordVPN.
Anyway, i found that if i get also disconnected the service need to be restarted after the connection to the VPN is restored
Can you help me with this?
Thanks a lot
I created a service and I delayed the time at boot
[Unit]
Description=qBittorrent-nox service
Documentation=man:qbittorrent-nox(1)
Wants=network-online.target
After=network-online.target nss-lookup.target
[Service]
ExecStartPre=/bin/sleep 60
# if you have systemd < 240 (Ubuntu 18.10 and earlier, for example), you probably want to use Type=>
Type=exec
# change user as needed
User=root
# The -d flag should not be used in this setup
ExecStart=/usr/bin/qbittorrent-nox
Restart=on-failure
RestartSec=1s
# uncomment this for versions of qBittorrent < 4.2.0 to set the maximum number of open files to unl>
#LimitNOFILE=infinity
# uncomment this to use "Network interface" and/or "Optional IP address to bind to" options
# without this binding will fail and qBittorrent's traffic will go through the default route
# AmbientCapabilities=CAP_NET_RAW
[Install]
WantedBy=multi-user.target
The Restart directive specifies the conditions under which the service should be restarted. The default value for this directive is on-failure, which means that the service will only be restarted if it exits with a non-zero exit code. In your case, you can modify this directive to specify that the service should be restarted whenever the VPN connection is restored.
Here is an example of how you could modify the Restart directive in your unit file:
[Service]
...
Restart=on-failure-or-vpn-restored
With this configuration, your service will be restarted whenever it exits with a non-zero exit code, or whenever the VPN connection is restored.
Note that you will need to create a separate unit file to manage the VPN connection and specify this unit file as a dependency for your service's unit file. This will ensure that the service is only started after the VPN connection is established.
For example, you could add the following lines to your service's unit file to make it dependent on a VPN connection:
[Unit]
...
After=vpn.service
Wants=vpn.service
This will ensure that your service is only started after the vpn.service unit has been started successfully. You will need to create the vpn.service unit file and specify the necessary details for managing the VPN connection.

Unit firewalld.service is masked

When I want to start the firewalld service, I got this error
[root#servera ~]# systemctl start firewalld
Failed to start firewalld.service: Unit firewalld.service is masked.
and I searched in the web and got a solution that run systemctl unmask firewalld, but it is not working, others get a message Removed symlink /etc/systemd/system/firewalld.service. but I got nothing.
When I want to enable this service, I got an error
[root#servera ~]# systemctl enable firewalld
Failed to enable unit: Unit file /usr/lib/systemd/system/firewalld.service is masked.
It's abnormal, because it's /usr/lib/systemd/system/firewalld.service, not /etc/systemd/system/firewalld.service
Any hints? Thanks!
I have tried
systemctl unmask firewalld
but it's no response and not working

Error restarting service: Failed to try-restart nscd.service: Unit nscd.service not found

I am trying to add a startup script in my GCP VM Instance to fetch data from a website (web crawler). I wanted to automate the crawling task following this answer. So, I added a startup script in my VM instance. The script looks like below:
#! /bin/bash
python3 /home/sadmanks/site-spider/src/main.py
Then, I wanted to schedule this instance. But when executing this startup script, it doesn't start the program that I want to execute. The log message that I get is following:
"Error restarting service: Failed to try-restart nscd.service: Unit nscd.service not found
I tried to do this in the browser ssh connection: sudo service nscd start outputs:
Failed to start nscd.service: Unit nscd.service not found.
Does anyone have any idea, how to resolve this issue?
Note: The program runs perfectly when I try to connect the instance with an SSH to my local machine.
The error "Error restarting service: Failed to try-restart nscd.service: Unit crond.service not found." is just harmless log spam. These error messages show up on every VM on start-up and are expected since systemd services like crond.service and nscd.service do not exist on COS. So, try updating the version of google-guest-agent service. But as suggested by #John Hanley that service is not related to python, web scraping/crawling, etc. So, make sure you know what the program is doing before running it on public servers.

systemctl restart logrotate throws error "Failed to restart logrotate.service: Unit not found."

I'm trying to make changes to logrotate.conf just to be sure before making changes to md_logging.c
I'm not able to check the functionality through
systemctl restart logrotate
Failed to restart logrotate.service: Unit not found.
I also tried logrotate.conf with the following command :
systemctl restart logrotate.conf
Failed to restart logrotate.conf.service: Unit not found.

Create a Lightsail instance and install the CodeDeploy agent

While following this tutorial, I created the instance with the desired script. Yet, when I ssh in and run
sudo service codedeploy-agent status
I'm getting the error
Redirecting to /bin/systemctl status codedeploy-agent.service
Unit codedeploy-agent.service could not be found.
What can be done to fix it?
If I created the instance using Amazon Linux 2, ssh in and run
sudo service codedeploy-agent status
then would get the error
Redirecting to /bin/systemctl status codedeploy-agent.service
Unit codedeploy-agent.service could not be found.
In order to fix it, created a new instance but this time made sure to be using Amazon Linux (as opposed to Amazon Linux 2).
Now, when running
sudo service codedeploy-agent status
I get the following result
The AWS CodeDeploy agent is running as PID 2780
P.S. - if you still want to use Amazon Linux 2 instead, consider reading this question and it's answer.

Resources