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
960 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,969
582 votes
14 answers
785k 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
301 votes
2 answers
468k views

View stdout/stderr of systemd service

I have created a simple systemd service file for a custom application. The application works well when I run it manually, but my CPU gets maxed out when I run it with systemd. I'm trying do track down ...
beatgammit's user avatar
  • 7,493
292 votes
2 answers
541k 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
265 votes
12 answers
321k 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
212 votes
6 answers
248k 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
196 votes
6 answers
101k views

What are the pros/cons of Upstart and systemd?

It appears systemd is the hot new init system on the block, same as Upstart was a few years ago. What are the pros/cons for each? Also, how does each compare to other init systems?
tshepang's user avatar
  • 65k
181 votes
3 answers
526k views

What does "systemctl daemon-reload" do?

I have a service that stopped suddenly. I tried to restart that service but failed and was asked to run: systemctl daemon-reload. What does it exactly do? What is a daemon-reload?
John's user avatar
  • 1,911
179 votes
1 answer
122k views

Executing chdir before starting systemd service

Question: Can I kick off a process with systemd and assign that process a working directory of my choosing? I have a service that I want to start with systemd. When that service is being started, I ...
Mario's user avatar
  • 1,985
175 votes
2 answers
228k 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
154 votes
5 answers
212k views

systemctl status shows : "State: degraded"

When I run systemctl status, I get State: degraded at the top, ● x230 State: degraded Jobs: 0 queued Failed: 1 units Since: Wed 2018-05-30 17:09:49 CDT; 3 days ago .... What's ...
Evan Carroll's user avatar
  • 29.6k
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
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
141 votes
7 answers
149k views

journalctl: how to prevent text from truncating in terminal

How can I keep long strings from truncating in terminal? For example if I run journalctl -xn There's a lot of text that I cannot read. I am open to using other programs/tools.
P.Brian.Mackey's user avatar
127 votes
12 answers
179k views

How to avoid conflicts between dnsmasq and systemd-resolved?

I recently installed dnsmasq to act as DNS Server for my local network. dnsmasq listens on port 53 which is already in use by the local DNS stub listener from systemd-resolved. Just stopping systemd-...
vic's user avatar
  • 2,042
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.8k
120 votes
2 answers
141k views

What are the systemctl options to "List all failed units"

systemctl Returns a list of the units, whether they are loaded, active, their sub and description. systemctl is-failed Returns a list of status only. What is the syntax to return the details of ...
Tai Paul's user avatar
  • 1,311
119 votes
4 answers
194k views

How to troubleshoot DNS with systemd-resolved?

