Difference between revisions of "En:Systemd FAQ"

From Sabayon Wiki
Jump to: navigation, search
(What other units does a unit depend on?)
Line 35: Line 35:
 
For example, if you want to figure out which services a target like multi-user.target pulls in, use something like this:  
 
For example, if you want to figure out which services a target like multi-user.target pulls in, use something like this:  
  
$ systemctl show -p "Wants" multi-user.target
+
$ systemctl show -p "Wants" multi-user.target
  
 
Instead of Wants you might also try WantedBy, Requires, RequiredBy, Conflicts, ConflictedBy, Before, After for the respective types of dependencies and their inverse.
 
Instead of Wants you might also try WantedBy, Requires, RequiredBy, Conflicts, ConflictedBy, Before, After for the respective types of dependencies and their inverse.

Revision as of 18:22, 31 October 2013

i18n: en

Frequently Asked Questions

For an up-to-date list of known issues, look at the upstream TODO.

How do I change the number of gettys running by default?

To add another getty, simply place another symlink for instantiating another getty in the /etc/systemd/system/getty.target.wants/ directory:

# ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
# systemctl start getty@tty9.service

To remove a getty, simply remove the getty symlinks you want to get rid of in the /etc/systemd/system/getty.target.wants/ directory:

# rm /etc/systemd/system/getty.target.wants/getty@{tty5,tty6}.service
# systemctl stop getty@tty5.service getty@tty6.service

systemd does not use the /etc/inittab file.

Question.png
As of systemd 30, only one getty will be launched by default. If you switch to another tty, a getty will be launched there (socket-activation style). You can still force additional agetty processes to start using the above methods.

Users may also change the number of gettys that may be auto-spawned by editing /etc/systemd/logind.conf and changing the value of NAutoVTs. By doing it this way, the on-demand spawning will be preserved, whereas the above method will simply have the gettys running from boot.}}

How do I get more verbose output during boot?

If you see no output at all in console after the initram message, this means you have the quiet parameter in your kernel line. It's best to remove it, at least the first time you boot with systemd, to see if everything is ok. Then, You will see a list [ OK ] in green or [ FAILED ] in red.

Any messages are logged to the system log and if you want to find out about the status of your system run systemctl (no root privileges required) or look at the boot/system log with journalctl

How do I avoid clearing the console after boot?

Create a custom getty@tty1.service file by copying /usr/lib/systemd/system/getty@.service to /etc/systemd/system/getty@tty1.service and change TTYVTDisallocate to no

What other units does a unit depend on?

For example, if you want to figure out which services a target like multi-user.target pulls in, use something like this:

$ systemctl show -p "Wants" multi-user.target

Instead of Wants you might also try WantedBy, Requires, RequiredBy, Conflicts, ConflictedBy, Before, After for the respective types of dependencies and their inverse.

My computer shuts down, but the power stays on

Use:

$ systemctl poweroff

Instead of systemctl halt

After migrating to systemd, why won't my fakeRAID mount?

Be sure you use:

  1. systemctl enable dmraid.service

How can I make a script start during the boot process?

Create a new file in /etc/systemd/system (e.g. myscript.service) and add the following contents:

[Unit]
Description=My script

[Service]
ExecStart=/usr/bin/my-script

[Install]
WantedBy=multi-user.target 

Then:

# systemctl enable myscript.service

This example assumes you want your script to start up when the target multi-user is launched. Also do chmod 755 to your script to enable execute permissions if you haven't done so already.

Question.png
In case you want to start a shell script, make sure you have #!/bin/sh in the first line of the script. Do not write something like ExecStart=/bin/sh /path/to/script.sh because that will not work.

Status of .service says "active (exited)" in green. (e.g. iptables)

This is perfectly normal. In the case with iptables it is because there is no daemon to run, it is controlled in the kernel. Therefore, it exits after the rules have been loaded.

To check if your iptables rules have been loaded properly:

  1. iptables --list

Failed to issue method call: File exists error

This happens when using systemctl enable and the symlink it tries to create in /etc/systemd/system/ already exists. Typically this happens when switching from one display manager to another one (for instance GDM to KDM, which can be enabled with gdm.service and kdm.service, respectively) and the corresponding symlink /etc/systemd/system/display-manager.service already exists.

To solve this problem, either first disable the relevent display manager before enabling the new one, or use systemctl -f enable to overwrite an existing symlink.