People who code: we want your input. Take the Survey

Questions tagged [systemd]

systemd is an alternative approach to SystemV and Upstart init daemons for Linux. It is intended to provide a better framework for expressing services' dependencies, allow more work to be done in parallel at system startup, and to reduce shell overhead.

Filter by
Sorted by
Tagged with
146
votes
2answers
190k views

How does systemd use /etc/init.d scripts?

I just switched to debian jessie, and most things run okay, including my graphical display manager wdm. The thing is, I just don't understand how this works. Obviously my /etc/init.d/wdm script is ...
76
votes
4answers
114k views

How to run a script with systemd right before shutdown?

What do I need to put in the [install] section, so that systemd runs /home/me/so.pl right before shutdown and also before /proc/self/net/dev gets destroyed? [Unit] Description=Log Traffic [Service] ...
6
votes
1answer
8k views

Which systemd service starts text console on the framebuffer device?

I'm working with an embedded platform and need to have /dev/fb0 clear for my own use (the device accessible over serial console while the screen is used to display information, without X.). I've ...
20
votes
4answers
12k views

Does systemd still know about runlevels?

Does systemd still have the concept of runlevels? For example is it pointless to use telinit <number>?
256
votes
1answer
481k views

How to write startup script for Systemd?

I have 2 graphics cards on my laptop. One is IGP and another discrete. I've written a shell script to to turn off the discrete graphics card. How can I convert it to systemd script to run it at ...
115
votes
3answers
176k views

Writing basic systemd service files

I am developing a Nodejs application that the user interacts with via HTTP on localhost. There are practically no parameters and the daemon has virtually no dependencies and it just needs to be up by ...
41
votes
4answers
91k views

What exactly is “a stop job”, as in “A stop job is running…”?

After a shutdown command is issued, sometimes one gets a status message like this: A stop job is running for Session 1 of user xy and then the system hangs for awhile, or forever depending on ??? ...
40
votes
3answers
43k views

What is the correct substitute for rc.local in systemd instead of re-creating rc.local

I cannot find the correct way to execute some local scripts (or very local commands) at systemd, I already know I must not create a service (in systemd a unit) for this kinds of scripts (or I must?)......
12
votes
1answer
12k views

Difference between systemd and terminal starting program

I am curious as to what this difference is between programs that are; started with systemd when enabled through systemctl, vs those started by means of /etc/rc.local or through the CLI. For example, ...
8
votes
4answers
6k views

systemctl --user not available for www-data user

systemctl --user seems to be working fine for the desktop user: dev@dev-VirtualBox:~$ systemctl --user > /dev/null dev@dev-VirtualBox:~$ echo $? 0 But when running the same command under the www-...
97
votes
5answers
112k views

How to find out if a system uses SysV, Upstart or Systemd initsystem [duplicate]

Is there a simple way to find out which initsystem is being used e.g by a recent Debian wheezy or Fedora system? I'm aware that Fedora 21 uses systemd initsystem but that is because I read that and ...
124
votes
7answers
165k views

Cause a script to execute after networking has started?

I am relatively new to systemd and am learning its architecture. Right now, I'm trying to figure out how to cause a custom shell script to run. This script needs to run after the networking layer has ...
16
votes
4answers
20k views

Systemd kills service immediately after start

I'm writing systemd unit files for OSSEC HIDS. The problem is that when systemd starts the services it immediately stops them. When I use the following ExecStart directive everything is working fine. ...
4
votes
2answers
3k views

Porting old sysvinit habits to systemd

I have a series of script with which I was able to install and configure newly Debian stable systems. To automatically start programs I use /etc/rc.local but for other cases I had to manually change ...
12
votes
1answer
16k views

configure java daemon with systemd

I'm using this definition for a systemd job: [Unit] Description=Some job [Service] ExecStart=/usr/local/sbin/somejob User=dlt Type=forking [Install] WantedBy=multi-user.target The script ...
378
votes
13answers
414k views

How to clear journalctl

I couldn't find in google any safe way to clear systemd journal. Do anyone know any safe and reliable way to do so? Let's say I was experimenting with something and my logs got cluttered with various ...
74
votes
9answers
126k views

A stop job is running for Session c2 of user

The following message appears almost every time I shutdown my computer: A stop job is running for Session c2 of user ... (1min 30s) It waits for 1min30s then continues the shutdown process. I follow ...
28
votes
6answers
42k views

