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.

Filter by
Sorted by
Tagged with
373 votes
6 answers
641k views

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 Daemon [Service] ...
lfagundes's user avatar
  • 3,833
267 votes
2 answers
451k views

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 ...
425nesp's user avatar
  • 2,912
159 votes
4 answers
187k views

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's user avatar
122 votes
4 answers
190k views

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." ...
TomOnTime's user avatar
  • 7,991
108 votes
3 answers
79k views

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 ...
fregas's user avatar
  • 1,231
105 votes
3 answers
158k views

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 ...
galaxy's user avatar
  • 2,099
92 votes
2 answers
74k views

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 ...
mikemaccana's user avatar
  • 3,440
88 votes
9 answers
387k views

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 ...
Vikas Tiwari's user avatar
  • 1,003
78 votes
3 answers
83k views

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 ...
giomanda's user avatar
  • 1,774
74 votes
2 answers
66k views

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 ...
user24601's user avatar
  • 993
74 votes
4 answers
235k views

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 ...
Snowcrash's user avatar
  • 1,157
69 votes
7 answers
138k views

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 ...
mlissner's user avatar
  • 1,070
67 votes
4 answers
58k views

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-...
Andy Shinn's user avatar
  • 4,231
58 votes
2 answers
68k views

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 ...
jdf's user avatar
  • 921
56 votes
5 answers
144k views

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 ...
Dinesh P.R.'s user avatar
55 votes
4 answers
92k views

Start N processes with one systemd service file

I found this systemd service file to start autossh to keep up a ssh tunnel: https://gist.github.com/thomasfr/9707568 [Unit] Description=Keeps a tunnel to 'remote.example.com' open After=network....
guettli's user avatar
  • 3,703
54 votes
3 answers
44k views

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 ...
Display Name's user avatar
53 votes
3 answers
40k views

loginctl enable-linger/disable-linger ... but reading linger-status?

I know how to enable/disable lingering with loginctl. But up to now I found no way to query the status of a user. I want to know: Is lingering enable for user foo? How can I access this information?...
guettli's user avatar
  • 3,703
52 votes
4 answers
187k views

Configuring Systemd Service to run with root access

I have a service in the form of a node.js application set up with Systemd on Raspbian Jessie and it is using its own user account. However, I am finding that the service does not run correctly because ...
Luke's user avatar
  • 567
51 votes
3 answers
49k views

How to allow a user to use journalctl to see user-specific systemd service logs?

I am running user-level services in Ubuntu 16.04 LTS. For example, I have my test.service located at ~/.config/systemd/user/test.service. I was able to run the service by doing systemctl --user start ...
ChromeHearts's user avatar
49 votes
3 answers
81k views

systemd: Grant an unprivileged user permission to alter one specific service

I'm running a private game server on a headless linux box. Because I'm not an idiot, said server is running as its own unprivileged user with the bare minimum access rights it needs to download ...
Shadur's user avatar
  • 1,357
45 votes
2 answers
38k views

Slow ssh login - Activation of org.freedesktop.login1 timed out

On one of my servers I've noticed really delay on SSH logins. Connecting using the ssh -vvv options the delay occurs at debug1: Entering interactive session. extract of connection: debug1: ...
Alasdair's user avatar
  • 571
44 votes
5 answers
118k views

How do you use systemd's journalctl patterns

I am trying to use journalctl's pattern matching on SYSLOG_IDENTIFIERS. As an example, I have a ton of message tagged sshd: $ journalctl -t sshd | wc -l 987 but if I try to use pattern matching to ...
Mark Grimes's user avatar
42 votes
3 answers
74k views

Increasing nproc for processes launched by systemd on CentOS 7

I have successfully increased the nofile and nproc value for the local users, but I couldn't find a proper solution for the processes launched by systemd. Adding max_open_files to the MariaDB ...
amq's user avatar
  • 733
40 votes
5 answers
48k views

Automount USB drives with systemd

We're updating our servers from a very out-of-date distro to a modern Debian Jessie based system, including lightdm / xfce, and of course systemd (and udisks2). One sticking point is automounting USB ...
Mike Blackwell's user avatar
38 votes
4 answers
131k views

Force systemd timesyncd to sync time with NTP server immediately

I've configured systemd timesyncd to get it's time from a NTP server: /etc/systemd/timesyncd.conf > NTP=ca.pool.ntp.org systemctl restart systemd-timesyncd.service timedatectl set-ntp true The ...
manifestor's user avatar
  • 6,259
35 votes
2 answers
61k views

Services remain in failed state after stopped with systemctl

we have a simple systemd script to start a MineCraft server in a service fashion. The SO is CentOS 7. Here the script: [Unit] Description=Minecraft Server After=syslog.target network.target [Service]...
kalise's user avatar
  • 453
33 votes
3 answers
6k views

Disable all services, except ssh

How can I disable all services except ssh on modern (systemd based) linux distributions? I need to implement a maintenance mode. All these services need to be down: postgres postfix apache cups ...
guettli's user avatar
  • 3,703
32 votes
6 answers
29k views

journalctl: how to display colors in its output?

The output of journalctl really looks messy without colors. Is it possible to add colors to its output? On my system it seems only important lines are highlighted. Even dmesg can output with color by ...
xuhdev's user avatar
  • 910
31 votes
4 answers
45k views

How to use the `$HOME` environment variable in systemd service files

I am trying to use the $HOME environment variable in the ExecStart. I tried many different things like $HOME and ${HOME} but nothing seems to be working ExecStart=${HOME}/bin/some-binary Anyone ...
Keeto's user avatar
  • 441
29 votes
4 answers
98k views

systemctl doesn't recognize my service: Default-Start contains no runlevels, aborting

