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
54
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
  • 761
  • 1
  • 8
  • 13
52
votes
4 answers

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.target [Service] User=autossh # -p [PORT] # -l…
guettli
  • 3,591
  • 17
  • 72
  • 123
51
votes
4 answers

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 it does not have the necessary permissions. One…
Luke
  • 557
  • 1
  • 5
  • 11
50
votes
3 answers

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
  • 3,591
  • 17
  • 72
  • 123
48
votes
3 answers

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 test.target However, when I try to read its log…
ChromeHearts
  • 600
  • 1
  • 4
  • 8
47
votes
3 answers

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 updates and modify the world database. I also created a…
Shadur
  • 1,337
  • 1
  • 11
  • 20
44
votes
2 answers

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: Authentication succeeded (publickey). Authenticated to…
Alasdair
  • 561
  • 1
  • 4
  • 7
43
votes
5 answers

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 find them: $ journalctl -t 'ssh*' -- No Entries…
Mark Grimes
  • 654
  • 1
  • 6
  • 8
42
votes
3 answers

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 configuration doesn't help. su - mysql to change the…
amq
  • 733
  • 2
  • 6
  • 9
40
votes
5 answers

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 drives. We used to accomplish this with some udev…
Mike Blackwell
  • 1,005
  • 1
  • 8
  • 12
35
votes
2 answers

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…
kalise
  • 453
  • 1
  • 4
  • 5
33
votes
3 answers

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 cron dovecot But ssh must not be shut down, since…
guettli
  • 3,591
  • 17
  • 72
  • 123
32
votes
4 answers

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 status is the following: $ timedatectl…
manifestor
  • 6,079
  • 7
  • 27
  • 39
31
votes
6 answers

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 adding the --color switch!
xuhdev
  • 890
  • 2
  • 8
  • 20
31
votes
4 answers

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 knows the correct format for this?
Keeto
  • 441
  • 1
  • 4
  • 6
1
2
3
98 99