Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd: cortex.service: Failed with result 'exit-code'. #155

Closed
faustus25 opened this issue Dec 3, 2018 · 2 comments
Closed

Systemd: cortex.service: Failed with result 'exit-code'. #155

faustus25 opened this issue Dec 3, 2018 · 2 comments
Assignees

Comments

@faustus25
Copy link

faustus25 commented Dec 3, 2018

Attempting to run cortex.service from systemd fails, issue described below:

Request Type

Bug/misconfiguration

Work Environment

Question Answer
OS version (server) Ubuntu
Cortex version / git hash cortex-2.1.2
Package Type From source

Problem Description

service cortex status
â cortex.service - cortex
Loaded: loaded (/usr/lib/systemd/system/cortex.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-12-03 ; 26min ago
Docs: https://thehive-project.org
Main PID: 1146 (code=exited, status=255)

cortex[1146]: at java.io.FileInputStream.open(FileInputStream.java:195)
cortex[1146]: at java.io.FileInputStream.(FileInputStream.java:138)
cortex[1146]: at java.io.FileInputStream.(FileInputStream.java:93)
cortex[1146]: at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
cortex[1146]: at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
cortex[1146]: at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52)
cortex[1146]: ... 13 more
systemd[1]: cortex.service: Main process exited, code=exited, status=255/n/a
systemd[1]: cortex.service: Unit entered failed state.
systemd[1]: cortex.service: Failed with result 'exit-code'.

Steps to Reproduce

sudo addgroup cortex
sudo adduser --system cortex
sudo cp /opt/cortex/package/cortex.service /usr/lib/systemd/system
sudo chown -R cortex:cortex /opt/cortex
sudo chgrp cortex /etc/cortex/application.conf
sudo chmod 640 /etc/cortex/application.conf
sudo systemctl enable cortex
sudo service cortex start
````


### Possible Solutions
https://github.com/TheHive-Project/TheHive/issues/29

Applied parameter below (removing it doen't work either):


````
-Dpidfile.path=/opt/cortex/RUNNING_PID
````


### Complementary information
/usr/lib/systemd/system/cortex.service


````
[Unit]
Description=cortex
Documentation=https://thehive-project.org
Wants=network-online.target
After=network-online.target

[Service]
WorkingDirectory=/opt/cortex

User=cortex
Group=cortex

ExecStart=/opt/cortex/bin/cortex \
        -Dconfig.file=/etc/cortex/application.conf \
        -Dlogger.file=/etc/cortex/logback.xml \
        -Dpidfile.path=/opt/cortex/RUNNING_PID

StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
````

@To-om
Copy link
Contributor

To-om commented Dec 19, 2018

Can you provide the complete error message ? It seems that a file can't be read.
Can you confirm that the file /etc/cortex/logback.xml exists ?

@To-om To-om self-assigned this Dec 19, 2018
@faustus25
Copy link
Author

Figured out the issue, the install guide for Cortex needs to include the following if using systemd to run cortex.service as it is missing in the specified path as described in /usr/lib/systemd/system/cortex.service

cp -r /opt/cortex/conf/logback.xml /etc/cortex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants