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.

1471 questions
366
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,763
  • 3
  • 14
  • 6
265
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,892
  • 2
  • 12
  • 8
156
votes
4 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,779
  • 3
  • 18
  • 21
120
votes
4 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,945
  • 6
  • 32
  • 52
107
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,221
  • 2
  • 9
  • 8
105
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
  • 2,089
  • 2
  • 15
  • 15
90
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,370
  • 5
  • 25
  • 29
86
votes
9 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
  • 983
  • 1
  • 6
  • 6
76
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,754
  • 4
  • 21
  • 30
73
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,137
  • 2
  • 17
  • 19
73
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
  • 973
  • 1
  • 6
  • 8
69
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
  • 1,060
  • 3
  • 10
  • 18
67
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,211
  • 8
  • 40
  • 55
56
votes
5 answers

systemd service automatic restart after StartLimitInterval

I want my systemd service to be automatically restarted on failure. Additionally I want to rate limit the restarts. I want to allow maximum of 3 restarts within 90 seconds duration. Hence I have done the following configuration. [Service] …
Dinesh P.R.
  • 671
  • 1
  • 6
  • 7
54
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
  • 881
  • 1
  • 7
  • 9
1
2 3
98 99