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
175 votes
2 answers
229k 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 ...
Martin Drautzburg's user avatar
88 votes
4 answers
154k 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] ...
sid_com's user avatar
  • 1,561
6 votes
1 answer
9k 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 ...
SF.'s user avatar
  • 2,901
292 votes
2 answers
542k 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 ...
Sharique's user avatar
  • 3,133
23 votes
4 answers
15k views

Does systemd still know about runlevels?

Does systemd still have the concept of runlevels? For example is it pointless to use telinit <number>?
drpaneas's user avatar
  • 2,262
142 votes
7 answers
216k 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 ...
fdmillion's user avatar
  • 2,768
118 votes
4 answers
191k 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 ...
beatgammit's user avatar
  • 7,493
55 votes
4 answers
132k 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 ??? ...
Elliptical view's user avatar
15 votes
1 answer
20k 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, ...
Brett Reinhard's user avatar
103 votes
5 answers
123k 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 ...
Valentin Bajrami's user avatar
81 votes
11 answers
150k 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 ...
dmn's user avatar
  • 955
53 votes
4 answers
72k 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?)......
Luciano Andress Martini's user avatar
20 votes
4 answers
25k 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. ...
Daniil Svetlov's user avatar
12 votes
1 answer
18k 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 ...
lash's user avatar
  • 729
11 votes
4 answers
9k 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-...
Jon Skarpeteig's user avatar
5 votes
2 answers
5k 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 ...
Pablo's user avatar
  • 202
583 votes
14 answers
788k 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 ...
Łukasz Zaroda's user avatar
212 votes
6 answers
249k 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 ...
Jonathan Komar's user avatar
116 votes
3 answers
93k 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 ...
therealssj's user avatar
  • 1,291
29 votes
6 answers
51k 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 ...
wb9688's user avatar
  • 739
15 votes
1 answer
20k views

Systemd backed tmpfs | How to specify /tmp size manually

I mount /tmp on tmpfs using: sudo systemctl enable tmp.mount sudo systemctl start tmp.mount But this way /tmp takes up all the free RAM: $ df -h /tmp Filesystem Size Used Avail Use% Mounted ...
GMaster's user avatar
  • 6,112
9 votes
1 answer
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 ...
osdamv's user avatar
  • 193
4 votes
7 answers
56k views

Failed to get D-Bus connection: Connection refused

A sudo user named my-host is getting the following error message when trying to reload systemctl on an Amazon Linux 2 EC2 image. [my-host@ip-12-3-4-56 ~]$ systemctl --user daemon-reload Failed to get ...
CodeMed's user avatar
  • 5,149
124 votes
2 answers
213k 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 ...
maxschlepzig's user avatar
  • 56.9k
83 votes
1 answer
34k 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 ...
Michael Hampton's user avatar
5 votes
1 answer
5k 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 ...
muru's user avatar
  • 71.3k
4 votes
1 answer
4k 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 ...
Tulkas's user avatar
  • 53
0 votes
2 answers
2k 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/...
Paweł's user avatar
  • 101
65 votes
4 answers
73k 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 ...
MountainX's user avatar
  • 17.5k
28 votes
2 answers
92k 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/...
don_crissti's user avatar
  • 81.5k
8 votes
1 answer
15k 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, ...
Despruk's user avatar
  • 351
3 votes
3 answers
5k 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 ...
prolificslacker's user avatar
2 votes
1 answer
8k 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 ...
user70436's user avatar
95 votes
5 answers
135k 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 ...
P A N's user avatar
  • 1,711
75 votes
2 answers
20k views

Process with weird random name consuming significant network and CPU resources. Is someone hacking me?

In a VM on a cloud provider, I'm seeing a process with weird random name. It consumes significant network and CPU resources. Here's how the process looks like from pstree view: systemd(1)───...
oldhomemovie's user avatar
  • 1,667
56 votes
5 answers
113k 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 ...
Sai Kurogetsu's user avatar
39 votes
2 answers
33k views

How to start and use ssh-agent as systemd service?

How to start ssh-agent as systemd service? There are some suggestions in the net, but they are not complete. How to add automatically unencrypted keys if ssh-agent service was started successfully? ...
midenok's user avatar
  • 553
23 votes
5 answers
26k 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 ...
lviggiani's user avatar
  • 3,559
17 votes
1 answer
20k 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 ...
Gradient's user avatar
  • 3,609
15 votes
1 answer
14k 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 ...
Wimateeka's user avatar
  • 995
3 votes
1 answer
2k 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 ...
Alex Stragies's user avatar
2 votes
1 answer
5k 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 ...
Subtle Development Space's user avatar
961 votes
6 answers
1.7m 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,...
10robinho's user avatar
  • 9,979
265 votes
12 answers
322k views

The "proper" way to test if a service is running in a script

My problem: I'm writing a bash script and in it I'd like to check if a given service is running. I know how to do this manually, with $ service [service_name] status. But (especially since the move ...
Nick S's user avatar
  • 2,795
146 votes
3 answers
127k views

Why do most systemd examples contain WantedBy=multi-user.target?

I have read what is multi-user.target and the systemd documentation, which states that the multi-user.target is a special target. Further, a lot of the systemd examples contain that line. Why do so ...
Carl's user avatar
  • 1,563
115 votes
6 answers
196k 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 ...
Belmin Fernandez's user avatar
93 votes
14 answers
213k 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 ...
Rodrigo's user avatar
  • 1,762
86 votes
3 answers
219k 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 ...
Piotr Dobrogost's user avatar
85 votes
4 answers
257k 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 ...
Caesar Ralf's user avatar
  • 1,073
49 votes
3 answers
156k views

How does _netdev mount option in /etc/fstab work?

I'd like to know what is the exact mechanism (implementation) used to defer mounting until after network interface is up when one uses _netdev option in /etc/fstab? Does systemd alter this behavior? ...
Piotr Dobrogost's user avatar

1
2 3 4 5
13