Fail2Ban: Service failed when log files symlink to another device - symlink

I am using a Raspberry Pi. To reduce I/O on my SD-Card I symlink all important log files to an external USB-mounted Harddrive.
Example:
ln -s /media/usb-device/logs/auth.log /var/log/auth.log
The logging works fine. But fail2ban seems not to like that. When I enable my ssh-monitoring in my /etc/fail2ban/jail.local file,
# [sshd]
enabled = true
bantime = 3600
fail2ban crash during executing this command systemctl restart fail2ban.service
I have tried to hardcode the path:
# logpath = %(sshd_log)s
logpath = /media/usb-devive/logs/auth.log
But fail2ban throws the same error:
fail2ban.service - Fail2Ban Service
Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-04-28 20:42:33 CEST; 45s ago
Docs: man:fail2ban(1)
Process: 3014 ExecStop=/usr/bin/fail2ban-client stop (code=exited, status=0/SUCCESS)
Process: 3045 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)
Main PID: 658 (code=killed, signal=TERM)
Apr 28 20:42:33 raspberrypi systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Apr 28 20:42:33 raspberrypi systemd[1]: Stopped Fail2Ban Service.
Apr 28 20:42:33 raspberrypi systemd[1]: fail2ban.service: Start request repeated too quickly.
Apr 28 20:42:33 raspberrypi systemd[1]: Failed to start Fail2Ban Service.
Apr 28 20:42:33 raspberrypi systemd[1]: fail2ban.service: Unit entered failed state.
Apr 28 20:42:33 raspberrypi systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Any ideas?

"devive" in the logpath is spelt incorrectly

Related

can't start minio in ubuntu due to "Variable MINIO_VOLUMES not set in /etc/default/minio";

