Fix Systemd.

This commit is contained in:
Robert Krátký 2018-01-21 18:04:05 +01:00
parent 78459f6c61
commit 46e675ef15
12 changed files with 80 additions and 743 deletions

View file

@ -40,8 +40,8 @@ Topics:
File: switching-desktop-environments File: switching-desktop-environments
- Name: Finding and installing Linux applications - Name: Finding and installing Linux applications
File: finding-and-installing-linux-applications File: finding-and-installing-linux-applications
- Name: (FIX ME!) Third party repositories - Name: Understanding and administering Systemd
File: 3rd-party-repos File: understanding-and-administering-systemd
- Name: (FIX ME!) Anaconda - Name: (FIX ME!) Anaconda
File: anaconda File: anaconda
- Name: (FIX ME!) AutoUpdates - Name: (FIX ME!) AutoUpdates
@ -98,10 +98,6 @@ Topics:
File: repositories File: repositories
- Name: (FIX ME!) How to reset a root password - Name: (FIX ME!) How to reset a root password
File: reset-root-password File: reset-root-password
- Name: (FIX ME!) Systemd
File: systemd
- Name: (FIX ME!) SysVinit to Systemd Cheatsheet
File: sysvinit-to-systemd-cheatsheet
- Name: (FIX ME!) Using UEFI with QEMU - Name: (FIX ME!) Using UEFI with QEMU
File: uefi-with-qemu File: uefi-with-qemu
- Name: (FIX ME!) Upgrading - Name: (FIX ME!) Upgrading

View file