How would you go about finding the DNS servers used by systemd-resolved, for troubleshooting purposes? Generally I can use dig and test the DNS servers shown in /etc/resolv.conf. (Or windows - ...
sourcejedi's user avatar
  • 49.3k
118 votes
4 answers
190k 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
117 votes
5 answers
291k views

How to see the latest x lines from systemctl service log

I'm looking for a way, to simply print the last X lines from a systemctl service in Debian. I would like to install this code into a script, which uses the printed and latest log entries. I've found ...
user3191334's user avatar
  • 1,439
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
115 votes
6 answers
195k 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
114 votes
6 answers
408k views

How can I find available network interfaces?

This is in regard to linux, but if anyone knows of a general *nix method that would be good. I booted a system yesterday with an ethernet cable plugged in. "NetworkManager" is not installed, so once ...
goldilocks's user avatar
114 votes
4 answers
122k views

Systemd service - what is `multi-user.target`

I have come across a .service that contains the following: [Install] WantedBy=multi-user.target The original .service file can be found HERE. I am on Ubuntu 16.04LTS.
eddyP23's user avatar
  • 1,251
106 votes
5 answers
230k views

Systemd Restart=always is not honored

Note: I wrote an article on Medium that explains how to create a service, and how to avoid this particular issue: Creating a Linux service with systemd. Original question: I'm using systemd to keep ...
BenMorel's user avatar
  • 4,507
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
101 votes
2 answers
185k views

What does status "active (exited)" mean for a systemd service?

I'm working with a custom service which essentially runs a web server, called thisismywebserver. Currently it's not working (ie I get an "Unable to Connect" error trying to access a page). When I ...
Highly Irregular'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
93 votes
14 answers
212k 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,752
91 votes
2 answers
79k views

How to tell journald to re-read its configuration?

My question is simple: how do I tell journald to re-read its configuration file without rebooting? I've made some changes to /etc/systemd/journald.conf and I'd like to see if they are correct and ...
lorenzog's user avatar
  • 1,413
90 votes
9 answers
104k views

How to disable `apt-daily.service` on Ubuntu cloud VM image?

The Ubuntu 16.04 server VM image apparently starts the "apt-daily.service" every 12 hours or so; this service performs various APT-related tasks like refreshing the list of available packages, ...
Riccardo Murri's user avatar
88 votes
4 answers
153k 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
87 votes
5 answers
128k views

Combining tail && journalctl

I'm tailing logs of my own app and postgres. tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log I need to include pgpool's logs. It used to be syslog but now it is in journalctl. Is ...
bikey's user avatar
  • 871
86 votes
3 answers
218k 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
256k 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
83 votes
1 answer
33k 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
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
80 votes
1 answer
122k views

How to set ulimits on service with systemd?

How would you set a ulimit on a systemd service unit? This stackoverflow question explains that systemd ignores system ulimits What would the syntax look like to set the following ulimits? ulimit ...
spuder's user avatar
  • 17.9k
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,647
67 votes
2 answers
98k views

systemd timer every 15 minutes

I'm trying to make a systemd timer that runs every 15 minutes. Right now I have: timer-fifteen.timer: [Unit] Description=15min timer [Timer] OnBootSec=0min OnCalendar=*:*:0,15,30,45 Unit=timer-...
Lily Hahn's user avatar
  • 773
65 votes
4 answers
40k views

Change default editor to vim for _ sudo systemctl edit [unit-file] _

[4.13.12-1-ARCH with gnome3 and gdm on Xorg] I already have set my VISUAL and EDITOR env-vars to vim. Similarly I did try SYSTEMD_EDITOR="vim"; export SYSTEMD_EDITOR in my ~/.bashrc, to no avail. ...
Cbhihe's user avatar
  • 2,589
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
65 votes
2 answers
64k views

What is systemd's target, service and socket?

I know that all of them are unit files, but I can't understand the special meaning of them. I think that targets are similar to daemons and sockets are the same as socket (IP + port) but also with ...
drpaneas's user avatar
  • 2,262
65 votes
2 answers
92k views

Can I restart systemd without rebooting?

I'm trying to restart services after a yum update on RHEL 7.4. I could restart every service using systemctl, but needs-restarting from yum utils tells me that I should also restart systemd itself: # ...
BenMorel's user avatar
  • 4,507
63 votes
1 answer
6k views

Crash during startup on a recent corporate computer

After some recent updates, my computer no longer boots! Here's what I could determine: This is a very recent computer that was provided to me by corporate IT. It has a recent Intel CPU (Skylake ...
Gilles 'SO- stop being evil''s user avatar
62 votes
1 answer
100k views

Convenient way to check if system is using systemd or sysvinit in BASH? [duplicate]

I am defining common bash files which I want to use across different distributions. I need a way to check if system is using systemd or sysvinit (/etc/init.d/). I need this so I run appropriate ...
ek9's user avatar
  • 2,885
58 votes
2 answers
56k views

How to override systemd unit file settings?

I have installed MySQL on my Arch Linux server. I moved the data directory to a place under /home, where my RAID volume is mounted. I noticed that mysqld will not start in this configuration by ...
fdmillion's user avatar
  • 2,768
58 votes
1 answer
64k views

Listening for journalctl changes

Usually I use tail -f /var/log/messages to get updates if there are new lines. How to have the similar functionality for journalctl?
Kokizzu's user avatar
  • 9,467
57 votes
4 answers
20k views

Can I prevent "service foo status" from paging its output through "less"?

How do you stop the command service <name> status from using less on its output? I have a script that automates some sysadmin actions, and after I upgraded my server to Ubuntu 16.04, it's ...
Cerin's user avatar
  • 1,619
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

1
2 3 4 5
90