0

I am trying to implement Sidekiq using Systemd on Ubuntu 16.

I am logged in as deployer. I navigated to the /lib/systemd/system directory and wanted there to create a file: nano sidekiq.service.

However, I received an error message because of missing permissions, so I created that file as sudo nano sidekiq.service. All created successfully.

Then, I wanted to activate it, but got this error message:

systemctl enable sidekiq => Failed to issue method call: Access denied

So, I tried using sudo:

sudo systemctl enable sidekiq => Failed to issue method call: No such file or directory

How do I move from here? How to activate this new service?

Thank you

EDIT: logs from sudo journalctl -u sidekiq.service

-- Logs begin at Tue 2020-03-24 15:45:10 UTC, end at Wed 2020-03-25 10:18:41 U
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: W, [2020-03-25T10:15:31.895985
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: Association Tracking for Paper
Mar 25 10:15:31 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:31.913Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:34.999Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:15:35 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:15:35.008Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.393Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.394Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.394Z pid=2
Mar 25 10:16:55 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:55.895Z pid=2
Mar 25 10:16:57 ip-172-31-46-41 sidekiq[29413]: 2020-03-25T10:16:57.898Z pid=2
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: W, [2020-03-25T10:17:05.050918
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: Association Tracking for Paper
Mar 25 10:17:05 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:05.072Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.903Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:17:07 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:17:07.904Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.944Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.944Z pid=2
Mar 25 10:18:28 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:28.945Z pid=2
Mar 25 10:18:29 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:29.446Z pid=2
Mar 25 10:18:31 ip-172-31-46-41 sidekiq[29581]: 2020-03-25T10:18:31.449Z pid=2
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: W, [2020-03-25T10:18:38.659569
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: Association Tracking for Paper
Mar 25 10:18:38 ip-172-31-46-41 sidekiq[29614]: 2020-03-25T10:18:38.669Z pid=2
user984621
  • 135
  • 1
  • 7

1 Answers1

0

Steps suppose to be:

  1. Create file sudo nano /lib/systemd/system/sidekiq.service
  2. Add content to sidekiq.service make sure all paths are available.
  3. Reload systemctl

    sudo systemctl daemon-reexec

    sudo systemctl daemon-reload

  4. Enable sidekiq sudo systemctl enable sidekiq
  5. Now you can do sudo systemctl start|stop|restart sidekiq

Please try and let me know in case of issue with audit logs. Make sure your service is listed with systemctl list-units --type=service | grep side

asktyagi
  • 2,401
  • 1
  • 5
  • 19
  • Thank you @asktyagi for the proper workflow. I followed the steps, but when executing `sudo systemctl enable sidekiq` got this error: **Failed to issue method call: No such file or directory**. All paths in the file are correct, the only thing I wasn't sure how to set was this: **UMask=0002** - the value 0002 was default in the file template, I left it as it is. – user984621 Mar 25 '20 at 09:23
  • When I run `sudo systemctl status sidekiq.service`, I get this message: `sidekiq.service Loaded: error (Reason: No such file or directory) Active: inactive (dead)` -- but the file (permissions: `-rw-r--r--`) physically exists in the directory. – user984621 Mar 25 '20 at 09:32
  • can you share content of unit and output of `journalctl -u sidekiq.service` also? – asktyagi Mar 25 '20 at 10:09
  • Added to the OP - also, I had to run that command with `sudo` – user984621 Mar 25 '20 at 10:20
  • I updated step 3 execute with same sequence, if still not working can you confirm if selinux is enabled? – asktyagi Mar 25 '20 at 10:38
  • Thank you; I followed all the steps, but still the same error message. `SELinux status: disabled` – user984621 Mar 25 '20 at 10:56
  • can you also add allowed permissions for `deployer` user? – asktyagi Mar 25 '20 at 11:16
  • I am sorry, I'm not sure what you mean by that. Where should I add it? – user984621 Mar 25 '20 at 11:23
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/105936/discussion-between-asktyagi-and-user984621). – asktyagi Mar 25 '20 at 11:33