I am installing latest minio on ubuntu 18.04 following the minio installation instruction from here.
after the installation, try to run it with sudo systemctl start minio.service
but it didn't work with message.
...skipping...
● minio.service - MinIO
Loaded: loaded (/etc/systemd/system/minio.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-12-08 17:03:45 CST; 2min 1s ago
Docs: https://docs.min.io
Process: 5072 ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES (code=exited, status=1/FAILURE)
Process: 5050 ExecStartPre=/bin/bash -c if [ -z "${MINIO_VOLUMES}" ]; then echo "Variable MINIO_VOLUMES not set in /etc/default/minio"; exit 1; fi (code=exited, status=0/SUCCES
Main PID: 5072 (code=exited, status=1/FAILURE)
12月 08 17:03:45 nky systemd[1]: minio.service: Service hold-off time over, scheduling restart.
12月 08 17:03:45 nky systemd[1]: minio.service: Scheduled restart job, restart counter is at 5.
12月 08 17:03:45 nky systemd[1]: Stopped MinIO.
12月 08 17:03:45 nky systemd[1]: minio.service: Start request repeated too quickly.
12月 08 17:03:45 nky systemd[1]: minio.service: Failed with result 'exit-code'.
12月 08 17:03:45 nky systemd[1]: Failed to start MinIO.
it is noted something wrong with 'MINIO_VOLUMES', but I have set the variable in the /etc/default/minio
MINIO_ROOT_USER=myminioadmin
MINIO_ROOT_PASSWORD=minio-secret-key-change-me
# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.
MINIO_VOLUMES="/mnt/data"
what is wrong with my configuration?
There is nothing obvious wrong with your configuration but you did not post your service file. Almost always this is a permissions issue, you can change the systemd service user to root to test. Common issues after that are that the binary is not present in the location specified in the service file, or not executable.

can't start minio server in ubuntu with systemctl start minio

I configured a minio instance server on the ubuntu 18.04 with the guide from https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04.
after the installation, the server failed to start with the command "sudo systemctl start minio", the error is saying :
root#iZbp1icuzly3aac0dmjz9aZ:~# sudo systemctl status minio
● minio.service - MinIO
Loaded: loaded (/etc/systemd/system/minio.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-12-23 17:11:56 CST; 4s ago
Docs: https://docs.min.io
Process: 9085 ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES (code=exited, status=1/FAILURE)
Process: 9084 ExecStartPre=/bin/bash -c if [ -z "${MINIO_VOLUMES}" ]; then echo "Variable MINIO_VOLUMES not set in /etc/default/minio"; exit 1; fi (code=exited, status=0/SUCCESS)
Main PID: 9085 (code=exited, status=1/FAILURE)
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Main process exited, code=exited, status=1/FAILURE
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Failed with result 'exit-code'.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Service hold-off time over, scheduling restart.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Scheduled restart job, restart counter is at 5.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: Stopped MinIO.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Start request repeated too quickly.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Failed with result 'exit-code'.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: Failed to start MinIO.
It looks like the reason is the Variable MINIO_VOLUMES not set in /etc/default/minio.
However, I double check the file from /etc/default/minio
MINIO_ACCESS_KEY="minioadmin"
MINIO_VOLUMES="/usr/local/share/minio/"
MINIO_OPTS="-C /etc/minio --address localhost:9001"
MINIO_SECRET_KEY="minioadmin"
I have set the value MINIO_VOLUMES.
I tried to start manually with minio server --address :9001 /usr/local/share/minio/, it works.
now I don't know what goes wrong with starting the minio server by using the systemctl start minio
I'd recommend sticking to the official documentation wherever possible. It's intended for distributed deployments but the only real change is that your MINIO_VOLUMES will be for a single node/drive.
I would recommend trying a combination of things here:
Review minio.service and ensure the user/group exists
Review file path permissions on the MINIO_VOLUMES value
Now for the why:
My guess without seeing further logs (journalctl -u minio would have been helpful here) is that this is a combination of two things:
the minio.service user/group doesn't have rwx permissions on the /usr/local/share/minio path,
you are missing an environment variable we recently introduced to prevent users from pointing at their root drive (this was intended as a safety measure, but somewhat complicates these kinds of smaller setups).
Take a look at these lines in the minio.service file - I'm assuming that is what you are using based on the instructions in the DO guide.
If you ls -al /usr/local/share/minio I would venture it has ROOT permissions for user and group and limited write access if any.
Hope this helps - for further troubleshooting having at least 10-20 lines from journalctl is invaluable, as it would show the actual error and not just the final quit message.

Error when I trying to start Elasticsearch

I've installed ElasticSearch and I'm trying to start, before installing Magento. I'm getting this error:
sudo systemctl start elasticsearch.service
Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
systemctl status elasticsearch.service -l
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2021-04-26 14:15:09 -03; 7s ago
Docs: https://www.elastic.co
Process: 3062 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 3062 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)
Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116)Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.cli.Command.main(Command.java:79)
Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
Apr 26 14:15:08 vps-5443219.labarba.digital systemd-entrypoint[3062]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81)
Apr 26 14:15:09 vps-5443219.labarba.digital systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Apr 26 14:15:09 vps-5443219.labarba.digital systemd[1]: Failed to start Elasticsearch.
Apr 26 14:15:09 vps-5443219.labarba.digital systemd[1]: Unit elasticsearch.service entered failed state.
Apr 26 14:15:09 vps-5443219.labarba.digital systemd[1]: elasticsearch.service failed.
I tried to follow this link to solve this problem: https://stackoverflow.com/questions/58656747/elasticsearch-job-for-elasticsearch-service-failed
None of these solutions works for me.
Any help, please?
Ps1.: I'm using VPS Hostgator.
Ps2.: To install, I'm following this link: https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html
I solved!
Just change in /etc/elasticsearch/jvm.options:
OLD: #-Djava.io.tmpdir=${ES_TMPDIR}
NEW: -Djava.io.tmpdir=/var/log/elasticsearch
For me, the problem is solved!

The service has been enabled but failed. How can I make it run?

