Questions tagged [systemd]

Systemd is a system management daemon designed for Linux. Use this tag for *programming questions* using systemd or its libraries. Questions about *configuring the daemon* (including writing unit files) are better directed to Unix & Linux: https://unix.stackexchange.com.

Systemd is a system management daemon designed for Linux and programmed exclusively for the Linux API. For systems using it, it is the first process which is executed in user space during the Linux startup process. Therefore, systemd serves as the root of the user space's process tree.

2384 questions
30
votes
5 answers

How do I check if my local docker image is outdated, without pushing from somewhere else?

I'm running a react app in a docker container, on a Coreos server. Let's say it's been pulled from dockerhub from https://hub.docker.com/r/myimages/myapp. Now I want to check periodically if the dockerhub image for the app container has been…
user5918874
29
votes
2 answers

Can I control a user systemd using 'systemctl --user' after sudo su - myuser?

I have a service that I want to start with system startup. I have built a ap@.service definition for it as a template, because there could be many instances. Defined in the root systemd, this works well, and starts and stops the service with the…
NeilCasey
  • 621
  • 6
  • 8
29
votes
2 answers

How to use a parameter in ExecStart command line?

I try to convert a SysVinit script used on Debian (and derivative distros such as Linux Mint and Ubuntu & Co.) to a systemd service to be used on Fedora or Arch Linux (and derivative distros such as Bridge or Manjaro), but even if the systemd start…
Fnux
  • 416
  • 1
  • 4
  • 9
28
votes
9 answers

DOCKER_OPTS do not work in config file /etc/default/docker

I have changed /etc/default/docker with DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock" (docker version 1.4.1 in ubuntu 14.04), but it do not take any effect for me (not listening at port 2375). It seems that docker do not read…
seanlook
  • 907
  • 2
  • 9
  • 13
27
votes
1 answer

In Ansible, what's the diffence between the service and the systemd modules?

In Ansible, what is the difference between the service and the systemd modules? The service module seems to include the systemd module so what's the point of having systemd by itself?
segolas.zoso
  • 317
  • 1
  • 3
  • 10
25
votes
3 answers

"sudo systemctl enable docker" not available: Automatically run Docker at boot on WSL2 (using a "sysvinit" / "init" command or a workaround)

I am using Ubuntu on WSL2 (not on Docker Desktop). According to How to fix docker ‘Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?’ on Ubuntu, I can automatically start the docker daemon at boot…
questionto42
  • 7,175
  • 4
  • 57
  • 90
25
votes
1 answer

Simple C or C++ API for controlling systemd services

Goal I'd like to write C/C++ applications and provide an API for them to communicate directly with systemd-managed services. Effectively, I'd like my applications to be able to do the equivalent of systemctl start service_name@unit_number.service…
Cloud
  • 18,753
  • 15
  • 79
  • 153
25
votes
1 answer

Starting a systemd service via python

Is there a way to start/restart a systemd service via python? I know that I can make a system call - but then I also could write this in shell script... from subprocess import call call(["systemctl", "restart service"]) I heared systemd has some…
Maximilian Kindshofer
  • 2,753
  • 3
  • 22
  • 37
25
votes
5 answers

Use of CPUQuota in systemd

I am trying to put a hard limit in CPU usage for a dd command . I have created the following unit file [Unit] Description=Virtual Distributed Ethernet [Service] ExecStart=/usr/bin/ddcommand CPUQuota=10% [Install] WantedBy=multi-user.target which…
SteveGr2015
  • 463
  • 2
  • 7
  • 15
24
votes
2 answers

Referencing Other Environment Variables in Systemd

Is is possible to reference other environment variables when setting new ones in…
Jason Waldrip
  • 5,038
  • 8
  • 36
  • 59
24
votes
1 answer

What is the Difference between ConditionPathExists= and ConditionPathExists=| in systemd?

I need check a file not exist before i start my service in Systemd. I see two case in [Unit]: ConditionPathExists=!/tmp/abc and ConditionPathExists=|!/tmp/abc are they the same? Can anybody help me explain if they are different?
Thao Nguyen
  • 452
  • 2
  • 10
  • 26
23
votes
3 answers

Is it recommended to run systemd inside docker container?

I am planning to use 'systemd' inside the container. Based on the articles I have read, it is preferable to limit only one process per container. But if I configure 'systemd' inside the container, I will end up running many processes. It would be…
champion
  • 345
  • 1
  • 2
  • 7
22
votes
9 answers

What does "Failed to execute operation: Invalid argument" mean when running systemctl enable?

I've created a systemd service file (specifically for svnserve; I'm actually using the example from here https://stackoverflow.com/a/40584047/464087), and when I enable it, typing sudo systemctl enable svnserve I get the response Failed to execute…
EricS
  • 569
  • 1
  • 3
  • 15
22
votes
6 answers

Docker (CentOS 7 with SYSTEMCTL) : Failed to mount tmpfs & cgroup

(I'm a Docker beginner. Then I followed some tutorials for CentOS-7) In my CentOS 7.2, I tried to learn Docker by following the steps below. # docker version Client: Version: 1.10.3 API version: 1.22 Go version: go1.5.3 Git commit: …
夏期劇場
  • 17,821
  • 44
  • 135
  • 217
22
votes
2 answers

Supervisor fails to restart half of the time

I'm trying to deploy a Django app using Uwsgi and supervisor on a machine running Debian 8.1. When I restart via sudo systemctl restart supervisor it fails to restart half of the time. $ root@host:/# systemctl start supervisor Job for…
Paul K.
  • 796
  • 2
  • 7
  • 20