I want to define a simple service to be started at boot, being on Ubuntu server 16.10. So I have created a /etc/init.d/mydaemon I somehow messed up between upstart and systemd: at first I thought I ...
CharlesB's user avatar
  • 555
29 votes
1 answer
41k views

Allowing a non-root user to restart a service

Background : I created an app called myapp with Spring-boot. It consists of a self-executable jar and is compatible with systemd services. Now, I am trying to integrate it with jenkins. What I want: ...
Arnaud Denoyelle's user avatar
25 votes
4 answers
113k views

Systemd dependencies and boot order

I need to specify a boot order for processes to start. I have 389 Directory Server and Samba running on Fedora 18. How can I have the network services boot, then 389 DS, then Samba? Is there a GUI to ...
Dylan Klomparens's user avatar
25 votes
4 answers
31k views

Systemd: Restart all instances of an Instantiated Service at once

I use the nice feature of systemd: Instantiated Services. Is there a simple way to reload all instantiated services with one call? Example: I don't want to run all like this: systemctl restart ...
guettli's user avatar
  • 3,703
24 votes
2 answers
65k views

How to set systemd service dependencies?

During CentOS 7 system boot nginx start fails with the following error: 2014/08/04 17:27:34 [emerg] 790#0: bind() to a.b.c.d:443 failed (99: Cannot assign requested address) I suspect this is ...
user avatar
24 votes
1 answer
18k views

What does the systemd-resolved service do and does it need to listen on all interfaces? [closed]

I am working on a project that involves an IOT device (the now deprecated Intel Galileo). I am looking at hardening these devices and I noticed that the systemd-resolved service is listening on all ...
jeeves's user avatar
  • 351
24 votes
6 answers
34k views

Systemd fails to run in a docker container when using cgroupv2 (--cgroupns=private)

I will attach the minimized test case below. However, it is a simple Dockerfile that has these lines: VOLUME ["/sys/fs/cgroup"] CMD ["/lib/systemd/systemd"] It is Debian:buster-...
Stephen's user avatar
  • 353
23 votes
2 answers
10k views

Configure buggy systemd service to terminate via SIGKILL

Background I've been asked to create a systemd script for a new service, foo_daemon, that sometimes gets into a "bad state", and won't die via SIGTERM (likely due to custom signal handler). ...
Cloud's user avatar
  • 425
23 votes
3 answers
62k views

How to debug systemd unit ExecStart

I am curious whether I can print out fully expanded ExecStart/ExecStop command line. Consider following example: ExecStart=/usr/bin/java $OPTS_COMMON $OPTS $OPTS_LOG $OPTS_DEBUG some.class.Start --...
pystole's user avatar
  • 365
23 votes
1 answer
44k views

systemd service with multiple After

Is it possible to create a service that depends on several other services? What is the right syntax? Such as: [Unit] Description=service description Wants=network.target After=network.target After=...
naXa stands with Ukraine's user avatar
22 votes
6 answers
32k views

Why am I missing /var/run/sshd after every boot?

I'm running a Ubuntu 16.04 container under Proxmox 5.2-11. After applying the latest round of patches1 I'm unable to login at the console or over ssh. I mounted the container root FS on the ...
Server Fault's user avatar
  • 3,734
22 votes
1 answer
30k views

Starting systemd services sharing a session D-Bus on headless system

I need help starting services that communicate via a session (not system) D-Bus on a headless Linux system. The key is that no-one will be logged in on the headless system. So far I've been able to ...
Ole Wolf's user avatar
  • 440
22 votes
4 answers
10k views

Systemd: start a unit after another unit REALLY starts

In my particular case I want to start remote-fs unit after all glusterfs completely starts. My systemd files: glusterfs target: node04:/usr/lib/systemd/system # cat glusterfsd.service [Unit] ...
Sergey's user avatar
  • 611
21 votes
4 answers
64k views

Cannot use `systemctl --user` due to "Failed to get D-bus connection: permission denied"

I'm trying to set up user-level services, using this answer to a similar question. I have create the required files and rebooted. I'm making progress because I now get "Failed to get D-bus connection:...
xenoid's user avatar
  • 393
21 votes
2 answers
62k views

Start systemd service conditionally?

At my organization we have a number of simple-to-use base AMIs for different services such as ECS and Docker. Since many of our projects involve CloudFormation, we're using cfn-bootstrap, which ...
Naftuli Kay's user avatar
  • 1,728
21 votes
1 answer
22k views

How to start and stop a systemd unit with another?

I am using CoreOS to schedule systemd units with fleet. I have two units (firehose.service and firehose-announce.service. I am trying to get the firehose-announce.service to start and stop along with ...
Andy Shinn's user avatar
  • 4,231
20 votes
1 answer
25k views

systemd: how do I view journals with journalctl without switching to root on CentOS 7?

If I run journalctl as nonroot, I would get the following message: No journal files were found. But switching to root, or using sudo gives me the journal. How can I view journals without switching ...
xuhdev's user avatar
  • 910
19 votes
4 answers
24k views

How to send an email if a systemd service is restarted?

I have a critical application which is run as a service by systemd. It is set up to restart as soon as there is a failure. How to send an email if the application restarts?
Greg's user avatar
  • 1,657
19 votes
2 answers
75k views

Systemd Environment and EnvironmentFile not working

I've built an application and a systemd unit for it. The systemd unit works fine, but as the dev and prod environments have diverged I've started moving config out to environment variables and I can't ...
Keef Baker's user avatar
19 votes
5 answers
103k views

Redis not starting with systemctl

I have installed redis on an ubuntu 16.04 machine and if I run /usr/local/bin/redis-server /etc/redis/cluster/7000/redis.conf it starts up and I can connect to it without issues. However I want to ...
munHunger's user avatar
  • 363

1
2 3 4 5
30