@ -1,80 +0,0 @@
= Third party repositories
'''
[IMPORTANT]
======
This page was automatically converted from https://fedoraproject.org/wiki/Third_party_repositories
It is probably
* Badly formatted
* Missing graphics and tables that do not convert well from mediawiki
* Out-of-date
* In need of other love
Please fix it, remove this notice, and then add to `_topic_map.yml`
Pull requests accepted at https://pagure.io/fedora-docs/quick-docs
Once that is live, go to the original wiki page and add an `{{old}}`
tag, followed by a note like
....
{{admon/note|This page has a new home!|
This wiki page is no longer maintained. Please find the up-to-date
version at: https://docs.fedoraproject.org/whatever-the-url
}}
....
======
'''
There are a number of third-party software repositories for Fedora. They
typically have more liberal licensing policies and provide software
packages that Fedora excludes for various reasons. These software
repositories are not officially affiliated or endorsed by the Fedora
Project. Use them at your own discretion. A detailed list is maintained
at https://ask.fedoraproject.org/en/question/39797/[Ask Fedora page]
The following repositories are commonly used by end users and do not
conflict with each other
* http://rpmfusion.org
* http://rpm.livna.org (Complementary to RPM Fusion)
There are a number of other repositories listed below but many of them
are known to explicitly conflict with each other and hence not
recommended unless you are a power user and know the technical aspects
better.
* http://rpmfusion.org/FedoraThirdPartyRepos
[[mixing-third-party-software-repositories]]
Mixing third party software repositories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We generally do not recommend mixing a lot of third party repositories
since they might conflict with each other causing instability and hard
to debug issues. If you are not a technical user, one safer method is to
not enable the third-party repo by default and instead use the
`--enablerepo` switch for `yum|dnf`, or a similar method configurable in
the graphical package manager. There are a number of yum|dnf plugins for
setting repo priorities or protecting the base packages from being
obsoleted by third party repositories which are helpful to more
technical users.
[[references]]
References
~~~~~~~~~~
* http://thread.gmane.org/gmane.linux.redhat.fedora.advisory-board/3288
* http://fedoraproject.org/wiki/Objectives
* http://fedoraproject.org/wiki/Forbidden_items
'''
See a typo, something missing or out of date, or anything else which can be
improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.

View file

@ -1,5 +1,5 @@
[#systemd] [id='understanding-systemd']
= Systemd = Understanding Systemd
Systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. Systemd provides: Systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. Systemd provides:
@ -48,4 +48,4 @@ slice::
Restrivtion of resources through Linux Control Group nodes (cgroups). Restrivtion of resources through Linux Control Group nodes (cgroups).
scope:: scope::
Information from Systemd bus interfaces. Usually used to manage external system processes. Information from Systemd bus interfaces. Usually used to manage external system processes.

View file

@ -36,9 +36,10 @@ Requires=network.target
. Identify the command used to start the service in the SysVinit script and convert this to the Systemd equivalent. For example, the script might contain a `start` function in the following format: . Identify the command used to start the service in the SysVinit script and convert this to the Systemd equivalent. For example, the script might contain a `start` function in the following format:
+ +
[source,bash]
---- ----
start() { start() {
echo "Starting My Custom Service..." echo "Starting My Custom Service..."
/usr/bin/myservice -D /usr/bin/myservice -D
} }
---- ----
@ -52,9 +53,10 @@ ExecStart=/usr/bin/myservice -D
. Check the SysVinit script to see if the service uses a special command to restart the service. For example, the script might contain a `reboot` function that reloads the service: . Check the SysVinit script to see if the service uses a special command to restart the service. For example, the script might contain a `reboot` function that reloads the service:
+ +
[source,bash]
---- ----
reboot() { reboot() {
echo "Reloading My Custom Service..." echo "Reloading My Custom Service..."
/usr/bin/myservice reload /usr/bin/myservice reload
} }
---- ----
@ -70,9 +72,10 @@ Alternatively, you can omit `ExecReload` and use the default behavior, which kil
. Check the SysVinit script to see if the service uses a special command to stop the service. For example, the script might contain a `stop` function that reloads the service: . Check the SysVinit script to see if the service uses a special command to stop the service. For example, the script might contain a `stop` function that reloads the service:
+ +
[source,bash]
---- ----
reboot() { reboot() {
echo "Stopping My Custom Service..." echo "Stopping My Custom Service..."
/usr/bin/myservice shutdown /usr/bin/myservice shutdown
} }
---- ----
@ -90,4 +93,4 @@ Alternatively, you can omit `ExecStop` and use the default behavior, which kills
.Related Information .Related Information
* See <<#common-service-parameters>> for more information about the parameters used in this procedure. * See link:#common-service-parameters[Common service parameters] for more information about the parameters used in this procedure.

View file

@ -14,7 +14,7 @@ This procedure creates a basic configuration file to control the `foo` service.
. Create and edit the new configuration file: . Create and edit the new configuration file:
+ +
---- ----
$ sudo vi /etc/systemd/system/foo.service # vi /etc/systemd/system/foo.service
---- ----
. The next few steps describe each section its parameters to add to the file: . The next few steps describe each section its parameters to add to the file:
@ -74,7 +74,7 @@ Save the file.
. Start the custom `foo` service: . Start the custom `foo` service:
+ +
---- ----
$ sudo systemctl start foo # systemctl start foo
---- ----
. Check the status of the service to ensure the service is running: . Check the status of the service to ensure the service is running:
@ -94,4 +94,4 @@ Dec 14 14:09:12 dansmachine systemd[1]: Started My custom service.
.Related Information .Related Information
* See <<#common-service-parameters>> for more information about the parameters used in this procedure. * See link:#common-service-parameters[Common service parameters] for more information about the parameters used in this procedure.

View file

@ -14,13 +14,13 @@ This example shows how to modify an existing service. The files for service modi
. Create a directory for the service modification in the following format: `[SERVICE NAME].service.d`. For example, the directory for the `httpd.service` modification is `httpd.service.d`: . Create a directory for the service modification in the following format: `[SERVICE NAME].service.d`. For example, the directory for the `httpd.service` modification is `httpd.service.d`:
+ +
---- ----
$ sudo mkdir /etc/systemd/system/httpd.service.d/ # mkdir /etc/systemd/system/httpd.service.d/
---- ----
. Create a configuration file within this directory: . Create a configuration file within this directory:
+ +
---- ----
$ sudo vi /etc/systemd/system/httpd.service.d/custom.conf # vi /etc/systemd/system/httpd.service.d/custom.conf
---- ----
. Add your custom configuration. For example: . Add your custom configuration. For example:
@ -36,9 +36,9 @@ RestartSec=30
. Restart the `httpd` service: . Restart the `httpd` service:
+ +
---- ----
$ sudo systemctl restart httpd # systemctl restart httpd
---- ----
.Related Information .Related Information
* See <<#common-service-parameters>> for more information about the parameters used in this procedure. * See link:#common-service-parameters[Common service parameters] for more information about the parameters used in this procedure.

View file

@ -5,7 +5,7 @@ You can perform various management tasks to control Systemd services using the `
.Prerequisites .Prerequisites
* You are logged in as a user with administrator-level permissions. You are logged in as a user with administrator-level permissions.
.Procedure .Procedure
@ -14,51 +14,51 @@ The following commands control the `foo` service:
* Activate a service immediately: * Activate a service immediately:
+ +
---- ----
$ sudo systemctl start foo # systemctl start foo
---- ----
* Deactivate a service immediately: * Deactivate a service immediately:
+ +
---- ----
$ sudo systemctl stop foo # systemctl stop foo
---- ----
* Restart a service: * Restart a service:
+ +
---- ----
$ sudo systemctl restart foo # systemctl restart foo
---- ----
* Show the status of a service including if it is running or not: * Show the status of a service including if it is running or not:
+ +
---- ----
$ sudo systemctl status foo # systemctl status foo
---- ----
* Enable a service to be started on bootup: * Enable a service to be started on bootup:
+ +
---- ----
$ sudo systemctl enable foo # systemctl enable foo
---- ----
* Disable a service to not start during bootup: * Disable a service to not start during bootup:
+ +
---- ----
$ sudo systemctl disable foo # systemctl disable foo
---- ----
* Prevent a service from starting dynamically or even manually unless unmasked: * Prevent a service from starting dynamically or even manually unless unmasked:
+ +
---- ----
$ sudo systemctl mask foo # systemctl mask foo
---- ----
* Check if a service is already enabled or not: * Check if a service is already enabled or not:
+ +
---- ----
$ sudo systemctl is-enabled foo # systemctl is-enabled foo
---- ----
.Related Information .Related Information
* Run `man systemctl` for more details. * Run `man systemctl` for more details.

View file

@ -115,4 +115,4 @@ Restart::
* `on-failure` - Restart only when the service process does not exit cleanly (node-zero exit code). * `on-failure` - Restart only when the service process does not exit cleanly (node-zero exit code).
* `on-abnormal` - Restart if the process terminates with a signal or when a timeout occurs. * `on-abnormal` - Restart if the process terminates with a signal or when a timeout occurs.
* `on-abort` - Restart if the process exits due to an uncaught signal not specified as a clean exit status. * `on-abort` - Restart if the process exits due to an uncaught signal not specified as a clean exit status.
* `always` - Always restart. * `always` - Always restart.

View file

@ -3,60 +3,40 @@
The following table demonstrates the Systemd equivalent of SysVinit commands. The following table demonstrates the Systemd equivalent of SysVinit commands.
[NOTE] NOTE: All recent versions of systemctl assume the `.service` suffix if left off the service name. For example, `systemctl start frobozz.service` is the same as `systemctl start frobozz`.
All recent versions of systemctl assume the '.service' suffix if left off the service name. For example, 'systemctl start frobozz.service' is the same as 'systemctl start frobozz'
[cols=",,",options="header",] [cols=",,",options="header",]
|=== |===
|Sysvinit Command |Systemd Command |Notes |Sysvinit Command |Systemd Command |Notes
|service frobozz start |systemctl start frobozz |Used to start a service |`service frobozz start`|`systemctl start frobozz`|Used to start a service (not reboot persistent)
(not reboot persistent)
|service frobozz stop |systemctl stop frobozz |Used to stop a service |`service frobozz stop`|`systemctl stop frobozz`|Used to stop a service (not reboot persistent)
(not reboot persistent)
|service frobozz restart |systemctl restart frobozz |Used to stop and |`service frobozz restart`|`systemctl restart frobozz`|Used to stop and then start a service
then start a service
|service frobozz reload |systemctl reload frobozz |When supported, |`service frobozz reload`|`systemctl reload frobozz`|When supported, reloads the config file without interrupting pending operations.
reloads the config file without interrupting pending operations.
|service frobozz condrestart |systemctl condrestart frobozz |Restarts if |`service frobozz condrestart`|`systemctl condrestart frobozz`|Restarts if the service is already running.
the service is already running.
|service frobozz status |systemctl status frobozz |Tells whether a |`service frobozz status`|`systemctl status frobozz`|Tells whether a service is currently running.
service is currently running.
|ls /etc/rc.d/init.d/ |systemctl (or) systemctl list-unit-files |`ls /etc/rc.d/init.d/`|`systemctl` or `systemctl list-unit-files --type=service` or +
--type=service (or) + `ls /lib/systemd/system/*.service /etc/systemd/system/*.service`|Used to list the services that can be started or stopped +
ls /lib/systemd/system/*.service /etc/systemd/system/*.service |Used to
list the services that can be started or stopped +
Used to list all the services and other units Used to list all the services and other units
|chkconfig frobozz on |systemctl enable frobozz |Turn the service on, |`chkconfig frobozz on`|`systemctl enable frobozz`|Turn the service on, for start at next boot, or other trigger.
for start at next boot, or other trigger.
|chkconfig frobozz off |systemctl disable frobozz |Turn the service off |`chkconfig frobozz off`|`systemctl disable frobozz`|Turn the service off for the next reboot, or any other trigger.
for the next reboot, or any other trigger.
|chkconfig frobozz |systemctl is-enabled frobozz |Used to check whether |`chkconfig frobozz`|`systemctl is-enabled frobozz`|Used to check whether a service is configured to start or not in the current environment.
a service is configured to start or not in the current environment.
|chkconfig --list |systemctl list-unit-files --type=service (or) ls |`chkconfig --list`|`systemctl list-unit-files --type=service` or `ls /etc/systemd/system/*.wants/`|Print a table of services that lists which runlevels each is configured on or off
/etc/systemd/system/*.wants/ |Print a table of services that lists which
runlevels each is configured on or off
|chkconfig --list | grep 5:on |systemctl list-dependencies |`chkconfig --list \| grep 5:on`|`systemctl list-dependencies graphical.target`|Print a table of services that will be started when booting into graphical mode
graphical.target |Print a table of services that will be started when
booting into graphical mode
|chkconfig frobozz --list |ls |`chkconfig frobozz --list`|`ls /etc/systemd/system/*.wants/frobozz.service`|Used to list what levels this service is configured on or off
/etc/systemd/system/*.wants/frobozz.service |Used to list what levels
this service is configured on or off
|chkconfig frobozz --add |systemctl daemon-reload |Used when you create |`chkconfig frobozz --add`|`systemctl daemon-reload`|Used when you create a new service file or modify any configuration
a new service file or modify any configuration
|=== |===
[NOTE] NOTE: All `/sbin/service` and `/sbin/chkconfig` commands listed in the table continue to work on Systemd-based systems and are translated to native equivalents as necessary. The only exception is `chkconfig --list`.
All `/sbin/service` and `/sbin/chkconfig` commands listed in the table continue to work on Systemd-based systems and are translated to native equivalents as necessary. The only exception is `chkconfig --list`.

View file

@ -1,423 +0,0 @@
= Systemd
'''
[IMPORTANT]
======
This page was automatically converted from https://fedoraproject.org/wiki/Systemd
It is probably
* Badly formatted
* Missing graphics and tables that do not convert well from mediawiki
* Out-of-date
* In need of other love
Please fix it, remove this notice, and then add to `_topic_map.yml`
Pull requests accepted at https://pagure.io/fedora-docs/quick-docs
Once that is live, go to the original wiki page and add an `{{old}}`
tag, followed by a note like
....
{{admon/note|This page has a new home!|
This wiki page is no longer maintained. Please find the up-to-date
version at: https://docs.fedoraproject.org/whatever-the-url
}}
....
======
'''
systemd is a system and service manager for Linux, compatible with SysV
and LSB init scripts. systemd provides aggressive parallelization
capabilities, uses socket and D-Bus activation for starting services,
offers on-demand starting of daemons, keeps track of processes using
Linux cgroups, supports snapshotting and restoring of the system state,
maintains mount and automount points and implements an elaborate
transactional dependency-based service control logic. It can work as a
drop-in replacement for sysvinit. For more information, watch the video
at http://www.youtube.com/watch?v=TyMLi8QF6sw
[[why-systemd]]
Why systemd?
~~~~~~~~~~~~
http://0pointer.de/blog/projects/why.html
[[systemd-documentation]]
systemd documentation
~~~~~~~~~~~~~~~~~~~~~
systemd has very comprehensive documentation. Refer to
http://0pointer.de/blog/projects/systemd-docs.html
[[boot-kernel-command-line]]
Boot Kernel Command Line
~~~~~~~~~~~~~~~~~~~~~~~~
On boot *systemd* activates (by default), the target unit
_default.target_ whose job is to activate services and other units by
pulling them in via dependencies.
To override the unit to activate, *systemd* parses its own kernel
command line arguments via the `systemd.unit=` command line option. This
may be used to temporarily boot into a different boot unit. The
classical run-levels are replaced as following:
`systemd.unit=rescue.target` is a special target unit for setting up the
base system and a rescue shell (similar to run level 1);
`systemd.unit=emergency.target`, is very similar to passing
`init=/bin/sh` but with the option to boot the full system from there;
`systemd.unit=multi-user.target` for setting up a non-graphical
multi-user system; `systemd.unit=graphical.target` for setting up a
graphical login screen.
For details about these special systemd boot units, view the man
`systemd.special` page. it scripts
[[what-is-the-tool-to-manage-services-with-systemd]]
What is the tool to manage services with systemd?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
systemctl is the primary tool to use. It combines the functionality of
both service and chkconfig into a single tool that you can use for
instance to enable/disable services permanently or only for the current
session.
list all running services etc:
....
systemctl
....
Refer to man systemctl for more details. systemd-cgls lists the running
process in a tree format. It can recursively show the content of any
given control group. Refer to man systemd-cgls for more details.
[[how-do-i-startstop-or-enabledisable-services]]
How do I start/stop or enable/disable services?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Activates a service immediately:
....
systemctl start foo
....
Deactivates a service immediately:
....
systemctl stop foo
....
Restarts a service:
....
systemctl restart foo
....
Shows status of a service including whether it is running or not:
....
systemctl status foo
....
Enables a service to be started on bootup:
....
systemctl enable foo
....
Disables a service to not start during bootup:
....
systemctl disable foo
....
Prevent a service from starting dynamically or even manually unless
unmasked:
....
systemctl mask foo
....
Check whether a service is already enabled or not:
....
systemctl is-enabled foo
....
Refer to man systemctl for more details.
[[how-do-i-change-the-target-runlevel]]
How do I change the target (runlevel)?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
systemd has the concept of targets which is a more flexible replacement
for runlevels in sysvinit.
Run level 3 is emulated by multi-user.target. Run level 5 is emulated by
graphical.target. runlevel3.target is a symbolic link to
multi-user.target and runlevel5.target is a symbolic link to
graphical.target.
You can switch to 'runlevel 3' by running
....
systemctl isolate multi-user.target
....
You can switch to 'runlevel 5' by running
....
systemctl isolate graphical.target
....
[[how-do-i-change-the-default-target]]
How do I change the default target?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
....
systemctl set-default <name of target>.target
....
graphical.target is the default. You might want multi-user.target for
the equivalent of non graphical (runlevel 3) from sysv init. The full
list of targets can be accessed via systemctl list-units --type=target
systemd does not use /etc/inittab file.
[[how-do-i-know-the-current-target]]
How do I know the current target?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
....
systemctl get-default
....
[[how-to-power-off-the-machine]]
How to power off the machine?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can use
....
poweroff
....
Some more possibilities are: `halt -p`, `init 0`, `shutdown -P now`
Note that `halt` used to work the same as `poweroff` in previous Fedora
releases, but systemd distinguishes between the two, so `halt` without
parameters now does exactly what it says - it merely stops the system
without turning it off.
[[does-service-command-work-with-systemd]]
Does service command work with systemd?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yes. It has been modified to call systemctl automatically when dealing
with systemd service files. So either of the following commands does the
same thing
....
systemctl stop NetworkManager
....
(or)
....
service NetworkManager stop
....
[[does-chkconfig-command-work-with-systemd]]
Does chkconfig command work with systemd?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yes, for turning on/off services, compatibility has been provided both
ways. chkconfig has been modified to call systemctl when dealing with
systemd service files. Also systemctl automatically calls chkconfig when
dealing with a traditional sysv init file.
So either of the following commands does the same thing
....
systemctl disable NetworkManager
....
(or)
....
chkconfig NetworkManager off
....
chkconfig --list doesn't list systemd services, only Sys V services. The
output of chkconfig takes note of this, along with supplying additional
information.
[[does-system-config-services-work-with-systemd]]
Does system-config-services work with systemd?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yes. It does.
[[how-do-i-change-the-number-of-gettys-running-by-default]]
How do I change the number of gettys running by default?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The simplest way is to edit /etc/systemd/logind.conf
([http://www.freedesktop.org/software/systemd/man/logind.conf.html#NAutoVTs=
man page]):
....
[Login]
...
NAutoVTs=8
....
This setting will take effect after reboot.
Alternatively, getty@.services which open the login prompt can be
enabled and started individually.
To add another getty:
....
systemctl enable getty@tty8
systemctl start getty@tty8
....
To remove a getty:
....
systemctl disable getty@tty8
systemctl stop getty@tty8
....
systemd does not use /etc/inittab file.
[[how-do-i-set-automatic-login-on-a-virtual-console-terminal]]
How do I set automatic login on a virtual console terminal?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First create a new service similar to getty@.service:
....
# cp /lib/systemd/system/getty@.service \
/etc/systemd/system/autologin@.service
# ln -s /etc/systemd/system/autologin@.service \
/etc/systemd/system/getty.target.wants/getty@tty8.service
....
then edit ExecStart, Restart and Alias values, like this:
....
...
ExecStart=-/sbin/mingetty --autologin USERNAME %I
Restart=no
...
Alias=getty.target.wants/getty@tty8.service
....
and finally reload daemon and start the service:
....
systemctl daemon-reload
systemctl start getty@tty8.service
....
Note that if you exit tty8 session, you wont be able to use it until
next reboot or manual start by systemctl, except if you leave Restart as
always, but I highly recommend to avoid this according to security
reasons.
[[how-do-i-customize-a-unit-file-add-a-custom-unit-file]]
How do I customize a unit file/ add a custom unit file?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The best way to customize unit files is to add
/etc/systemd/system/foobar.service.d/*.conf where foobar.service is the
name of the service you want to customize. If a directory doesn't
already exist, create one and drop a conf file with the settings you
want to override. For example,
/etc/systemd/system/httpd.service.d/restart.conf
....
[Service]
Restart=always
RestartSec=30
....
Refer to man
http://www.freedesktop.org/software/systemd/man/systemd.unit.html[systemd.unit]
page for more details.
Special care must be taken when overriding options which can be set
muliple times (`ExecStart`, `ExecStartPre`, `ExecStartPost` are a common
example). Assigning some value to the option _appends_ to the existing
list, while assiging the _empty_ value _resets_ the list.
For example, let's say we have a service file like this:
....
[Service]
ExecStart=/bin/echo execstart1
ExecStart=
ExecStart=/bin/echo execstart2
ExecStartPost=/bin/echo post1
ExecStartPost=/bin/echo post2
....
When started, this service will print
....
execstart2
post1
post2
....
The same rules apply to snippets in `.d` directories. This means that
snippets which override `ExecStart` and similar settings, often should
start with the empty assignment `ExecStart=`, followed by the new
setting.
[[how-do-i-debug-systemd-issues]]
How do I debug systemd issues?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Refer to How_to_debug_Systemd_problems
[[man-pages]]
Man pages
---------
systemd comes with extensive documentation including several man pages.
On the web: http://www.freedesktop.org/software/systemd/man/[list of all
systemd man pages],
http://www.freedesktop.org/software/systemd/man/systemd.directives.html[index
of all settings].
[[references]]
References
----------
* http://www.freedesktop.org/wiki/Software/systemd[Project homepage]
* http://0pointer.de/blog/projects/ - Lennart's blog has lots of
information about systemd. Lennart is the primary systemd developer
* http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions
* http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks
* link:Features/systemd[ Features Fedora 15:systemd]
* http://fosdem.org/2011/interview/lennart-poettering.html[Interview
with the developer]
'''
See a typo, something missing or out of date, or anything else which can be
improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.