When I log in, it hangs until crng init done

When I log in with LightDM on my laptop running Debian Unstable, it recently started to hang for around 2 minutes until journalctl shows the message kernel: random: crng init done. When I press random ...
4
votes
1answer
2k views

Not sure what starts this systemd unit file

So I've been looking at the openvpn configuration on my Debian 9 based server and found something that I cannot explain in the systemd unit files for the openvpn daemon. The daemon itself is starting ...
8
votes
1answer
2k views

How does gnome reboot without root privileges?

I am reading the book Linux kernel development, in chapter 5 "System Call Implementation" page 77 says For example, capable(CAP_SYS_NICE) checks whether the caller has the ability to modify nice ...
80
votes
2answers
52k views

What's the difference between /usr/lib/systemd/system and /etc/systemd/system?

Before all the unit files were in /etc/systemd/system/ but now some are showing up in /usr/lib/systemd/system (<- on CentOS, or /lib/systemd/system <- on Debian/Ubuntu), what is the difference ...
5
votes
1answer
4k views

What are the default Polkit privileges on Arch Linux for shutdown, halt, etc., and why are they so?

On Arch Linux, with systemd, the following commands are all symlinks to systemctl: /usr/bin/telinit /usr/bin/poweroff /usr/bin/runlevel /usr/bin/reboot /usr/bin/halt /usr/bin/shutdown I find their ...
0
votes
2answers
1k views

systemd cannot find PID file after YAJSW wrapper startup

