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
45 votes
3 answers
74k 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 ...
  • 1,317
71 votes
3 answers
68k 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 ...
  • 1,694
106 votes
3 answers
76k 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 ...
  • 1,211
348 votes
6 answers
567k 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] ...
  • 3,583
50 votes
4 answers
86k 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....
  • 3,331
69 votes
2 answers
59k 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 ...
  • 923
14 votes
3 answers
29k views

Systemd drop-in fails to create PID file

I have a drop-in for systemd-machined at the path /etc/systemd/system/systemd-machined.service.d/10-machined-pid-file.conf. when I run systemctl status systemd-machined I do see the lines Drop-In: /...
255 votes
2 answers
416k 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 ...
  • 2,782
115 votes
3 answers
164k 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." ...
  • 7,767
70 votes
4 answers
215k 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 ...
  • 1,107
67 votes
7 answers
131k 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 ...
  • 1,020
41 votes
3 answers
72k 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 ...
  • 723
40 votes
5 answers
45k 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 ...
17 votes
4 answers
91k 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 ...
  • 343
14 votes
2 answers
39k views

Is there a way to run just save with firewalld in RHEL7?

I'm starting to use RHEL7 and learning a little about the changes that come with systemd. Is there a way to perform /sbin/service iptables save in firewalld? $ /sbin/service iptables save The ...
12 votes
5 answers
5k views

Correctly setting the hostname - Fedora 20 on Amazon EC2

Context I have a Fedora 20 cloud image running on Amazon EC2 (henceforth called the "instance"). And I have some uncertainty about persistently setting its hostname. Goal In this case, let's say I ...
5 votes
1 answer
10k views

systemd to wait for command to complete before restart/shutdown or killing other processes

When I'm initiating "reboot" or "poweroff", systemd is killing all the processes, but I need it to wait for one particular application to finish before stopping other services. Actually, I want ...
  • 4,494
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 ...
  • 3,331
27 votes
6 answers
25k 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 ...
  • 830
24 votes
4 answers
107k 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 ...
21 votes
6 answers
29k 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 ...
  • 3,584
21 votes
2 answers
57k 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 ...
  • 1,678
18 votes
1 answer
90k views

Failed at step EXEC spawning... Permission denied

I have read alot about this but still not sure why this is not working. as far as I know all dirs have the right permission and even with everything being 777 I still get permission denied when trying ...
17 votes
6 answers
25k views

SSH sessions hang on shutdown/reboot

I have a server that runs Debian and sshd on it, and in case I need to reboot the server my SSH session hangs at client side until TCP timeout. I assume this is because when sshd is being terminated ...
  • 774
9 votes
4 answers
22k views

systemd-networkd and direct routes

I have problem adding direct routes through systemd-networkd. What I'm trying to achieve is similar to: ip a a 192.168.0.2/32 dev enp0s3 ip r a 192.168.0.1/32 dev enp0s3 ip r a default via 192.168.0....
  • 280
9 votes
1 answer
5k views

Is it possible to override a systemd unit file to create a template unit file?

I know that systemd provides an excellent mechanism to override a package-provided unit file to influence the service configuration/behavior. This is typically done by using the below command sudo ...
  • 95
6 votes
4 answers
12k views

Why won't MariaDB start after upgrade (NO_NEW_PRIVILEGES)

After upgrade of my debian(testing, jessie to stretch) server on DigitalOcean, MariaDB won't start with service mariadb start. I tried to purge all mariadb-* and mysql-* packages, delete configs and ...
  • 245
4 votes
1 answer
4k views

How can sshd be configured to have high CPU priority

When a server is overloaded, what is a way under systemd to give ssh a high priority to ensure a remote ssh connection gets a priority to resolve the critical situation?
  • 1,204
1 vote
2 answers
4k views

Docker service not able to start anymore because of modprobe error

I just ran in some issues with my server running docker that I cannot fix myself. Im using Docker version 18.09.0, build 4d60db4 with Ubuntu 16.04.5 LTS. During the day I noticed, that my docker ...
84 votes
2 answers
64k 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 ...
  • 3,220
83 votes
7 answers
319k 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 ...
50 votes
4 answers
163k 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 ...
  • 547
44 votes
2 answers
36k 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: ...
  • 561
42 votes
3 answers
29k 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?...
  • 3,331
29 votes
1 answer
40k 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: ...
25 votes
4 answers
28k 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 ...
  • 3,331
23 votes
2 answers
60k 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 ...
22 votes
3 answers
53k 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 --...
  • 355
21 votes
1 answer
21k 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 ...
  • 4,201
20 votes
1 answer
26k 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 ...
  • 420
19 votes
4 answers
22k 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?
  • 1,637
19 votes
3 answers
22k views

How to set the hostname for a Debian Jessie system?

Debian Jessie comes with systemd. The recommendation to set the hostname is using hostnamectl for systemd. However, this command does not work (even to display the current hostname) on the Debian ...
  • 746
19 votes
1 answer
23k 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 ...
  • 830
16 votes
5 answers
12k views

predictable network interface names in systemd

Recent version of Ubuntu and Debian (stretch) bring a new network interface naming scheme. Now, when updating from a system that's using old style names like "eth0", I'd like to know prior to booting ...
16 votes
2 answers
66k 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 ...
15 votes
1 answer
30k views

What is SIGRTMIN+24 in syslog?

My Debian 8 vm has lots of systemd logs like this: Apr 28 23:02:09 foo systemd[22305]: Starting Shutdown. Apr 28 23:02:09 foo systemd[22305]: Reached target Shutdown. Apr 28 23:02:09 foo systemd[...
  • 2,805
15 votes
4 answers
53k 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:...
  • 313
14 votes
2 answers
10k views

Change systemd unit tag send to journalctl/syslog

Is it possible to change what tag systemd managed service uses for logging? For example, my custom service report-daemon.service defined as # ... [Service] ExecStart=/usr/bin/php # ... # ... shows ...
12 votes
2 answers
21k views

How can systemd run a command as root before launching a service as a different user? [closed]

I'm running svnserve on a Fedora 17 machine with the following systemd service file: [Unit] Description=Subversion Server After=syslog.target network.target [Service] User=svn Type=forking ...
  • 243
12 votes
1 answer
8k views

How to use systemd-firstboot.service?

I'm making an image of Debian Jessie. On boot the system has no /etc/machine-id file. This causes some problems with the journald that doesn't start. I've found that in the systemd repo: # This ...
  • 344