I use Linux Mint 19. I have created a simple script, "After_suspension", which will run three commands. I am trying to make it run when Mint wakes up from suspension.
matthew#matthew-pc:~$ cat /usr/local/bin/After_suspension
#!/bin/bash
pon dsl-provider
sudo service fancontrol start
/usr/bin/mailnag
matthew#matthew-pc:~$ file /usr/local/bin/After_suspension
/usr/local/bin/After_suspension: Bourne-Again shell script, ASCII text executable
"mailnag" is (text/x-python). I have created the following service file, which has been enabled but failed. How can I make it run? Should I use three separate service files to run the three commands?
matthew#matthew-pc:~$ cat /etc/systemd/system/After_suspension.service
[Unit]
After=suspend.target
[Service]
ExecStart=/usr/local/bin/After_suspension
[Install]
WantedBy=suspend.target
matthew#matthew-pc:~$ systemctl is-enabled After_suspension.service
enabled
matthew#matthew-pc:~$ systemctl is-active After_suspension.service
failed
matthew#matthew-pc:~$ systemctl status After_suspension.service
● After_suspension.service
Loaded: loaded (/etc/systemd/system/After_suspension.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-04-11 01:19:42 HKT; 3min 46s ago
Process: 11655 ExecStart=/usr/local/bin/After_suspension (code=exited, status=1/FAILURE)
Main PID: 11655 (code=exited, status=1/FAILURE)
Apr 11 01:19:11 matthew-pc After_suspension[11655]: File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 122, in __new__
Apr 11 01:19:11 matthew-pc After_suspension[11655]: bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
Apr 11 01:19:11 matthew-pc After_suspension[11655]: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbu
Apr 11 01:19:07 matthew-pc systemd[1]: Started
After_suspension.service.
Apr 11 01:19:07 matthew-pc systemd[1]: After_suspension.service: Main process exited, code=exited, status=1/FAILURE
Apr 11 01:19:42 matthew-pc pppd[11657]: Timeout waiting for PADO packets
Apr 11 01:19:42 matthew-pc pppd[11657]: Unable to complete PPPoE Discovery
Apr 11 01:19:42 matthew-pc pppd[11657]: Terminating on signal 15
Apr 11 01:19:42 matthew-pc pppd[11657]: Exit.
Apr 11 01:19:42 matthew-pc systemd[1]: After_suspension.service: Failed with result 'exit-code'.
The following is the present "fancontrol.service".
matthew#matthew-pc:~$ cat /lib/systemd/system/fancontrol.service
[Unit]
Description=fan speed regulator
# Run pwmconfig to create this file.
ConditionPathExists=/etc/fancontrol
After=lm-sensors.service
Documentation=man:fancontrol(8) man:pwmconfig(8)
[Service]
ExecStartPre=/usr/sbin/fancontrol --check
ExecStart=/usr/sbin/fancontrol
PIDFile=/var/run/fancontrol.pid
[Install]
WantedBy=multi-user.target
Systemd runs system scripts as root, so you're trying to start GNOME disks as a root, in a terminal session with no X server active, that's why you probably get a connection refused message.
You probably want to configure that service to be an user service (you'll probably have to pass the DISPLAY variable, too), or just first try setting a DISPLAY variable in either your script or systemd service.

Apache server not working locally in ubuntu showing an error " Failed to start The Apache HTTP Server." on terminal

user#user-desktop:~$ sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
user#user-desktop:~$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2018-09-18 16:45:15 IST; 7s ago
Process: 12099 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Sep 18 16:45:14 user-desktop systemd[1]: Starting The Apache HTTP Server...
Sep 18 16:45:14 user-desktop apachectl[12099]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line
14 of /etc
Sep 18 16:45:15 user-desktop apachectl[12099]: Action 'start' failed.
Sep 18 16:45:15 user-desktop apachectl[12099]: The Apache error log may have more information.
Sep 18 16:45:15 user-desktop systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 18 16:45:15 user-desktop systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 18 16:45:15 user-desktop systemd[1]: Failed to start The Apache HTTP Server.

Resources