]> git.ipfire.org Git - thirdparty/systemd.git/blame - docs/FAQ.md
Merge pull request #32324 from mrc0mmand/more-website-fixes
[thirdparty/systemd.git] / docs / FAQ.md
CommitLineData
6b2a2776 1---
2title: Frequently Asked Questions
3category: Manuals and Documentation for Users and Administrators
4layout: default
5SPDX-License-Identifier: LGPL-2.1-or-later
6---
7
8# Frequently Asked Questions
9
0d592a5e 10Also check out the [Tips & Tricks](/TIPS_AND_TRICKS)!
6b2a2776 11
12**Q: How do I change the current runlevel?**
13
14A: In systemd runlevels are exposed via "target units". You can change them like this:
15
16```sh
17# systemctl isolate runlevel5.target
18```
19
20Note however, that the concept of runlevels is a bit out of date, and it is usually nicer to use modern names for this. e.g.:
21
22```sh
23# systemctl isolate graphical.target
24```
25
26This will only change the current runlevel, and has no effect on the next boot.
27
28**Q: How do I change the default runlevel to boot into?**
29
30A: The symlink /etc/systemd/system/default.target controls where we boot into by default. Link it to the target unit of your choice. For example, like this:
31
32```sh
33# ln -sf /usr/lib/systemd/system/multi-user.target /etc/systemd/system/default.target
34```
35
36or
37
38```sh
39# ln -sf /usr/lib/systemd/system/graphical.target /etc/systemd/system/default.target
40```
41
42**Q: How do I figure out the current runlevel?**
43
44A: Note that there might be more than one target active at the same time. So the question regarding _the_ runlevel might not always make sense. Here's how you would figure out all targets that are currently active:
45
46```sh
47$ systemctl list-units --type=target
48```
49
50If you are just interested in a single number, you can use the venerable _runlevel_ command, but again, its output might be misleading.
51
52**Q: I want to change a service file, but rpm keeps overwriting it in /usr/lib/systemd/system all the time, how should I handle this?**
53
54A: The recommended way is to copy the service file from /usr/lib/systemd/system to /etc/systemd/system and edit it there. The latter directory takes precedence over the former, and rpm will never overwrite it. If you want to use the distributed service file again you can simply delete (or rename) the service file in /etc/systemd/system again.
55
56**Q: My service foo.service as distributed by my operating system vendor is only started when (a connection comes in or some hardware is plugged in). I want to have it started always on boot, too. What should I do?**
57
58A: Simply place a symlink from that service file in the multi-user.target.wants/ directory (which is where you should symlink everything you want to run in the old runlevel 3, i.e. the normal boot-up without graphical UI. It is pulled in by graphical.target too, so will be started for graphical boot-ups, too):
59
60```sh
61# ln -sf /usr/lib/systemd/system/foobar.service /etc/systemd/system/multi-user.target.wants/foobar.service
62# systemctl daemon-reload
63```
64
65**Q: I want to enable another getty, how would I do that?**
66
67A: Simply instantiate a new getty service for the port of your choice (internally, this places another symlink for instantiating another serial getty in the getty.target.wants/ directory).
68```sh
69# systemctl enable serial-getty@ttyS2.service
70# systemctl start serial-getty@ttyS2.service
71```
72
565e2396 73Note that gettys on the virtual console are started on demand. You can control how many you get via the NAutoVTs= setting in [logind.conf(7)](http://www.freedesktop.org/software/systemd/man/systemd-logind.service).
74Also see [this blog story](http://0pointer.de/blog/projects/serial-console.html).
6b2a2776 75
76**Q: How to I figure out which service a process belongs to?**
77
78A: You may either use ps for that:
79
80```sh
81$ alias psc='ps xawf -eo pid,user,cgroup,args'
82$ psc
83...
84```
85
86Or you can even check /proc/$PID/cgroup directly. Also see [this blog story](http://0pointer.de/blog/projects/systemd-for-admins-2.html).
87
88**Q: Why don't you use inotify to reload the unit files automatically on change?**
89
90A: Unfortunately that would be a racy operation. For an explanation why and how we tried to improve the situation, see [the bugzilla report about this](https://bugzilla.redhat.com/show_bug.cgi?id=615527).
91
92**Q: I have a native systemd service file and a SysV init script installed which share the same basename, e.g. /usr/lib/systemd/system/foobar.service vs. /etc/init.d/foobar -- which one wins?**
93
94A: If both files are available the native unit file always takes precedence and the SysV init script is ignored, regardless whether either is enabled or disabled. Note that a SysV service that is enabled but overridden by a native service does not have the effect that the native service would be enabled, too. Enabling of native and SysV services is completely independent. Or in other words: you cannot enable a native service by enabling a SysV service by the same name, and if a SysV service is enabled but the respective native service is not, this will not have the effect that the SysV script is executed.
95
96**Q: How can I use journalctl to display full (= not truncated) messages even if less is not used?**
97
98A: Use:
99
100```sh
101# journalctl --full
102```
103
104
105**Q: Whenever my service tries to acquire RT scheduling for one of its threads this is refused with EPERM even though my service is running with full privileges. This works fine on my non-systemd system!**
106
0d592a5e 107A: By default, systemd places all systemd daemons in their own cgroup in the "cpu" hierarchy. Unfortunately, due to a kernel limitation, this has the effect of disallowing RT entirely for the service. See [My Service Can't Get Realtime!](/MY_SERVICE_CANT_GET_REATLIME) for a longer discussion and what to do about this.
6b2a2776 108
109**Q: My service is ordered after `network.target` but at boot it is still called before the network is up. What's going on?**
110
0d592a5e 111A: That's a long story, and that's why we have a wiki page of its own about this: [Running Services After the Network is up](/NETWORK_ONLINE)
6b2a2776 112
113**Q: My systemd system always comes up with `/tmp` as a tiny `tmpfs`. How do I get rid of this?**
114
0d592a5e 115A: That's also a long story, please have a look on [API File Systems](/API_FILE_SYSTEMS)