I have a systemd startup script for a forking service (let's call it foo) based on YAJSW (Yet Another Java Service Wrapper). The relevant part of the .service file looks like this: ExecStart=/opt/foo/...
124
votes
4answers
112k views

Where do I put my systemd unit file?

I read that there are two folders for unit files (not in user mode). /usr/lib/systemd/system/: units provided by installed packages /etc/systemd/system/: units installed by the system administrator ...
57
votes
1answer
23k views

Why doesn't my systemd user unit start at boot?

I'm trying to create a systemd user unit and have it start when the system boots. The service does start manually, however it does not start at boot. From searching the Internet I learned that in ...
2
votes
1answer
7k views

How to start 2FA-using OpenVPN with systemd?

I have openvpn config that users 2 factor authentication. If I start it manually, by running: /usr/sbin/openvpn --writepid /run/whatever --cd /etc/openvpn/ --config /etc/openvpn/work.conf it asks ...
2
votes
3answers
4k views

Why does `init 0` result in “Excess Arguments” on Arch install?

I am used to the old method of calling init 0 to shutdown. Bad, I know; but when I tried it on my new Arch install I get this: # init 0 Excess Arguments This confuses me because I thought systemd ...
6
votes
1answer
12k views

Output of a python script running as unit is out of order while shells seems unnafected

How would I get all outputs of systemd managed python2 script instantly into journal, just like it appears in terminal I'm on centos 7, but seems to be same on arch according to systemd manual, ...
105
votes
2answers
150k views

How do I display log messages from previous boots under CentOS 7?

Executing journalctl under a CentOS 7 system just prints messages generated after the last boot. The command # journalctl --boot=-1 prints Failed to look up boot -1: Cannot assign requested ...
8
votes
1answer
9k views

Location to place systemd service EnvironmentFile when creating debian package

I am currently rewriting upstart jobs to use systemd and I wanted to know: Where is the "default" place to an EnvironmentFile? It could potentially go in /etc/environment It could be with all the ...
12
votes
1answer
13k views

In systemd, what starts units generated by generator?

On my machine (Arch linux), systemd-generator generates some unit files in /run/systemd/generator/ and they seem to be started somehow on boot. What is starting them? For example, boot.mount is ...
22
votes
1answer
46k views

systemctl - service exit codes and status information explanation

When checking a service status via systemctl systemctl status docker the output is something like ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/...
3
votes
1answer
1k views

Integration of afuse user-level automounter with sshfs as a systemd service spawned from login for local users

Edit 2020: I've been using the systemd-answer posted below for several years now, and am quite happy with it. To facilitate working with remote files, I setup afuse with sshfs to run from .bashrc of ...
84
votes
4answers
125k views

How could we allow non-root users to control a systemd service?

With sysvinit, a sudoers entry like this would suffice: %webteam cms051=/sbin/service httpd * This would allow for commands such as: sudo service httpd status sudo service httpd restart Now, with ...
57
votes
11answers
105k views

How to unload kernel module 'nvidia-drm'?

I'm trying to install the most up-to-date NVIDIA driver in Debian Stretch. I've downloaded NVIDIA-Linux-x86_64-390.48.run from here, but when I try to do sudo sh ./NVIDIA-Linux-x86_64-390.48.run as ...
66
votes
4answers
84k views

Set systemd service to execute after fstab mount

I'm working on a systemd .service script that is supposed to start after a CIFS network location is mounted via /etc/fstab to /mnt/ on boot-up. The script waits for an OpenVPN dependency script to ...
57
votes
3answers
103k views

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

I'm connected to local area network with access to the Internet through gateway. There is DNS server in local network which is capable of resolving hostnames of computers from local network. I would ...
42
votes
2answers
34k views

Is it OK to change /etc/machine-id?

I cloned a disk (SSD) and put the cloned disk into another machine. Now both systems have the same value in /etc/machine-id. Is it any problem to simply edit /etc/machine-id to change the value? Can I ...
18
votes
3answers
19k views

Writing a systemd service to be executed at resume

my Dell laptop is subject to this bug with kernel 3.14. As a workaround I wrote a simple script /usr/bin/brightness-fix: #!/bin/bash echo 0 > /sys/class/backlight/intel_backlight/brightnes (and ...
14
votes
3answers
21k views

Setting DISPLAY in systemd service file

I'm trying to learn systemd services by trying to start xclock as a service; the service file is below [Unit] Description=clock [Service] Environment=DISPLAY=:0 ExecStart=/usr/bin/xclock [Install] ...
17
votes
1answer
10k views

How to write a systemd service unit file so it waits until a specific interface is up before starting?

I am trying to write a unit file for hostapd on Debian. The hostapd daemon seems to need the interface for the associated Wifi interface to be up before it is run or else it SEGV's. I've tried ...
15
votes
1answer
4k views

How to avoid /usr/bin/env being marked in systemd logs as the executable

I've created a systemd service to run a tomcat application based on the information found in this article. The short version of the article recommends avoiding the shell script wrappers, and executing ...
3
votes
2answers
22k views

Failed to get D-Bus connection: No such file or directory. $XDG_RUNTIME_DIR not set. libpam-systemd installed

I installed Yunohost on a LIME2 like I did with my Pi3 and now I have the same error as two months (see "Cannot enable user service. “Failed to get D-Bus connection: Connection refused” Support"), ...
1
vote
1answer
2k views

How do I setup user autostart and properly configure systemd user services?

On my arch server, I was setting up users restricted to their home directories. I ran: useradd -m -s /bin/bash username and passwd username I've read this wiki article... I figured I should use ...
3
votes
1answer
6k views

Systemd timeout because it doesn't detect daemon forking

I'm currently developping a systemd daemon. The problem I'm facing is that the daemon is killed 1m30s after beeing launched because the forking is not detected. I'm using the int daemon(int nochdir, ...
3
votes
1answer
8k views

Starting openvpn client as daemon - in debian

[Unit] Description=Simple Openvpn tunnel [Service] Type=simple ExecStart=/usr/sbin/openvpn --config /etc/vpn/config/myclient.ovpn --daemon [Install] WantedBy=multi-user.target I have this service, ...
1
vote
1answer
5k views

Yocto linux service script problem

I have written a systemd script mqtt.service which is in /home/root directory This is my mqtt.service script : # This file is part of systemd. # # systemd is free software; you can redistribute ...
651
votes
5answers
898k views

How to see full log from systemctl status service?

I check service status with systemctl status service-name. By default, I see few rows only, so I add -n50 to see more. Sometimes, I want to see full log, from start. It could have 1000s of rows. Now,...
51
votes
5answers
98k views

How to disable X server autostart in Debian Jessie?

I have a remote machine running Debian 8 (Jessie) with lightdm installed. I want it to start in no-GUI mode, but I don't want to remove all X-related stuff to still be able to run it though SSH with ...
59
votes
4answers
154k views

How to change systemd service timeout value?

In the company I am working now there is a legacy service and its init script is using old SysvInit, but is running over systemd (CentOS 7). Because there's a lot of computation, this service takes ...

1
2 3 4 5
11