Skip to main content
120 votes
Accepted

systemd forking vs simple?

When you start the service manually from the command line (without using the nohupprefix command or the & suffix to run it in the background, or in other words, just run the command you would put ...
telcoM's user avatar
  • 4,477
95 votes

How to remove systemd services

You are probably looking for reset-failed: $ sudo systemctl reset-failed $ From the systemd man page: reset-failed [PATTERN...] Reset the "failed" state of the specified units, or if no unit ...
Vebjorn Ljosa's user avatar
74 votes
Accepted

Activation via systemd failed for unit 'dbus-org.freedesktop.resolve1.service': Unit dbus-org.freedesktop.resolve1.service not found

This problem is related to the network-manager and systemd-resolved.service. After reading the the manjaro forums and the arch wiki You have 2 options configure network-manager to not use systemd-...
nelaaro's user avatar
  • 13.7k
69 votes
Accepted

How do I figure out why systemctl service "systemd-modules-load" fails?

I too had this issue. I was able to solve it by following the instructions on the Arch Linux systemd wiki page. Here is a summary of what I did : Lets find the systemd services which fail to start ...
Rahul Khimasia's user avatar
57 votes
Accepted

Restart Systemd service automatically whenever a directory changes (any file inside it)

Michal Politowski's comment is exactly correct. I use this method to automatically restart services when new artifacts are deployed. It is very helpful. To be clear, you need: srv.service [Unit] ...
John's user avatar
  • 686
50 votes
Accepted

Writing a service that depends on Xorg

I've been researching this and grawity's answer seems out of date. You can now setup user services with systemd that run with as part of the user's session. They can have DISPLAY and XAUTHORITY set (...
John Eikenberry's user avatar
50 votes
Accepted

How to debug systemd-networkd?

From https://coreos.com/os/docs/latest/network-config-with-networkd.html : Enable debugging manually mkdir -p /etc/systemd/system/systemd-networkd.service.d/ Create Drop-In /etc/systemd/system/...
Anon's user avatar
  • 1,379
49 votes
Accepted

Ubuntu 17.04 systemd-resolved DNS lookups randomly fail

Ubuntu 17.04 can not resolve DNS servers with DNSSEC support as of 2017-04-18. Disable DNSSEC with this daemon: sudo mkdir -p /etc/systemd/resolved.conf.d printf "[Resolve]\nDNSSEC=no\n" | sudo tee /...
Sajad Bahmani's user avatar
49 votes

systemctl --user Failed to connect to bus: No such file or directory Debian 9

There must be a /lib/systemd/systemd --user process for the user you're running this for. Check with: ps aux | grep systemd. In my case the process didn't exist because I was trying to setup ...
Roger Dueck's user avatar
48 votes

systemd - Giving my service multiple arguments

I wanted to do the same thing, but without a separate file for each combination of arguments. I found that I could pass one long argument with spaces and then use systemd's environment variable space-...
nonagon's user avatar
  • 583
47 votes

what causes “systemd: Failed at step USER spawning /usr/sbin/opendkim: No such process”

I've just ran into this and in my case it was caused by quoting a user name in my service file: [Unit] Description=Demonstrate Failed at step USER spawning ...: No such process error when user name ...
Tad Lispy's user avatar
  • 931
46 votes
Accepted

How does WSL/WSL2/WSLg work without systemd?

Update: Systemd support is now available in WSL2 and (update #2) now on both Windows 10 and Windows 11. As noted in my original answer (below) and others here, it's not required, and is opt-in. ...
NotTheDr01ds's user avatar
  • 23.2k
43 votes
Accepted

How to know if I am using systemd on Linux?

I know this is an old question, but since I was just asking myself the same question - here are my 2ct. Best solution I came up with ps --no-headers -o comm 1 This returns either systemd or init ...
sborsky's user avatar
  • 979
37 votes

How to find out the systemd version on Raspbian

Ask it: $ /sbin/init --version systemd 123 $ systemctl --version systemd 123 You can also ask the package manager: $ dpkg -l systemd ||/ Name Version Architecture Description ++...
29 votes
Accepted

How to start a systemd service after user login and stop it before user logout

Use systemd it already includes support for user sessions, in fact you should already depend on it (unwittingly). Create the service directory mkdir -p $HOME/.local/share/systemd/user Create edit a ...
anx's user avatar
  • 406
29 votes
Accepted

How to disable systemd service in rescue mode

To disable it, you call systemctl disable <service>. Without arguments, systemctl displays the current state, which is obviously not possible in a chroot. Alternatively, you can also go to /...
Daniel B's user avatar
  • 63.7k
27 votes

How does WSL/WSL2/WSLg work without systemd?

Systemd is actually a fairly recent project, having been started in ~2010. Many others have been used before it: sysvinit, upstart, init-ng, s6, launchd (I think it had a Linux version once). Several ...
grawity_u1686's user avatar
26 votes
Accepted

How to follow systemd unit log?

I've found out I'm using the arguments in a bad order. Logs can actually be followed for a single unit by using: journalctl -fu my_unit.service Other working variations: journalctl -f -u my_unit....
jirislav's user avatar
  • 573
24 votes
Accepted

Is there any strategy for *really* disabling systemd services? Some start up even after disabling with systemctl

"Disabling" a service in systemd is mostly equivalent to "removing from runlevel" in other init systems (it removes the service from 'multi-user.target' dependency tree). Most of ...
grawity_u1686's user avatar
23 votes
Accepted

How to logrotate with systemd?

Increasing Storage If you are storing to disk you can increase the amount of space used by changing SystemMaxUse and/or SystemKeepFree. Having more space would allow more entries to be stored. By ...
DougC's user avatar
  • 364
20 votes

Systemd error : Executable path is not absolute

You can't use exec in a systemd service unit configuration. exec is a shell built-in and cannot be called directly from the filesystem (it doesn't reside on the filesystem) -- type exec and whereis ...
Fanatique's user avatar
  • 4,658
20 votes
Accepted

Systemd service - Python script inside Screen on boot

Type=simple expects the service's main process to continue running forever. Your actual command, however, is telling Screen to do the opposite – start a new session and fork to background. When ...
grawity_u1686's user avatar
19 votes

Why is systemd stopping service immediately after it is started?

None of the above and similar SO answers worked for me. But this post eventually did. [Unit] Description=Setup foo #After=network.target [Service] Type=oneshot ExecStart=/opt/foo/setup-foo.sh ...
Avio's user avatar
  • 927
18 votes

How to remove systemd services

Adding on to @mark-lakata's answer and keeping in mind the attentiveness required for the rm command. [chkconfig] can simplify the process!(click here to read about chkconfig) To re-iterate the list ...
garlicFrancium's user avatar
18 votes

Restart Systemd service automatically whenever a directory changes (any file inside it)

The answer above is almost great, but it's missing a few things that took me a while to figure out. Others came across the same issues, see the comments section. systemctl enable srv-watcher.{path,...
Drew's user avatar
  • 291
17 votes
Accepted

Is /var/run/user/$UID the new /var/run for PID files?

You ask: Is /var/run/user/$UID the new /var/run for PID files? The short answer is "no". And the long answer still is "no". Or to say it loud and clear: Traditional PID files must not go below /...
Tino's user avatar
  • 1,196
17 votes
Accepted

PermissionsStartOnly alternative in systemd

Setting PermissionsStartOnly=true means that User & Group are only applied to ExecStart. So switching to the new syntax will be : ExecStartPre=+/bin/bash -c '/bin/journalctl -b -u ntpdate | /bin/...
Reda Salih's user avatar
16 votes
Accepted

systemd keeps respawning pulseaudio, and doesn't allow me to stop it

To stop user services it's necessary to use the parameter --user: systemctl --user stop pulseaudio.socket systemctl --user stop pulseaudio.service
diogovk's user avatar
  • 448
15 votes

cant start systemd - Failed to get D-Bus connection

Resolution Install systemd-sysv: apt install systemd-sysv Explanation Failed to get D-Bus connection: Unknown error -1 means that systemd is not running. Here is my LMDE 2 installation, which is ...
Deltik's user avatar
  • 19.7k
15 votes
Accepted

How can I use Monit to monitor a service that does not have a /var/run/ pid file or how can I create a pid file?

If all you want is to know whether the service is running, you can query systemd: systemctl is-active TestApp.service You can also check whether it is inactive specifically due to a known failure: ...
grawity_u1686's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible