Questions tagged [systemd]

systemd is a modern replacement for the traditional Linux init. Its main features include the ability to express dependencies between services and aggressive parallelization of service startup.

systemd, created by Lennart Poettering and Kay Sievers, is a modern replacement for the traditional Linux init, whether System-V or BSD-style initscripts. Its main features include the ability to express dependencies between services and aggressive parallelization of service startup.

1376 questions
321
votes
6 answers

How to set environment variable in systemd service?

I have an Arch Linux system with systemd and I've created my own service. The configuration service at /etc/systemd/system/myservice.service looks like this: [Unit] Description=My…
lfagundes
  • 3,313
  • 2
  • 13
  • 6
237
votes
2 answers

Do systemd unit files have to be reloaded when modified?

Let's say I write a mine.service file. Then I use systemctl enable mine.service. If I later decide to edit mine.service, do I have to tell systemd that mine.service was changed? If so, how do I do that?
425nesp
  • 2,572
  • 2
  • 11
  • 7
138
votes
2 answers

Find the location of a systemd unit file service

There are many different places where systemd unit files may be placed. Is there a quick and easy way to ask systemd where it read a service’s declaration from, given just the service name?
Joachim Breitner
  • 3,469
  • 3
  • 17
  • 20
107
votes
3 answers

In systemd, what's the difference between After= and Requires=?

I'm creating a systemd .service file and I need help understanding the difference between Requires= and After=. The man page says that Requires= "Configures requirement dependencies on other units." and After= "Configures ordering dependencies…
TomOnTime
  • 7,567
  • 6
  • 28
  • 51
105
votes
3 answers

Does getting disconnected from an SSH session kill your programs?

So, say I get disconnected from an SSH-session after I've started rsync or cp or any other command that can be long running. Does that command keep running until it's finished after I get disconnected or does it just get killed? Always wondered…
fregas
  • 1,201
  • 2
  • 9
  • 7
97
votes
3 answers

Is there a way to see the execution tree of systemd?

What I mean under the question is: is there a way to dump the ordered list (like pstree does for processes) to see how systemd executed the supplied set of units, i.e. the tree after the dependencies were resolved and jobs were queued for the…
galaxy
  • 1,974
  • 1
  • 13
  • 15
80
votes
2 answers

How can I send a message to the systemd journal from the command line?

In older Linux systems, the logger command can be used to send a log message to syslog. Reading where does logger log its messages to in Arch Linux?, it seems that syslog messages and the logger command line app only talk to the systemd journal if a…
mikemaccana
  • 3,070
  • 5
  • 24
  • 29
73
votes
6 answers

Service start request repeated too quickly, refusing to start limit

I have a systemd service that displays the following error service start request repeated too quickly, refusing to start I understand that the service is configured to restart on failure and it is restarting again and again. But when exactly does…
Vikas Tiwari
  • 853
  • 1
  • 6
  • 6
68
votes
4 answers

failed to get D-Bus connection: Operation not permitted

I'm trying to list services on my CentOS image running in Docker using systemctl list-units but I get this error message: Failed to get D-Bus connection: Operation not permitted Any suggestions what the problem might be?
Snowcrash
  • 1,087
  • 2
  • 16
  • 19
66
votes
3 answers

Modify systemd unit file without altering upstream unit file

I have installed the pimd service by means of apt. This comes with an upstream systemd unit file (/lib/systemd/system/pimd.service). I want the service to be restarted when for some reason it gets killed, hence I wish to add the line Restart =…
giomanda
  • 1,644
  • 4
  • 20
  • 30
66
votes
7 answers

What's the easiest way to make my old init script work in systemd?

I don't want to do the right thing by creating a new systemd script, I just want my old init script to work again now that I've upgraded my system to an OS that's using systemd. I've briefly researched how to convert init scripts and how to write…
mlissner
  • 990
  • 3
  • 8
  • 17
64
votes
2 answers

Create a directory under /var/run at boot

I had a daemon that needed its own dir in /var/run for its PID file with write permission granted to the daemon's user. I found I could create this dir with these commands: # mkdir /var/run/mydaemon Then I could change its ownership to the…
user24601
  • 873
  • 1
  • 6
  • 8
62
votes
4 answers

How to remove missing systemd units?

I'm having trouble figuring out how to remove systemd units that no longer have files. They still seem to linger in the system somehow. The old broken units I am trying to remove: core@ip-172-16-32-83 ~ $ systemctl list-units --all firehose-router* …
Andy Shinn
  • 4,131
  • 8
  • 38
  • 55
53
votes
3 answers

get notification when systemd-monitored service enters failed state

I need to have network messages sent when a systemd service I have crashes or is hung (i.e., enters failed state; I monitor for hung by using WatchdogSec=). I noticed that newer systemd have FailureAction=, but then saw that this doesn't allow…
Display Name
  • 751
  • 1
  • 8
  • 13
50
votes
2 answers

How do view older journalctl logs (after a rotation maybe?)

I am running docker on ubuntu 16.04 and would like to view the logs. However, I am unable to view logs after what I am guessing is some sort of rotation or the logs grow to a certain size. I have not made any changes to my journald.conf, so I am…
jdf
  • 821
  • 1
  • 7
  • 9
1
2 3
91 92