View file

@ -1,172 +0,0 @@
= SysVinit to Systemd Cheatsheet
'''
[IMPORTANT]
======
This page was automatically converted from https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
It is probably
* Badly formatted
* Missing graphics and tables that do not convert well from mediawiki
* Out-of-date
* In need of other love
Please fix it, remove this notice, and then add to `_topic_map.yml`
Pull requests accepted at https://pagure.io/fedora-docs/quick-docs
Once that is live, go to the original wiki page and add an `{{old}}`
tag, followed by a note like
....
{{admon/note|This page has a new home!|
This wiki page is no longer maintained. Please find the up-to-date
version at: https://docs.fedoraproject.org/whatever-the-url
}}
....
======
'''
This is a document to help system administrators who need to understand
what commands in systemd replace their old workflow in sysvinit. If you
want general information on systemd, refer to systemd.
[[services]]
Services
~~~~~~~~
Note that all recent versions of systemctl assume the '.service' if left
off. So, 'systemctl start frobozz.service' is the same as 'systemctl
start frobozz'
[cols=",,",options="header",]
|=======================================================================
|Sysvinit Command |Systemd Command |Notes
|service frobozz start |systemctl start frobozz |Used to start a service
(not reboot persistent)
|service frobozz stop |systemctl stop frobozz |Used to stop a service
(not reboot persistent)
|service frobozz restart |systemctl restart frobozz |Used to stop and
then start a service
|service frobozz reload |systemctl reload frobozz |When supported,
reloads the config file without interrupting pending operations.
|service frobozz condrestart |systemctl condrestart frobozz |Restarts if
the service is already running.
|service frobozz status |systemctl status frobozz |Tells whether a
service is currently running.
|ls /etc/rc.d/init.d/ |systemctl (or) systemctl list-unit-files
--type=service (or) +
ls /lib/systemd/system/*.service /etc/systemd/system/*.service |Used to
list the services that can be started or stopped +
Used to list all the services and other units
|chkconfig frobozz on |systemctl enable frobozz |Turn the service on,
for start at next boot, or other trigger.
|chkconfig frobozz off |systemctl disable frobozz |Turn the service off
for the next reboot, or any other trigger.
|chkconfig frobozz |systemctl is-enabled frobozz |Used to check whether
a service is configured to start or not in the current environment.
|chkconfig --list |systemctl list-unit-files --type=service (or) ls
/etc/systemd/system/*.wants/ |Print a table of services that lists which
runlevels each is configured on or off
|chkconfig --list | grep 5:on |systemctl list-dependencies
graphical.target |Print a table of services that will be started when
booting into graphical mode
|chkconfig frobozz --list |ls
/etc/systemd/system/*.wants/frobozz.service |Used to list what levels
this service is configured on or off
|chkconfig frobozz --add |systemctl daemon-reload |Used when you create
a new service file or modify any configuration
|=======================================================================
Note that all /sbin/service and /sbin/chkconfig lines listed above
continue to work on systemd, and will be translated to native
equivalents as necessary. The only exception is chkconfig --list.
[[runlevelstargets]]
Runlevels/targets
~~~~~~~~~~~~~~~~~
Systemd has a concept of _targets_ which serve a similar purpose as
runlevels but act a little different. Each _target_ is named instead of
numbered and is intended to serve a specific purpose. Some _targets_ are
implemented by inheriting all of the services of another _target_ and
adding additional services to it. There are systemd __target__s that
mimic the common sysvinit runlevels so you can still switch __target__s
using the familiar `telinit RUNLEVEL` command. The runlevels that are
assigned a specific purpose on vanilla Fedora installs; 0, 1, 3, 5, and
6; have a 1:1 mapping with a specific systemd _target_. Unfortunately,
there's no good way to do the same for the user-defined runlevels like 2
and 4. If you make use of those it is suggested that you make a new
named systemd _target_ as `/etc/systemd/system/$YOURTARGET` that takes
one of the existing runlevels as a base (you can look at
`/lib/systemd/system/graphical.target` as an example), make a directory
`/etc/systemd/system/$YOURTARGET.wants`, and then symlink the additional
services that you want to enable into that directory. (The service unit
files that you symlink live in `/lib/systemd/system`).
[cols=",,",options="header",]
|=======================================================================
|Sysvinit Runlevel |Systemd Target |Notes
|0 |runlevel0.target, poweroff.target |Halt the system.
|1, s, single |runlevel1.target, rescue.target |Single user mode.
|2, 4 |runlevel2.target, runlevel4.target, multi-user.target
|User-defined/Site-specific runlevels. By default, identical to 3.
|3 |runlevel3.target, multi-user.target |Multi-user, non-graphical.
Users can usually login via multiple consoles or via the network.
|5 |runlevel5.target, graphical.target |Multi-user, graphical. Usually
has all the services of runlevel 3 plus a graphical login.
|6 |runlevel6.target, reboot.target |Reboot
|emergency |emergency.target |Emergency shell
|=======================================================================
Changing runlevels:
[cols=",,",options="header",]
|=======================================================================
|Sysvinit Command |Systemd Command |Notes
|telinit 3 |systemctl isolate multi-user.target (OR systemctl isolate
runlevel3.target OR telinit 3) |Change to multi-user run level.
|sed s/^id:.*:initdefault:/id:3:initdefault:/ |ln -sf
/lib/systemd/system/multi-user.target /etc/systemd/system/default.target
|Set to use multi-user runlevel on next reboot.
|=======================================================================
Kernel Options:
The above systemd targets can be used when booting. At the GRUB menu,
edit the selection to add "systemd.unit=__target__" (without the
double-quotation marks) as a kernel option where _target_ is one of the
above. (For example, "rescue.target".)
Tip: the ".target" extention is optional. The "systemd.unit=rescue"
kernel option works the same as "systemd.unit=rescue.target".
'''
See a typo, something missing or out of date, or anything else which can be
improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.

View file

@ -0,0 +1,33 @@
:source-highlighter: prettify
[id='understanding-and-administering-systemd']
= Understanding and administering Systemd
Learn the basic principles of Systemd: how to configure it and use to administer the system.
include::modules/con_understanding-systemd.adoc[leveloffset=+1]
include::modules/proc_starting-stopping-and-querying-systemd-services.adoc[leveloffset=+1]
include::modules/proc_modifying-existing-systemd-services.adoc[leveloffset=+1]
include::modules/proc_creating-new-systemd-services.adoc[leveloffset=+1]
include::modules/proc_converting-sysvinit-services.adoc[leveloffset=+1]
include::modules/ref_common-service-parameters.adoc[leveloffset=+1]
include::modules/ref_mapping-runlevel-to-targets.adoc[leveloffset=+1]
include::modules/ref_mapping-service-commands.adoc[leveloffset=+1]
[discrete]
== Additional resources
* http://www.freedesktop.org/wiki/Software/systemd[Project homepage]
* http://0pointer.de/blog/projects/ - Lennart's blog has lots of information about systemd. Lennart is the primary systemd developer
* http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions
* http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks
* link:Features/systemd[ Features Fedora 15:systemd]
* http://fosdem.org/2011/interview/lennart-poettering.html[Interview with the developer]