Last active
January 19, 2023 15:26
-
-
Save tomschr/01bd34acca30b789456ad5e4ee7b3dab to your computer and use it in GitHub Desktop.
Error from transforming a big book into HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No titlepage template for: quote | |
No localization for keycap/keycap in en, using "MISSING" | |
No localization for keycap/keycap in en, using "MISSING" | |
Type error at char 11 in expression in xsl:variable/@select on line 94 column 57 of objects.xsl: | |
XPTY0004 An empty sequence is not allowed as the first argument of array:size() | |
invoked by xsl:iterate at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/objects.xsl#62 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}mediaobject)" on line 23 of objects.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/blocks.xsl#20 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}informalfigure)" on line 17 of blocks.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/sections.xsl#20 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}sect1)" on line 16 of sections.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/components.xsl#22 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}chapter)" on line 14 of components.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/divisions.xsl#18 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}part)" on line 13 of divisions.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/modules/divisions.xsl#18 | |
In template rule with match="element(Q{http://docbook.org/ns/docbook}book)" on line 13 of divisions.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/main.xsl#88 | |
In template rule with match="/" on line 72 of main.xsl | |
invoked by xsl:apply-templates at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/docbook.xsl#211 | |
at template t:docbook on line 162 column 32 of docbook.xsl: | |
invoked by xsl:call-template at file:/home/tom/repos/GH/tomschr/docbook-xslt3-fo/docbook-xslTNG-2.0.2/xslt/docbook.xsl#157 | |
In template rule with match="/" on line 146 of docbook.xsl | |
An empty sequence is not allowed as the first argument of array:size() |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en" xml:id="book-administration"> | |
<info> | |
<title><citetitle>Administration Guide</citetitle></title> | |
<productname><phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase></productname> | |
<productnumber><phrase role="productnumber"><phrase os="sles;sled">15 SP5</phrase></phrase></productnumber><date> | |
<?dbtimestamp format="B d, Y" ?> | |
</date> | |
<legalnotice version="5.0"> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Copyright © 2006– | |
<?dbtimestamp format="Y"?> | |
SUSE LLC and contributors. All rights reserved. | |
</para> | |
<para> | |
Permission is granted to copy, distribute and/or modify this document under | |
the terms of the GNU Free Documentation License, Version 1.2 or (at your | |
option) version 1.3; with the Invariant Section being this copyright notice | |
and license. A copy of the license version 1.2 is included in the section | |
entitled <quote>GNU Free Documentation License</quote>. | |
</para> | |
<para> | |
For SUSE trademarks, see | |
<link xlink:href="https://www.suse.com/company/legal/"/>. All other | |
third-party trademarks are the property of their respective owners. Trademark | |
symbols (®, ™ etc.) denote trademarks of SUSE and its affiliates. | |
Asterisks (*) denote third-party trademarks. | |
</para> | |
<para> | |
All information found in this book has been compiled with utmost attention to | |
detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, | |
its affiliates, the authors nor the translators shall be held liable for | |
possible errors or the consequences thereof. | |
</para> | |
</legalnotice> | |
<abstract> | |
<para> | |
This guide covers system administration tasks | |
like maintaining, monitoring and customizing an initially installed | |
system. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker> | |
<dm:assignee>[email protected]</dm:assignee> | |
</dm:bugtracker> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<preface version="5.0" xml:id="pre-sle"> | |
<title>Preface</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 version="5.0"> | |
<title>Available documentation</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker> | |
</dm:bugtracker> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<variablelist> | |
<varlistentry> | |
<term>Online documentation</term> | |
<listitem> | |
<para> | |
The online documentation for this product is available at | |
<link os="sles" xlink:href="https://documentation.suse.com/#sles"/>. | |
Browse or download the documentation in various formats. | |
</para> | |
<para os="sles;sled"> | |
Find the online documentation for other products at | |
<link xlink:href="https://documentation.suse.com/"/>. | |
</para> | |
<note> | |
<title>Latest updates</title> | |
<para> | |
The latest documentation updates are usually available in the English | |
version of the documentation. | |
</para> | |
</note> | |
</listitem> | |
</varlistentry> | |
<varlistentry os="sles;sled;slemicro"> | |
<term>Release notes</term> | |
<listitem> | |
<para> | |
For release notes, see | |
<link xlink:href="https://www.suse.com/releasenotes/"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry os="sles;sled;osuse"> | |
<term>In your system</term> | |
<listitem> | |
<para> | |
For offline use, find documentation in your installed system under | |
<filename>/usr/share/doc</filename>. Many commands are also described in | |
detail in their <emphasis>manual pages</emphasis>. To view them, run | |
<command>man</command>, followed by a specific command name. If the | |
<command>man</command> command is not installed on your system, install it | |
with <command>sudo zypper install man</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 version="5.0"> | |
<title>Improving the documentation</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Your feedback and contributions to this documentation are welcome. | |
The following channels for giving feedback are available: | |
</para> | |
<variablelist> | |
<varlistentry os="sles;sled;slemicro"> | |
<term>Service requests and support</term> | |
<listitem> | |
<para> | |
For services and support options available for your product, see | |
<link xlink:href="https://www.suse.com/support/"/>. | |
</para> | |
<para> | |
To open a service request, you need a SUSE subscription registered | |
at SUSE Customer Center. | |
Go to <link xlink:href="https://scc.suse.com/support/requests"/>, log in, | |
and click <guimenu>Create New</guimenu>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Bug reports</term> | |
<listitem> | |
<para> | |
Report issues with the documentation at | |
<link os="sles;sled;slemicro" xlink:href="https://bugzilla.suse.com/"/>. | |
</para> | |
<para> | |
To simplify this process, click the <guimenu>Report | |
an issue</guimenu> icon next to a headline in the HTML | |
version of this document. This preselects the right product and | |
category in Bugzilla and adds a link to the current section. | |
You can start typing your bug report right away. | |
</para> | |
<para> | |
A Bugzilla account is required. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Contributions</term> | |
<listitem> | |
<para> | |
To contribute to this documentation, click the <guimenu>Edit source | |
document</guimenu> icon next to a headline in the HTML version of | |
this document. This will take you to the source code on GitHub, where you | |
can open a pull request.</para> | |
<para> | |
A GitHub account is required. | |
</para> | |
<note> | |
<title><guimenu>Edit source document</guimenu> only available for English</title> | |
<para> | |
The <guimenu>Edit source document</guimenu> icons are only available for the | |
English version of each document. For all other languages, use the | |
<guimenu>Report an issue</guimenu> icons instead. | |
</para> | |
</note> | |
<para> | |
For more information about the documentation environment used for this | |
documentation, see the repository's README at | |
<link xlink:href="https://github.com/SUSE/doc-sle/blob/main/README.adoc"/> | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Mail</term> | |
<listitem> | |
<para> | |
You can also report errors and send feedback concerning the | |
documentation to <email>[email protected]</email>. Include the | |
document title, the product version, and the publication date of the | |
document. Additionally, include the relevant section number and title (or | |
provide the URL), and provide a concise description of the problem. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 version="5.0"> | |
<title>Documentation conventions</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
The following notices and typographical conventions are used in this | |
documentation: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
<filename>/etc/passwd</filename>: directory names and file names | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<replaceable>PLACEHOLDER</replaceable>: replace | |
<replaceable>PLACEHOLDER</replaceable> with the actual value | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<envar>PATH</envar>: the environment variable PATH | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<command>ls</command>, <option>--help</option>: commands, options, and | |
parameters | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<systemitem class="username">user</systemitem>: users or groups | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>package name</package> : name of a package | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<keycap function="alt"/>, <keycombo> <keycap function="alt"/> | |
<keycap>F1</keycap> </keycombo>: a key to press or a key combination; keys | |
are shown in uppercase as on a keyboard | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<guimenu>File</guimenu>, <menuchoice> <guimenu>File</guimenu> <guimenu>Save | |
As</guimenu> </menuchoice>: menu items, buttons | |
</para> | |
</listitem> | |
<listitem os="sles;slemicro"> | |
<para arch="x86_64"> | |
This paragraph is only relevant for the AMD64/Intel 64 architecture. The | |
arrows mark the beginning and the end of the text block. | |
</para> | |
<para arch="zseries;power"> | |
This paragraph is only relevant for the architectures | |
<literal>IBM Z</literal> and <literal>POWER</literal>. The arrows | |
mark the beginning and the end of the text block. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis>Dancing Penguins</emphasis> (Chapter | |
<emphasis>Penguins</emphasis>, ↑Another Manual): This is a reference | |
to a chapter in another manual. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Commands that must be run with <systemitem class="username">root</systemitem> privileges. Often you can also | |
prefix these commands with the <command>sudo</command> command to run them | |
as non-privileged user. | |
</para> | |
<screen><prompt role="root"># </prompt><command>command</command> | |
<prompt>> </prompt><command>sudo</command> <command>command</command></screen> | |
</listitem> | |
<listitem> | |
<para> | |
Commands that can be run by non-privileged users. | |
</para> | |
<screen><prompt>> </prompt><command>command</command></screen> | |
</listitem> | |
<listitem> | |
<para> | |
Notices | |
</para> | |
<warning> | |
<title>Warning notice</title> | |
<para> | |
Vital information you must be aware of before proceeding. Warns you about | |
security issues, potential loss of data, damage to hardware, or physical | |
hazards. | |
</para> | |
</warning> | |
<important> | |
<title>Important notice</title> | |
<para> | |
Important information you should be aware of before proceeding. | |
</para> | |
</important> | |
<note> | |
<title>Note notice</title> | |
<para> | |
Additional information, for example about differences in software | |
versions. | |
</para> | |
</note> | |
<tip> | |
<title>Tip notice</title> | |
<para> | |
Helpful information, like a guideline or a piece of practical advice. | |
</para> | |
</tip> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 version="5.0"> | |
<title>Support</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker> | |
</dm:bugtracker> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Find the support statement for <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> and general information about | |
technology previews below. For details about the product lifecycle, see | |
<phrase role="externalbook-cha-upgrade-background">“Lifecycle and support” (↑Upgrade Guide)</phrase>. | |
</para> | |
<para os="sles;sled;osuse"> | |
If you are entitled to support, find details on how to collect information | |
for a support ticket in <xref linkend="cha-adm-support" role="internalbook"/>. | |
</para> | |
<sect2> | |
<title>Support statement for <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase></title> | |
<para> | |
To receive support, you need an appropriate subscription with SUSE. To | |
view the specific support offerings available to you, go to | |
<link xlink:href="https://www.suse.com/support/"/> and select your product. | |
</para> | |
<para> | |
The support levels are defined as follows: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>L1</term> | |
<listitem> | |
<para> | |
Problem determination, which means technical support designed to provide | |
compatibility information, usage support, ongoing maintenance, | |
information gathering, and basic troubleshooting using available | |
documentation. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>L2</term> | |
<listitem> | |
<para> | |
Problem isolation, which means technical support designed to analyze | |
data, reproduce customer problems, isolate problem areas, and provide a | |
resolution for problems not resolved by Level 1, or prepare for | |
Level 3. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>L3</term> | |
<listitem> | |
<para> | |
Problem resolution, which means technical support designed to resolve | |
problems by engaging engineering to resolve product defects which have | |
been identified by Level 2 Support. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
For contracted customers and partners, <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is delivered with L3 | |
support for all packages, except for the following: | |
</para> | |
<itemizedlist> | |
<listitem os="sles;sled"> | |
<para> | |
technology previews | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
sound, graphics, fonts, and artwork | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
packages that require an additional customer contract | |
</para> | |
</listitem> | |
<listitem os="sles;sled"> | |
<para> | |
some packages shipped as part of the module <emphasis>Workstation | |
Extension</emphasis> are L2-supported only | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
packages with names ending in <package>-devel</package> (containing header | |
files and similar developer resources) will only be supported together | |
with their main packages | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
SUSE will only support the usage of original packages. That is, packages | |
that are unchanged and not recompiled. | |
</para> | |
</sect2> | |
<sect2 os="sles;sled"> | |
<title>Technology previews</title> | |
<para> | |
Technology previews are packages, stacks, or features delivered by SUSE to | |
provide glimpses into upcoming innovations. The previews are included for | |
your convenience to give you the chance to test new technologies within your | |
environment. We would appreciate your feedback! If you test a technology | |
preview, contact your SUSE representative and let them know about your | |
experience and use cases. Your input is helpful for future development. | |
</para> | |
<para> | |
However, technology previews come with the following limitations: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Technology previews are still in development. Therefore, they may be | |
functionally incomplete, unstable, or in other ways | |
<emphasis>not</emphasis> suitable for production use. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Technology previews are <emphasis>not</emphasis> supported. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Technology previews may only be available for specific hardware | |
architectures. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Details and functionality of technology previews are subject to change. As | |
a result, upgrading to subsequent releases of a technology preview may be | |
impossible and require a fresh installation. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Technology previews can be dropped at any time. For example, if SUSE | |
discovers that a preview does not meet the customer or market needs, or | |
does not prove to comply with enterprise standards. SUSE does not commit | |
to providing a supported version of such technologies in the future. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
For an overview of technology previews shipped with your product, see the | |
release notes at <link xlink:href="https://www.suse.com/releasenotes/"/>. | |
</para> | |
</sect2> | |
</sect1> | |
</preface> | |
<part xml:id="part-administration"> | |
<title>Common tasks</title> | |
<chapter version="5.0" xml:id="cha-adm-shell"> | |
<title>Bash and Bash scripts</title> | |
<info> | |
<abstract> | |
<para> | |
Today, many people use computers with a graphical user interface (GUI) | |
like GNOME. Although GUIs offer many features, they are limited | |
when performing automated task execution. Shells complement | |
GUIs well, and this chapter gives an overview of some aspects of | |
shells, in this case the Bash shell. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 xml:id="sec-adm-whatistheshell"> | |
<title>What is <quote>the shell</quote>?</title> | |
<para> | |
Traditionally, <emphasis>the</emphasis> Linux shell is Bash | |
(Bourne again Shell). When this chapter speaks about <quote>the shell</quote> | |
it means Bash. There are more shells available (ash, csh, ksh, zsh, …), | |
each employing different features and characteristics. If you need further | |
information about other shells, search for <emphasis>shell</emphasis> in | |
YaST. | |
</para> | |
<sect2 xml:id="sec-adm-configfiles"> | |
<title>Bash configuration files</title> | |
<para> | |
A shell can be invoked as an: | |
</para> | |
<orderedlist spacing="normal"> | |
<listitem> | |
<formalpara> | |
<title>Interactive login shell</title> | |
<para> | |
This is used when logging in to a machine, invoking Bash with the | |
<option>--login</option> option or when logging in to a remote machine | |
with SSH. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title><quote>Ordinary</quote> interactive shell</title> | |
<para> | |
This is normally the case when starting xterm, konsole, gnome-terminal, | |
or similar command line interface (CLI) tools. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Non-interactive shell</title> | |
<para> | |
This is invoked when invoking a shell script at the command line. | |
</para> | |
</formalpara> | |
</listitem> | |
</orderedlist> | |
<para> | |
Depending on the type of shell you use, different configuration files will be | |
read. The following tables show the login and non-login shell | |
configuration files. | |
</para> | |
<table xml:id="tab-adm-shell-config-loginshells"> | |
<title>Bash configuration files for login shells</title> | |
<tgroup cols="2"> | |
<thead> | |
<row> | |
<entry> | |
<para> | |
File | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Description | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc/profile</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Do not modify this file, otherwise your modifications may be destroyed | |
during your next update! | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc/profile.local</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Use this file if you extend <filename>/etc/profile</filename> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc/profile.d/</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Contains system-wide configuration files for specific programs | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>~/.profile</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Insert user specific configuration for login shells here | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<para> | |
Note that the login shell also sources the configuration files listed under | |
<xref linkend="tab-adm-shell-configs-nonloginshells" role="internalbook"/>. | |
</para> | |
<table xml:id="tab-adm-shell-configs-nonloginshells"> | |
<title>Bash configuration files for non-login shells</title> | |
<tgroup cols="2"> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc/bash.bashrc</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Do not modify this file, otherwise your modifications may be destroyed | |
during your next update! | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc/bash.bashrc.local</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Use this file to insert your system-wide modifications for Bash only | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>~/.bashrc</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Insert user specific configuration here | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<para> | |
Additionally, Bash uses some more files: | |
</para> | |
<table> | |
<title>Special files for Bash</title> | |
<tgroup cols="2"> | |
<thead> | |
<row> | |
<entry> | |
<para> | |
File | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Description | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<filename>~/.bash_history</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Contains a list of all commands you have typed | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>~/.bash_logout</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Executed when logging out | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>~/.alias</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
User defined aliases of frequently used commands. See | |
<command>man 1 alias</command> for more details about defining | |
aliases. | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<bridgehead>No-Login Shells</bridgehead> | |
<para> | |
There are special shells that block users from logging into | |
the system: <systemitem>/bin/false</systemitem> and | |
<systemitem>/sbin/nologin</systemitem>. Both fail silently | |
when the user attempts to log into the system. This was intended | |
as a security measure for system users, though modern | |
Linux operating systems have more effective tools for controlling system | |
access, such as PAM and AppArmor. | |
</para> | |
<para> | |
The default on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is to assign <systemitem>/bin/bash</systemitem> | |
to human users, and <systemitem>/bin/false</systemitem> or | |
<systemitem>/sbin/nologin</systemitem> to system users. | |
The <systemitem class="username">nobody</systemitem> | |
user has <systemitem>/bin/bash</systemitem> for historical reasons, as | |
it is a minimally-privileged user that used to be the default for system users. | |
However, whatever little bit of security gained by using | |
<systemitem class="username">nobody</systemitem> is lost when | |
multiple system users use it. It should be possible to change it to | |
<systemitem>/sbin/nologin</systemitem>; the fastest way to test it is change | |
it and see if it breaks any services or applications. | |
</para> | |
<para> | |
Use the following command to list which shells are assigned to all users, | |
system and human users, in <filename>/etc/passwd</filename>. The output | |
varies according to the services and users on your system: | |
</para> | |
<screen><prompt>> </prompt>sort -t: -k 7 /etc/passwd | awk -F: '{print $1"\t" $7}' | column -t | |
tux /bin/bash | |
nobody /bin/bash | |
root /bin/bash | |
avahi /bin/false | |
chrony /bin/false | |
dhcpd /bin/false | |
dnsmasq /bin/false | |
ftpsecure /bin/false | |
lightdm /bin/false | |
mysql /bin/false | |
postfix /bin/false | |
rtkit /bin/false | |
sshd /bin/false | |
tftp /bin/false | |
unbound /bin/false | |
bin /sbin/nologin | |
daemon /sbin/nologin | |
ftp /sbin/nologin | |
lp /sbin/nologin | |
mail /sbin/nologin | |
man /sbin/nologin | |
nscd /sbin/nologin | |
polkitd /sbin/nologin | |
pulse /sbin/nologin | |
qemu /sbin/nologin | |
radvd /sbin/nologin | |
rpc /sbin/nologin | |
statd /sbin/nologin | |
svn /sbin/nologin | |
systemd-coredump /sbin/nologin | |
systemd-network /sbin/nologin | |
systemd-timesync /sbin/nologin | |
usbmux /sbin/nologin | |
vnc /sbin/nologin | |
wwwrun /sbin/nologin | |
messagebus /usr/bin/false | |
scard /usr/sbin/nologin</screen> | |
</sect2> | |
<sect2 version="5.0" xml:id="sec-adm-dirstructure"> | |
<title>The directory structure</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
The following table provides a short overview of the most important | |
higher-level directories that you find on a Linux system. Find more detailed | |
information about the directories and important subdirectories in the | |
following list. | |
</para> | |
<table> | |
<title>Overview of a standard directory tree</title> | |
<tgroup cols="2"> | |
<colspec colnum="1" colname="1" colwidth="25*"/> | |
<colspec colnum="2" colname="2" colwidth="75*"/> | |
<thead> | |
<row> | |
<entry> | |
<para> | |
Directory | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Contents | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<filename>/</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Root directory—the starting point of the directory tree. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/bin</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Essential binary files, such as commands that are needed by both the | |
system administrator and normal users. Usually also contains the shells, | |
such as Bash. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/boot</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Static files of the boot loader. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/dev</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Files needed to access host-specific devices. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/etc</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Host-specific system configuration files. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/home</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Holds the home directories of all users who have accounts on the system. | |
However, <systemitem class="username">root</systemitem>'s home directory is not located in | |
<filename>/home</filename> but in <filename>/root</filename>. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/lib</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Essential shared libraries and kernel modules. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/media</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Mount points for removable media. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/mnt</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Mount point for temporarily mounting a file system. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/opt</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Add-on application software packages. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/root</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Home directory for the superuser <systemitem class="username">root</systemitem>. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/sbin</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Essential system binaries. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/srv</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Data for services provided by the system. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/tmp</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Temporary files. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/usr</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Secondary hierarchy with read-only data. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/var</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Variable data such as log files. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<filename>/windows</filename> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Only available if you have both Microsoft Windows* and Linux installed | |
on your system. Contains the Windows data. | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<para> | |
The following list provides more detailed information and gives some examples | |
of which files and subdirectories can be found in the directories: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><filename>/bin</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains the basic shell commands that may be used both by <systemitem class="username">root</systemitem> and | |
by other users. These commands include <command>ls</command>, | |
<command>mkdir</command>, <command>cp</command>, <command>mv</command>, | |
<command>rm</command> and <command>rmdir</command>. | |
<filename>/bin</filename> also contains Bash, the default shell in | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/boot</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains data required for booting, such as the boot loader, the kernel, | |
and other data that is used before the kernel begins executing user-mode | |
programs. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/dev</filename> | |
</term> | |
<listitem> | |
<para> | |
Holds device files that represent hardware components. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/etc</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains local configuration files that control the operation of programs | |
like the X Window System. The <filename>/etc/init.d</filename> | |
subdirectory contains LSB init scripts that can be executed during the | |
boot process. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/home/<replaceable>USERNAME</replaceable></filename> | |
</term> | |
<listitem> | |
<para> | |
Holds the private data of every user who has an account on the system. The | |
files located here can only be modified by their owner or by the system | |
administrator. By default, your e-mail directory and personal desktop | |
configuration are located here in the form of hidden files and | |
directories, such as <filename>.gconf/</filename> and | |
<filename>.config</filename>. | |
</para> | |
<note> | |
<title>Home directory in a network environment</title> | |
<para> | |
If you are working in a network environment, your home directory may be | |
mapped to a directory in the file system other than | |
<filename>/home</filename>. | |
</para> | |
</note> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/lib</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains the essential shared libraries needed to boot the system and to | |
run the commands in the root file system. The Windows equivalent for | |
shared libraries are DLL files. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/media</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains mount points for removable media, such as CD-ROMs, flash disks, | |
and digital cameras (if they use USB). <filename>/media</filename> | |
generally holds any type of drive except the hard disk of your system. | |
When your removable medium has been inserted or connected to the system | |
and has been mounted, you can access it from here. | |
<remark>taroth 060518: | |
find out how the names of the drives are assigned to a | |
medium!</remark> | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/mnt</filename> | |
</term> | |
<listitem> | |
<para> | |
This directory provides a mount point for a temporarily mounted file | |
system. <systemitem class="username">root</systemitem> may mount file systems here. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/opt</filename> | |
</term> | |
<listitem> | |
<para> | |
Reserved for the installation of third-party software. Optional software | |
and larger add-on program packages can be found here. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/root</filename> | |
</term> | |
<listitem> | |
<para> | |
Home directory for the <systemitem class="username">root</systemitem> user. The personal data of <systemitem class="username">root</systemitem> is | |
located here. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/run</filename> | |
</term> | |
<listitem> | |
<para> | |
A tmpfs directory used by <systemitem>systemd</systemitem> and various | |
components. <filename>/var/run</filename> is a symbolic link to | |
<filename>/run</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/sbin</filename> | |
</term> | |
<listitem> | |
<para> | |
As the <literal>s</literal> indicates, this directory holds utilities for | |
the superuser. <filename>/sbin</filename> contains the binaries essential | |
for booting, restoring and recovering the system in addition to the | |
binaries in <filename>/bin</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/srv</filename> | |
</term> | |
<listitem> | |
<para> | |
Holds data for services provided by the system, such as FTP and HTTP. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/tmp</filename> | |
</term> | |
<listitem> | |
<para> | |
This directory is used by programs that require temporary storage of | |
files. | |
</para> | |
<important> | |
<title>Cleaning up <filename>/tmp</filename> at boot time</title> | |
<para> | |
Data stored in <filename>/tmp</filename> is not guaranteed to survive a | |
system reboot. It depends, for example, on settings made in | |
<filename>/etc/tmpfiles.d/tmp.conf</filename>. | |
</para> | |
</important> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr</filename> | |
</term> | |
<listitem> | |
<para> | |
<literal>/usr</literal> has nothing to do with users, but is the acronym | |
for Unix system resources. The data in <filename>/usr</filename> is | |
static, read-only data that can be shared among various hosts compliant | |
with the <literal>Filesystem Hierarchy Standard</literal> (FHS). This | |
directory contains all application programs including the graphical | |
desktops such as GNOME and establishes a secondary hierarchy in the file | |
system. <filename>/usr</filename> holds several subdirectories, such as | |
<filename>/usr/bin</filename>, <filename>/usr/sbin</filename>, | |
<filename>/usr/local</filename>, and <filename>/usr/share/doc</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr/bin</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains generally accessible programs. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr/sbin</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains programs reserved for the system administrator, such as repair | |
functions. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr/local</filename> | |
</term> | |
<listitem> | |
<para> | |
In this directory the system administrator can install local, | |
distribution-independent extensions. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr/share/doc</filename> | |
</term> | |
<listitem> | |
<para> | |
Holds various documentation files and the release notes for your system. | |
In the <filename>manual</filename> subdirectory find an online version of | |
this manual. If more than one language is installed, this directory may | |
contain versions of the manuals for different languages. | |
</para> | |
<para> | |
Under <filename>packages</filename> find the documentation included in the | |
software packages installed on your system. For every package, a | |
subdirectory | |
<filename>/usr/share/doc/packages/<replaceable>PACKAGENAME</replaceable></filename> | |
is created that often holds README files for the package and sometimes | |
examples, configuration files or additional scripts. | |
</para> | |
<para> | |
If HOWTOs are installed on your system <filename>/usr/share/doc</filename> | |
also holds the <filename>howto</filename> subdirectory in which to find | |
additional documentation on many tasks related to the setup and operation | |
of Linux software. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/var</filename> | |
</term> | |
<listitem> | |
<para> | |
Whereas <filename>/usr</filename> holds static, read-only data, | |
<filename>/var</filename> is for data which is written during system | |
operation and thus is variable data, such as log files or spooling data. | |
For an overview of the most important log files you can find under | |
<filename>/var/log/</filename>, refer to | |
<xref linkend="tab-trouble-info" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-adm-shellscripts"> | |
<title>Writing shell scripts</title> | |
<para> | |
Shell scripts provide a convenient way to perform a wide range of tasks: collecting | |
data, searching for a word or phrase in a text and other useful things. | |
The following example shows a small shell script that prints a text: | |
</para> | |
<example> | |
<title>A shell script printing a text</title> | |
<screen>#!/bin/sh <co xml:id="co-adm-shell-shebang"/> | |
# Output the following line: <co xml:id="co-adm-shell-comment"/> | |
echo "Hello World" <co xml:id="co-adm-shell-echo"/></screen> | |
<calloutlist> | |
<callout arearefs="co-adm-shell-shebang"> | |
<para> | |
The first line begins with the <emphasis>Shebang</emphasis> | |
characters (<literal>#!</literal>) which indicate | |
that this file is a script. The interpreter, specified after the <emphasis>Shebang</emphasis>, executes the script. In this case, | |
the specified interpreter is <command>/bin/sh</command>. | |
</para> | |
</callout> | |
<callout arearefs="co-adm-shell-comment"> | |
<para> | |
The second line is a comment beginning with the hash sign. We recommend that you | |
comment difficult lines. With proper commenting, you can remember the purpose | |
and function of the line. Also, other readers will hopefully understand your | |
script. Commenting is considered good practice in the development community. | |
</para> | |
</callout> | |
<callout arearefs="co-adm-shell-echo"> | |
<para> | |
The third line uses the built-in command <command>echo</command> to print | |
the corresponding text. | |
</para> | |
</callout> | |
</calloutlist> | |
</example> | |
<para> | |
Before you can run this script, there are a few prerequisites: | |
</para> | |
<orderedlist spacing="normal"> | |
<listitem> | |
<para> | |
Every script should contain a Shebang line (as in the example above). If | |
the line is missing, you need to call the interpreter manually. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
You can save the script wherever you want. However, it is a good idea to | |
save it in a directory where the shell can find it. The search path in a | |
shell is determined by the environment variable <envar>PATH</envar>. | |
Usually a normal user does not have write access to | |
<filename>/usr/bin</filename>. Therefore it is recommended to save your | |
scripts in the users' directory <filename>~/bin/</filename>. The above | |
example gets the name <filename>hello.sh</filename>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The script needs executable permissions. Set the permissions with the | |
following command: | |
</para> | |
<screen><prompt>> </prompt>chmod +x ~/bin/hello.sh</screen> | |
</listitem> | |
</orderedlist> | |
<para> | |
If you have fulfilled all of the above prerequisites, you can execute the | |
script in the following ways: | |
</para> | |
<orderedlist spacing="normal"> | |
<listitem> | |
<formalpara> | |
<title>As absolute path</title> | |
<para> | |
The script can be executed with an absolute path. In our case, it is | |
<command>~/bin/hello.sh</command>. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Everywhere</title> | |
<para> | |
If the <envar>PATH</envar> environment variable contains the directory | |
where the script is located, you can execute the script with | |
<command>hello.sh</command>. | |
</para> | |
</formalpara> | |
</listitem> | |
</orderedlist> | |
</sect1> | |
<sect1 xml:id="sec-adm-shell-redirect"> | |
<title>Redirecting command events</title> | |
<para> | |
Each command can use three channels, either for input or output: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<formalpara> | |
<title>Standard output</title> | |
<para> | |
This is the default output channel. Whenever a command prints something, | |
it uses the standard output channel. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Standard input</title> | |
<para> | |
If a command needs input from users or other commands, it uses this | |
channel. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Standard error</title> | |
<para> | |
Commands use this channel for error reporting. | |
</para> | |
</formalpara> | |
</listitem> | |
</itemizedlist> | |
<para> | |
To redirect these channels, there are the following possibilities: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>Command > File</literal> | |
</term> | |
<listitem> | |
<para> | |
Saves the output of the command into a file, an existing file will be | |
deleted. For example, the <command>ls</command> command writes its output | |
into the file <filename>listing.txt</filename>: | |
</para> | |
<screen><prompt>> </prompt>ls > listing.txt</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Command >> File</literal> | |
</term> | |
<listitem> | |
<para> | |
Appends the output of the command to a file. For example, the | |
<command>ls</command> command appends its output to the file | |
<filename>listing.txt</filename>: | |
</para> | |
<screen><prompt>> </prompt>ls >> listing.txt</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Command < File</literal> | |
</term> | |
<listitem> | |
<para> | |
Reads the file as input for the given command. For example, the | |
<command>read</command> command reads in the content of the file into the | |
variable: | |
</para> | |
<screen><prompt>> </prompt>read a < foo</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Command1 | Command2</literal> | |
</term> | |
<listitem> | |
<para> | |
Redirects the output of the left command as input for the right command. | |
For example, the <command>cat</command> command outputs the content of | |
the <filename>/proc/cpuinfo</filename> file. This output is used by | |
<command>grep</command> to filter only those lines which contain | |
<literal>cpu</literal>: | |
</para> | |
<screen><prompt>> </prompt>cat /proc/cpuinfo | grep cpu</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Every channel has a <emphasis>file descriptor</emphasis>: 0 (zero) for | |
standard input, 1 for standard output and 2 for standard error. It is | |
allowed to insert this file descriptor before a <literal><</literal> or | |
<literal>></literal> character. For example, the following line searches | |
for a file starting with <filename>foo</filename>, but suppresses its errors | |
by redirecting it to <filename>/dev/null</filename>: | |
</para> | |
<screen><prompt>> </prompt>find / -name "foo*" 2>/dev/null</screen> | |
</sect1> | |
<sect1 xml:id="sec-adm-alias"> | |
<title>Using aliases</title> | |
<para> | |
An alias is a shortcut definition of one or more commands. The syntax for an | |
alias is: | |
</para> | |
<screen>alias <replaceable>NAME</replaceable>=<replaceable>DEFINITION</replaceable></screen> | |
<para> | |
For example, the following line defines an alias <command>lt</command> that | |
outputs a long listing (option <option>-l</option>), sorts it by | |
modification time (<option>-t</option>), and prints it in reverse sorted order (<option>-r</option>): | |
</para> | |
<screen><prompt>> </prompt>alias lt='ls -ltr'</screen> | |
<para> | |
To view all alias definitions, use <command>alias</command>. Remove your | |
alias with <command>unalias</command> and the corresponding alias name. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-adm-variables"> | |
<title>Using variables in Bash</title> | |
<para> | |
A shell variable can be global or local. Global variables, or environment | |
variables, can be accessed in all shells. In contrast, local variables are | |
visible in the current shell only. | |
</para> | |
<para> | |
To view all environment variables, use the <command>printenv</command> | |
command. If you need to know the value of a variable, insert the name of | |
your variable as an argument: | |
</para> | |
<screen><prompt>> </prompt>printenv PATH</screen> | |
<para> | |
A variable, be it global or local, can also be viewed with | |
<command>echo</command>: | |
</para> | |
<screen><prompt>> </prompt>echo $PATH</screen> | |
<para> | |
To set a local variable, use a variable name followed by the equal sign, | |
followed by the value: | |
</para> | |
<screen><prompt>> </prompt>PROJECT="SLED"</screen> | |
<para> | |
Do not insert spaces around the equal sign, otherwise you get an error. To | |
set an environment variable, use <command>export</command>: | |
</para> | |
<screen><prompt>> </prompt>export NAME="tux"</screen> | |
<para> | |
To remove a variable, use <command>unset</command>: | |
</para> | |
<screen><prompt>> </prompt>unset NAME</screen> | |
<para> | |
The following table contains some common environment variables which can be | |
used in you shell scripts: | |
</para> | |
<table xml:id="tab-adm-envars"> | |
<title>Useful environment variables</title> | |
<tgroup cols="2"> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<envar>HOME</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
the home directory of the current user | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>HOST</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
the current host name | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>LANG</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
when a tool is localized, it uses the language from this environment | |
variable. English can also be set to <literal>C</literal> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>PATH</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
the search path of the shell, a list of directories separated by colon | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>PS1</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
specifies the normal prompt printed before each command | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>PS2</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
specifies the secondary prompt printed when you execute a multi-line | |
command | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>PWD</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
current working directory | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<envar>USER</envar> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
the current user | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<sect2 xml:id="sec-adm-variables-argument"> | |
<title>Using argument variables</title> | |
<para> | |
For example, if you have the script <command>foo.sh</command> you can | |
execute it like this: | |
</para> | |
<screen><prompt>> </prompt>foo.sh "Tux Penguin" 2000 </screen> | |
<para> | |
To access all the arguments which are passed to your script, you need | |
positional parameters. These are <envar>$1</envar> for the first argument, | |
<envar>$2</envar> for the second, and so on. You can have up to nine | |
parameters. To get the script name, use <envar>$0</envar>. | |
</para> | |
<para> | |
The following script <command>foo.sh</command> prints all arguments from 1 | |
to 4: | |
</para> | |
<screen>#!/bin/sh | |
echo \"$1\" \"$2\" \"$3\" \"$4\"</screen> | |
<para> | |
If you execute this script with the above arguments, you get: | |
</para> | |
<screen>"Tux Penguin" "2000" "" ""</screen> | |
</sect2> | |
<sect2 xml:id="sec-adm-shell-varsubst"> | |
<title>Using variable substitution</title> | |
<para> | |
Variable substitutions apply a pattern to the content of a variable either | |
from the left or right side. The following list contains the possible | |
syntax forms: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>${VAR#pattern}</literal> | |
</term> | |
<listitem> | |
<para> | |
removes the shortest possible match from the left: | |
</para> | |
<screen><prompt>> </prompt>file=/home/tux/book/book.tar.bz2 | |
<prompt>> </prompt>echo ${file#*/} | |
home/tux/book/book.tar.bz2</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>${VAR##pattern}</literal> | |
</term> | |
<listitem> | |
<para> | |
removes the longest possible match from the left: | |
</para> | |
<screen><prompt>> </prompt>file=/home/tux/book/book.tar.bz2 | |
<prompt>> </prompt>echo ${file##*/} | |
book.tar.bz2</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>${VAR%pattern}</literal> | |
</term> | |
<listitem> | |
<para> | |
removes the shortest possible match from the right: | |
</para> | |
<screen><prompt>> </prompt>file=/home/tux/book/book.tar.bz2 | |
<prompt>> </prompt>echo ${file%.*} | |
/home/tux/book/book.tar</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>${VAR%%pattern}</literal> | |
</term> | |
<listitem> | |
<para> | |
removes the longest possible match from the right: | |
</para> | |
<screen><prompt>> </prompt>file=/home/tux/book/book.tar.bz2 | |
<prompt>> </prompt>echo ${file%%.*} | |
/home/tux/book/book</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>${VAR/pattern_1/pattern_2}</literal> | |
</term> | |
<listitem> | |
<para> | |
substitutes the content of <replaceable>VAR</replaceable> from the | |
<replaceable>PATTERN_1</replaceable> with | |
<replaceable>PATTERN_2</replaceable>: | |
</para> | |
<screen><prompt>> </prompt>file=/home/tux/book/book.tar.bz2 | |
<prompt>> </prompt>echo ${file/tux/wilber} | |
/home/wilber/book/book.tar.bz2</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-adm-shell-grouping"> | |
<title>Grouping and combining commands</title> | |
<para> | |
Shells allow you to concatenate and group commands for conditional | |
execution. Each command returns an exit code which determines the success or | |
failure of its operation. If it is 0 (zero) the command was successful, | |
everything else marks an error which is specific to the command. | |
</para> | |
<para> | |
The following list shows, how commands can be grouped: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>Command1 ; Command2</literal> | |
</term> | |
<listitem> | |
<para> | |
executes the commands in sequential order. The exit code is not checked. | |
The following line displays the content of the file with | |
<command>cat</command> and then prints its file properties with | |
<command>ls</command> regardless of their exit codes: | |
</para> | |
<screen><prompt>> </prompt>cat filelist.txt ; ls -l filelist.txt</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Command1 && Command2</literal> | |
</term> | |
<listitem> | |
<para> | |
runs the right command, if the left command was successful (logical AND). | |
The following line displays the content of the file and prints its file | |
properties only, when the previous command was successful (compare it | |
with the previous entry in this list): | |
</para> | |
<screen><prompt>> </prompt>cat filelist.txt && ls -l filelist.txt</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Command1 || Command2</literal> | |
</term> | |
<listitem> | |
<para> | |
runs the right command, when the left command has failed (logical OR). | |
The following line creates only a directory in | |
<filename>/home/wilber/bar</filename> when the creation of the directory | |
in <filename>/home/tux/foo</filename> has failed: | |
</para> | |
<screen><prompt>> </prompt>mkdir /home/tux/foo || mkdir /home/wilber/bar</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>funcname(){ ... }</literal> | |
</term> | |
<listitem> | |
<para> | |
creates a shell function. You can use the positional parameters to access | |
its arguments. The following line defines the function | |
<literal>hello</literal> to print a short message: | |
</para> | |
<screen><prompt>> </prompt>hello() { echo "Hello $1"; }</screen> | |
<para> | |
You can call this function like this: | |
</para> | |
<screen><prompt>> </prompt>hello Tux</screen> | |
<para> | |
which prints: | |
</para> | |
<screen>Hello Tux</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-adm-shell-commonconstructs"> | |
<title>Working with common flow constructs</title> | |
<para> | |
To control the flow of your script, a shell has <command>while</command>, | |
<command>if</command>, <command>for</command> and <command>case</command> | |
constructs. | |
</para> | |
<sect2 xml:id="sec-adm-shell-if"> | |
<title>The if control command</title> | |
<para> | |
The <command>if</command> command is used to check expressions. For | |
example, the following code tests whether the current user is Tux: | |
</para> | |
<screen>if test $USER = "tux"; then | |
echo "Hello Tux." | |
else | |
echo "You are not Tux." | |
fi</screen> | |
<para> | |
The test expression can be as complex or simple as possible. The following | |
expression checks if the file <filename>foo.txt</filename> exists: | |
</para> | |
<screen>if test -e /tmp/foo.txt ; then | |
echo "Found foo.txt" | |
fi</screen> | |
<para> | |
The test expression can also be abbreviated in square brackets: | |
</para> | |
<screen>if [ -e /tmp/foo.txt ] ; then | |
echo "Found foo.txt" | |
fi</screen> | |
<para> | |
Find more useful expressions at | |
<link xlink:href="https://bash.cyberciti.biz/guide/If..else..fi"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-adm-shell-for"> | |
<title>Creating loops with the <command>for</command> command</title> | |
<para> | |
The <command>for</command> loop allows you to execute commands to a list of | |
entries. For example, the following code prints some information about PNG | |
files in the current directory: | |
</para> | |
<screen>for i in *.png; do | |
ls -l $i | |
done</screen> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-adm-shell-moreinfo"> | |
<title>More information</title> | |
<para> | |
Important information about Bash is provided in the man pages <command>man | |
bash</command>. More about this topic can be found in the following list: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
<link xlink:href="http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html"/>—Bash | |
Guide for Beginners | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html"/>—BASH | |
Programming - Introduction HOW-TO | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="http://tldp.org/LDP/abs/html/index.html"/>—Advanced | |
Bash-Scripting Guide | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="http://www.grymoire.com/Unix/Sh.html"/>—Sh - the | |
Bourne Shell | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-adm-sudo"> | |
<title><command>sudo</command> basics</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Running certain commands requires root privileges. However, for security | |
reasons and to avoid mistakes, it is not recommended to log in as | |
<systemitem class="username">root</systemitem>. A safer approach is to log in as a regular user, and | |
then use <command>sudo</command> to run commands with elevated privileges. | |
</para> | |
<para> | |
On <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>, <command>sudo</command> is configured to work similarly to <command>su</command>. However, | |
<command>sudo</command> provides a flexible mechanism that allows users to run commands with | |
privileges of any other user. This can be used to assign roles with specific | |
privileges to certain users and groups. For example, it is possible to allow | |
members of the group <systemitem class="groupname">users</systemitem> to run a command with the privileges of | |
user <systemitem class="username">wilber</systemitem>. Access to the command can be further restricted by | |
disallowing any command options. While su always requires the <systemitem class="username">root</systemitem> | |
password for authentication with PAM, <command>sudo</command> can be configured to | |
authenticate with your own credentials. This means that the users do not need | |
to share the <systemitem class="username">root</systemitem> password, which improves security. | |
</para> | |
<sect1 xml:id="sec-adm-sudo-usage"> | |
<title>Basic <command>sudo</command> usage</title> | |
<para> | |
The following chapter provides an introduction to basic usage of <command>sudo</command>. | |
</para> | |
<sect2 xml:id="sec-adm-sudo-usage-cmd"> | |
<title>Running a single command</title> | |
<para> | |
As a regular user, you can run any command as <systemitem class="username">root</systemitem> by | |
adding <command>sudo</command> before it. This prompts you to provide the root password. If | |
authenticated successfully, this runs the command as <systemitem class="username">root</systemitem>: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>id -un</command><co xml:id="co-sudo-usage-id"/> | |
tux | |
<prompt>> </prompt><command>sudo</command> <command>id -un</command> | |
root's password:<co xml:id="co-sudo-usage-pw"/> | |
root | |
<prompt>> </prompt><command>id -un</command> | |
tux<co xml:id="co-sudo-usage-after"/> | |
<prompt>> </prompt><command>sudo</command> <command>id -un</command> | |
<co xml:id="co-sudo-usage-nopw"/> | |
root | |
</screen> | |
<calloutlist> | |
<callout arearefs="co-sudo-usage-id"> | |
<para> | |
The <command>id -un</command> command prints the login name of the | |
current user. | |
</para> | |
</callout> | |
<callout arearefs="co-sudo-usage-pw"> | |
<para> | |
The password is not shown during input, neither as clear text nor as | |
masking characters. | |
</para> | |
</callout> | |
<callout arearefs="co-sudo-usage-after"> | |
<para> | |
Only commands that start with <command>sudo</command> run with elevated privileges. | |
</para> | |
</callout> | |
<callout arearefs="co-sudo-usage-nopw"> | |
<para> | |
The elevated privileges persist for a certain period of time, so you | |
do not need to provide the <systemitem class="username">root</systemitem> again. | |
password again. | |
</para> | |
</callout> | |
</calloutlist> | |
<tip> | |
<title>I/O redirection</title> | |
<para> | |
When using <command>sudo</command>, I/O redirection does not work: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> echo s > /proc/sysrq-trigger | |
bash: /proc/sysrq-trigger: Permission denied | |
<prompt>> </prompt><command>sudo</command> cat < /proc/1/maps | |
bash: /proc/1/maps: Permission denied | |
</screen> | |
<para> | |
In the example above, only the <command>echo</command> and | |
<command>cat</command> commands run with elevated privileges. The | |
redirection is done by the user's shell with user privileges. To perform | |
redirection with elevated privileges, either start a shell as in <xref linkend="sec-sudo-shell" role="internalbook"/> or use the <command>dd</command> utility: | |
</para> | |
<screen> | |
echo s | sudo dd of=/proc/sysrq-trigger | |
sudo dd if=/proc/1/maps | cat | |
</screen> | |
</tip> | |
</sect2> | |
<sect2 xml:id="sec-sudo-shell"> | |
<title>Starting a shell</title> | |
<para> | |
Using <command>sudo</command> every time to run a command with elevated privileges is not | |
always practical. While you can use the <command>sudo bash</command> | |
command, it is recommended to use one of the built-in mechanisms to start a | |
shell: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>sudo -s (<command>)</literal> | |
</term> | |
<listitem> | |
<para> | |
Starts a shell specified by the <envar>SHELL</envar> environment | |
variable or the target user's default shell. If a command is specified, it | |
is passed to the shell (with the <option>-c</option> option). Otherwise the | |
shell runs in interactive mode. | |
</para> | |
<screen> | |
<prompt>tux:~ > </prompt>sudo -s | |
root's password: | |
<prompt>root:/home/tux # </prompt>exit | |
<prompt>tux:~ > </prompt> | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>sudo -i (<command>)</literal> | |
</term> | |
<listitem> | |
<para> | |
Similar to <option>-s</option>, but starts the shell as a login shell. This | |
means that the shell's start-up files (<filename>.profile</filename> | |
etc.) are processed, and the current working directory is set to the | |
target user's home directory. | |
</para> | |
<screen> | |
<prompt>tux:~ > </prompt>sudo -i | |
root's password: | |
<prompt>root:~ # </prompt>exit | |
<prompt>tux:~ > </prompt> | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<tip> | |
<title>Environment variables</title> | |
<para> | |
By default, <command>sudo</command> does not propagate environment variables. This behavior | |
can be changed using the <literal>env_reset</literal> option (see <xref linkend="tab-adm-sudo-options" role="internalbook"/>). | |
</para> | |
</tip> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-sudo-conf"> | |
<title>Configuring <command>sudo</command></title> | |
<para> | |
<command>sudo</command> provides a wide range on configurable options. | |
</para> | |
<note> | |
<title>Locked yourself out of sudo</title> | |
<para> | |
If you accidentally locked yourself out of <command>sudo</command>, use <command>su | |
-</command> and the <systemitem class="username">root</systemitem> password to start a root shell. | |
To fix the error, run <command>visudo</command>. | |
</para> | |
</note> | |
<sect2 xml:id="sec-sudo-conf-edit"> | |
<title>Editing the configuration files</title> | |
<para> | |
The main policy configuration file for <command>sudo</command> is | |
<filename>/etc/sudoers</filename>. As it is possible to lock yourself out | |
of the system if the file is malformed, it is strongly recommended to use | |
<command>visudo</command> for editing. It prevents editing conflicts and | |
checks for syntax errors before saving the modifications. | |
</para> | |
<para> | |
You can use another editor instead of vi by setting the | |
<envar>EDITOR</envar> environment variable, for example: | |
</para> | |
<screen>sudo EDITOR=<replaceable>/usr/bin/nano</replaceable> visudo</screen> | |
<para> | |
Keep in mind that the <filename>/etc/sudoers</filename> file is supplied by | |
the system packages, and modifications done directly in the file may break | |
updates. Therefore, it is recommended to put custom configuration into | |
files in the <filename>/etc/sudoers.d/</filename> directory. Use the | |
following command to create or edit a file: | |
</para> | |
<screen>sudo visudo -f /etc/sudoers.d/<replaceable>NAME</replaceable></screen> | |
<para> | |
The command bellow opens the file using a different editor (in this case, | |
<command>nano</command>): | |
</para> | |
<screen>sudo EDITOR=<replaceable>/usr/bin/nano</replaceable> visudo -f /etc/sudoers.d/<replaceable>NAME</replaceable></screen> | |
<note> | |
<title>Ignored files in <filename>/etc/sudoers.d</filename></title> | |
<para> | |
The <literal>#includedir</literal> directive in | |
<filename>/etc/sudoers</filename> ignores files that end with the | |
<literal>~</literal> (tilde) character or contain the <literal>.</literal> | |
(dot) character. | |
</para> | |
</note> | |
<para> | |
For more information on the <command>visudo</command> command, run | |
<command>man 8 visudo</command>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-sudo-conf-syntax"> | |
<title>Basic sudoers configuration syntax</title> | |
<para> | |
The sudoers configuration files contain two types of options: strings | |
and flags. While strings can contain any value, flags can be turned either | |
ON or OFF. The most important syntax constructs for sudoers configuration | |
files are as follows: | |
</para> | |
<screen> | |
# Everything on a line after # is ignored <co xml:id="co-sudo-syntax-comment"/> | |
Defaults !insults # Disable the insults flag <co xml:id="co-sudo-syntax-flag"/> | |
Defaults env_keep += "DISPLAY HOME" # Add DISPLAY and HOME to env_keep | |
tux ALL = NOPASSWD: /usr/bin/frobnicate, PASSWD: /usr/bin/journalctl <co xml:id="co-sudo-syntax-rule"/> | |
</screen> | |
<calloutlist> | |
<callout arearefs="co-sudo-syntax-comment"> | |
<para> | |
There are two exceptions: <literal>#include</literal> and | |
<literal>#includedir</literal> are regular commands. | |
</para> | |
</callout> | |
<callout arearefs="co-sudo-syntax-flag"> | |
<para> | |
Remove the <literal>!</literal> character to set the desired flag to ON. | |
</para> | |
</callout> | |
<callout arearefs="co-sudo-syntax-rule"> | |
<para> | |
See <xref linkend="sec-sudo-conf-rule" role="internalbook"/>. | |
</para> | |
</callout> | |
</calloutlist> | |
<variablelist xml:id="tab-adm-sudo-options"><title>Useful flags and options</title> | |
<varlistentry> | |
<term> | |
<literal>targetpw</literal> | |
</term> | |
<listitem> | |
<para> | |
This flag controls whether the invoking user is required to enter the | |
password of the target user (ON) (for example <systemitem class="username">root</systemitem>) or the invoking | |
user (OFF). | |
</para> | |
<screen>Defaults targetpw # Turn targetpw flag ON</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<literal>rootpw</literal> | |
</term> | |
<listitem> | |
<para> | |
If set, <command>sudo</command> prompts for the <systemitem class="username">root</systemitem> password. The default is OFF. | |
</para> | |
<screen>Defaults !rootpw # Turn rootpw flag OFF</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<literal>env_reset</literal> | |
</term> | |
<listitem> | |
<para> | |
If set, <command>sudo</command> constructs a minimal environment with | |
<envar>TERM</envar>, <envar>PATH</envar>, <envar>HOME</envar>, | |
<envar>MAIL</envar>, <envar>SHELL</envar>, <envar>LOGNAME</envar>, | |
<envar>USER</envar>, <envar>USERNAME</envar>, and | |
<envar>SUDO_*</envar>. Additionally, variables listed in | |
<literal>env_keep</literal> are imported from the calling | |
environment. The default is ON. | |
</para> | |
<screen>Defaults env_reset # Turn env_reset flag ON</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<literal>env_keep</literal> | |
</term> | |
<listitem> | |
<para> | |
List of environment variables to keep when the | |
<literal>env_reset</literal> flag is ON. | |
</para> | |
<screen> | |
# Set env_keep to contain EDITOR and PROMPT | |
Defaults env_keep = "EDITOR PROMPT" | |
Defaults env_keep += "JRE_HOME" # Add JRE_HOME | |
Defaults env_keep -= "JRE_HOME" # Remove JRE_HOME | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<literal>env_delete</literal> | |
</term> | |
<listitem> | |
<para> | |
List of environment variables to remove when the | |
<literal>env_reset</literal> flag is OFF. | |
</para> | |
<screen> | |
# Set env_delete to contain EDITOR and PROMPT | |
Defaults env_delete = "EDITOR PROMPT" | |
Defaults env_delete += "JRE_HOME" # Add JRE_HOME | |
Defaults env_delete -= "JRE_HOME" # Remove JRE_HOME | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The <literal>Defaults</literal> token can also be used to create aliases | |
for a collection of users, hosts, and commands. Furthermore, it is possible | |
to apply an option only to a specific set of users. | |
</para> | |
<para> | |
For detailed information about the <filename>/etc/sudoers</filename> | |
configuration file, consult <command>man 5 sudoers</command>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-sudo-conf-rule"> | |
<title>Basic sudoers rules</title> | |
<para> | |
Each rule follows the following scheme | |
(<literal>[]</literal> marks optional parts): | |
</para> | |
<screen> | |
#Who Where As whom Tag What | |
User_List Host_List = [(User_List)] [NOPASSWD:|PASSWD:] Cmnd_List | |
</screen> | |
<variablelist> | |
<title>sudoers rule syntax</title> | |
<varlistentry> | |
<term><literal>User_List</literal> | |
</term> | |
<listitem> | |
<para> | |
One or several (separated by comma) identifiers: either a | |
user name, a group in the format <literal>%GROUPNAME</literal>, or a user | |
ID in the format <literal>#UID</literal>. Negation can be specified with | |
the <literal>!</literal> prefix. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Host_List</literal> | |
</term> | |
<listitem> | |
<para> | |
One or several (separated by comma) identifiers: either a | |
(fully qualified) host name or an IP address. Negation can be specified | |
with the <literal>!</literal> prefix. <literal>ALL</literal> is a common | |
choice for <literal>Host_List</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>NOPASSWD:|PASSWD:</literal> | |
</term> | |
<listitem> | |
<para> | |
The user is not prompted for a password when running commands | |
matching <literal>Cmd_List</literal> after <literal>NOPASSWD:</literal>. | |
</para> | |
<para> | |
<literal>PASSWD</literal> is the default. It only needs to be specified | |
when both <literal>PASSWD</literal> and <literal>NOPASSWD</literal> are | |
on the same line: | |
</para> | |
<screen>tux ALL = PASSWD: /usr/bin/foo, NOPASSWD: /usr/bin/bar</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>Cmnd_List</literal> | |
</term> | |
<listitem> | |
<para> | |
One or several (separated by comma) specifiers: A path to an | |
executable, followed by an optional allowed argument. | |
</para> | |
<screen> | |
/usr/bin/foo # Anything allowed | |
/usr/bin/foo bar # Only "/usr/bin/foo bar" allowed | |
/usr/bin/foo "" # No arguments allowed | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
<literal>ALL</literal> can be used as <literal>User_List</literal>, | |
<literal>Host_List</literal>, and <literal>Cmnd_List</literal>. | |
</para> | |
<para> | |
A rule that allows <systemitem class="username">tux</systemitem> to run all commands as root without | |
entering a password: | |
</para> | |
<screen>tux ALL = NOPASSWD: ALL</screen> | |
<para> | |
A rule that allows <systemitem class="username">tux</systemitem> to run <command>systemctl restart | |
apache2</command>: | |
</para> | |
<screen>tux ALL = /usr/bin/systemctl restart apache2</screen> | |
<para> | |
A rule that allows <systemitem class="username">tux</systemitem> to run <command>wall</command> as | |
<systemitem>admin</systemitem> with no arguments: | |
</para> | |
<screen>tux ALL = (admin) /usr/bin/wall ""</screen> | |
<warning> | |
<title>Unsafe rules</title> | |
<para> | |
<emphasis>Do not</emphasis> use rules like <literal>ALL ALL = | |
ALL</literal> without <literal>Defaults targetpw</literal>. Otherwise | |
anyone can run commands as <systemitem class="username">root</systemitem>. | |
</para> | |
</warning> | |
<important> | |
<title>Winbind and sudo</title> | |
<para> | |
When specifying the group name in the <filename>sudoers</filename> file, make sure that you use the NetBIOS domain name instead of the realm, for example: | |
</para> | |
<screen><replaceable>%DOMAIN</replaceable>\\<replaceable>GROUP_NAME</replaceable> ALL = (ALL) ALL</screen> | |
<para> | |
Keep in mind that when using winbindd, the format also depends on the <option>winbind separator</option> option in the <filename>smb.conf</filename> file. By default, it is <literal>\</literal>. If it is changed, for example, to <literal>+</literal>, then the account format in the <filename>sudoers</filename> file must be <literal>DOMAIN+GROUP_NAME</literal>. | |
</para> | |
</important> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-sudo-usecases"> | |
<title><command>sudo</command> use cases</title> | |
<para> | |
While the default configuration works for standard usage scenarios, you can | |
customize the default configuration to meet your specific needs. | |
</para> | |
<sect2 xml:id="sec-sudo-usecases-userpw"> | |
<title>Using <command>sudo</command> without <systemitem class="username">root</systemitem> password</title> | |
<para> | |
By design, members of the group <systemitem class="groupname">wheel</systemitem> can run all commands with <command>sudo</command> as | |
root. The following procedure explains how to add a user account to the <systemitem class="groupname">wheel</systemitem> group. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Add your user account to the group | |
<systemitem class="groupname">wheel</systemitem>. | |
</para> | |
<para> | |
If your user account is not already a member of the <systemitem class="groupname">wheel</systemitem> group, add it using the | |
<command>sudo usermod -a -G wheel | |
<replaceable>USERNAME</replaceable></command> command. Log out and log in | |
again to enable the change. Verify that the change was successful by | |
running the <command>groups <replaceable>USERNAME</replaceable></command> | |
command. | |
</para> | |
</step> | |
<step> | |
<para> | |
Authenticate with the user account's normal password. | |
</para> | |
<para> | |
Create the file <filename>/etc/sudoers.d/userpw</filename> using the | |
<command>visudo</command> command (see <xref linkend="sec-sudo-conf-edit" role="internalbook"/>) and | |
add the following: | |
</para> | |
<screen>Defaults !targetpw</screen> | |
</step> | |
<step> | |
<para> | |
Select a new default rule. | |
</para> | |
<para> | |
Depending on whether you want users to re-enter their passwords, | |
uncomment the appropriate line in <filename>/etc/sudoers</filename> and | |
comment out the default rule. | |
</para> | |
<screen> | |
## Uncomment to allow members of group wheel to execute any command | |
# %wheel ALL=(ALL) ALL | |
## Same thing without a password | |
# %wheel ALL=(ALL) NOPASSWD: ALL | |
</screen> | |
</step> | |
<step> | |
<para> | |
Make the default rule more restrictive. | |
</para> | |
<para> | |
Comment out or remove the allow-everything rule in | |
<filename>/etc/sudoers</filename>: | |
</para> | |
<screen>ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!</screen> | |
<warning> | |
<title>Dangerous rule in sudoers</title> | |
<para> | |
Do not skip this step. Otherwise <emphasis>any</emphasis> user can | |
execute <emphasis>any</emphasis> command as <systemitem class="username">root</systemitem>! | |
</para> | |
</warning> | |
</step> | |
<step> | |
<para> | |
Test the configuration. | |
</para> | |
<para> | |
Run <command>sudo</command> as member and non-member of | |
<systemitem class="groupname">wheel</systemitem>. | |
</para> | |
<screen> | |
<prompt>tux:~ > </prompt>groups | |
users wheel | |
<prompt>tux:~ > </prompt>sudo id -un | |
tux's password: | |
root | |
<prompt>wilber:~ > </prompt>groups | |
users | |
<prompt>wilber:~ > </prompt>sudo id -un | |
wilber is not in the sudoers file. This incident will be reported. | |
</screen> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-sudo-usecases-xorg"> | |
<title>Using <command>sudo</command> with X.Org applications</title> | |
<para> | |
Starting graphical applications with <command>sudo</command> usually results in the following | |
error: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> xterm | |
xterm: Xt error: Can't open display: %s | |
xterm: DISPLAY is not set | |
</screen> | |
<para> | |
A simple workaround is to use xhost to temporarily allow the root user | |
to access the local user's X session. This is done using the following command: | |
</para> | |
<screen>xhost si:localuser:root</screen> | |
<para> | |
The command below removes the granted access: | |
</para> | |
<screen>xhost -si:localuser:root</screen> | |
<warning> | |
<title>Potential security issue</title> | |
<para> | |
Running graphical applications with root privileges has security | |
implications. It is recommended to enable root access for a graphical | |
application only as an exception. It is also recommended to revoke | |
the granted root access as soon as the graphical application is closed. | |
</para> | |
</warning> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-adm-sudo-moreinfo"> | |
<title>More information</title> | |
<para> | |
The <command>sudo --help</command> command offers a brief overview of the | |
available command line options, while the <command>man sudoers</command> | |
command provides detailed information about <filename>sudoers</filename> | |
and its configuration. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-yast-gui"> | |
<title>Using YaST</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
YaST is a <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> tool that provides a graphical interface for | |
all essential installation and system configuration tasks. Whether you need | |
to update packages, configure a printer, modify firewall settings, set up an | |
FTP server, or partition a hard disk—you can do it using | |
YaST. Written in Ruby, YaST features an extensible architecture that | |
makes it possible to add new functionality via modules. | |
</para> | |
<para> | |
Additional information about YaST is available on the project's official | |
Web site at <link xlink:href="https://yast.opensuse.org/"/>. | |
</para> | |
<sect1 xml:id="sec-yast2-gui"> | |
<title>YaST interface overview</title> | |
<para> | |
YaST has two graphical interfaces: one for use with graphical desktop | |
environments like KDE and GNOME, and an ncurses-based pseudo-graphical | |
interface for use on systems without an X server (see <xref linkend="cha-yast-text" role="internalbook"/>). | |
</para> | |
<para> | |
In the graphical version of YaST, all modules in YaST are grouped by | |
category, and the navigation sidebar allows you to quickly access modules in | |
the desired category. The search field at the top makes it possible to find | |
modules by their names. To find a specific module, enter its name into the | |
search field, and you should see the modules that match the entered string | |
as you type. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-yast-gui-key-combination"> | |
<title>Useful key combinations</title> | |
<para>The graphical version of YaST supports keyboard | |
shortcuts</para> | |
<variablelist> | |
<varlistentry> | |
<term> | |
<keycap>Print Screen</keycap> | |
</term> | |
<listitem> | |
<para> | |
Take and save a screenshot. It may not work on certain desktop environments. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="shift"/><keycap>F4</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Enable and disable the color palette optimized for visually-impaired users. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="shift"/><keycap>F7</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Enable/disable logging of debug messages. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="shift"/><keycap>F8</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Open a file dialog to save log files to a user-defined location. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>D</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Send a DebugEvent. YaST modules can react to this by executing special debugging actions. | |
The result depends on the specific YaST module. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>M</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Start and stop macro recorder. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>P</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Replay macro. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>S</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Show style sheet editor. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>T</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Dump widget tree to the log file. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>X</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Open a terminal window (xterm). Useful for installation process via VNC. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<keycombo><keycap function="control"/><keycap function="shift"/><keycap function="alt"/><keycap>Y</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Show widget tree browser. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-yast-text"> | |
<title>YaST in text mode</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
The ncurses-based pseudo-graphical YaST interface is designed primarily to | |
help system administrators to manage systems without an X | |
server. The interface offers several advantages compared to the | |
conventional GUI. You can navigate the ncurses interface using the keyboard, | |
and there are keyboard shortcuts for practically all interface elements. The | |
ncurses interface is light on resources, and runs fast even on modest | |
hardware. You can run the ncurses-based version of YaST via an SSH | |
connection, so you can administer remote systems. Keep in mind that | |
the minimum supported size of the terminal emulator in which to run YaST is | |
80x25 characters. | |
</para> | |
<figure xml:id="fig-yast2-ncurses"> | |
<title>Main window of YaST in text mode</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_ncurses_main.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_ncurses_main.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
To launch the ncurses-based version of YaST, open the terminal and run the | |
<command>sudo yast2</command> command. Use the <keycap function="tab"/> or | |
arrow keys to navigate between interface elements like menu | |
items, fields, and buttons. All menu items and buttons in YaST can be | |
accessed using the appropriate function keys or keyboard shortcuts. For | |
example, you can cancel the current operation by pressing | |
<keycap>F9</keycap>, while the <keycap>F10</keycap> key can be used to accept | |
the changes. Each menu item and button in YaST's ncurses-based interface | |
has a highlighted letter in its label. This letter is part of the keyboard | |
shortcut assigned to the interface element. For example, the letter | |
<literal>Q</literal> is highlighted in the <guimenu>Quit</guimenu> | |
button. This means that you can activate the button by pressing | |
<keycombo><keycap function="alt"/><keycap>Alt+Q</keycap></keycombo>. | |
</para> | |
<tip> | |
<title>Refreshing YaST dialogs</title> | |
<para> | |
If a YaST dialog gets corrupted or distorted (for example, while resizing | |
the window), press | |
<keycombo><keycap function="control"/><keycap>L</keycap></keycombo> | |
to refresh and restore its contents. | |
</para> | |
</tip> | |
<sect1 xml:id="sec-yast-cli-navigate"> | |
<title>Navigation in modules</title> | |
<para> | |
The following description of the control elements in the YaST modules | |
assumes that all function keys and <keycap function="alt"/> key combinations | |
work and are not assigned to different global functions. Read | |
<xref linkend="sec-yast-cli-restricted-keys" role="internalbook"/> for information about | |
possible exceptions. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Moving between buttons and selection lists</term> | |
<listitem> | |
<para> | |
Use <keycap function="tab"/> to move between the buttons and frames | |
containing selection lists. To navigate in the opposite direction, use | |
<keycombo> <keycap function="alt"/> | |
<keycap function="tab"/> </keycombo> or <keycombo> | |
<keycap function="shift"/> <keycap function="tab"/> </keycombo> | |
combinations. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Navigating in selection lists</term> | |
<listitem> | |
<para> | |
Use the arrow keys (<keycap function="up"/> and <keycap function="down"/>) to move through the individual elements in an active | |
frame containing a selection list. If individual entries are longer than | |
the frame's width, use <keycombo><keycap function="shift"/> <keycap function="right"/></keycombo> or <keycombo> <keycap function="shift"/> | |
<keycap function="left"/></keycombo> to scroll | |
horizontally. If the arrow key causes the selection to move to another frame, use <keycombo> <keycap function="control"/> | |
<keycap>E</keycap> | |
</keycombo> or <keycombo> <keycap function="control"/> | |
<keycap>A</keycap> </keycombo> instead. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Working with buttons, radio buttons, and check boxes</term> | |
<listitem> | |
<para> | |
To select items with empty square brackets (check boxes) or empty | |
parentheses (radio buttons), press <keycap function="space"/> or | |
<keycap function="enter"/>. Alternatively, radio buttons and check boxes | |
can be selected directly with <keycombo> | |
<keycap function="alt"/> <keycap>highlighted_letter</keycap></keycombo>. | |
In this case, you do not need to confirm with <keycap function="enter"/>. | |
If you navigate to an item with <keycap function="tab"/>, press | |
<keycap function="enter"/> to execute the selected action or activate the | |
respective menu item. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Function keys</term> | |
<listitem> | |
<para> | |
The function keys (from <keycap>F1</keycap> to <keycap>F12</keycap>) enable | |
quick access to the various buttons. Available function key combinations | |
(<literal>F<replaceable>X</replaceable></literal>) are shown in the | |
bottom line of the YaST screen. Which function keys are actually mapped | |
to which buttons depend on the active YaST module, because the | |
different modules offer different buttons (<guimenu>Details</guimenu>, | |
<guimenu>Info</guimenu>, <guimenu>Add</guimenu>, | |
<guimenu>Delete</guimenu>, etc.). Use <keycap>F10</keycap> for | |
<guimenu>Accept</guimenu>, <guimenu>OK</guimenu>, | |
<guimenu>Next</guimenu>, and <guimenu>Finish</guimenu>. Press | |
<keycap>F1</keycap> to access the YaST help. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Using the navigation tree</term> | |
<listitem> | |
<para> | |
Some YaST modules use a navigation tree in the left part of the window | |
to select configuration dialogs. Use the arrow keys | |
(<keycap function="up"/> and <keycap function="down"/>) to navigate in | |
the tree. Use <keycap function="space"/> to open or close tree items. In | |
the ncurses mode, <keycap function="enter"/> must be pressed after a | |
selection in the navigation tree to show the selected dialog. This is an | |
intentional behavior to save time-consuming redraws when browsing through | |
the navigation tree. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Selecting software in the software installation module</term> | |
<listitem> | |
<para> | |
Use the filters on the left side to list packages matching the specified | |
string. Installed packages are marked with the letter | |
<literal>i</literal>. To change the status of a package, press <keycap function="space"/> or <keycap function="enter"/>. Alternatively, use the | |
<guimenu>Actions</guimenu> menu to select the needed status change | |
(install, delete, update, taboo, or lock). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<figure xml:id="fig-yast2-ncurses-inst"> | |
<title>The software installation module</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_ncurses_inst.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_ncurses_inst.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
</sect1> | |
<sect1 xml:id="sec-yast-cli-key-combination"> | |
<title>Advanced key combinations</title> | |
<para> | |
The ncurses-based version of YaST offers several advanced key combinations. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><keycombo><keycap function="shift"/><keycap>F1</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
List advanced hotkeys. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="shift"/><keycap>F4</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Change color schema. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="control"/><keycap/></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Quit the application. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="control"/><keycap>L</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Refresh screen. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="control"/><keycap>D</keycap></keycombo><keycap>F1</keycap> | |
</term> | |
<listitem> | |
<para> | |
List advanced hotkeys. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="control"/><keycap>D</keycap></keycombo><keycombo><keycap function="shift"/><keycap>D</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Dump dialog to the log file as a screenshot. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><keycombo><keycap function="control"/><keycap>D</keycap></keycombo><keycombo><keycap function="shift"/><keycap>Y</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
Open YDialogSpy to see the widget hierarchy. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-yast-cli-restricted-keys"> | |
<title>Restriction of key combinations</title> | |
<para> | |
If your window manager uses global <keycap function="alt"/> combinations, | |
the <keycap function="alt"/> combinations in YaST might not work. Keys | |
like <keycap function="alt"/> or <keycap function="shift"/> can also be | |
occupied by the settings of the terminal. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Using <keycap function="alt"/> instead of <keycap function="escape"/> | |
</term> | |
<listitem> | |
<para> | |
<keycap function="alt"/> shortcuts can be executed with | |
<keycap function="escape"/> instead of <keycap function="alt"/>. For | |
example, <keycombo> | |
<keycap function="escape"/><keycap>H</keycap></keycombo> replaces | |
<keycombo> | |
<keycap function="alt"/><keycap>H</keycap></keycombo>. (Press | |
<keycap function="escape"/>, <emphasis>then</emphasis> press | |
<keycap>H</keycap>.) | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> Backward and forward navigation with <keycombo><keycap function="control"/><keycap>F</keycap></keycombo> and <keycombo><keycap function="control"/><keycap>B</keycap></keycombo> | |
</term> | |
<listitem> | |
<para> | |
If the <keycap function="alt"/> and <keycap function="shift"/> | |
combinations are taken over by the window manager or the terminal, use the | |
combinations <keycombo> <keycap function="control"/> | |
<keycap>F</keycap></keycombo> (forward) and <keycombo> | |
<keycap function="control"/><keycap>B</keycap></keycombo> (backward) | |
instead. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Restriction of function keys</term> | |
<listitem> | |
<para> | |
The function keys (<keycap>F1</keycap> ... <keycap>F12</keycap>) are also | |
used for functions. Certain function keys might be taken over by the | |
terminal and may not be available for YaST. However, the | |
<keycap function="alt"/> key combinations and function keys should always | |
be fully available on a text-only console. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-yast-cli-options"> | |
<title>YaST command line options</title> | |
<para> | |
Besides the text mode interface, YaST provides a command line | |
interface. To get a list of YaST command line options, use the following | |
command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> yast -h</screen> | |
<sect2 xml:id="sec-yast-cli-options-install"> | |
<title>Installing packages from the command line</title> | |
<para> | |
If you know the package name, and the package is provided by an active | |
installation repository, you can use the command line option | |
<option>-i</option> to install the package: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> yast <replaceable>-i package_name</replaceable></screen> | |
<para> | |
or | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> yast --install <replaceable>-i package_name</replaceable></screen> | |
<para> | |
<replaceable>package_name</replaceable> can be a single short package name | |
(for example <package>gvim</package>) installed with dependency checking, | |
or the full path to an RPM package, which is installed without dependency | |
checking. | |
</para> | |
<para> | |
While YaST offers basic functionality for managing software from the | |
command line, consider using Zypper for more advanced package management | |
tasks. Find more information on using Zypper in <xref linkend="sec-zypper" role="internalbook"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-yast-cli-options-modules"> | |
<title>Working with individual modules</title> | |
<para> | |
To save time, you can start individual YaST modules using the following | |
command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> yast <replaceable>module_name</replaceable></screen> | |
<para> | |
View a list of all modules available on your system with <command>yast | |
-l</command> or <command>yast --list</command>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-yast-cli-options-module-params"> | |
<title>Command line parameters of YaST modules</title> | |
<para> | |
To use YaST functionality in scripts, YaST provides command line | |
support for individual modules. However, not all modules have command line | |
support. To display the available options of a module, use the following | |
command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> yast <replaceable>module_name</replaceable> help</screen> | |
<para> | |
If a module does not provide command line support, it is started in a text | |
mode with the following message: | |
</para> | |
<screen>This YaST module does not support the command line interface.</screen> | |
<para> | |
The following sections describe all YaST modules with command line | |
support, along with a brief explanation of all their commands and | |
available options. | |
</para> | |
<sect3> | |
<title>Common YaST module commands</title> | |
<para> | |
All YaST modules support the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>help</term> | |
<listitem> | |
<para> | |
Lists all the module's supported commands with their | |
description: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan help | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>longhelp</term> | |
<listitem> | |
<para> | |
Same as <command>help</command>, but adds a detailed list of all | |
command's options and their descriptions: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan longhelp | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>xmlhelp</term> | |
<listitem> | |
<para> | |
Same as <command>longhelp</command>, but the output is structured as | |
an XML document and redirected to a file: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan xmlhelp xmlfile=/tmp/yast_lan.xml | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>interactive</term> | |
<listitem> | |
<para> | |
Enters the <emphasis>interactive</emphasis> mode. This lets you run the | |
module's commands without prefixing them with <command>sudo | |
yast</command>. Use <literal>exit</literal> to leave the interactive | |
mode. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast add-on</title> | |
<para> | |
Adds a new add-on product from the specified path: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast add-on http://server.name/directory/Lang-AddOn-CD1/ | |
</screen> | |
<para> | |
You can use the following protocols to specify the source path: http:// | |
ftp:// nfs:// disk:// cd:// or dvd://. | |
</para> | |
</sect3> | |
<sect3> | |
<title>yast audit-laf</title> | |
<para> | |
Displays and configures the Linux Audit Framework. Refer to the <phrase role="externalbook-part-audit">“The Linux Audit Framework” (↑Security and Hardening Guide)</phrase> for more details. <command>yast audit-laf</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Sets an option: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast audit-laf set log_file=/tmp/audit.log | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast audit-laf set help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>show</term> | |
<listitem> | |
<para> | |
Displays settings of an option: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast audit-laf show diskspace | |
space_left: 75 | |
space_left_action: SYSLOG | |
admin_space_left: 50 | |
admin_space_left_action: SUSPEND | |
action_mail_acct: root | |
disk_full_action: SUSPEND | |
disk_error_action: SUSPEND | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast audit-laf show | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast dhcp-server</title> | |
<para> | |
Manages the DHCP server and configures its settings. <command>yast | |
dhcp-server</command> accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>disable</term> | |
<listitem> | |
<para> | |
Disables the DHCP server service. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>enable</term> | |
<listitem> | |
<para> | |
Enables the DHCP server service. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>host</term> | |
<listitem> | |
<para> | |
Configures settings for individual hosts. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>interface</term> | |
<listitem> | |
<para> | |
Specifies to which network interface to listen to: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dhcp-server interface current | |
Selected Interfaces: eth0 | |
Other Interfaces: bond0, pbu, eth1 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dhcp-server interface | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>options</term> | |
<listitem> | |
<para> | |
Manages global DHCP options. For a complete list of options, run | |
<command>yast dhcp-server options help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>status</term> | |
<listitem> | |
<para> | |
Prints the status of the DHCP service. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>subnet</term> | |
<listitem> | |
<para> | |
Manages the DHCP subnet options. For a complete list of options, run | |
<command>yast dhcp-server subnet help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast dns-server</title> | |
<para> | |
Manages the DNS server configuration. <command>yast dns-server</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>acls</term> | |
<listitem> | |
<para> | |
Displays access control list settings: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server acls show | |
ACLs: | |
----- | |
Name Type Value | |
---------------------------- | |
any Predefined | |
localips Predefined | |
localnets Predefined | |
none Predefined | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>dnsrecord</term> | |
<listitem> | |
<para> | |
Configures zone resource records: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dnsrecord add zone=example.org query=office.example.org type=NS value=ns3 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server dnsrecord | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>forwarders</term> | |
<listitem> | |
<para> | |
Configures DNS forwarders: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server forwarders add ip=10.0.0.100 | |
<prompt>> </prompt><command>sudo</command> yast dns-server forwarders show | |
[...] | |
Forwarder IP | |
------------ | |
10.0.0.100 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server forwarders | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>host</term> | |
<listitem> | |
<para> | |
Handles 'A' and its related 'PTR' record at once: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server host show zone=example.org | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server host | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>logging</term> | |
<listitem> | |
<para> | |
Configures logging settings: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server logging set updates=no transfers=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server logging | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>mailserver</term> | |
<listitem> | |
<para> | |
Configures zone mail servers: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server mailserver add zone=example.org mx=mx1 priority=100 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server mailserver | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>nameserver</term> | |
<listitem> | |
<para> | |
Configures zone name servers: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server nameserver add zone=example.com ns=ns1 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server nameserver | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>soa</term> | |
<listitem> | |
<para> | |
Configures the start of authority (SOA) record: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server soa set zone=example.org serial=2006081623 ttl=2D3H20S | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server soa help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>startup</term> | |
<listitem> | |
<para> | |
Manages the DNS server service: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server startup atboot | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server startup help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>transport</term> | |
<listitem> | |
<para> | |
Configures zone transport rules. For a complete list of options, run | |
<command>yast dns-server transport help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>zones</term> | |
<listitem> | |
<para> | |
Manages DNS zones: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast dns-server zones add name=example.org zonetype=master | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast dns-server zones help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast disk</title> | |
<para> | |
Prints information about all disks or partitions. The only supported | |
command is <command>list</command> followed by either of the following | |
options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>disks</term> | |
<listitem> | |
<para> | |
Lists all configured disks in the system: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast disk list disks | |
Device | Size | FS Type | Mount Point | Label | Model | |
---------+------------+---------+-------------+-------+------------- | |
/dev/sda | 119.24 GiB | | | | SSD 840 | |
/dev/sdb | 60.84 GiB | | | | WD1003FBYX-0 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>partitions</term> | |
<listitem> | |
<para> | |
Lists all partitions in the system: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast disk list partitions | |
Device | Size | FS Type | Mount Point | Label | Model | |
---------------+------------+---------+-------------+-------+------ | |
/dev/sda1 | 1.00 GiB | Ext2 | /boot | | | |
/dev/sdb1 | 1.00 GiB | Swap | swap | | | |
/dev/sdc1 | 698.64 GiB | XFS | /mnt/extra | | | |
/dev/vg00/home | 580.50 GiB | Ext3 | /home | | | |
/dev/vg00/root | 100.00 GiB | Ext3 | / | | | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-yast-ftp-server"> | |
<title>yast ftp-server</title> | |
<para> | |
Configures FTP server settings. <command>yast ftp-server</command> accepts | |
the following options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>SSL, TLS</term> | |
<listitem> | |
<para> | |
Controls secure connections via SSL and TLS. SSL | |
options are valid for the <systemitem>vsftpd</systemitem> only. | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server SSL enable | |
<prompt>> </prompt><command>sudo</command> yast ftp-server TLS disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>access</term> | |
<listitem> | |
<para> | |
Configures access permissions: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server access authen_only | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast ftp-server access | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>anon_access</term> | |
<listitem> | |
<para> | |
Configures access permissions for anonymous users: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server anon_access can_upload | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast ftp-server | |
anon_access help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>anon_dir</term> | |
<listitem> | |
<para> | |
Specifies the directory for anonymous users. The directory must already | |
exist on the server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server anon_dir set_anon_dir=/srv/ftp | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast ftp-server anon_dir | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>chroot</term> | |
<listitem> | |
<para> | |
Controls <emphasis>change root</emphasis> environment (chroot): | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server chroot enable | |
<prompt>> </prompt><command>sudo</command> yast ftp-server chroot disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>idle-time</term> | |
<listitem> | |
<para> | |
Sets the maximum idle time in minutes before FTP server terminates the | |
current connection: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server idle-time set_idle_time=15 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>logging</term> | |
<listitem> | |
<para> | |
Determines whether to save the log messages into a log file: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server logging enable | |
<prompt>> </prompt><command>sudo</command> yast ftp-server logging disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>max_clients</term> | |
<listitem> | |
<para> | |
Specifies the maximum number of concurrently connected clients: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server max_clients set_max_clients=1500 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>max_clients_ip</term> | |
<listitem> | |
<para> | |
Specifies the maximum number of concurrently connected clients via IP: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server max_clients_ip set_max_clients=20 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>max_rate_anon</term> | |
<listitem> | |
<para> | |
Specifies the maximum data transfer rate permitted for anonymous | |
clients (KB/s): | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server max_rate_anon set_max_rate=10000 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>max_rate_authen</term> | |
<listitem> | |
<para> | |
Specifies the maximum data transfer rate permitted for locally | |
authenticated users (KB/s): | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server max_rate_authen set_max_rate=10000 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>port_range</term> | |
<listitem> | |
<para> | |
Specifies the port range for passive connection replies: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server port_range set_min_port=20000 set_max_port=30000 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast ftp-server port_range help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>show</term> | |
<listitem> | |
<para> | |
Displays FTP server settings. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>startup</term> | |
<listitem> | |
<para> | |
Controls the FTP start-up method: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server startup atboot | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast ftp-server startup | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>umask</term> | |
<listitem> | |
<para> | |
Specifies the file umask for <literal>authenticated:anonymous</literal> | |
users: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server umask set_umask=177:077 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>welcome_message</term> | |
<listitem> | |
<para> | |
Specifies the text to display when someone connects to the FTP server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast ftp-server welcome_message set_message="hello everybody" | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast http-server</title> | |
<para> | |
Configures the HTTP server (Apache2). <command>yast http-server</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>configure</term> | |
<listitem> | |
<para> | |
Configures the HTTP server host settings: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast http-server configure host=main servername=www.example.com \ | |
[email protected] | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast http-server configure | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<variablelist> | |
<varlistentry> | |
<term>hosts</term> | |
<listitem> | |
<para> | |
Configures virtual hosts: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast http-server hosts create servername=www.example.com \ | |
[email protected] documentroot=/var/www | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast http-server hosts | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<variablelist> | |
<varlistentry> | |
<term>listen</term> | |
<listitem> | |
<para> | |
Specifies the ports and network addresses where the HTTP server should | |
listen: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast http-server listen add=81 | |
<prompt>> </prompt><command>sudo</command> yast http-server listen list | |
Listen Statements: | |
================== | |
:80 | |
:81 | |
<prompt>> </prompt><command>sudo</command> yast http-server delete=80 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast http-server listen | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<variablelist> | |
<varlistentry> | |
<term>mode</term> | |
<listitem> | |
<para> | |
Enables or disables the wizard mode: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast http-server mode wizard=on | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<variablelist> | |
<varlistentry> | |
<term>modules</term> | |
<listitem> | |
<para> | |
Controls the Apache2 server modules: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast http-server modules enable=php5,rewrite | |
<prompt>> </prompt><command>sudo</command> yast http-server modules disable=ssl | |
<prompt>> </prompt><command>sudo</command> http-server modules list | |
[...] | |
Enabled rewrite | |
Disabled ssl | |
Enabled php5 | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast kdump</title> | |
<para> | |
Configures <systemitem>kdump</systemitem> settings. For more information | |
on <systemitem>kdump</systemitem>, refer to the | |
<phrase role="externalbook-cha-tuning-kdump-basic">“Basic Kdump configuration” (Section “Kexec and Kdump”, ↑System Analysis and Tuning Guide)</phrase>. <command>yast kdump</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>copykernel</term> | |
<listitem> | |
<para> | |
Copies the kernel into the dump directory. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>customkernel</term> | |
<listitem> | |
<para> | |
Specifies the <replaceable>kernel_string</replaceable> part of the name | |
of the custom kernel. The naming scheme is | |
<filename>/boot/vmlinu[zx]-<replaceable>kernel_string</replaceable>[.gz]</filename>. | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump customkernel kernel=kdump | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast kdump customkernel | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>dumpformat</term> | |
<listitem> | |
<para> | |
Specifies the (compression) format of the dump kernel image. Available | |
formats are 'none', 'ELF', 'compressed', or 'lzo': | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump dumpformat dump_format=ELF | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>dumplevel</term> | |
<listitem> | |
<para> | |
Specifies the dump level number in the range from 0 to 31: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump dumplevel dump_level=24 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>dumptarget</term> | |
<listitem> | |
<para> | |
Specifies the destination for saving dump images: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> kdump dumptarget taget=ssh server=name_server port=22 \ | |
dir=/var/log/dump user=user_name | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast kdump dumptarget | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>immediatereboot</term> | |
<listitem> | |
<para> | |
Controls whether the system should reboot immediately after saving the | |
core in the kdump kernel: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump immediatereboot enable | |
<prompt>> </prompt><command>sudo</command> yast kdump immediatereboot disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>keepolddumps</term> | |
<listitem> | |
<para> | |
Specifies how many old dump images are kept. Specify zero to keep them | |
all: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump keepolddumps no=5 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>kernelcommandline</term> | |
<listitem> | |
<para> | |
Specifies the command line that needs to be passed off to the kdump | |
kernel: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump kernelcommandline command="ro root=LABEL=/" | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>kernelcommandlineappend</term> | |
<listitem> | |
<para> | |
Specifies the command line that you need to <emphasis>append</emphasis> | |
to the default command line string: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump kernelcommandlineappend command="ro root=LABEL=/" | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>notificationcc</term> | |
<listitem> | |
<para> | |
Specifies an e-mail address for sending copies of notification messages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump notificationcc email="[email protected] [email protected]" | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>notificationto</term> | |
<listitem> | |
<para> | |
Specifies an e-mail address for sending notification messages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump notificationto email="[email protected] [email protected]" | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>show</term> | |
<listitem> | |
<para> | |
Displays <systemitem>kdump</systemitem> settings: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump show | |
Kdump is disabled | |
Dump Level: 31 | |
Dump Format: compressed | |
Dump Target Settings | |
target: file | |
file directory: /var/crash | |
Kdump immediate reboots: Enabled | |
Numbers of old dumps: 5 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>smtppass</term> | |
<listitem> | |
<para> | |
Specifies the file with the plain text SMTP password used for sending | |
notification messages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump smtppass pass=/path/to/file | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>smtpserver</term> | |
<listitem> | |
<para> | |
Specifies the SMTP server host name used for sending notification | |
messages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump smtpserver server=smtp.server.com | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>smtpuser</term> | |
<listitem> | |
<para> | |
Specifies the SMTP user name used for sending notification messages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump smtpuser user=smtp_user | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>startup</term> | |
<listitem> | |
<para> | |
Enables or disables start-up options: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast kdump startup enable alloc_mem=128,256 | |
<prompt>> </prompt><command>sudo</command> yast kdump startup disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast keyboard</title> | |
<para> | |
Configures the system keyboard for virtual consoles. It does not affect | |
the keyboard settings in graphical desktop environments, such as GNOME | |
or KDE. <command>yast keyboard</command> accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Lists all available keyboard layouts. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Activates new keyboard layout setting: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast keyboard set layout=czech | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays the current keyboard configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast lan</title> | |
<para> | |
Configures network cards. <command>yast lan</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>add</term> | |
<listitem> | |
<para> | |
Configures a new network card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan add name=vlan50 ethdevice=eth0 bootproto=dhcp | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast lan add | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>delete</term> | |
<listitem> | |
<para> | |
Deletes an existing network card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan delete id=0 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>edit</term> | |
<listitem> | |
<para> | |
Changes the configuration of an existing network card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan edit id=0 bootproto=dhcp | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Displays a summary of network card configuration: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast lan list | |
id name, bootproto | |
0 Ethernet Card 0, NONE | |
1 Network Bridge, DHCP | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast language</title> | |
<para> | |
Configures system languages. <command>yast language</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Lists all available languages. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Specifies the main system languages and secondary languages: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast language set lang=cs_CZ languages=en_US,es_ES no_packages | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast mail</title> | |
<para> | |
Displays the configuration of the mail system: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast mail summary | |
</screen> | |
</sect3> | |
<sect3> | |
<title>yast nfs</title> | |
<para> | |
Controls the NFS client. <command>yast nfs</command> accepts the following | |
commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>add</term> | |
<listitem> | |
<para> | |
Adds a new NFS mount: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs add spec=remote_host:/path/to/nfs/share file=/local/mount/point | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nfs add help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>delete</term> | |
<listitem> | |
<para> | |
Deletes an existing NFS mount: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs delete spec=remote_host:/path/to/nfs/share file=/local/mount/point | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nfs delete help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>edit</term> | |
<listitem> | |
<para> | |
Changes an existing NFS mount: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs edit spec=remote_host:/path/to/nfs/share \ | |
file=/local/mount/point type=nfs4 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nfs edit help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Lists existing NFS mounts: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs list | |
Server Remote File System Mount Point Options | |
---------------------------------------------------------------- | |
nfs.example.com /mnt /nfs/mnt nfs | |
nfs.example.com /home/tux/nfs_share /nfs/tux nfs | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast nfs-server</title> | |
<para> | |
Configures the NFS server. <command>yast nfs-server</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>add</term> | |
<listitem> | |
<para> | |
Adds a directory to export: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server add mountpoint=/nfs/export hosts=*.allowed_hosts.com | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nfs-server add help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>delete</term> | |
<listitem> | |
<para> | |
Deletes a directory from the NFS export: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server delete mountpoint=/nfs/export | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Specifies additional parameters for the NFS server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server set enablev4=yes security=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nfs-server set help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>start</term> | |
<listitem> | |
<para> | |
Starts the NFS server service: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server start | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>stop</term> | |
<listitem> | |
<para> | |
Stops the NFS server service: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server stop | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays a summary of the NFS server configuration: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nfs-server summary | |
NFS server is enabled | |
NFS Exports | |
* /mnt | |
* /home | |
NFSv4 support is enabled. | |
The NFSv4 domain for idmapping is localdomain. | |
NFS Security using GSS is enabled. | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast nis</title> | |
<para> | |
Configures the NIS client. <command>yast nis</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>configure</term> | |
<listitem> | |
<para> | |
Changes global settings of a NIS client: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis configure server=nis.example.com broadcast=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nis configure | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>disable</term> | |
<listitem> | |
<para> | |
Disables the NIS client: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>enable</term> | |
<listitem> | |
<para> | |
Enables your machine as NIS client: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis enable server=nis.example.com broadcast=yes automounter=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nis enable help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>find</term> | |
<listitem> | |
<para> | |
Shows available NIS servers for a given domain: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis find domain=nisdomain.com | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays a configuration summary of a NIS client. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast nis-server</title> | |
<para> | |
Configures a NIS server. <command>yast nis-server</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>master</term> | |
<listitem> | |
<para> | |
Configures a NIS master server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis-server master domain=nisdomain.com yppasswd=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nis-server master help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>slave</term> | |
<listitem> | |
<para> | |
Configures a NIS worker server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis-server slave domain=nisdomain.com master_ip=10.100.51.65 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast nis-server slave help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>stop</term> | |
<listitem> | |
<para> | |
Stops a NIS server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis-server stop | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays a configuration summary of a NIS server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast nis-server summary | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast proxy</title> | |
<para> | |
Configures proxy settings. <command>yast proxy</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>authentication</term> | |
<listitem> | |
<para> | |
Specifies the authentication options for proxy: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast proxy authentication username=tux password=secret | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast proxy authentication | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>enable, disable</term> | |
<listitem> | |
<para> | |
Enables or disables proxy settings. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Changes the current proxy settings: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast proxy set https=proxy.example.com | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast proxy set help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays proxy settings. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast rdp</title> | |
<para> | |
Controls remote desktop settings. <command>yast rdp</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>allow</term> | |
<listitem> | |
<para> | |
Allows remote access to the server's desktop: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast rdp allow set=yes | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Displays the remote desktop configuration summary. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast samba-client</title> | |
<para> | |
Configures the Samba client settings. <command>yast samba-client</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>configure</term> | |
<listitem> | |
<para> | |
Changes global settings of Samba: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-client configure workgroup=FAMILY | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>isdomainmember</term> | |
<listitem> | |
<para> | |
Checks whether the machine is a member of a domain: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-client isdomainmember domain=SMB_DOMAIN | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>joindomain</term> | |
<listitem> | |
<para> | |
Makes the machine a member of a domain: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-client joindomain domain=SMB_DOMAIN user=username password=pwd | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>winbind</term> | |
<listitem> | |
<para> | |
Enables or disables Winbind services (the | |
<systemitem>winbindd</systemitem> daemon): | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-client winbind enable | |
<prompt>> </prompt><command>sudo</command> yast samba-client winbind disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast samba-server</title> | |
<para> | |
Configures Samba server settings. <command>yast samba-server</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>backend</term> | |
<listitem> | |
<para> | |
Specifies the back-end for storing user information: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server backend smbpasswd | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast samba-server backend help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>configure</term> | |
<listitem> | |
<para> | |
Configures global settings of the Samba server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server configure workgroup=FAMILY description='Home server' | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast samba-server configure help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Displays a list of available shares: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server list | |
Status Type Name | |
============================== | |
Disabled Disk profiles | |
Enabled Disk print$ | |
Enabled Disk homes | |
Disabled Disk groups | |
Enabled Disk movies | |
Enabled Printer printers | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>role</term> | |
<listitem> | |
<para> | |
Specifies the role of the Samba server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server role standalone | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast samba-server role help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>service</term> | |
<listitem> | |
<para> | |
Enables or disables the Samba services (<systemitem>smb</systemitem> | |
and <systemitem>nmb</systemitem>): | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server service enable | |
<prompt>> </prompt><command>sudo</command> yast samba-server service disable | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>share</term> | |
<listitem> | |
<para> | |
Manipulates a single Samba share: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast samba-server share name=movies browseable=yes guest_ok=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast samba-server share help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast security</title> | |
<para> | |
Controls the security level of the host. <command>yast security</command> | |
accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>level</term> | |
<listitem> | |
<para> | |
Specifies the security level of the host: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast security level server | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast security level help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Sets the value of a specific option: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast security set passwd=sha512 crack=yes | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast security set help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays a summary of the current security configuration: | |
</para> | |
<screen> | |
<command>sudo</command>yast security summary | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast sound</title> | |
<para> | |
Configures sound card settings. <command>yast sound</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>add</term> | |
<listitem> | |
<para> | |
Configures a new sound card. Without any parameters, the command adds | |
the first detected card. | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound add card=0 volume=75 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast sound add | |
help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>channels</term> | |
<listitem> | |
<para> | |
Lists available volume channels of a sound card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound channels card=0 | |
Master 75 | |
PCM 100 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>modules</term> | |
<listitem> | |
<para> | |
Lists all available sound kernel modules: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound modules | |
snd-atiixp ATI IXP AC97 controller (snd-atiixp) | |
snd-atiixp-modem ATI IXP MC97 controller (snd-atiixp-modem) | |
snd-virtuoso Asus Virtuoso driver (snd-virtuoso) | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>playtest</term> | |
<listitem> | |
<para> | |
Plays a test sound on a sound card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound playtest card=0 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>remove</term> | |
<listitem> | |
<para> | |
Removes a configured sound card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound remove card=0 | |
<prompt>> </prompt><command>sudo</command> yast sound remove all | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Specifies new values for a sound card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound set card=0 volume=80 | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>show</term> | |
<listitem> | |
<para> | |
Displays detailed information about a sound card: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound show card=0 | |
Parameters of card 'ThinkPad X240' (using module snd-hda-intel): | |
align_buffer_size | |
Force buffer and period sizes to be multiple of 128 bytes. | |
bdl_pos_adj | |
BDL position adjustment offset. | |
beep_mode | |
Select HDA Beep registration mode (0=off, 1=on) (default=1). | |
Default Value: 0 | |
enable_msi | |
Enable Message Signaled Interrupt (MSI) | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Prints a configuration summary for all sound cards on the system: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sound summary | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>volume</term> | |
<listitem> | |
<para> | |
Specifies the volume level of a sound card: | |
</para> | |
<screen> | |
<command>sudo</command>yast sound volume card=0 play | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast sysconfig</title> | |
<para> | |
Controls the variables in files under <filename>/etc/sysconfig</filename>. | |
<command>yast sysconfig</command> accepts the following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>clear</term> | |
<listitem> | |
<para> | |
Sets empty value to a variable: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig clear=POSTFIX_LISTEN | |
</screen> | |
<tip> | |
<title>Variable in multiple files</title> | |
<para> | |
If the variable is available in several files, use the | |
<replaceable>VARIABLE_NAME</replaceable>$<replaceable>FILE_NAME</replaceable> | |
syntax: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig clear=CONFIG_TYPE$/etc/sysconfig/mail | |
</screen> | |
</tip> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>details</term> | |
<listitem> | |
<para> | |
Displays detailed information about a variable: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig details variable=POSTFIX_LISTEN | |
Description: | |
Value: | |
File: /etc/sysconfig/postfix | |
Possible Values: Any value | |
Default Value: | |
Configuration Script: postfix | |
Description: | |
Comma separated list of IP's | |
NOTE: If not set, LISTEN on all interfaces | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Displays summary of modified variables. Use <command>all</command> to | |
list all variables and their values: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig list all | |
AOU_AUTO_AGREE_WITH_LICENSES="false" | |
AOU_ENABLE_CRONJOB="true" | |
AOU_INCLUDE_RECOMMENDS="false" | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Sets a value for a variable: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig set DISPLAYMANAGER=gdm | |
</screen> | |
<tip> | |
<title>Variable in multiple files</title> | |
<para> | |
If the variable is available in several files, use the | |
<replaceable>VARIABLE_NAME</replaceable>$<replaceable>FILE_NAME</replaceable> | |
syntax: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast sysconfig set CONFIG_TYPE$/etc/sysconfig/mail=advanced | |
</screen> | |
</tip> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast tftp-server</title> | |
<para> | |
Configures a TFTP server. <command>yast tftp-server</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>directory</term> | |
<listitem> | |
<para> | |
Specifies the directory of the TFTP server: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast tftp-server directory path=/srv/tftp | |
<prompt>> </prompt><command>sudo</command> yast tftp-server directory list | |
Directory Path: /srv/tftp | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>status</term> | |
<listitem> | |
<para> | |
Controls the status of the TFTP server service: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast tftp-server status disable | |
<prompt>> </prompt><command>sudo</command> yast tftp-server status show | |
Service Status: false | |
<prompt>> </prompt><command>sudo</command> yast tftp-server status enable | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast timezone</title> | |
<para> | |
Configures the time zone. <command>yast timezone</command> accepts the | |
following commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Lists all available time zones grouped by region: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast timezone list | |
Region: Africa | |
Africa/Abidjan (Abidjan) | |
Africa/Accra (Accra) | |
Africa/Addis_Ababa (Addis Ababa) | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>set</term> | |
<listitem> | |
<para> | |
Specifies new values for the time zone configuration: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast timezone set timezone=Europe/Prague hwclock=local | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>summary</term> | |
<listitem> | |
<para> | |
Displays the time zone configuration summary: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast timezone summary | |
Current Time Zone: Europe/Prague | |
Hardware Clock Set To: Local time | |
Current Time and Date: Mon 12. March 2018, 11:36:21 CET | |
</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3> | |
<title>yast users</title> | |
<para> | |
Manages user accounts. <command>yast users</command> accepts the following | |
commands: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>add</term> | |
<listitem> | |
<para> | |
Adds a new user: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast users add username=user1 password=secret home=/home/user1 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast users add help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>delete</term> | |
<listitem> | |
<para> | |
Deletes an existing user account: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast users delete username=user1 delete_home | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast users delete help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>edit</term> | |
<listitem> | |
<para> | |
Changes an existing user account: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast users edit username=user1 password=new_secret | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast users edit help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>list</term> | |
<listitem> | |
<para> | |
Lists existing users filtered by user type: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast users list system | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast users list help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>show</term> | |
<listitem> | |
<para> | |
Displays details about a user: | |
</para> | |
<screen> | |
<prompt>> </prompt><command>sudo</command> yast users show username=wwwrun | |
Full Name: WWW daemon apache | |
List of Groups: www | |
Default Group: wwwrun | |
Home Directory: /var/lib/wwwrun | |
Login Shell: /sbin/nologin | |
Login Name: wwwrun | |
UID: 456 | |
</screen> | |
<para> | |
For a complete list of options, run <command>yast users show help</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
</sect2> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-yast-lang"> | |
<title>Changing language and country settings with YaST</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
This chapter explains how to configure language and country settings. You | |
can change the language globally for the whole system, individually for | |
certain users or desktops, or temporarily for single applications. | |
Additionally, you can configure secondary languages and adjust the date and | |
country settings. | |
</para> | |
</abstract> | |
</info> | |
<para> | |
If you work in different countries or in a multilingual environment, you | |
should configure your system accordingly. <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> can handle | |
different <literal>locales</literal> in parallel. A locale is a set of | |
parameters that defines the language and country settings reflected in the | |
user interface. | |
</para> | |
<para> | |
The main system language is selected during installation, and keyboard and | |
time zone settings are adjusted accordingly. However, you can install | |
additional languages and determine which of the installed languages should be | |
the default. | |
</para> | |
<para> | |
For those tasks, use the YaST language module as described in | |
<xref linkend="sec-yast-langmod" role="internalbook"/>. Install secondary languages to get optional | |
localization if you need to start applications or desktops in languages other | |
than the primary one. | |
</para> | |
<para> | |
The YaST time zone module allows you to adjust your country | |
and time zone settings accordingly. It also lets you synchronize your system | |
clock against a time server. For details, refer to | |
<xref linkend="sec-yast-country" role="internalbook"/>. | |
</para> | |
<sect1 xml:id="sec-yast-langmod"> | |
<title>Changing the system language</title> | |
<para> | |
Depending on how you use your desktop and whether you want to switch the | |
entire system to another language or only the desktop environment, | |
you have several options: | |
</para> | |
<variablelist> | |
<varlistentry xml:id="vle-lang-system"> | |
<term>Changing the system language globally</term> | |
<listitem> | |
<para> | |
Proceed as described in <xref linkend="sec-yast-lang-primsec" role="internalbook"/> and | |
<xref linkend="sec-yast-lang-switch" role="internalbook"/> to install additional localized | |
packages with YaST and to set the default language. Changes are | |
effective after the next login. To ensure that the entire system reflects | |
the change, reboot the system or close and restart all running services, | |
applications, and programs. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-lang-desktop"> | |
<term>Changing the language for the desktop only</term> | |
<listitem> | |
<para> | |
Provided you have previously installed the desired language packages for | |
your desktop environment with YaST as described below, you can switch | |
the language of your desktop using the desktop's control center. | |
After the | |
X server has been restarted, your entire desktop reflects your new choice | |
of language. Applications not belonging to your desktop framework are not | |
affected by this change and may still appear in the language that was set | |
in YaST. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-lang-application"> | |
<term>Temporarily switching languages for one application only</term> | |
<listitem> | |
<para> | |
You can also run a single application in another language (that has | |
already been installed with YaST). To do so, start it from the command | |
line by specifying the language code as described in | |
<xref linkend="sec-yast-lang-applications" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<sect2 xml:id="sec-yast-lang-primsec"> | |
<title>Modifying system languages with YaST</title> | |
<para> | |
YaST supports two different language categories: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Primary Language</guimenu></term> | |
<listitem> | |
<para> | |
The primary language set in YaST applies to the entire system, | |
including YaST and the desktop environment. This language is used | |
whenever available unless you manually specify another language. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Secondary Languages</guimenu></term> | |
<listitem> | |
<para> | |
Install secondary languages to make your system multilingual. Languages | |
installed as secondary can be selected manually, when needed. For example, use a secondary language to start an application | |
in a certain language to do word processing in this language. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Before installing additional languages, determine which of them should be | |
the default system language (primary language). | |
</para> | |
<para> | |
To access the YaST language module, start YaST and click <menuchoice> | |
<guimenu>System</guimenu> <guimenu>Language</guimenu> </menuchoice>. | |
Alternatively, start the <guimenu>Languages</guimenu> dialog directly by | |
running <command>sudo yast2 language &</command> from a command line. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_language.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_language.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
<procedure xml:id="pro-yast-lang-additional"> | |
<title>Installing additional languages</title> | |
<para> | |
When installing additional languages, YaST allows you to | |
set different locale settings for the user <systemitem class="username">root</systemitem>, see <xref linkend="st-yast-lang-additional-root" role="internalbook"/>. The option | |
<guimenu>Locale Settings for User root</guimenu> determines how | |
the locale variables (<envar>LC_*</envar>) in the file | |
<filename>/etc/sysconfig/language</filename> are set for | |
<systemitem class="username">root</systemitem>. You can set them to the same locale as for regular | |
users. Alternatively, you can keep them unaffected by any language | |
changes, or only set the variable <envar>RC_LC_CTYPE</envar> to | |
the same values as for the regular users. The | |
<envar>RC_LC_CTYPE</envar> variable sets the localization for | |
language-specific function calls. | |
</para> | |
<step> | |
<para> | |
To add languages in the YaST language module, select the | |
<guimenu>Secondary Languages</guimenu> you want to install. | |
</para> | |
</step> | |
<step> | |
<para> | |
To make a language the default language, set it as <guimenu>Primary | |
Language</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Additionally, adapt the keyboard to the new primary language and adjust | |
the time zone, if appropriate. | |
</para> | |
<tip> | |
<title>Advanced settings</title> | |
<para> | |
For advanced keyboard or time zone settings, select <menuchoice> | |
<guimenu>Hardware</guimenu> <guimenu>System Keyboard Layout</guimenu> | |
</menuchoice> or <menuchoice> <guimenu>System</guimenu> <guimenu>Date | |
and Time</guimenu> </menuchoice> in YaST. For more information, refer to <xref linkend="sec-yast-hw-keym" role="internalbook"/> and <xref linkend="sec-yast-country" role="internalbook"/>. | |
</para> | |
</tip> | |
</step> | |
<step xml:id="st-yast-lang-additional-root"> | |
<para> | |
To change language settings specific to the user <systemitem class="username">root</systemitem>, click | |
<guimenu>Details</guimenu>. | |
</para> | |
<substeps performance="required"> | |
<step> | |
<para> | |
Set <guimenu>Locale Settings for User root</guimenu> to the desired | |
value. For more information, click <guimenu>Help</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Decide if you want to <guimenu>Use UTF-8 Encoding</guimenu> for | |
<systemitem class="username">root</systemitem> or not. | |
</para> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<para> | |
If your locale was not included in the list of primary languages | |
available, try specifying it with <guimenu>Detailed Locale | |
Setting</guimenu>. However, this may result in some locales being incomplete. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm the changes in the dialogs with <guimenu>OK</guimenu>. If you | |
have selected secondary languages, YaST installs the localized software | |
packages for the additional languages. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
The system is now multilingual. However, to start an application in a | |
language other than the primary one, you need to set the desired language | |
explicitly as explained in <xref linkend="sec-yast-lang-applications" role="internalbook"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-yast-lang-switch"> | |
<title>Switching the default system language</title> | |
<para> | |
To globally change the default language of a system, use the following procedure: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Start the YaST language module. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select the desired new system language as <guimenu>Primary | |
Language</guimenu>. | |
</para> | |
<important> | |
<title>Deleting former system languages</title> | |
<para> | |
If you switch to a different primary language, the localized software | |
packages for the former primary language will be removed from the | |
system. To switch the default system language but keep the former | |
primary language as an additional language, add it as <guimenu>Secondary | |
Language</guimenu> by selecting the respective check box. | |
</para> | |
</important> | |
</step> | |
<step> | |
<para> | |
Adjust the keyboard and time zone options as desired. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your changes with <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
After YaST has applied the changes, restart current X sessions (for | |
example, by logging out and logging in again) to make YaST and the | |
desktop applications reflect your new language settings. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-yast-lang-applications"> | |
<title>Switching languages for standard X and GNOME applications</title> | |
<para> | |
After you have installed the respective language with YaST, you can run a | |
single application in another language. | |
</para> | |
<para> | |
Start the application from the command line by using the following command: | |
</para> | |
<screen>LANG=<replaceable>LANGUAGE</replaceable> <replaceable>application</replaceable></screen> | |
<para> | |
For example, to start f-spot in German, run | |
<command>LANG=de_DE f-spot</command>. For other languages, use the | |
appropriate language code. Get a list of all language codes available with | |
the <command>locale </command> <option>-av</option> command. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-yast-country"> | |
<title>Changing the country and time settings</title> | |
<para> | |
Using the YaST date and time module, adjust your system date, clock and | |
time zone information to the area you are working in. To access the YaST | |
module, start YaST and click <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Date and Time</guimenu> </menuchoice>. Alternatively, start the | |
<guimenu>Clock and Time Zone</guimenu> dialog directly by running | |
<command>sudo yast2 timezone &</command> from a command line. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_timezone.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_timezone.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
<para> | |
First, select a general region, such as <guimenu>Europe</guimenu>. Choose an | |
appropriate country that matches the one you are working in, for example, | |
<guimenu>Germany</guimenu>. | |
</para> | |
<para> | |
Depending on which operating systems run on your workstation, adjust the | |
hardware clock settings accordingly: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
If you run another operating system on your machine, such as Microsoft | |
Windows*, it is likely your system does not use UTC, but local time. In | |
this case, deactivate <guimenu>Hardware Clock Set To UTC</guimenu>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
If you only run Linux on your machine, set the hardware clock to UTC and | |
have the switch from standard time to daylight saving time performed | |
automatically. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<important> | |
<title>Set the hardware clock to UTC</title> | |
<para> | |
The switch from standard time to daylight saving time (and vice versa) can | |
only be performed automatically when the hardware clock (CMOS clock) is set | |
to UTC. This also applies if you use automatic time synchronization with | |
NTP, because automatic synchronization will only be performed if the time | |
difference between the hardware and system clock is less than 15 minutes. | |
</para> | |
<para> | |
Since a wrong system time can cause serious problems (missed backups, | |
dropped mail messages, mount failures on remote file systems, etc.) it is | |
strongly recommended to <emphasis>always</emphasis> set the hardware clock | |
to UTC. | |
</para> | |
</important> | |
<para> | |
You can change the date and time manually or opt for synchronizing your | |
machine against an NTP server, either permanently or only for adjusting your | |
hardware clock. | |
</para> | |
<procedure> | |
<title>Manually adjusting time and date</title> | |
<step> | |
<para> | |
In the YaST timezone module, click <guimenu>Other Settings</guimenu> to | |
set date and time. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select <guimenu>Manually</guimenu> and enter date and time values. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your changes. | |
</para> | |
</step> | |
</procedure> | |
<procedure> | |
<title>Setting date and time with NTP server</title> | |
<step> | |
<para> | |
Click <guimenu>Other Settings</guimenu> to set date and time. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select <guimenu>Synchronize with NTP Server</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the address of an NTP server, if not already populated. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_timezone_ntp.png" width="75%"/> | |
</imageobject> | |
<imageobject role="pdf"> | |
<imagedata fileref="yast2_timezone_ntp.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
With the <guimenu>Configure</guimenu> button, you can open the advanced | |
NTP configuration. For details, see <xref linkend="sec-ntp-yast" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your changes. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-yast-userman"> | |
<title>Managing users with YaST</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
During installation, you may have created a local user for your system. | |
With the YaST module <guimenu>User and Group Management</guimenu> you can | |
add users or edit existing ones. It also lets you configure your system | |
to authenticate users with a network server. | |
</para> | |
<sect1 xml:id="sec-yast-userman-main"> | |
<title>User and group administration dialog</title> | |
<para> | |
To administer users or groups, start YaST and click <menuchoice> | |
<guimenu>Security and Users</guimenu> <guimenu>User and Group | |
Management</guimenu> </menuchoice>. Alternatively, start the <guimenu>User | |
and Group Administration</guimenu> dialog directly by running <command>sudo | |
yast2 users &</command> from a command line. | |
</para> | |
<figure xml:id="fig-y2-userman-main"> | |
<title>YaST user and group administration</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_users_main_qt.png" width="90%" os="sles;sled"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_users_main_qt.png" width="70%" os="sles;sled"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
Every user is assigned a system-wide user ID (UID). Apart from the users | |
that can log in to your machine, there are also several <emphasis>system | |
users</emphasis> for internal use only. Each user is assigned to one or more | |
groups. Similar to <emphasis>system users</emphasis>, there are also | |
<emphasis>system groups</emphasis> for internal use. | |
</para> | |
<para> | |
The main window shows several tabs, depending on the set of users (local users, network users, system users) you choose to view and modify. The tabs allow you to perform the following tasks: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Managing user accounts</term> | |
<listitem> | |
<para> | |
From the <guimenu>Users</guimenu> tab create, modify, delete or | |
temporarily disable user accounts as described in | |
<xref linkend="sec-yast-userman-users" role="internalbook"/>. Learn about advanced options like | |
enforcing password policies, using encrypted home directories, or | |
managing disk quotas in <xref linkend="sec-yast-userman-adv" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Changing default settings</term> | |
<listitem> | |
<para> | |
Local user accounts are created according to the settings defined on the | |
<guimenu>Defaults for New Users</guimenu> tab. Learn how to change the | |
default group assignment, or the default path and access permissions for | |
home directories in <xref linkend="sec-yast-userman-defaults" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Assigning users to groups</term> | |
<listitem> | |
<para> | |
Learn how to change the group assignment for individual users in | |
<xref linkend="sec-yast-userman-assign" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Managing groups</term> | |
<listitem> | |
<para> | |
From the <guimenu>Groups</guimenu> tab, you can add, modify, or delete | |
existing groups. Refer to <xref linkend="sec-yast-userman-groups" role="internalbook"/> for | |
information on how to do this. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Changing user authentication method</term> | |
<listitem> | |
<para> | |
When your machine is connected to a network that provides user | |
authentication methods like NIS or LDAP, you can choose between several | |
authentication methods on the <guimenu>Authentication Settings</guimenu> | |
tab. For more information, refer to | |
<xref linkend="sec-yast-userman-authent" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
For user and group management, the dialog provides similar functionality. | |
You can easily switch between the user and group administration view by | |
choosing the appropriate tab at the top of the dialog. | |
</para> | |
<para> | |
Filter options allow you to define the set of users or groups you want to | |
modify: On the <guimenu>Users</guimenu> or <guimenu>Group</guimenu> tab, | |
click <guimenu>Set Filter</guimenu> to view and edit users or groups. | |
They are listed according to certain categories, such as <guimenu>Local Users</guimenu> or | |
<guimenu>LDAP Users</guimenu>, if applicable. With <menuchoice> <guimenu>Set Filter</guimenu> | |
<guimenu>Customize Filter</guimenu> </menuchoice> you can also set up and | |
use a custom filter. | |
</para> | |
<para> | |
Depending on the filter you choose, not all of the following options and | |
functions will be available from the dialog. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-users"> | |
<title>Managing user accounts</title> | |
<para> | |
YaST allows you to create, modify, delete or temporarily disable | |
user accounts. Do not modify user accounts unless you are an experienced | |
user or administrator. | |
</para> | |
<note> | |
<title>Changing user IDs of existing users</title> | |
<para> | |
File ownership is bound to the user ID, not to the user name. After a user | |
ID change, the files in the user's home directory are automatically | |
adjusted to reflect this change. However, after an ID change, the user no | |
longer owns the files they created elsewhere in the file system unless the | |
file ownership for those files are manually modified. | |
</para> | |
</note> | |
<para> | |
The following instructions demonstrate how to set up default user accounts. | |
For further options, refer to | |
<xref linkend="sec-yast-userman-adv" role="internalbook"/>. | |
</para> | |
<procedure> | |
<title>Adding or modifying user accounts</title> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Administration</guimenu> dialog | |
and click the <guimenu>Users</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
With <guimenu>Set Filter</guimenu> define the set of users you want to | |
manage. The dialog lists users in the system and the groups the users | |
belong to. | |
</para> | |
</step> | |
<step> | |
<para> | |
To modify options for an existing user, select an entry and click | |
<guimenu>Edit</guimenu>. | |
</para> | |
<para> | |
To create a new user account, click <guimenu>Add</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the appropriate user data on the first tab, such as | |
<guimenu>Username </guimenu> (which is used for login) and | |
<guimenu>Password</guimenu>. This data is sufficient to create a new user. | |
If you click <guimenu>OK</guimenu> now, the system automatically | |
assigns a user ID and sets all other values as default. | |
</para> | |
</step> | |
<step> | |
<para> | |
Activate <guimenu>Receive System Mail</guimenu> if you want system | |
notifications to be delivered to this user's mailbox. This creates a mail | |
alias for <systemitem class="username">root</systemitem> and the user can read the system mail without having | |
to first log in as <systemitem class="username">root</systemitem>. | |
</para> | |
<para> | |
The mails sent by system services are stored in the local mailbox | |
<filename>/var/spool/mail/</filename><replaceable>USERNAME</replaceable>, | |
where <replaceable>USERNAME</replaceable> is the login name of the | |
selected user. To read e-mails, you can use the <command>mail</command> | |
command. | |
</para> | |
</step> | |
<step> | |
<para> | |
To adjust further details such as the user ID or the path to | |
the user's home directory, do so on the <guimenu>Details</guimenu> tab. | |
</para> | |
<para> | |
If you need to relocate the home directory of an existing user, enter the | |
path to the new home directory there and move the contents of the current | |
home directory with <guimenu>Move to New Location</guimenu>. Otherwise, a | |
new home directory is created without any of the existing data. | |
</para> | |
</step> | |
<step> | |
<para> | |
To force users to regularly change their password or set other password | |
options, switch to <guimenu>Password Settings</guimenu> and adjust the | |
options. For more details, refer to | |
<xref linkend="sec-yast-userman-adv-passw" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
If all options are set according to your wishes, click | |
<guimenu>OK</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to close the administration dialog and to save | |
the changes. A newly added user can now log in to the system using the | |
login name and password you created. | |
</para> | |
<para> | |
Alternatively, to save all changes without exiting the | |
<guimenu>User and Group Administration</guimenu> dialog, click | |
<menuchoice> <guimenu>Expert Options</guimenu> <guimenu>Write Changes | |
Now</guimenu> </menuchoice>. | |
</para> | |
</step> | |
</procedure> | |
<tip> | |
<title>Matching user IDs</title> | |
<para> | |
It is useful to match the (local) user ID to the ID in the network. | |
For example, a new (local) user on a laptop should be integrated into a | |
network environment with the same user ID. This ensures that the | |
file ownership of the files the user creates <quote>offline</quote> is the | |
same as if they had created them directly on the network. | |
</para> | |
</tip> | |
<procedure> | |
<title>Disabling or deleting user accounts</title> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Administration</guimenu> dialog | |
and click the <guimenu>Users</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
To temporarily disable a user account without deleting it, select the user | |
from the list and click <guimenu>Edit</guimenu>. Activate <guimenu>Disable | |
User Login</guimenu>. The user cannot log in to your machine until you | |
enable the account again. | |
</para> | |
</step> | |
<step> | |
<para> | |
To delete a user account, select the user from the list and click | |
<guimenu>Delete</guimenu>. Choose if you also want to delete the user's | |
home directory or to retain the data. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-adv"> | |
<title>Additional options for user accounts</title> | |
<para> | |
In addition to the settings for a default user account, <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> | |
offers further options. For example, options to enforce password policies, use | |
encrypted home directories or define disk quotas for users and groups. | |
</para> | |
<sect2 xml:id="sec-yast-userman-adv-login"> | |
<title>Automatic login and passwordless login</title> | |
<para> | |
If you use the GNOME desktop environment you can configure <emphasis>Auto | |
Login</emphasis> for a certain user and <emphasis>Passwordless | |
Login</emphasis> for all users. Auto login causes a user to become | |
automatically logged in to the desktop environment on boot. This | |
functionality can only be activated for one user at a time. Login without | |
password allows all users to log in to the system after they have entered | |
their user name in the login manager. | |
</para> | |
<warning> | |
<title>Security risk</title> | |
<para> | |
Enabling <emphasis>Auto Login</emphasis> or <emphasis>Passwordless | |
Login</emphasis> on a machine that can be accessed by more than one person | |
is a security risk. Without the need to authenticate, any user can gain | |
access to your system and your data. If your system contains confidential | |
data, do not use this functionality. | |
</para> | |
</warning> | |
<para> | |
To activate auto login or login without password, access these | |
functions in the YaST <guimenu>User and Group Administration</guimenu> | |
with <menuchoice> <guimenu>Expert Options</guimenu> <guimenu>Login | |
Settings</guimenu> </menuchoice>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-yast-userman-adv-passw"> | |
<title>Enforcing password policies</title> | |
<para> | |
On any system with multiple users, it is a good idea to enforce at least | |
basic password security policies. Users should change their passwords | |
regularly and use strong passwords that cannot easily be exploited. For | |
local users, proceed as follows: | |
</para> | |
<procedure> | |
<title>Configuring password settings</title> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Administration</guimenu> dialog | |
and select the <guimenu>Users</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select user and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Switch to the <guimenu>Password Settings</guimenu> tab. The user's last | |
password change is displayed on the tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
To make the user change their password at next login, activate | |
<guimenu>Force Password Change</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To enforce password rotation, set a <guimenu>Maximum Number of Days for | |
the Same Password</guimenu> and a <guimenu>Minimum Number of Days for the | |
Same Password</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To remind the user to change their password before it expires, set the | |
number of <guimenu>Days before Password Expiration to Issue | |
Warning</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To restrict the period of time the user can log in after their password has | |
expired, change the value in <guimenu>Days after Password Expires with | |
Usable Login</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
You can also specify a certain expiration date for the complete account. | |
Enter the <guimenu>Expiration Date</guimenu> in | |
<replaceable>YYYY-MM-DD</replaceable> format. Note that this setting is | |
not password-related but rather applies to the account itself. | |
</para> | |
</step> | |
<step> | |
<para> | |
For more information about options and default values, click | |
<guimenu>Help</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Apply your changes with <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-yast-userman-adv-quota"> | |
<title>Managing quotas</title> | |
<para> | |
To prevent system capacities from being exhausted without notification, | |
system administrators can set up quotas for users or groups. Quotas can be | |
defined for one or more file systems and restrict the amount of disk space | |
that can be used and the number of inodes (index nodes) that can be created | |
there. Inodes are data structures on a file system that store basic | |
information about a regular file, directory, or other file system object. | |
They store all attributes of a file system object (like user and group | |
ownership, read, write, or execute permissions), except file name and | |
contents. | |
</para> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> allows usage of <literal>soft</literal> and | |
<literal>hard</literal> quotas. Additionally, grace intervals can be | |
defined that allow users or groups to temporarily exceed their quotas by | |
certain amounts. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Soft quota</term> | |
<listitem> | |
<para> | |
Defines a warning level at which users are informed that they are | |
nearing their limit. Administrators will urge the users to clean up and | |
reduce their data on the partition. The soft quota limit is usually | |
lower than the hard quota limit. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Hard quota</term> | |
<listitem> | |
<para> | |
Defines the limit at which write requests are denied. When the hard | |
quota is reached, no more data can be stored and applications may crash. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Grace period</term> | |
<listitem> | |
<para> | |
Defines the time between the overflow of the soft quota and a warning | |
being issued. Usually set to a rather low value of one or several hours. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<procedure> | |
<title>Enabling quota support for a partition</title> | |
<para> | |
To configure quotas for certain users and groups, you need to enable quota | |
support for the respective partition in the YaST Expert Partitioner | |
first. | |
</para> | |
<note os="sles"> | |
<title>Quotas for Btrfs partitions</title> | |
<para> | |
Quotas for Btrfs partitions are handled differently. For more | |
information, see <phrase role="externalbook-sec-filesystems-major-btrfs-quota">“Btrfs quota support for subvolumes” (Section “Overview of file systems in Linux”, ↑Storage Administration Guide)</phrase>. | |
<remark>taroth 2014-06-04: todo - after btrfs quotas have been covered in | |
the manuals (Storage Guide?), add link - taroth 2014-12-29: done</remark> | |
</para> | |
</note> | |
<step> | |
<para> | |
In YaST, select <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Partitioner</guimenu> </menuchoice> and click | |
<guimenu>Yes</guimenu> to proceed. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>Expert Partitioner</guimenu>, select the partition for | |
which to enable quotas and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Fstab Options</guimenu> and activate <guimenu>Enable Quota | |
Support</guimenu>. If the <systemitem>quota</systemitem> package is not | |
already installed, it will be installed when you confirm the respective | |
message with <guimenu>Yes</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your changes and leave the <guimenu>Expert Partitioner</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Make sure the service <systemitem class="service">quotaon</systemitem> is | |
running by entering the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl status quotaon.service</screen> | |
<para> | |
It should be marked as being <literal>active</literal>. If this is not | |
the case, start it with the command <command>systemctl start | |
quotaon.service</command>. | |
</para> | |
</step> | |
</procedure> | |
<procedure> | |
<title>Setting up quotas for users or groups</title> | |
<para> | |
Now you can define soft or hard quotas for specific users or groups and | |
set time periods as grace intervals. | |
</para> | |
<step> | |
<para> | |
In the YaST <guimenu>User and Group Administration</guimenu>, select | |
the user or the group you want to set the quotas for and click | |
<guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
On the <guimenu>Plug-Ins</guimenu> tab, select the <guimenu>Manage User | |
Quota</guimenu> entry and click <guimenu>Launch</guimenu> to open the | |
<guimenu>Quota Configuration</guimenu> dialog. | |
</para> | |
</step> | |
<step> | |
<para> | |
From <guimenu>File System</guimenu>, select the partition to which the | |
quota should apply. | |
</para> | |
<informalfigure os="sles;sled"> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_users_quota_qt.png" width="80%" os="sles;sled"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_users_quota_qt.png" width="70%" os="sles;sled"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
Below <guimenu>Size Limits</guimenu>, restrict the amount of disk space. | |
Enter the number of 1 KB blocks the user or group may have on this | |
partition. Specify a <guimenu>Soft Limit</guimenu> and a <guimenu>Hard | |
Limit</guimenu> value. | |
</para> | |
</step> | |
<step> | |
<para> | |
Additionally, you can restrict the number of inodes the user or group may | |
have on the partition. Below <guimenu>Inodes Limits</guimenu>, enter a | |
<guimenu>Soft Limit</guimenu> and <guimenu>Hard Limit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
You can only define grace intervals if the user or group has already | |
exceeded the soft limit specified for size or inodes. Otherwise, the | |
time-related text boxes are not activated. Specify the time period for | |
which the user or group is allowed to exceed the limits set above. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your settings with <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to close the administration dialog and save | |
the changes. | |
</para> | |
<para> | |
Alternatively, to save all changes without exiting the | |
<guimenu>User and Group Administration</guimenu> dialog, click | |
<menuchoice> <guimenu>Expert Options</guimenu> <guimenu>Write Changes | |
Now</guimenu> </menuchoice>. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> also ships command line tools like | |
<literal>repquota</literal> or <literal>warnquota</literal>. System | |
administrators can use these tools to control the disk usage or send e-mail | |
notifications to users exceeding their quota. Using | |
<command>quota_nld</command>, administrators can also forward kernel | |
messages about exceeded quotas to D-BUS. For more information, refer to the | |
<systemitem>repquota</systemitem>, the <systemitem>warnquota</systemitem> | |
and the <command>quota_nld</command> man page. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-defaults"> | |
<title>Changing default settings for local users</title> | |
<para> | |
When creating new local users, several default settings are used by YaST. | |
These include, for example, the primary group and the secondary groups the | |
user belongs to, or the access permissions of the user's home directory. You | |
can change these default settings to meet your requirements: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Administration</guimenu> dialog | |
and select the <guimenu>Defaults for New Users</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
To change the primary group the new users should automatically belong to, | |
select another group from <guimenu>Default Group</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To modify the secondary groups for new users, add or change groups in | |
<guimenu>Secondary Groups</guimenu>. The group names must be separated by | |
commas. | |
</para> | |
</step> | |
<step> | |
<para> | |
If you do not want to use | |
<filename>/home/<replaceable>USERNAME</replaceable></filename> as the default | |
path for new users' home directories, modify the <guimenu>Path Prefix for | |
Home Directory</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To change the default permission modes for newly created home directories, | |
adjust the umask value in <guimenu>Umask for Home Directory</guimenu>. For | |
more information about umask, refer to <phrase role="externalbook-cha-security-acls">“Access control lists in Linux” (↑Security and Hardening Guide)</phrase> | |
and to the <command>umask</command> man page. | |
</para> | |
</step> | |
<step> | |
<para> | |
For information about the individual options, click | |
<guimenu>Help</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Apply your changes with <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-assign"> | |
<title>Assigning users to groups</title> | |
<para> | |
Local users are assigned to several groups according to the | |
default settings, which you can access from the <guimenu>User and Group | |
Administration</guimenu> dialog on the <guimenu>Defaults for New | |
Users</guimenu> tab. In the following, learn how to modify an individual | |
user's group assignment. If you need to change the default group assignments | |
for new users, refer to <xref linkend="sec-yast-userman-defaults" role="internalbook"/>. | |
</para> | |
<procedure> | |
<title>Changing a user's group assignment</title> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Administration</guimenu> dialog | |
and click the <guimenu>Users</guimenu> tab. It lists users and the | |
groups the users belong to. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Edit</guimenu> and switch to the <guimenu>Details</guimenu> | |
tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
To change the primary group the user belongs to, click <guimenu>Default | |
Group</guimenu> and select the group from the list. | |
</para> | |
</step> | |
<step> | |
<para> | |
To assign the user additional secondary groups, activate the corresponding | |
check boxes in the <guimenu>Additional Groups</guimenu> list. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to apply your changes. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to close the administration dialog and save | |
the changes. | |
</para> | |
<para> | |
Alternatively, to save all changes without exiting the | |
<guimenu>User and Group Administration</guimenu> dialog, click | |
<menuchoice> <guimenu>Expert Options</guimenu> <guimenu>Write Changes | |
Now</guimenu> </menuchoice>. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-groups"> | |
<title>Managing groups</title> | |
<para> | |
With YaST you can also easily add, modify, or delete groups. | |
</para> | |
<procedure> | |
<title>Creating and modifying groups</title> | |
<step> | |
<para> | |
Open the YaST <guimenu>User and Group Management</guimenu> dialog and | |
click the <guimenu>Groups</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
With <guimenu>Set Filter</guimenu> define the set of groups you want to | |
manage. The dialog lists groups in the system. | |
</para> | |
</step> | |
<step> | |
<para> | |
To create a new group, click <guimenu>Add</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To modify an existing group, select the group and click | |
<guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the following dialog, enter or change the data. The list on the right | |
shows an overview of all available users and system users which can be | |
members of the group. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_groups_edit_qt.png" width="80%" os="sles;sled"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_groups_edit_qt.png" width="75%" os="sles;sled"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
To add existing users to a new group select them from the list of possible | |
<guimenu>Group Members</guimenu> by checking the corresponding box. To | |
remove them from the group deactivate the box. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to apply your changes. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to close the administration dialog and save | |
the changes. | |
</para> | |
<para> | |
Alternatively, to save all changes without exiting the | |
<guimenu>User and Group Administration</guimenu> dialog, click | |
<menuchoice> <guimenu>Expert Options</guimenu> <guimenu>Write Changes | |
Now</guimenu> </menuchoice>. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
To delete a group, it must not contain any group members. To delete a group, | |
select it from the list and click <guimenu>Delete</guimenu>. Click | |
<guimenu>OK</guimenu> to close the administration dialog and save the | |
changes. Alternatively, to save all changes without exiting the | |
<guimenu>User and Group Administration</guimenu> dialog, click <menuchoice> | |
<guimenu>Expert Options</guimenu> <guimenu>Write Changes Now</guimenu> | |
</menuchoice>. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-authent"> | |
<title>Changing the user authentication method</title> | |
<para> | |
When your machine is connected to a network, you can change the | |
authentication method. The following options are available: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>NIS</term> | |
<listitem> | |
<para> | |
Users are administered centrally on a NIS server for all systems | |
in the network. For details, see <phrase role="externalbook-cha-nis">“Using NIS” (↑Security and Hardening Guide)</phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>SSSD</term> | |
<listitem> | |
<para> | |
The <emphasis>System Security Services Daemon</emphasis> (SSSD) | |
can locally cache user data and then allow users to use the | |
data, even if the real directory service is (temporarily) | |
unreachable. For details, see <phrase role="externalbook-sec-security-auth-sssd">“SSSD” (Section “Setting up authentication clients using YaST”, ↑Security and Hardening Guide)</phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Samba</term> | |
<listitem> | |
<para> | |
SMB authentication is often used in mixed Linux and Windows | |
networks. For details, see <phrase role="externalbook-cha-samba">“Samba” (↑Storage Administration Guide)</phrase> | |
. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
To change the authentication method, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Open the <guimenu>User and Group Administration</guimenu> dialog in | |
YaST. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click the <guimenu>Authentication Settings</guimenu> tab to show an | |
overview of the available authentication methods and the current settings. | |
</para> | |
</step> | |
<step> | |
<para> | |
To change the authentication method, click <guimenu>Configure</guimenu> | |
and select the authentication method you want to modify. This takes you | |
directly to the client configuration modules in YaST. For information | |
about the configuration of the appropriate client, refer to the following | |
sections: | |
</para> | |
<formalpara> | |
<title>NIS:</title> | |
<para> | |
<phrase role="externalbook-sec-nis-client">“Configuring NIS clients” (Section “Using NIS”, ↑Security and Hardening Guide)</phrase> | |
</para> | |
</formalpara> | |
<formalpara> | |
<title>LDAP:</title> | |
<para> | |
<phrase><phrase role="externalbook-sec-security-auth-yast-client">“Configuring an authentication client with YaST” (Section “Setting up authentication clients using YaST”, ↑Security and Hardening Guide)</phrase></phrase> | |
</para> | |
</formalpara> | |
<formalpara os="sles"> | |
<title>Samba:</title> | |
<para> | |
<phrase role="externalbook-sec-samba-client-inst-yast">“Configuring a Samba client with YaST” (Section “Samba”, ↑Storage Administration Guide)</phrase> | |
</para> | |
</formalpara> | |
<formalpara> | |
<title>SSSD:</title> | |
<para> | |
<phrase role="externalbook-sec-security-auth-sssd">“SSSD” (Section “Setting up authentication clients using YaST”, ↑Security and Hardening Guide)</phrase> | |
</para> | |
</formalpara> | |
</step> | |
<step> | |
<para> | |
After accepting the configuration, return to the <guimenu>User and Group | |
Administration</guimenu> overview. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to close the administration dialog. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-yast-userman-defaultsystemusers"> | |
<title>Default system users</title> | |
<para> | |
By default, <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> creates user names, which cannot be deleted. | |
These users are typically defined in the Linux Standard Base. | |
The following list provides the common user names and their purpose: | |
</para> | |
<variablelist> | |
<title>Common user names installed by default</title> | |
<varlistentry> | |
<term><systemitem class="username">bin</systemitem></term> | |
<term><systemitem class="username">daemon</systemitem></term> | |
<listitem> | |
<para> | |
Legacy user, included for compatibility with legacy applications. New | |
applications should no longer use this user name. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">gdm</systemitem></term> | |
<listitem> | |
<para> | |
Used by GNOME Display Manager (GDM) to provide graphical logins and | |
manage local and remote displays. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">lp</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Printer daemon for Common Unix Printing System (CUPS). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">mail</systemitem></term> | |
<listitem> | |
<para> | |
User reserved for mailer programs like <command>sendmail</command> | |
or <command>postfix</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">man</systemitem></term> | |
<listitem> | |
<para> | |
Used by man to access man pages. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">messagebus</systemitem></term> | |
<listitem> | |
<para> | |
Used to access D-Bus (desktop bus), a software bus for inter-process | |
communication. Daemon is <systemitem class="daemon">dbus-daemon</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">nobody</systemitem></term> | |
<listitem> | |
<para> | |
User that owns no files and is in no privileged groups. Nowadays, | |
its use is limited as it is recommended by Linux Standard Base to provide | |
a separate user account for each daemon. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">nscd</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Name Service Caching Daemon. This daemon is a lookup | |
service to improve performance with NIS and LDAP. | |
Daemon is <systemitem class="daemon">nscd</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">polkitd</systemitem></term> | |
<listitem> | |
<para> | |
Used by the PolicyKit Authorization Framework, which defines and | |
handles authorization requests for unprivileged processes. | |
Daemon is <systemitem class="daemon">polkitd</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">postfix</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Postfix mailer. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">pulse</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Pulseaudio sound server. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">root</systemitem></term> | |
<listitem> | |
<para> | |
Used by the system administrator, providing all appropriate privileges. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">rpc</systemitem></term> | |
<listitem> | |
<para> | |
Used by the <command>rpcbind</command> command, an RPC | |
port mapper. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">rtkit</systemitem></term> | |
<listitem> | |
<para> | |
Used by the <package>rtkit</package> package providing a | |
D-Bus system service for real time scheduling mode. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">salt</systemitem></term> | |
<listitem> | |
<para> | |
User for parallel remote execution provided by Salt. Daemon | |
is named <systemitem class="daemon">salt-master</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">scard</systemitem></term> | |
<listitem> | |
<para> | |
User for communication with smart cards and readers. Daemon is named | |
<systemitem class="daemon">pcscd</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">srvGeoClue</systemitem></term> | |
<listitem> | |
<para> | |
Used by the GeoClue D-Bus service to provide location information. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">sshd</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Secure Shell daemon (SSH) to ensure secured and encrypted | |
communication over an insecure network. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">statd</systemitem></term> | |
<listitem> | |
<para> | |
Used by the Network Status Monitor protocol (NSM), implemented in the | |
<systemitem class="daemon">rpc.statd</systemitem> daemon, to listen | |
for reboot notifications. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">systemd-coredump</systemitem></term> | |
<listitem> | |
<para> | |
Used by the <command>/usr/lib/systemd/systemd-coredump</command> command | |
to acquire, save, and process core dumps. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="username">systemd-timesync</systemitem></term> | |
<listitem> | |
<para> | |
Used by the <command>/usr/lib/systemd/systemd-timesyncd</command> command | |
to synchronize the local system clock with a remote Network Time | |
Protocol (NTP) server. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-onlineupdate-you"> | |
<title>YaST online update</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
SUSE offers a continuous stream of software security updates for your | |
product. By default, the update applet is used to keep your system | |
up to date. Refer to <xref linkend="sec-updater" role="internalbook"/> for further information on | |
the update applet. This chapter covers the alternative tool for updating | |
software packages: YaST Online Update. | |
</para> | |
<para> | |
The current patches for <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> are available from an update | |
software repository. <phrase os="sles;sled">If you have | |
registered your product during the installation, an update repository is | |
already configured. If you have not registered <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>, you can do so | |
by starting the <guimenu>Product Registration</guimenu> in YaST.</phrase> | |
Alternatively, you can manually add an update repository from a source you | |
trust. To add or remove repositories, start the Repository Manager with | |
<menuchoice> <guimenu>Software</guimenu> | |
<guimenu>Software Repositories</guimenu> </menuchoice> in YaST. Learn more | |
about the Repository Manager in <xref linkend="sec-yast-software-instsource" role="internalbook"/>. | |
</para> | |
<note os="sles;sled"> | |
<title>Error on accessing the update catalog</title> | |
<para> | |
If you are not able to access the update catalog, this might be because of | |
an expired subscription. Normally, <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> comes with a one-year or | |
three-year subscription, during which you have access to the update catalog. | |
This access will be denied after the subscription ends. | |
</para> | |
<para> | |
If an access to the update catalog is denied, you will see a warning | |
message prompting you to visit the SUSE Customer Center and check your | |
subscription. The SUSE Customer Center is available at <link xlink:href="https://scc.suse.com//"/>. | |
</para> | |
</note> | |
<note os="sles;sled"> | |
<title>Firewall settings for receiving updates</title> | |
<para> | |
By default, the firewall on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> only blocks incoming connections. | |
If your system is behind another firewall that blocks outgoing traffic, | |
make sure to allow connections to <link xlink:href="https://scc.suse.com/"/> and | |
<link xlink:href="https://updates.suse.com"/> on ports 80 and 443 in order | |
to receive updates. | |
</para> | |
</note> | |
<para> | |
SUSE provides updates with different relevance levels: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Security updates</term> | |
<listitem> | |
<para> | |
Fix severe security hazards and should always be installed. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Recommended updates</term> | |
<listitem> | |
<para> | |
Fix issues that could compromise your computer. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Optional updates</term> | |
<listitem> | |
<para> | |
Fix non-security relevant issues or provide enhancements. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<sect1 xml:id="sec-onlineupdate-you-overview"> | |
<title>The online update dialog</title> | |
<para> | |
To open the YaST <guimenu>Online Update</guimenu> dialog, start YaST and | |
select <menuchoice> <guimenu>Software </guimenu> <guimenu>Online | |
Update</guimenu> </menuchoice>. Alternatively, start it from the command | |
line with <command>yast2 online_update</command>. | |
</para> | |
<para> | |
The <guimenu>Online Update</guimenu> window consists of four sections. | |
</para> | |
<figure> | |
<title>YaST online update</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_you.png" width="75%" os="sles;sled"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_you.png" width="75%" os="sles;sled"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The <guimenu>Summary</guimenu> section on the left lists the available | |
patches for <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. The patches are sorted by security relevance: | |
<literal>security</literal>, <literal>recommended</literal>, and | |
<literal>optional</literal>. You can change the view of the | |
<guimenu>Summary</guimenu> section by selecting one of the following options | |
from <guimenu>Show Patch Category</guimenu>: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Needed patches</guimenu> (default view)</term> | |
<listitem> | |
<para> | |
Non-installed patches that apply to packages installed on your system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Unneeded patches</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Patches that either apply to packages not installed on your system, or | |
patches that have requirements which have already have been fulfilled | |
(because the relevant packages have already been updated from another | |
source). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>All patches</guimenu> | |
</term> | |
<listitem> | |
<para> | |
All patches available for <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Each list entry in the <guimenu>Summary</guimenu> section consists of a | |
symbol and the patch name. For an overview of the possible symbols and their | |
meaning, press <keycombo> <keycap function="shift"/> <keycap>F1</keycap> | |
</keycombo>. Actions required by <literal>Security</literal> and | |
<literal>Recommended</literal> patches are automatically preset. These | |
actions are <guimenu>Autoinstall</guimenu>, <guimenu>Autoupdate</guimenu> | |
and <guimenu>Autodelete</guimenu>. | |
</para> | |
<para> | |
If you install an up-to-date package from a repository other than the update | |
repository, the requirements of a patch for this package may be fulfilled | |
with this installation. In this case a check mark is displayed in front of | |
the patch summary. The patch will be visible in the list until you mark it | |
for installation. This will in fact not install the patch (because the | |
package already is up to date), but mark the patch as having been installed. | |
</para> | |
<para> | |
Select an entry in the <guimenu>Summary</guimenu> section to view a short | |
<guimenu>Patch Description</guimenu> at the bottom left corner of the | |
dialog. The upper right section lists the packages included in the selected | |
patch (a patch can consist of several packages). Click an entry in the upper | |
right section to view details about the respective package that is included | |
in the patch. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-onlineupdate-you-install"> | |
<title>Installing patches</title> | |
<para> | |
The YaST Online Update dialog allows you to either install all available | |
patches at once or manually select the desired patches. You may also revert patches that have been applied to the | |
system. | |
</para> | |
<para> | |
By default, all new patches (except <literal>optional</literal> ones) that | |
are currently available for your system are already marked for installation. | |
They will be applied automatically once you click <guimenu>Accept</guimenu> | |
or <guimenu>Apply</guimenu>. | |
If one or multiple patches require a system reboot, you will be notified | |
about this before the patch installation starts. You can then either decide | |
to continue with the installation of the selected patches, skip the | |
installation of all patches that need rebooting and install the rest, or go | |
back to the manual patch selection. | |
</para> | |
<procedure> | |
<title>Applying patches with YaST online update</title> | |
<step> | |
<para> | |
Start YaST and select <menuchoice> <guimenu>Software</guimenu> | |
<guimenu>Online Update</guimenu> </menuchoice>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To automatically apply all new patches (except <literal>optional</literal> | |
ones) that are currently available for your system, click | |
<guimenu>Apply</guimenu> or <guimenu>Accept</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
First modify the selection of patches that you want to apply: | |
</para> | |
<substeps performance="required"> | |
<step> | |
<para> | |
Use the respective filters and views that the interface provides. For | |
details, refer to <xref linkend="sec-onlineupdate-you-overview" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select or deselect patches according to your needs and wishes by | |
right-clicking the patch and choosing the respective action from the | |
context menu. | |
</para> | |
<important> | |
<title>Always apply security updates</title> | |
<para> | |
Do not deselect any <literal>security</literal>-related patches without | |
a very good reason. These patches fix severe security hazards and | |
prevent your system from being exploited. | |
</para> | |
</important> | |
</step> | |
<step> | |
<para> | |
Most patches include updates for several packages. To change | |
actions for single packages, right-click a package in the package view | |
and choose an action. | |
</para> | |
</step> | |
<step> | |
<para> | |
To confirm your selection and apply the selected patches, proceed with | |
<guimenu>Apply</guimenu> or <guimenu>Accept</guimenu>. | |
</para> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<para> | |
After the installation is complete, click <guimenu>Finish</guimenu> to | |
leave the YaST <guimenu>Online Update</guimenu>. Your system is now | |
up to date. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-onlineupdate-retracted-patches"> | |
<title>Viewing retracted patches</title> | |
<para> | |
Maintenance updates are carefully tested to minimize the risk | |
of introducing a bug. If a patch proves to contain a bug, it is | |
automatically retracted. A new update (with a higher version number) is | |
issued to revert the buggy patch, and is blocked from being installed | |
again. You can see retracted patches, and their history, on the | |
<guimenu>Package Classification</guimenu> tab. | |
</para> | |
<figure> | |
<title>Viewing retracted patches and history</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_retracted_patches.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_retracted_patches.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
</sect1> | |
<sect1 xml:id="sec-onlineupdate-you-automatically"> | |
<title>Automatic online update</title> | |
<para> | |
You may configure automatic updates with a daily, weekly, or | |
monthly schedule with YaST. Install the | |
<systemitem class="resource">yast2-online-update-configuration</systemitem> | |
package. | |
</para> | |
<para> | |
By default, updates are downloaded as delta RPMs. Since rebuilding RPM | |
packages from delta RPMs is a memory- and processor-intensive task, certain | |
setups or hardware configurations might require you to disable the use of | |
delta RPMs for the sake of performance. | |
</para> | |
<para> | |
Some patches, such as kernel updates or packages requiring license | |
agreements, require user interaction, which would cause the automatic update | |
procedure to stop. You can configure skipping patches that require user | |
interaction. | |
</para> | |
<para> | |
Use the <guimenu>Patches</guimenu> tab in the YaST | |
<guimenu>Software</guimenu> module to review available and installed | |
patches, including references to bug reports and CVE bulletins. | |
</para> | |
<procedure> | |
<title>Configuring the automatic online update</title> | |
<step> | |
<para> | |
After installation, start YaST and select <menuchoice> | |
<guimenu>Software</guimenu> <guimenu>Online Update</guimenu> | |
</menuchoice>. Choose <menuchoice><guimenu>Configuration</guimenu> | |
<guimenu>Online Update</guimenu></menuchoice>. If the | |
<package>yast2-online-update-configuration</package> is not installed, you | |
will be prompted to do that. | |
</para> | |
<figure> | |
<title>YaST online update configuration</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_autoupdate.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_autoupdate.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
Alternatively, start the module with | |
<command>yast2 online_update_configuration</command> from the command | |
line. | |
</para> | |
</step> | |
<step> | |
<para> | |
Choose the update interval: <guimenu>Daily</guimenu>, | |
<guimenu>Weekly</guimenu>, or <guimenu>Monthly</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Sometimes patches may require the attention of the administrator, for | |
example when restarting critical services. For example, this might be an | |
update for Docker Open Source Engine that requires all containers to be restarted. Before | |
these | |
patches are installed, the user is informed about the consequences and is | |
asked to confirm the installation of the patch. Such patches are called | |
<quote>Interactive Patches</quote>. | |
</para> | |
<para> | |
When installing patches automatically, it is assumed that you have | |
accepted the installation of interactive patches. If you prefer to | |
review these patches before they get installed, check <guimenu>Skip | |
Interactive Patches</guimenu>. In this case, interactive patches will be | |
skipped during automated patching. Make sure to periodically run a manual | |
online update, to check whether interactive patches are waiting to be | |
installed. | |
</para> | |
</step> | |
<step> | |
<para> | |
To automatically accept any license agreements, activate <guimenu>Agree | |
with Licenses</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To automatically install all packages recommended by updated packages, | |
activate <guimenu>Include Recommended Packages</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To disable the use of delta RPMs (for performance reasons), un-check | |
<guimenu>Use Delta RPMs</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To filter the patches by category (such as security or recommended), | |
check <guimenu>Filter by Category</guimenu> and add the appropriate | |
patch categories from the list. Only patches of the selected categories | |
will be installed. It is a good practice to enable only automatic | |
<guimenu>Security</guimenu> updates, and to manually review all others. | |
Patching is usually reliable, but you may wish to test non-security | |
patches, and roll them back if you encounter any problems. | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para><guimenu>Packagemanager and YaST</guimenu> supply patches | |
for package management and YaST features and modules. | |
</para> | |
</listitem> | |
<listitem> | |
<para><guimenu>Security</guimenu> patches provide crucial | |
updates and bugfixes. | |
</para> | |
</listitem> | |
<listitem> | |
<para><guimenu>Recommended</guimenu> patches are optional | |
bugfixes and enhancements. | |
</para> | |
</listitem> | |
<listitem> | |
<para><guimenu>Optional</guimenu> are new packages.</para> | |
</listitem> | |
<listitem> | |
<para><guimenu>Other</guimenu> is equivalent to miscellaneous. | |
</para> | |
</listitem> | |
<listitem> | |
<para><guimenu>Document</guimenu> is unused. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</step> | |
<step> | |
<para> | |
Confirm your configuration by clicking <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
The automatic online update does not automatically restart the system | |
afterward. If there are package updates that require a system reboot, you | |
need to do this manually. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-yast-software"> | |
<title>Installing or removing software</title> | |
<info> | |
<abstract> | |
<para> | |
Using YaST's software management module, you can search for software | |
packages as well as install and remove them. When installing packages, | |
YaST automatically resolves all dependencies. To install packages that are | |
not on the installation medium, you can add software repositories and YaST | |
to manage them. You can also keep your system up to date by managing | |
software updates using the update applet. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
The YaST Software Manager makes it possible to manage software sources on | |
your system. There are two versions of this YaST module: a graphical version | |
for X Window and a text-based version to use with the command line. The | |
graphical flavor is described below—for details on the text-based | |
YaST, see <xref linkend="cha-yast-text" role="internalbook"/>. | |
</para> | |
<note> | |
<title>Confirmation and review of changes</title> | |
<para> | |
When installing, updating, or removing packages, any changes in the Software | |
Manager are only applied after clicking <guimenu>Accept</guimenu> or | |
<guimenu>Apply</guimenu>. YaST maintains a list with all actions, allowing | |
you to review and modify your changes before applying them to the system. | |
</para> | |
</note> | |
<sect1 xml:id="sec-onlineupdate-terms"> | |
<title>Definition of terms</title> | |
<para> | |
The following terms are important for understanding installing and removing | |
software in <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Repository</term> | |
<listitem> | |
<para> | |
A local or remote directory containing packages, plus additional | |
information about these packages (package metadata). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>(Repository) alias/repository name</term> | |
<listitem> | |
<para> | |
A short name for a repository (called <literal>Alias</literal> within | |
Zypper and <guimenu>Repository Name</guimenu> within YaST). It can be | |
chosen by the user when adding a repository and must be unique. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Repository description files</term> | |
<listitem> | |
<para> | |
Each repository provides files describing content of the repository | |
(package names, versions, etc.). These repository description files are | |
downloaded to a local cache that is used by YaST. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Product</term> | |
<listitem> | |
<para> | |
Represents a whole product, for example <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Pattern</term> | |
<listitem> | |
<para> | |
A pattern is an installable group of packages dedicated to a certain | |
purpose. For example, the <systemitem>Laptop</systemitem> pattern | |
contains all packages that are needed in a mobile computing environment. | |
Patterns define package dependencies (such as required or recommended | |
packages) and come with a preselection of packages marked for | |
installation. This ensures that the most important packages needed for a | |
certain purpose are available on your system after installation of the | |
pattern. If necessary, you can manually select or deselect | |
packages within a pattern. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Package</term> | |
<listitem> | |
<para> | |
A package is a compressed file in <literal>rpm</literal> format that | |
contains the files for a particular program. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-patch"> | |
<term>Patch</term> | |
<listitem> | |
<para> | |
A patch consists of one or more packages and may be applied by means of | |
delta RPMs. It may also introduce dependencies to packages that are not | |
installed yet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Resolvable</term> | |
<listitem> | |
<para> | |
A generic term for product, pattern, package, or patch. The most commonly | |
used type of resolvable is a package or a patch. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Delta RPM</term> | |
<listitem> | |
<para> | |
A delta RPM consists only of the binary diff between two defined versions | |
of a package, and therefore has the smallest download size. Before being | |
installed, the full RPM package is rebuilt on the local machine. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Package dependencies</term> | |
<listitem> | |
<para> | |
Certain packages are dependent on other packages, such as shared | |
libraries. In other terms, a package may <literal>require</literal> other | |
packages—if the required packages are not available, the package | |
cannot be installed. In addition to dependencies (package requirements) | |
that must be fulfilled, some packages <literal>recommend</literal> other | |
packages. These recommended packages are only installed if they are | |
actually available, otherwise they are ignored and the package | |
recommending them is installed nevertheless. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-yast-software-register" os="sles;sled"> | |
<title>Registering an installed system</title> | |
<para> | |
If you skip registration during installation, or you want to re-register your | |
system, you can register the system at any time. Use the YaST module | |
<emphasis>Product Registration</emphasis> or the command line tool | |
<command>SUSEConnect</command>. | |
</para> | |
<sect2 xml:id="sec-yast-software-register-yast"> | |
<title>Registering with YaST</title> | |
<para> | |
To register the system, start YaST and switch to | |
<guimenu>Software</guimenu>, then <guimenu>Product | |
Registration</guimenu>. | |
</para> | |
<para> | |
By default the system is registered with the SUSE Customer Center. If your | |
organization provides local registration servers, you can either | |
choose one from the list of auto-detected servers or provide the | |
URL manually. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-register-suseconnect"> | |
<title>Registering with SUSEConnect</title> | |
<para> | |
To register from the command line, use the command | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>SUSEConnect -r <replaceable>REGISTRATION_CODE</replaceable> -e <replaceable>EMAIL_ADDRESS</replaceable></command></screen> | |
<para> | |
Replace <replaceable>REGISTRATION_CODE</replaceable> with the registration | |
code you received with your copy of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
Replace <replaceable>EMAIL_ADDRESS</replaceable> with | |
the e-mail address associated with the SUSE account you or your | |
organization uses to manage subscriptions. | |
</para> | |
<para> | |
To register with a local registration server, also provide the URL to | |
the server: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>SUSEConnect -r <replaceable>REGISTRATION_CODE</replaceable> -e <replaceable>EMAIL_ADDRESS</replaceable> --url "<replaceable>URL</replaceable>"</command></screen> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-yast-software-qt"> | |
<title>Using the YaST software manager</title> | |
<para> | |
Start the software manager from the <guimenu>YaST Control Center</guimenu> | |
by choosing <menuchoice> <guimenu>Software</guimenu> <guimenu>Software | |
Management</guimenu> </menuchoice>. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<textobject role="description"> | |
<phrase><guimenu>YaST</guimenu> software manager screen</phrase> | |
</textobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_sw_manager.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_sw_manager.png" width="65%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
<sect2 xml:id="sec-yast-software-search"> | |
<title>Searching software</title> | |
<para> | |
The YaST software manager can install packages or patterns from all | |
currently enabled repositories. It offers different views and filters to | |
make it easier to find the software you are searching for. The | |
<guimenu>Search</guimenu> view is the default view of the window. To change | |
view, click <guimenu>View</guimenu> and select one of the following entries | |
from the drop-down box. The selected view opens in a new tab. | |
</para> | |
<variablelist> | |
<title>Views for searching packages or patterns</title> | |
<varlistentry> | |
<term><guimenu>Patterns</guimenu></term> | |
<listitem> | |
<para> | |
Lists all patterns available for installation on your system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Package Groups</guimenu></term> | |
<listitem> | |
<para> | |
Lists all packages sorted by groups such as <guimenu>Graphics</guimenu>, | |
<guimenu>Programming</guimenu>, or <guimenu>Security</guimenu>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Languages</guimenu></term> | |
<listitem> | |
<para> | |
A filter to list all packages needed to add a new system language. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Repositories</guimenu></term> | |
<listitem> | |
<para> | |
A filter to list packages by repository. To select more than one | |
repository, hold the <keycap function="control"/> key while clicking | |
repository names. The <quote>pseudo repository</quote> | |
<guimenu>@System</guimenu> lists all packages currently installed. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Services</guimenu></term> | |
<listitem> | |
<para> | |
Shows which packages belong to a certain module or extension. Select an | |
entry (for example, <literal>Basesystem</literal> or <literal>High | |
Availability</literal>) to display a list of packages that | |
belong to this module or extension. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Search</guimenu></term> | |
<listitem> | |
<para> | |
Lets you search for a package according to certain criteria. Enter a | |
search term and press <keycap function="enter"/>. Refine your search by | |
specifying where to <guimenu>Search In</guimenu> and by changing the | |
<guimenu>Search Mode</guimenu>. For example, if you do not know the | |
package name but only the name of the application that you are searching | |
for, try including the package <guimenu>Description</guimenu> in the | |
search process. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Installation Summary</guimenu></term> | |
<listitem> | |
<para> | |
If you have already selected packages for installation, update or | |
removal, this view shows the changes that will be applied to your system | |
when you click <guimenu>Accept</guimenu>. To filter for packages with a | |
certain status in this view, activate or deactivate the respective check | |
boxes. Press <keycombo> <keycap function="shift"/> <keycap>F1</keycap> | |
</keycombo> for details on the status flags. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<tip> | |
<title>Finding packages not belonging to an active repository</title> | |
<para> | |
To list all packages that do not belong to an active repository, choose | |
<menuchoice> <guimenu>View</guimenu> <guimenu>Repositories</guimenu> | |
<guimenu>@System</guimenu> </menuchoice> and then choose <menuchoice> | |
<guimenu>Secondary Filter</guimenu> <guimenu>Unmaintained | |
Packages</guimenu></menuchoice>. This is useful, for example, if you have | |
deleted a repository and want to make sure no packages from that | |
repository remain installed. | |
</para> | |
</tip> | |
<tip os="sles;sled" xml:id="tip-yast-software-search-online"> | |
<title>Searching software online</title> | |
<para> | |
The online search feature allows searching for packages across all | |
registered and unregistered modules and extensions. | |
</para> | |
<procedure> | |
<title>Searching software online</title> | |
<para> | |
To search for software packages online, perform the following steps: | |
</para> | |
<step> | |
<para> | |
Open the online search window with <menuchoice><guimenu>Extras</guimenu> | |
<guimenu>Search Online</guimenu></menuchoice>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter a <guimenu>Package Name</guimenu> and press | |
<keycap function="enter"/> or click <guimenu>Search</guimenu>. | |
YaST contacts the SUSE Customer Center and shows the results in a table, including the | |
module or extension of each package. Select a package to see additional | |
details. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select one or more packages for installation by clicking the | |
corresponding table row and <guimenu>Toggle Selection</guimenu>. | |
Alternatively, you can double-click a row. If the package belongs to | |
an unregistered module or extension, YaST asks for confirmation to | |
register it. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Next</guimenu>, review the changes, and install the | |
packages. | |
</para> | |
</step> | |
</procedure> | |
</tip> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-install"> | |
<title>Installing and removing packages or patterns</title> | |
<para> | |
Certain packages are dependent on other packages, such as shared libraries. | |
On the other hand, some packages cannot coexist with others on the system. | |
If possible, YaST automatically resolves these dependencies or conflicts. | |
If your choice results in a dependency conflict that cannot be | |
automatically solved, you need to solve it manually as described in | |
<xref linkend="sec-yast-software-dependencies" role="internalbook"/>. | |
</para> | |
<note> | |
<title>Removal of packages</title> | |
<para> | |
When removing any packages, by default YaST only removes the selected | |
packages. If you want YaST to also remove any other packages that become | |
unneeded after removal of the specified package, select <menuchoice> | |
<guimenu>Options</guimenu> <guimenu>Cleanup when deleting | |
packages</guimenu> </menuchoice> from the main menu. | |
</para> | |
</note> | |
<procedure> | |
<step> | |
<para> | |
Search for packages as described in <xref linkend="sec-yast-software-search" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
The packages found are listed in the right pane. To install a package or | |
remove it, right-click it and choose <guimenu>Install</guimenu> or | |
<guimenu>Delete</guimenu>. If the relevant option is not available, check | |
the package status indicated by the symbol in front of the package | |
name—press <keycombo> <keycap function="shift"/> | |
<keycap>F1</keycap> </keycombo> for help. | |
</para> | |
<tip> | |
<title>Applying an action to all packages listed</title> | |
<para> | |
To apply an action to all packages listed in the right pane, go to the | |
main menu and choose an action from <menuchoice> | |
<guimenu>Package</guimenu> <guimenu>All in This List</guimenu> | |
</menuchoice>. | |
</para> | |
</tip> | |
</step> | |
<step> | |
<para> | |
To install a pattern, right-click the pattern name and choose | |
<guimenu>Install</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
It is not possible to remove a pattern. Instead, select the | |
packages for the pattern you want to remove and mark them for removal. | |
</para> | |
</step> | |
<step> | |
<para> | |
To select more packages, repeat the steps mentioned above. | |
</para> | |
</step> | |
<step> | |
<para> | |
Before applying your changes, you can review or modify them by clicking | |
<menuchoice> <guimenu>View</guimenu> <guimenu>Installation | |
Summary</guimenu> </menuchoice>. By default, all packages that will | |
change status are listed. | |
</para> | |
</step> | |
<step> | |
<para> | |
To revert the status for a package, right-click the package and | |
select one of the following entries: <guimenu>Keep</guimenu> if the | |
package was scheduled to be deleted or updated, or <guimenu>Do Not | |
Install</guimenu> if it was scheduled for installation. To abandon all | |
changes and quit the Software Manager, click <guimenu>Cancel</guimenu> | |
and <guimenu>Abandon</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
When you are finished, click <guimenu>Accept</guimenu> to apply your | |
changes. | |
</para> | |
</step> | |
<step> | |
<para> | |
If YaST finds additional dependencies, it shows a list of related | |
packages to install, update or remove. Click <guimenu>Continue</guimenu> | |
to accept them. | |
</para> | |
<para> | |
After all selected packages are installed, updated, or removed, the YaST | |
Software Manager automatically closes. | |
</para> | |
</step> | |
</procedure> | |
<note> | |
<title>Installing source packages</title> | |
<para> | |
Installing source packages with YaST Software Manager is not possible at | |
the moment. Use the command line tool <command>zypper</command> for this | |
purpose. For more information, see | |
<xref linkend="sec-zypper-softman-sources" role="internalbook"/>. | |
</para> | |
</note> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-update"> | |
<title>Updating packages</title> | |
<para> | |
Instead of updating individual packages, you can also update all installed | |
packages or all packages from a certain repository. When mass updating | |
packages, the following aspects are generally considered: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
priorities of the repositories that provide the package, | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
architecture of the package (for example, AMD64/Intel 64), | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
version number of the package, | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
package vendor. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Which of the aspects has the highest importance for choosing the update | |
candidates depends on the respective update option you choose. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
To update all installed packages to the latest version, choose | |
<menuchoice> <guimenu>Package</guimenu> <guimenu>All Packages</guimenu> | |
<guimenu>Update if Newer Version Available</guimenu> </menuchoice> from | |
the main menu. | |
</para> | |
<para> | |
All repositories are checked for possible update candidates, using the | |
following policy: YaST first tries to restrict the search to packages | |
with the same architecture and vendor as the installed one. If the | |
search is positive, the <quote>best</quote> update candidate from those | |
is selected according to the process below. However, if no comparable | |
package of the same vendor can be found, the search is expanded to all | |
packages with the same architecture. If still no comparable package can | |
be found, all packages are considered and the <quote>best</quote> update | |
candidate is selected according to the following criteria: | |
</para> | |
<orderedlist spacing="normal"> | |
<listitem> | |
<para> | |
Repository priority: Prefer the package from the repository with the | |
highest priority. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
If more than one package results from this selection, choose the one | |
with the <quote>best</quote> architecture (best choice: matching the | |
architecture of the installed one). | |
</para> | |
</listitem> | |
</orderedlist> | |
<para> | |
If the resulting package has a higher version number than the installed | |
one, the installed package will be updated and replaced with the selected | |
update candidate. | |
</para> | |
<para> | |
This option tries to avoid changes in architecture and vendor for the | |
installed packages, but under certain circumstances, they are tolerated. | |
</para> | |
<note> | |
<title>Update unconditionally</title> | |
<para> | |
If you choose <menuchoice> <guimenu>Package</guimenu> <guimenu>All | |
Packages</guimenu> <guimenu>Update Unconditionally</guimenu> | |
</menuchoice> instead, the same criteria apply but any candidate package | |
found is installed unconditionally. Thus, choosing this option might | |
actually lead to downgrading some packages. | |
</para> | |
</note> | |
</step> | |
<step> | |
<para> | |
To make sure that the packages for a mass update derive from a certain | |
repository: | |
</para> | |
<substeps performance="required"> | |
<step> | |
<para> | |
Choose the repository from which to update as described in | |
<xref linkend="sec-yast-software-search" role="internalbook"/> . | |
</para> | |
</step> | |
<step> | |
<para> | |
On the right hand side of the window, click <guimenu>Switch system | |
packages to the versions in this repository</guimenu>. This explicitly | |
allows YaST to change the package vendor when replacing the packages. | |
</para> | |
<para> | |
When you proceed with <guimenu>Accept</guimenu>, all installed packages | |
will be replaced by packages deriving from this repository, if | |
available. This may lead to changes in vendor and architecture and even | |
to downgrading some packages. | |
</para> | |
</step> | |
<step> | |
<para> | |
To refrain from this, click <guimenu>Cancel switching system packages | |
to the versions in this repository</guimenu>. Note that you can only | |
cancel this until you click the <guimenu>Accept</guimenu> button. | |
</para> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<para> | |
Before applying your changes, you can review or modify them by clicking | |
<menuchoice> <guimenu>View</guimenu> <guimenu>Installation | |
Summary</guimenu> </menuchoice>. By default, all packages that will | |
change status, are listed. | |
</para> | |
</step> | |
<step> | |
<para> | |
If all options are set according to your wishes, confirm your changes | |
with <guimenu>Accept</guimenu> to start the mass update. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-dependencies"> | |
<title>Package dependencies</title> | |
<para> | |
Most packages are dependent on other packages. If a package, for example, | |
uses a shared library, it is dependent on the package providing this | |
library. On the other hand, some packages cannot coexist, | |
causing a conflict (for example, you can only install one mail transfer | |
agent: sendmail or postfix). When installing or removing software, the | |
Software Manager makes sure no dependencies or conflicts remain unsolved to | |
ensure system integrity. | |
</para> | |
<para> | |
In case there exists only one solution to resolve a dependency or a | |
conflict, it is resolved automatically. Multiple solutions always cause a | |
conflict which needs to be resolved manually. If solving a conflict | |
involves a vendor or architecture change, it also needs to be solved | |
manually. When clicking <guimenu>Accept</guimenu> to apply any changes in | |
the Software Manager, you get an overview of all actions triggered by the | |
automatic resolver which you need to confirm. | |
</para> | |
<para> | |
By default, dependencies are automatically checked. A check is performed | |
every time you change a package status (for example, by marking a package | |
for installation or removal). This is generally useful, but can become | |
exhausting when manually resolving a dependency conflict. To disable this | |
function, go to the main menu and deactivate <menuchoice> | |
<guimenu>Dependencies</guimenu> <guimenu>Autocheck</guimenu> </menuchoice>. | |
Manually perform a dependency check with <menuchoice> | |
<guimenu>Dependencies</guimenu> <guimenu>Check Now</guimenu></menuchoice>. | |
A consistency check is always performed when you confirm your selection | |
with <guimenu>Accept</guimenu>. | |
</para> | |
<para> | |
To review a package's dependencies, right-click it and choose <guimenu>Show | |
Solver Information</guimenu>. A map showing the dependencies opens. | |
Packages that are already installed are displayed in a green frame. | |
</para> | |
<note> | |
<title>Manually solving package conflicts</title> | |
<para> | |
Unless you are very experienced, follow the suggestions YaST makes when | |
handling package conflicts, otherwise you may not be able to resolve them. | |
Keep in mind that every change you make potentially triggers other | |
conflicts, so you can easily end up with a steadily increasing number of | |
conflicts. In case this happens, <guimenu>Cancel</guimenu> the Software | |
Manager, <guimenu>Abandon</guimenu> all your changes and start again. | |
</para> | |
</note> | |
<figure xml:id="fig-y2-sw-packconfl"> | |
<title>Conflict management of the software manager</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_package_conflict.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_package_conflict.png" width="65%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-recommendations"> | |
<title>Handling package recommendations</title> | |
<para> | |
In addition to the hard dependencies required to run a program (for | |
example a certain library), a package can also have weak dependencies, | |
which add for example extra functionality or translations. These weak | |
dependencies are called package recommendations. | |
</para> | |
<para> | |
When installing a new package, recommended packages are still | |
installed by default. When updating an existing package, missing | |
recommendations will not be installed automatically. To change this, set | |
<envar>PKGMGR_RECOMMENDED="yes"</envar> in | |
<filename>/etc/sysconfig/yast2</filename>. To install all missing | |
recommendations for already installed packages, start <menuchoice> | |
<guimenu>YaST</guimenu> <guimenu>Software Manager</guimenu> | |
</menuchoice> and choose <menuchoice> <guimenu>Extras</guimenu> | |
<guimenu>Install All Matching Recommended Packages</guimenu> | |
</menuchoice>. | |
</para> | |
<para> | |
To disable the installation of recommended packages when installing new | |
packages, deactivate <menuchoice> <guimenu>Dependencies</guimenu> | |
<guimenu>Install Recommended Packages</guimenu> </menuchoice> in the | |
YaST Software Manager. When using the command-line tool Zypper to install | |
packages, use the option <option>--no-recommends.</option> | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-yast-software-instsource"> | |
<title>Managing software repositories and services</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
To install third-party software, add software repositories to your | |
system. By default, product repositories such as | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>-DVD <phrase role="productnumber"><phrase os="sles;sled">15 SP5</phrase></phrase> and a matching update repository | |
are automatically configured<phrase os="sles;sled"> when you | |
register your system. For more information about registration, see | |
<phrase role="externalbook-sec-yast-install-scc-registration">“Registration” (Section “Installation steps”, ↑Deployment Guide)</phrase> or <phrase role="externalbook-sec-update-registersystem">“Registering your system” (Section “Upgrading offline”, ↑Upgrade Guide)</phrase></phrase>. Depending on the | |
initially selected product, an additional repository containing | |
translations, dictionaries, etc. might also be configured. | |
</para> | |
<para> | |
To manage repositories, start YaST and select <menuchoice> | |
<guimenu>Software</guimenu> <guimenu>Software Repositories</guimenu> | |
</menuchoice>. The <guimenu>Configured Software Repositories</guimenu> dialog | |
opens. Here, you can also manage subscriptions to | |
<guimenu>Services</guimenu> by changing the <guimenu>View</guimenu> at the | |
right corner of the dialog to <guimenu>All Services</guimenu>. A Service in | |
this context is a <guimenu>Repository Index Service</guimenu> (RIS) that can | |
offer one or more software repositories. Such a Service can be changed | |
dynamically by its administrator or vendor. | |
</para> | |
<para> | |
Each repository provides files describing repository content (package | |
names, versions, etc.). YaST downloads these repository description files to | |
a local cache. To ensure their integrity, software | |
repositories can be signed with the GPG Key of the repository maintainer. | |
Whenever you add a new repository, YaST offers the ability to import its | |
key. | |
</para> | |
<warning> | |
<title>Trusting external software sources</title> | |
<para> | |
Before adding external software repositories to your list of repositories, | |
make sure this repository can be trusted. SUSE is not responsible for any | |
problems arising from software installed from third-party software | |
repositories. | |
</para> | |
</warning> | |
<sect2 xml:id="sec-yast-software-instsource-add"> | |
<title>Adding software repositories</title> | |
<para> | |
You can either add repositories from DVD/CD, a USB flash drive, a local | |
directory, an ISO image, or a network source. | |
</para> | |
<para> | |
To add repositories from the <guimenu>Configured Software | |
Repositories</guimenu> dialog in YaST proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Click <guimenu>Add</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select one of the options listed in the dialog: | |
</para> | |
<figure xml:id="fig-y2-sw-repo-new"> | |
<title>Adding a software repository</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_addon_new.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_addon_new.png" width="65%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
To scan your network for installation servers announcing their services | |
via SLP, select <guimenu>Scan Using SLP</guimenu> and click | |
<guimenu>Next</guimenu>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
To add a repository from a removable medium, choose the relevant option | |
and insert the medium or connect the USB device to the machine, | |
respectively. Click <guimenu>Next</guimenu> to start the installation. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
For the majority of repositories, you will be asked to specify the path | |
(or URL) to the media after selecting the respective option and clicking | |
<guimenu>Next</guimenu>. Specifying a <guimenu>Repository Name</guimenu> | |
is optional. If none is specified, YaST will use the product name or | |
the URL as repository name. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
The option <guimenu>Download Repository Description Files</guimenu> is | |
activated by default. If you deactivate the option, YaST will | |
automatically download the files later, if needed. | |
</para> | |
</step> | |
<step> | |
<para> | |
Depending on the repository you add, you may be prompted to import | |
the repository's GPG key or asked to agree to a | |
license. | |
</para> | |
<para> | |
After confirming, YaST will download and parse the | |
metadata. It will add the repository to the list of <guimenu>Configured | |
Repositories</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
If needed, adjust the repository <guimenu>Properties</guimenu> as | |
described in <xref linkend="sec-yast-software-instsource-manage" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your changes with <guimenu>OK</guimenu> to close the configuration | |
dialog. | |
</para> | |
</step> | |
<step> | |
<para> | |
After having successfully added the repository, the software manager | |
starts and you can install packages from this repository. For details, | |
refer to <xref linkend="cha-yast-software" role="internalbook"/>. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-instsource-manage"> | |
<title>Managing repository properties</title> | |
<para> | |
The <guimenu>Configured Software Repositories</guimenu> overview of the | |
<guimenu>Software Repositories</guimenu> lets you change the following | |
repository properties: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Status</term> | |
<listitem> | |
<para> | |
The repository status can either be <guimenu>Enabled</guimenu> or | |
<guimenu>Disabled</guimenu>. You can only install packages from | |
repositories that are enabled. To turn a repository off temporarily, | |
select it and deactivate <guimenu>Enable</guimenu>. You can also | |
double-click a repository name to toggle its status. To | |
remove a repository completely, click <guimenu>Delete</guimenu>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Refresh</term> | |
<listitem> | |
<para> | |
When refreshing a repository, its content description (package names, | |
versions, etc.) is downloaded to a local cache that is used by YaST. It | |
is sufficient to do this once for static repositories such as CDs or | |
DVDs, whereas repositories whose content changes often should be | |
refreshed frequently. The easiest way to keep a repository's cache | |
up to date is to choose <guimenu>Automatically Refresh</guimenu>. To do a | |
manual refresh click <guimenu>Refresh</guimenu> and select one of the | |
options. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Keep Downloaded Packages</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Packages from remote repositories are downloaded before being installed. | |
By default, they are deleted upon successful installation. Activating | |
<guimenu>Keep Downloaded Packages</guimenu> prevents the deletion of | |
downloaded packages. The download location is configured in | |
<filename>/etc/zypp/zypp.conf</filename>, by default it is | |
<filename>/var/cache/zypp/packages</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Priority</guimenu> | |
</term> | |
<listitem> | |
<para> | |
The <guimenu>Priority</guimenu> of a repository is a value between | |
<literal>1</literal> and <literal>200</literal>, with | |
<literal>1</literal> being the highest priority and | |
<literal>200</literal> the lowest priority. Any new repositories that are | |
added with YaST get a priority of <literal>99</literal> by default. If | |
you do not care about a priority value for a certain repository, you can | |
also set the value to <literal>0</literal> to apply the default priority | |
to that repository (<literal>99</literal>). If a package is available in | |
more than one repository, then the repository with the highest priority | |
takes precedence. This is useful to avoid downloading | |
packages unnecessarily from the Internet by giving a local repository | |
(for example, a DVD) a higher priority. | |
</para> | |
<important> | |
<title>Priority compared to version</title> | |
<para> | |
The repository with the highest priority takes precedence in any case. | |
Therefore, make sure that the update repository always has the highest | |
priority, otherwise you might install an outdated version that will not | |
be updated until the next online update. | |
</para> | |
</important> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Name and URL</term> | |
<listitem> | |
<para> | |
To change a repository name or its URL, select it from the list with a | |
single-click and then click <guimenu>Edit</guimenu>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-yast-software-repo-gpg-keys"> | |
<title>Managing repository keys</title> | |
<para> | |
To ensure their integrity, software repositories can be signed with the | |
GPG Key of the repository maintainer. Whenever you add a new repository, | |
YaST offers to import its key. Verify it as you would do with any other | |
GPG key and make sure it does not change. If you detect a key change, | |
something might be wrong with the repository. Disable the repository as an | |
installation source until you know the cause of the key change. | |
</para> | |
<para> | |
To manage all imported keys, click <guimenu>GPG Keys</guimenu> in the | |
<guimenu>Configured Software Repositories</guimenu> dialog. Select an entry | |
with the mouse to show the key properties at the bottom of the window. | |
<guimenu>Add</guimenu>, <guimenu>Edit</guimenu>, or <guimenu>Delete</guimenu> | |
keys with a click on the respective buttons. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-updater"> | |
<title>The GNOME package updater</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
SUSE offers a continuous stream of software security patches and updates | |
for your product. They can be installed using tools available with your | |
desktop or by running the <xref linkend="cha-onlineupdate-you" xrefstyle="select:title nopage" role="internalbook"/> | |
module. This section describes how to update the system from the GNOME | |
desktop using the <guimenu>Package Updater</guimenu>. | |
</para> | |
<para> | |
Contrary to the YaST Online Update module, the GNOME <guimenu>Package | |
Updater</guimenu> not only offers to install patches from the update | |
repositories, but also new versions of packages that are already | |
installed. (Patches fix security issues or malfunctions; the functionality | |
and version number is usually not changed. New versions of a package increase | |
the version number and usually add functionality or introduce major changes.) | |
</para> | |
<para> | |
Whenever new patches or package updates are available, GNOME shows a | |
notification in the notification area or on the lock screen. | |
</para> | |
<figure> | |
<title>Update notification on GNOME desktop</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata os="sles;sled" fileref="gnome_update_notification_desktop.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata os="sles;sled" fileref="gnome_update_notification_desktop.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
To configure the notification settings for the <guimenu>Package | |
Updater</guimenu>, start GNOME <guimenu>Settings</guimenu> and choose | |
<menuchoice><guimenu>Notifications</guimenu> | |
<guimenu>Package Updater</guimenu></menuchoice>. | |
</para> | |
<procedure> | |
<title>Installing patches and updates with the GNOME package updater</title> | |
<step> | |
<para> | |
To install the patches and updates, click the notification message. This | |
opens the GNOME <guimenu>Package Updater</guimenu>. Alternatively, open | |
the updater from <guimenu>Activities</guimenu> by typing <literal>package | |
U</literal> and choosing <guimenu>Package Updater</guimenu>. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="gupdater_updates.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="gupdater_updates.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
Updates are sorted into four categories: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Security updates (patches)</term> | |
<listitem> | |
<para> | |
Fix severe security hazards and should always be installed. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Recommended updates (patches)</term> | |
<listitem> | |
<para> | |
Fix issues that could compromise your computer. Installing them is | |
strongly recommended. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Optional updates (patches)</term> | |
<listitem> | |
<para> | |
Fix non-security relevant issues or provide enhancements. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Other updates</term> | |
<listitem> | |
<para> | |
New versions of packages that are installed. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
All available updates are preselected for installation. If you do not want | |
to install all updates, deselect unwanted updates first. It is strongly | |
recommended to always install all security and recommended updates. | |
</para> | |
<para> | |
To get detailed information on an update, click its title and then | |
<guimenu>Details</guimenu>. The information will be displayed in a box | |
beneath the package list. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Install Updates</guimenu> to start the installation. | |
</para> | |
</step> | |
<step> | |
<para> | |
Some updates may require to restart the machine or to log out. Check | |
the message displayed after installation for instructions. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-updater-gnomesw"> | |
<title>Updating packages with <guimenu>GNOME Software</guimenu></title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
In addition to the GNOME <guimenu>Package Updater</guimenu>, GNOME provides | |
<guimenu>GNOME Software</guimenu> which has the following functionality: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Install, update, and remove software delivered as an RPM via PackageKit | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Install, update, and remove software delivered as a Flatpak | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Install, update, and remove GNOME shell extensions | |
(<link xlink:href="https://extensions.gnome.org"/>) | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Update firmware for hardware devices using <emphasis>Linux Vendor | |
Firmware Service</emphasis> (LVFS, <link xlink:href="https://fwupd.org"/>) | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
In addition to this, <guimenu>GNOME Software</guimenu> provides screenshots, | |
ratings, and reviews for software. | |
</para> | |
<figure> | |
<title><guimenu>GNOME Software</guimenu>—<guimenu>Updates</guimenu> view</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="gnome-software-updates.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="gnome-software-updates.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
<guimenu>GNOME Software</guimenu> has the following differences to other | |
tools provided on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Unlike YaST or Zypper, for installing software packaged as an RPM, | |
<guimenu>GNOME Software</guimenu> is restricted to software that | |
provides AppStream metadata. This includes most desktop applications. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
While the GNOME <guimenu>Package Updater</guimenu> updates packages within | |
the running system (forcing you to restart the respective applications), | |
<guimenu>GNOME Software</guimenu> downloads the updates and applies | |
them after reboot. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-sw-cl"> | |
<title>Managing software with command line tools</title> | |
<info> | |
<abstract> | |
<para> | |
This chapter describes Zypper and RPM, two command line tools for managing | |
software. For a definition of the terminology used in this context (for | |
example, <literal>repository</literal>, <literal>patch</literal>, or | |
<literal>update</literal>) refer to | |
<xref linkend="sec-onlineupdate-terms" role="internalbook"/>. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 version="5.0" xml:id="sec-zypper"> | |
<title>Using Zypper</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Zypper is a command line package manager for installing, updating, and | |
removing packages. It also manages repositories. It is especially useful for | |
accomplishing remote software management tasks or managing software from | |
shell scripts. | |
</para> | |
<sect2 xml:id="sec-zypper-usage"> | |
<title>General usage</title> | |
<para> | |
The general syntax of Zypper is: | |
</para> | |
<screen>zypper <option>[--global-options]</option> <replaceable>COMMAND</replaceable> <option> [--command-options]</option> <option>[arguments]</option></screen> | |
<para> | |
The components enclosed in brackets are not required. See <command>zypper | |
help</command> for a list of general options and all commands. To get help | |
for a specific command, type <command>zypper help</command> | |
<replaceable>COMMAND</replaceable>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Zypper commands</term> | |
<listitem> | |
<para> | |
The simplest way to execute Zypper is to type its name, followed by a | |
command. For example, to apply all needed patches to the system, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Global options</term> | |
<listitem> | |
<para> | |
Additionally, you can choose from one or more global options by typing | |
them immediately before the command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper --non-interactive patch</screen> | |
<para> | |
In the above example, the option <option>--non-interactive</option> means | |
that the command is run without asking anything (automatically applying | |
the default answers). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Command-specific options</term> | |
<listitem> | |
<para> | |
To use options that are specific to a particular command, type them | |
immediately after the command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --auto-agree-with-licenses</screen> | |
<para> | |
In the above example, <option>--auto-agree-with-licenses</option> is used | |
to apply all needed patches to a system without you being asked to | |
confirm any licenses. Instead, license will be accepted automatically. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Arguments</term> | |
<listitem> | |
<para> | |
Some commands require one or more arguments. For example, when using the | |
command <command>install</command>, you need to specify which package or | |
which packages you want to <emphasis>install</emphasis>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install mplayer</screen> | |
<para> | |
Some options also require a single argument. The following command will | |
list all known patterns: | |
</para> | |
<screen><prompt>> </prompt>zypper search -t pattern</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
You can combine all of the above. For example, the following command will | |
install the <package>mc</package> and <package>vim</package> packages from | |
the <literal>factory</literal> repository while being verbose: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper -v install --from factory mc vim</screen> | |
<para> | |
The <option>--from</option> option keeps all repositories | |
enabled (for solving any dependencies) while requesting the package from the | |
specified repository. <option>--repo</option> is an alias for <option>--from</option>, and you may use either one. | |
</para> | |
<para> | |
Most Zypper commands have a <literal>dry-run</literal> option that does a | |
simulation of the given command. It can be used for test purposes. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper remove --dry-run MozillaFirefox</screen> | |
<para> | |
Zypper supports the global <option>--userdata | |
<replaceable>STRING</replaceable></option> option. You can specify a string | |
with this option, which gets written to Zypper's log files and plug-ins | |
(such as the Btrfs plug-in). It can be used to mark and identify | |
transactions in log files. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper --userdata <replaceable>STRING</replaceable> patch</screen> | |
</sect2> | |
<sect2 xml:id="sec-zypper-subcommands"> | |
<title>Using Zypper subcommands</title> | |
<para> | |
Zypper subcommands are executables that are stored in the directory | |
specified by the <option>zypper_execdir</option> configuration option. It is | |
<filename>/usr/lib/zypper/commands</filename> by default. If a subcommand | |
is not found there, Zypper automatically searches the rest of your $PATH | |
locations for it. This lets you create your own local extensions and store | |
them in user space. | |
</para> | |
<para> | |
Executing subcommands in the Zypper shell, and using global Zypper options | |
are not supported. | |
</para> | |
<para> | |
List your available subcommands: | |
</para> | |
<screen><prompt>> </prompt>zypper help subcommand | |
[...] | |
Available zypper subcommands in '/usr/lib/zypper/commands' | |
appstream-cache | |
lifecycle | |
migration | |
search-packages | |
Zypper subcommands available from elsewhere on your $PATH | |
log Zypper logfile reader | |
(/usr/sbin/zypper-log) | |
</screen> | |
<para> | |
View the help screen for a subcommand: | |
</para> | |
<screen> | |
<prompt>> </prompt>zypper help appstream-cache | |
</screen> | |
</sect2> | |
<sect2 xml:id="sec-zypper-softman"> | |
<title>Installing and removing software with Zypper</title> | |
<para> | |
To install or remove packages, use the following commands: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install <replaceable>PACKAGE_NAME</replaceable> | |
<prompt>> </prompt><command>sudo</command> zypper remove <replaceable>PACKAGE_NAME</replaceable></screen> | |
<warning> | |
<title>Do not remove mandatory system packages</title> | |
<para> | |
Do not remove mandatory system packages like <package>glibc</package> , | |
<package>zypper</package> , <package>kernel</package> . If they are | |
removed, the system can become unstable or stop working altogether. | |
</para> | |
</warning> | |
<sect3 xml:id="sec-zypper-selectpackage"> | |
<title>Selecting which packages to install or remove</title> | |
<para> | |
There are various ways to address packages with the commands | |
<command>zypper install</command> and <command>zypper remove</command>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>By exact package name</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install MozillaFirefox</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By exact package name and version number</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install MozillaFirefox-52.2</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By repository alias and package name</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install mozilla:MozillaFirefox</screen> | |
<para> | |
Where <literal>mozilla</literal> is the alias of the repository from | |
which to install. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By package name using wild cards</term> | |
<listitem> | |
<para> | |
You can select all packages that have names starting or ending with a | |
certain string. Use wild cards with care, especially when removing | |
packages. The following command will install all packages starting with | |
<quote>Moz</quote>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install 'Moz*'</screen> | |
<tip> | |
<title>Removing all <filename>-debuginfo</filename> packages</title> | |
<para> | |
When debugging a problem, you sometimes need to temporarily install a | |
lot of <filename>-debuginfo</filename> packages which give you more | |
information about running processes. After your debugging session | |
finishes and you need to clean the environment, run the following: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper remove '*-debuginfo'</screen> | |
</tip> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By capability</term> | |
<listitem> | |
<para> | |
For example, to install a package without knowing its name, capabilities | |
come in handy. The following command will install the package | |
<package>MozillaFirefox</package>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install firefox</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By capability, hardware architecture, or version</term> | |
<listitem> | |
<para> | |
Together with a capability, you can specify a hardware architecture and | |
a version: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
The name of the desired hardware architecture is appended to the | |
capability after a full stop. For example, to specify the AMD64/Intel 64 | |
architectures (which in Zypper is named <literal>x86_64</literal>), | |
use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install 'firefox.x86_64'</screen> | |
</listitem> | |
<listitem> | |
<para> | |
Versions must be appended to the end of the string and must be | |
preceded by an operator: <literal><</literal> (lesser than), | |
<literal><=</literal> (lesser than or equal), <literal>=</literal> | |
(equal), <literal>>=</literal> (greater than or equal), | |
<literal>></literal> (greater than). | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install 'firefox>=74.2'</screen> | |
</listitem> | |
<listitem> | |
<para> | |
You can also combine a hardware architecture and version requirement: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install 'firefox.x86_64>=74.2'</screen> | |
</listitem> | |
</itemizedlist> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By path to the RPM file</term> | |
<listitem> | |
<para> | |
You can also specify a local or remote path to a package: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install /tmp/install/MozillaFirefox.rpm | |
<prompt>> </prompt><command>sudo</command> zypper install http://download.example.com/MozillaFirefox.rpm</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-zypper-combineinstall"> | |
<title>Combining installation and removal of packages</title> | |
<para> | |
To install and remove packages simultaneously, use the | |
<literal>+/-</literal> modifiers. To install <package>emacs</package> and | |
simultaneously remove <package>vim</package> , use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install emacs -vim</screen> | |
<para> | |
To remove <package>emacs</package> and simultaneously install | |
<package>vim</package> , use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper remove emacs +vim</screen> | |
<para> | |
To prevent the package name starting with the <literal>-</literal> being | |
interpreted as a command option, always use it as the second argument. If | |
this is not possible, precede it with <literal>--</literal>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install -emacs +vim # Wrong | |
<prompt>> </prompt><command>sudo</command> zypper install vim -emacs # Correct | |
<prompt>> </prompt><command>sudo</command> zypper install -- -emacs +vim # Correct | |
<prompt>> </prompt><command>sudo</command> zypper remove emacs +vim # Correct</screen> | |
</sect3> | |
<sect3 xml:id="sec-zypper-clean"> | |
<title>Cleaning up dependencies of removed packages</title> | |
<para> | |
If (together with a certain package), you automatically want to remove any | |
packages that become unneeded after removing the specified package, use the | |
<option>--clean-deps</option> option: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper rm --clean-deps <replaceable>PACKAGE_NAME</replaceable></screen> | |
</sect3> | |
<sect3 xml:id="sec-zypper-script"> | |
<title>Using Zypper in scripts</title> | |
<para> | |
By default, Zypper asks for a confirmation before installing or removing a | |
selected package, or when a problem occurs. You can override this behavior | |
using the <option>--non-interactive</option> option. This option must be | |
given before the actual command (<command>install</command>, | |
<command>remove</command>, and <command>patch</command>), as can be seen in | |
the following: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper <option>--non-interactive</option> install <replaceable>PACKAGE_NAME</replaceable></screen> | |
<para> | |
This option allows the use of Zypper in scripts and cron jobs. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softman-sources"> | |
<title>Installing or downloading source packages</title> | |
<para> | |
To install the corresponding source package of a package, use: | |
</para> | |
<screen><prompt>> </prompt>zypper source-install <replaceable>PACKAGE_NAME</replaceable></screen> | |
<para> | |
When executed as <systemitem class="username">root</systemitem>, the default location to install source | |
packages is <filename>/usr/src/packages/</filename> and | |
<filename>~/rpmbuild</filename> when run as user. These values can be | |
changed in your local <command>rpm</command> configuration. | |
</para> | |
<para> | |
This command will also install the build dependencies of the specified | |
package. If you do not want this, add the switch <literal>-D</literal>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper source-install -D <replaceable>PACKAGE_NAME</replaceable></screen> | |
<para> | |
To install only the build dependencies use <literal>-d</literal>. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper source-install -d <replaceable>PACKAGE_NAME</replaceable></screen> | |
<para> | |
Of course, this will only work if you have the repository with the source | |
packages enabled in your repository list (it is added by default, but not | |
enabled). See <xref linkend="sec-zypper-instrepo" role="internalbook"/> for details on | |
repository management. | |
</para> | |
<para> | |
A list of all source packages available in your repositories can be | |
obtained with: | |
</para> | |
<screen><prompt>> </prompt>zypper search -t srcpackage</screen> | |
<para> | |
You can also download source packages for all installed packages to a local | |
directory. To download source packages, use: | |
</para> | |
<screen><prompt>> </prompt>zypper source-download</screen> | |
<para> | |
The default download directory is | |
<filename>/var/cache/zypper/source-download</filename>. You can change it | |
using the <option>--directory</option> option. To only show missing or | |
extraneous packages without downloading or deleting anything, use the | |
<option>--status</option> option. To delete extraneous source packages, use | |
the <option>--delete</option> option. To disable deleting, use the | |
<option>--no-delete</option> option. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softman-pluscontent"> | |
<title>Installing packages from disabled repositories</title> | |
<para> | |
Normally you can only install or refresh packages from enabled | |
repositories. The <option>--plus-content | |
<replaceable>TAG</replaceable></option> option helps you specify | |
repositories to be refreshed, temporarily enabled during the current Zypper | |
session, and disabled after it completes. | |
</para> | |
<para> | |
For example, to enable repositories that may provide additional | |
<filename>-debuginfo</filename> or <filename>-debugsource</filename> | |
packages, use <option>--plus-content debug</option>. You can specify this | |
option multiple times. | |
</para> | |
<para> | |
To temporarily enable such 'debug' repositories to install a specific | |
<filename>-debuginfo</filename> package, use the option as follows: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper --plus-content debug \ | |
install "debuginfo(build-id)=eb844a5c20c70a59fc693cd1061f851fb7d046f4"</screen> | |
<para> | |
The <literal>build-id</literal> string is reported by | |
<command>gdb</command> for missing debuginfo packages. | |
</para> | |
<note> | |
<title>Disabled installation media</title> | |
<para> | |
<remark>cwickert 2019-04-18: JSC#SLE-3191</remark> | |
Repositories from the <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> installation media are still | |
configured but disabled after successful installation. You can use the | |
<option>--plus-content</option> option to install packages from the | |
installation media instead of the online repositories. Before calling | |
<command>zypper</command>, ensure the media is available, for example by | |
inserting the DVD into the computer's drive. | |
</para> | |
</note> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softman-util"> | |
<title>Utilities</title> | |
<para> | |
To verify whether all dependencies are still fulfilled and to repair | |
missing dependencies, use: | |
</para> | |
<screen><prompt>> </prompt>zypper verify</screen> | |
<para> | |
In addition to dependencies that must be fulfilled, some packages | |
<quote>recommend</quote> other packages. These recommended packages are | |
only installed if actually available and installable. In case recommended | |
packages were made available after the recommending package has been | |
installed (by adding additional packages or hardware), use the following | |
command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper install-new-recommends</screen> | |
<para> | |
This command is very useful after plugging in a Web cam or Wi-Fi device. It | |
will install drivers for the device and related software, if available. | |
Drivers and related software are only installable if certain hardware | |
dependencies are fulfilled. | |
</para> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-zypper-softup"> | |
<title>Updating software with Zypper</title> | |
<para> | |
There are three different ways to update software using Zypper: by | |
installing patches, by installing a new version of a package or by updating | |
the entire distribution. The latter is achieved with <command>zypper | |
dist-upgrade</command>. Upgrading <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is discussed in | |
<phrase os="sles;sled"><phrase role="externalbook-cha-upgrade-paths">“Upgrade paths and methods” (↑Upgrade Guide)</phrase></phrase>. | |
</para> | |
<sect3 xml:id="sec-zypper-softup-patch"> | |
<title>Installing all needed patches</title> | |
<para> | |
<emphasis>Patching</emphasis> SUSE Linux Enterprise is the most reliable way to install | |
new versions of installed packages. It guarantees that all required | |
packages with correct versions are installed and ensures that package versions | |
considered as <emphasis>conflicting</emphasis> are omitted. | |
</para> | |
<para> | |
To install all officially released patches that apply to your system, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch</screen> | |
<para> | |
All patches available from repositories configured on your computer are | |
checked for their relevance to your installation. If they are relevant (and | |
not classified as <literal>optional</literal> or | |
<literal>feature</literal>), they are installed immediately. | |
If <command>zypper patch</command> succeeds, it is guaranteed that no | |
vulnerable version package is installed unless you confirm the exception. | |
<phrase os="sles;sled">Note that the official update repository is only | |
available after registering your <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> installation.</phrase> | |
</para> | |
<para> | |
If a patch that is about to be installed includes changes that require a | |
system reboot, you will be warned before. | |
</para> | |
<para> | |
The plain <command>zypper patch</command> command does not apply patches | |
from third party repositories. To update also the third party repositories, | |
use the <literal>with-update</literal> command option as follows: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --with-update</screen> | |
<para> | |
To install also optional patches, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --with-optional</screen> | |
<remark> | |
The structure here is a bit unfortunate: We explain how to use the | |
--cve/--bugzilla options in more detail below ("Listing Patches"). | |
However, the first bit people get is the very brief intro immediately below. | |
Not sure whether to replicate all the information from "Listing Patches" | |
here. | |
- sknorr, 2016-04-25 | |
</remark> | |
<para> | |
To install all patches relating to a specific Bugzilla issue, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --bugzilla=<replaceable>NUMBER</replaceable></screen> | |
<para> | |
To install all patches relating to a specific CVE database entry, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --cve=<replaceable>NUMBER</replaceable></screen> | |
<para> | |
For example, to install a security patch with the CVE number | |
<literal>CVE-2010-2713</literal>, execute: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --cve=CVE-2010-2713</screen> | |
<para> | |
To install only patches which affect Zypper and the package management | |
itself, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper patch --updatestack-only</screen> | |
<para> | |
Bear in mind that other command options that would also update other | |
repositories will be dropped if you use the | |
<literal>updatestack-only</literal> command option. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softup-listpatch"> | |
<title>Listing patches</title> | |
<para> | |
To find out whether patches are available, Zypper allows viewing the | |
following information: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Number of needed patches</term> | |
<listitem> | |
<para> | |
To list the number of needed patches (patches that apply to your system | |
but are not yet installed), use <command>patch-check</command>: | |
</para> | |
<screen><prompt>> </prompt>zypper patch-check | |
Loading repository data... | |
Reading installed packages... | |
5 patches needed (1 security patch)</screen> | |
<para> | |
This command can be combined with the | |
<option>--updatestack-only</option> option to list only the patches | |
which affect Zypper and the package management itself. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>List of needed patches</term> | |
<listitem> | |
<para> | |
To list all needed patches (patches that apply to your system but are | |
not yet installed), use <command>zypper list-patches</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>List of all patches</term> | |
<listitem> | |
<para> | |
To list all patches available for <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>, regardless of whether | |
they are already installed or apply to your installation, use | |
<command>zypper patches</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
It is also possible to list and install patches relevant to specific | |
issues. To list specific patches, use the <command>zypper | |
list-patches</command> command with the following options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>By Bugzilla issues</term> | |
<listitem> | |
<para> | |
To list all needed patches that relate to Bugzilla issues, use the | |
option <option>--bugzilla</option>. | |
</para> | |
<para> | |
To list patches for a specific bug, you can also specify a bug number: | |
<option>--bugzilla=<replaceable>NUMBER</replaceable></option>. To search | |
for patches relating to multiple Bugzilla issues, add commas between the | |
bug numbers, for example: | |
</para> | |
<screen><prompt>> </prompt>zypper list-patches --bugzilla=972197,956917</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>By CVE number</term> | |
<listitem> | |
<para> | |
To list all needed patches that relate to an entry in the CVE database | |
(Common Vulnerabilities and Exposures), use the option | |
<option>--cve</option>. | |
</para> | |
<para> | |
To list patches for a specific CVE database entry, you can also specify | |
a CVE number: <option>--cve=<replaceable>NUMBER</replaceable></option>. | |
To search for patches relating to multiple CVE database entries, add | |
commas between the CVE numbers, for example: | |
</para> | |
<screen><prompt>> </prompt>zypper list-patches --cve=CVE-2016-2315,CVE-2016-2324</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>List retracted patches</term> | |
<listitem> | |
<para> | |
In the SUSE Linux Enterprise 15 codestream, some patches are automatically | |
retracted. Maintenance updates are carefully tested, because there | |
is a risk that an update contains a new bug. If an update proves to | |
contain a bug, a new update (with a higher version number) is | |
issued to revert the buggy update, and the buggy update is blocked | |
from being installed again. You can list retracted patches with | |
<command>zypper</command>: | |
</para> | |
<screen><prompt>> </prompt><command>zypper lp --all |grep retracted</command> | |
SLE-Module-Basesystem15-SP3-Updates | SUSE-SLE-Module-Basesystem-15-SP3-2021-1965 | |
| recommended | important | --- | retracted | Recommended update for multipath-tools | |
SLE-Module-Basesystem15-SP3-Updates | SUSE-SLE-Module-Basesystem-15-SP3-2021-2689 | |
| security | important | --- | retracted | Security update for cpio | |
SLE-Module-Basesystem15-SP3-Updates | SUSE-SLE-Module-Basesystem-15-SP3-2021-3655 | |
| security | important | reboot | retracted | Security update for the Linux Kernel</screen> | |
<para> | |
See complete information on a retracted (or any) patch: | |
</para> | |
<screen><prompt>> </prompt><command>zypper patch-info SUSE-SLE-Product-SLES-15-2021-2689</command> | |
Loading repository data... | |
Reading installed packages... | |
Information for patch SUSE-SLE-Product-SLES-15-2021-2689: | |
--------------------------------------------------------- | |
Repository : SLE-Product-SLES15-LTSS-Updates | |
Name : SUSE-SLE-Product-SLES-15-2021-2689 | |
Version : 1 | |
Arch : noarch | |
Vendor : [email protected] | |
Status : retracted | |
Category : security | |
Severity : important | |
Created On : Mon 16 Aug 2021 03:44:00 AM PDT | |
Interactive : --- | |
Summary : Security update for cpio | |
Description : | |
This update for cpio fixes the following issues: | |
It was possible to trigger Remote code execution due to a integer overflow | |
(CVE-2021-38185, bsc#1189206) | |
UPDATE: | |
This update was buggy and could lead to hangs, so it has been retracted. | |
There will be a follow up update. | |
[...]</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Patch with conflicting packages</term> | |
<listitem> | |
<screen> | |
Information for patch openSUSE-SLE-15.3-2022-333: | |
------------------------------------------------- | |
Repository : Update repository with updates from SUSE Linux Enterprise 15 | |
Name : openSUSE-SLE-15.3-2022-333 | |
Version : 1 | |
Arch : noarch | |
Vendor : [email protected] | |
Status : needed | |
Category : security | |
Severity : important | |
Created On : Fri Feb 4 09:30:32 2022 | |
Interactive : reboot | |
Summary : Security update for xen | |
Description : | |
This update for xen fixes the following issues: | |
- CVE-2022-23033: Fixed guest_physmap_remove_page not removing the p2m mappings. (XSA-393) (bsc#1194576) | |
- CVE-2022-23034: Fixed possible DoS by a PV guest Xen while unmapping a grant. (XSA-394) (bsc#1194581) | |
- CVE-2022-23035: Fixed insufficient cleanup of passed-through device IRQs. (XSA-395) (bsc#1194588) | |
Provides : patch:openSUSE-SLE-15.3-2022-333 = 1 | |
Conflicts : [22] | |
xen.src < 4.14.3_06-150300.3.18.2 | |
xen.noarch < 4.14.3_06-150300.3.18.2 | |
xen.x86_64 < 4.14.3_06-150300.3.18.2 | |
xen-devel.x86_64 < 4.14.3_06-150300.3.18.2 | |
xen-devel.noarch < 4.14.3_06-150300.3.18.2 | |
[...] | |
</screen> | |
<para> | |
The above patch conflicts with the affected or vulnerable versions of | |
22 packages. If any of these affected or vulnerable packages are | |
installed, it triggers a conflict, and the patch is classified as | |
<emphasis>needed</emphasis>. <command>zypper patch</command> tries to | |
install all available patches. If it encounters problems, it reports | |
them, thus informing you that not all updates are installed. The | |
conflict can be resolved by either updating the affected or vulnerable | |
packages or by removing them. Because SUSE update repositories also | |
ship fixed packages, updating is a standard way to resolve conflicts. | |
If the package cannot be updated—for example, because of dependency | |
issues or package locks—it is deleted after the user's approval. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
To list all patches regardless of whether they are needed, use the option | |
<option>--all</option> additionally. For example, to list all patches with | |
a CVE number assigned, use: | |
</para> | |
<screen><?dbsuse-fo font-size="0.70em"?> | |
<prompt>> </prompt>zypper list-patches --all --cve | |
Issue | No. | Patch | Category | Severity | Status | |
------+---------------+-------------------+-------------+-----------+---------- | |
cve | CVE-2019-0287 | SUSE-SLE-Module.. | recommended | moderate | needed | |
cve | CVE-2019-3566 | SUSE-SLE-SERVER.. | recommended | moderate | not needed | |
[...]</screen> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softup-update"> | |
<title>Installing new package versions</title> | |
<para> | |
If a repository contains only new packages, but does not provide patches, | |
<command>zypper patch</command> does not show any effect. To update | |
all installed packages with newer available versions, use the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper update</screen> | |
<important> | |
<para> | |
<command>zypper update</command> ignores problematic packages. | |
For example, if a package is locked, <command>zypper update</command> | |
omits the package, even if a higher version of it is available. Conversely, | |
<command>zypper patch</command> reports a conflict if the package is | |
considered vulnerable. | |
</para> | |
</important> | |
<para> | |
To update individual packages, specify the package with either the update | |
or install command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper update <replaceable>PACKAGE_NAME</replaceable> | |
<prompt>> </prompt><command>sudo</command> zypper install <replaceable>PACKAGE_NAME</replaceable></screen> | |
<para> | |
A list of all new installable packages can be obtained with the command: | |
</para> | |
<screen><prompt>> </prompt>zypper list-updates</screen> | |
<para> | |
Note that this command only lists packages that match the following | |
criteria: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
has the same vendor like the already installed package, | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
is provided by repositories with at least the same priority than the | |
already installed package, | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
is installable (all dependencies are satisfied). | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
A list of <emphasis>all</emphasis> new available packages (regardless | |
whether installable or not) can be obtained with: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper list-updates --all</screen> | |
<para> | |
To find out why a new package cannot be installed, use the <command>zypper | |
install</command> or <command>zypper update</command> command as described | |
above. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-softup-orphaned"> | |
<title>Identifying orphaned packages</title> | |
<para> | |
Whenever you remove a repository from Zypper or upgrade your system, some | |
packages can get in an <quote>orphaned</quote> state. These | |
<emphasis>orphaned</emphasis> packages belong to no active repository | |
anymore. The following command gives you a list of these: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper packages --orphaned</screen> | |
<para> | |
With this list, you can decide if a package is still needed or can be | |
removed safely. | |
</para> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-zypper-ps"> | |
<title>Identifying processes and services using deleted files</title> | |
<para> | |
When patching, updating, or removing packages, there may be running processes | |
on the system which continue to use files having been deleted by the update | |
or removal. Use <command>zypper ps</command> to list processes using deleted | |
files. In case the process belongs to a known service, the service name is | |
listed, making it easy to restart the service. By default <command>zypper | |
ps</command> shows a table: | |
</para> | |
<screen><?dbsuse-fo font-size="0.70em"?> | |
<prompt>> </prompt>zypper ps | |
PID | PPID | UID | User | Command | Service | Files | |
------+------+-----+-------+--------------+--------------+------------------- | |
814 | 1 | 481 | avahi | avahi-daemon | avahi-daemon | /lib64/ld-2.19.s-> | |
| | | | | | /lib64/libdl-2.1-> | |
| | | | | | /lib64/libpthrea-> | |
| | | | | | /lib64/libc-2.19-> | |
[...]</screen> | |
<simplelist><member><emphasis role="bold">PID</emphasis>: ID of the process | |
</member><member><emphasis role="bold">PPID</emphasis>: ID of the parent process | |
</member><member><emphasis role="bold">UID</emphasis>: ID of the user running the | |
process | |
</member><member><emphasis role="bold">Login</emphasis>: Login name of the user | |
running the process | |
</member><member><emphasis role="bold">Command</emphasis>: Command used to | |
execute the process | |
</member><member><emphasis role="bold">Service</emphasis>: Service name (only if command | |
is associated with a system service) | |
</member><member><emphasis role="bold">Files</emphasis>: The list of the deleted | |
files | |
</member> | |
</simplelist> | |
<para> | |
The output format of <command>zypper ps</command> can be controlled as | |
follows: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><command>zypper ps</command><option>-s</option></term> | |
<listitem> | |
<para> | |
Create a short table not showing the deleted files. | |
</para> | |
<screen><?dbsuse-fo font-size="0.70em"?> | |
<prompt>> </prompt>zypper ps -s | |
PID | PPID | UID | User | Command | Service | |
------+------+------+---------+--------------+-------------- | |
814 | 1 | 481 | avahi | avahi-daemon | avahi-daemon | |
817 | 1 | 0 | root | irqbalance | irqbalance | |
1567 | 1 | 0 | root | sshd | sshd | |
1761 | 1 | 0 | root | master | postfix | |
1764 | 1761 | 51 | postfix | pickup | postfix | |
1765 | 1761 | 51 | postfix | qmgr | postfix | |
2031 | 2027 | 1000 | tux | bash |</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>zypper ps</command><option>-ss</option></term> | |
<listitem> | |
<para> | |
Show only processes associated with a system service. | |
</para> | |
<screen>PID | PPID | UID | User | Command | Service | |
------+------+------+---------+--------------+-------------- | |
814 | 1 | 481 | avahi | avahi-daemon | avahi-daemon | |
817 | 1 | 0 | root | irqbalance | irqbalance | |
1567 | 1 | 0 | root | sshd | sshd | |
1761 | 1 | 0 | root | master | postfix | |
1764 | 1761 | 51 | postfix | pickup | postfix | |
1765 | 1761 | 51 | postfix | qmgr | postfix</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>zypper ps</command><option>-sss</option></term> | |
<listitem> | |
<para> | |
Only show system services using deleted files. | |
</para> | |
<screen>avahi-daemon | |
irqbalance | |
postfix | |
sshd</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>zypper ps</command><option>--print "systemctl status %s"</option></term> | |
<listitem> | |
<para> | |
Show the commands to retrieve status information for services which might | |
need a restart. | |
</para> | |
<screen>systemctl status avahi-daemon | |
systemctl status irqbalance | |
systemctl status postfix | |
systemctl status sshd</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
For more information about service handling refer to | |
<xref linkend="cha-systemd" role="internalbook"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-zypper-instrepo"> | |
<title>Managing repositories with Zypper</title> | |
<para> | |
All installation or patch commands of Zypper rely on a list of known | |
repositories. To list all repositories known to the system, use the command: | |
</para> | |
<screen><prompt>> </prompt>zypper repos</screen> | |
<para> | |
The result will look similar to the following output: | |
</para> | |
<example xml:id="ex-zypper-repos"> | |
<title>Zypper—list of known repositories</title> | |
<screen os="sles;sled"><prompt>> </prompt>zypper repos | |
# | Alias | Name | Enabled | Refresh | |
--+--------------+---------------+---------+-------- | |
1 | SLEHA-15-GEO | SLEHA-15-GEO | Yes | No | |
2 | SLEHA-15 | SLEHA-15 | Yes | No | |
3 | SLES15 | SLES15 | Yes | No</screen> | |
</example> | |
<para> | |
When specifying repositories in various commands, an alias, URI or | |
repository number from the <command>zypper repos</command> command output | |
can be used. A repository alias is a short version of the repository name | |
for use in repository handling commands. Note that the repository numbers | |
can change after modifying the list of repositories. The alias will never | |
change by itself. | |
</para> | |
<para> | |
By default, details such as the URI or the priority of the repository are | |
not displayed. Use the following command to list all details: | |
</para> | |
<screen><prompt>> </prompt>zypper repos -d</screen> | |
<sect3 xml:id="sec-zypper-instrepo-add"> | |
<title>Adding repositories</title> | |
<para> | |
To add a repository, run | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper addrepo <replaceable>URI</replaceable> <replaceable>ALIAS</replaceable></screen> | |
<para> | |
<replaceable>URI</replaceable> can either be an Internet repository, a | |
network resource, a directory or a CD or DVD (see | |
<link xlink:href="https://en.opensuse.org/openSUSE:Libzypp_URIs"/> for | |
details). The <replaceable>ALIAS</replaceable> is a shorthand and unique | |
identifier of the repository. You can freely choose it, with the only | |
exception that it needs to be unique. Zypper will issue a warning if you | |
specify an alias that is already in use. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-instrepo-refresh"> | |
<title>Refreshing repositories</title> | |
<para> | |
<command>zypper</command> enables you to fetch changes in packages from | |
configured repositories. To fetch the changes, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper refresh</screen> | |
<note> | |
<title>Default behavior of <command>zypper</command></title> | |
<para> | |
By default, some commands perform <command>refresh</command> | |
automatically, so you do not need to run the command explicitly. | |
</para> | |
</note> | |
<para> | |
The <command>refresh</command> command enables you to view changes also in | |
disabled repositories, by using the <literal>--plus-content</literal> | |
option: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper --plus-content refresh</screen> | |
<para> | |
This option fetches changes in repositories, but keeps the disabled | |
repositories in the same state—disabled. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-instrepo-rm"> | |
<title>Removing repositories</title> | |
<para> | |
To remove a repository from the list, use the command <command>zypper | |
removerepo</command> together with the alias or number of the repository | |
you want to delete. For example, to remove the repository | |
<literal os="sles;sled">SLEHA-12-GEO</literal> | |
from <xref linkend="ex-zypper-repos" role="internalbook"/>, use one of the following commands: | |
</para> | |
<screen os="sles;sled"><prompt>> </prompt><command>sudo</command> zypper removerepo 1 | |
<prompt>> </prompt><command>sudo</command> zypper removerepo "SLEHA-12-GEO"</screen> | |
</sect3> | |
<sect3 xml:id="sec-zypper-instrepo-mofify"> | |
<title>Modifying repositories</title> | |
<para> | |
Enable or disable repositories with <command>zypper modifyrepo</command>. | |
You can also alter the repository's properties (such as refreshing | |
behavior, name or priority) with this command. The following command will | |
enable the repository named <literal>updates</literal>, turn on | |
auto-refresh and set its priority to 20: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper modifyrepo -er -p 20 'updates'</screen> | |
<para> | |
Modifying repositories is not limited to a single repository—you can | |
also operate on groups: | |
</para> | |
<simplelist><member><option>-a</option>: all repositories</member><member><option>-l</option>: local repositories</member><member><option>-t</option>: remote repositories</member><member><option>-m <replaceable>TYPE</replaceable></option>: repositories | |
of a certain type (where <replaceable>TYPE</replaceable> can be one of the | |
following: <literal>http</literal>, <literal>https</literal>, <literal>ftp</literal>, | |
<literal>cd</literal>, <literal>dvd</literal>, <literal>dir</literal>, <literal>file</literal>, | |
<literal>cifs</literal>, <literal>smb</literal>, <literal>nfs</literal>, <literal>hd</literal>, | |
<literal>iso</literal>) </member> | |
</simplelist> | |
<para> | |
To rename a repository alias, use the <literal>renamerepo</literal> | |
command. The following example changes the alias from <literal>Mozilla | |
Firefox</literal> to <literal>firefox</literal>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper renamerepo 'Mozilla Firefox' firefox</screen> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-zypper-query"> | |
<title>Querying repositories and packages with Zypper</title> | |
<para> | |
Zypper offers various methods to query repositories or packages. To get | |
lists of all products, patterns, packages or patches available, use the | |
following commands: | |
</para> | |
<screen><prompt>> </prompt>zypper products | |
<prompt>> </prompt>zypper patterns | |
<prompt>> </prompt>zypper packages | |
<prompt>> </prompt>zypper patches</screen> | |
<para> | |
To query all repositories for certain packages, use | |
<literal>search</literal>. To get information regarding particular packages, | |
use the <literal>info</literal> command. | |
</para> | |
<sect3 xml:id="sec-zypper-query-search"> | |
<title>Searching for software</title> | |
<para> | |
The <command>zypper search</command> command works on package names, or, | |
optionally, on package summaries and descriptions. Strings wrapped in | |
<literal>/</literal> are interpreted as regular expressions. By default, | |
the search is not case-sensitive. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Simple search for a package name containing <literal>fire</literal></term> | |
<listitem> | |
<screen><prompt>> </prompt>zypper search "fire"</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Simple search for the exact package <literal>MozillaFirefox</literal></term> | |
<listitem> | |
<screen><prompt>> </prompt>zypper search --match-exact "MozillaFirefox"</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Also search in package descriptions and summaries</term> | |
<listitem> | |
<screen><prompt>> </prompt>zypper search -d fire</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Only display packages not already installed</term> | |
<listitem> | |
<screen><prompt>> </prompt>zypper search -u fire</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Display packages containing the string <literal>fir</literal> not followed be <literal>e</literal></term> | |
<listitem> | |
<screen><prompt>> </prompt>zypper se "/fir[^e]/"</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-zypper-query-search-packages" os="sles;sled"> | |
<title>Searching for packages across all SLE modules</title> | |
<para> | |
To search for packages both within and outside of currently enabled SLE | |
modules, use the <command>search-packages</command> subcommand. This | |
command contacts the SUSE Customer Center and searches all modules for matching packages, | |
for example: | |
</para> | |
<screen><prompt>> </prompt>zypper search-packages <replaceable>package1</replaceable> <replaceable>package2</replaceable></screen> | |
<para> | |
<command>zypper search-packages</command> provides the following options: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Search for an exact match of your search string: <option>-x</option>, | |
<option>--match-exact</option> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Group the results by module (default: group by package): | |
<option>-g,</option> <option>--group-by-module</option> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Display more detailed information about packages: <option>-d</option>, | |
<option>--details</option> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Output search results in XML: <option>--xmlout</option> | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect3> | |
<sect3 xml:id="sec-zypper-query-what-provides"> | |
<title>Searching for specific capability</title> | |
<para> | |
To search for packages which provide a special capability, use the command | |
<literal>what-provides</literal>. For example, if you want to know which | |
package provides the Perl module <literal>SVN::Core</literal>, use the | |
following command: | |
</para> | |
<screen><prompt>> </prompt>zypper what-provides 'perl(SVN::Core)'</screen> | |
<para> | |
The <literal>what-provides | |
<replaceable>PACKAGE_NAME</replaceable></literal> is similar to | |
<command>rpm -q --whatprovides</command> | |
<replaceable>PACKAGE_NAME</replaceable>, but RPM is only able to query the | |
RPM database (that is the database of all installed packages). Zypper, on | |
the other hand, will tell you about providers of the capability from any | |
repository, not only those that are installed. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-zypper-query-info"> | |
<title>Showing package information</title> | |
<para> | |
To query single packages, use <command>info</command> with an exact package | |
name as an argument. This displays detailed information about a package. In | |
case the package name does not match any package name from repositories, | |
the command outputs detailed information for non-package matches. If you | |
request a specific type (by using the <literal>-t</literal> option) and the | |
type does not exist, the command outputs other available matches but | |
without detailed information. | |
</para> | |
<para> | |
If you specify a source package, the command displays binary packages built | |
from the source package. If you specify a binary package, the command | |
outputs the source packages used to build the binary package. | |
</para> | |
<para> | |
To also show what is required/recommended by the package, use the options | |
<option>--requires</option> and <option>--recommends</option>: | |
</para> | |
<screen><prompt>> </prompt>zypper info --requires MozillaFirefox</screen> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-zypper-lifecycle" os="sles;sled"> | |
<title>Showing lifecycle information</title> | |
<para> | |
SUSE products are generally supported for 10 years. Often, you can extend | |
that standard lifecycle by using the extended support offerings of SUSE | |
which add three years of support. Depending on your product, find the exact | |
support lifecycle at <link xlink:href="https://www.suse.com/lifecycle"/>. | |
</para> | |
<para> | |
To check the lifecycle of your product and the supported package, use the | |
<command>zypper lifecycle</command> command as shown below: | |
</para> | |
<screen><prompt role="root"># </prompt><command>zypper lifecycle</command> | |
Product end of support | |
Codestream: SUSE Linux Enterprise Server 15 2028-07-31 | |
Product: SUSE Linux Enterprise Server 15 SP3 n/a* | |
Module end of support | |
Basesystem Module n/a* | |
Desktop Applications Module n/a* | |
Server Applications Module n/a* | |
Package end of support if different from product: | |
autofs Now, installed 5.1.3-7.3.1, update available 5.1.3-7.6.1 | |
</screen> | |
</sect2> | |
<sect2 xml:id="sec-zypper-configure"> | |
<title>Configuring Zypper</title> | |
<para> | |
Zypper now comes with a configuration file, allowing you to permanently | |
change Zypper's behavior (either system-wide or user-specific). For | |
system-wide changes, edit <filename>/etc/zypp/zypper.conf</filename>. For | |
user-specific changes, edit <filename>~/.zypper.conf</filename>. If | |
<filename>~/.zypper.conf</filename> does not yet exist, you can use | |
<filename>/etc/zypp/zypper.conf</filename> as a template: copy it to | |
<filename>~/.zypper.conf</filename> and adjust it to your liking. Refer to | |
the comments in the file for help about the available options. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-zypper-trouble"> | |
<title>Troubleshooting</title> | |
<para> | |
If you have trouble accessing packages from configured repositories (for | |
example, Zypper cannot find a certain package even though you know it exists | |
in one of the repositories), refreshing the repositories may help: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper refresh</screen> | |
<para> | |
If that does not help, try | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper refresh -fdb</screen> | |
<para> | |
This forces a complete refresh and rebuild of the database, including a | |
forced download of raw metadata. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-zypper-rollback"> | |
<title>Zypper rollback feature on Btrfs file system</title> | |
<para> | |
If the Btrfs file system is used on the root partition and | |
<command>snapper</command> is installed, Zypper automatically calls | |
<command>snapper</command> when committing changes to the file system to | |
create appropriate file system snapshots. These snapshots can be used to | |
revert any changes made by Zypper. See <xref linkend="cha-snapper" role="internalbook"/> for | |
more information. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-zypper-more"> | |
<title>More information</title> | |
<para> | |
For more information on managing software from the command line, enter | |
<command>zypper help</command>, <command>zypper help </command> | |
<replaceable>COMMAND</replaceable> or refer to the | |
<command>zypper(8)</command> man page. For a complete and detailed command | |
reference, <literal>cheat sheets</literal> with the most important commands, | |
and information on how to use Zypper in scripts and applications, refer to | |
<link xlink:href="https://en.opensuse.org/SDB:Zypper_usage"/>. A list of | |
software changes for the latest <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> version can be found at | |
<link xlink:href="https://en.opensuse.org/openSUSE:Zypper_versions"/>. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-rpm"> | |
<title>RPM—the package manager</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
RPM (RPM Package Manager) is used for managing software packages. Its main | |
commands are <command>rpm</command> and <command>rpmbuild</command>. The | |
powerful RPM database can be queried by the users, system administrators and | |
package builders for detailed information about the installed software. | |
</para> | |
<para> | |
<command>rpm</command> has five modes: installing, uninstalling | |
(or updating) software packages, rebuilding the RPM database, querying RPM | |
bases or individual RPM archives, integrity checking of packages and signing | |
packages. <command>rpmbuild</command> can be used to build installable | |
packages from pristine sources. | |
</para> | |
<para> | |
Installable RPM archives are packed in a special binary format. These | |
archives consist of the program files to install and certain meta information | |
used during the installation by <command>rpm</command> to configure the | |
software package or stored in the RPM database for documentation purposes. | |
RPM archives normally have the extension <filename>.rpm</filename>. | |
</para> | |
<tip> | |
<title>Software development packages</title> | |
<para> | |
For several packages, the components needed for software development | |
(libraries, headers, include files, etc.) have been put into separate | |
packages. These development packages are only needed if you want to compile | |
software yourself (for example, the most recent GNOME packages). They can | |
be identified by the name extension <literal>-devel</literal>, such as the | |
packages <systemitem class="resource">alsa-devel</systemitem> and | |
<systemitem class="resource">gimp-devel</systemitem>. | |
</para> | |
</tip> | |
<sect2 xml:id="sec-rpm-package-auth"> | |
<title>Verifying package authenticity</title> | |
<para> | |
RPM packages have a GPG signature. To verify the signature of an RPM | |
package, use the command <command>rpm --checksig </command> | |
<replaceable>PACKAGE</replaceable>-1.2.3.rpm to determine whether the | |
package originates from SUSE or from another trustworthy facility. This is | |
especially recommended for update packages from the Internet. | |
</para> | |
<para os="sles;sled"> | |
While fixing issues in the operating system, you might need to install a | |
Problem Temporary Fix (PTF) into a production system. The packages provided | |
by SUSE are signed against a special PTF key. However, in contrast to | |
SUSE Linux Enterprise 11, this key is not imported by default on SUSE Linux Enterprise 12 systems. To | |
manually import the key, use the following command: | |
</para> | |
<screen os="sles;sled"><prompt>> </prompt><command>sudo</command> rpm --import \ | |
/usr/share/doc/packages/suse-build-key/suse_ptf_key.asc</screen> | |
<para os="sles;sled"> | |
After importing the key, you can install PTF packages on your system. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-packages-manage"> | |
<title>Managing packages: install, update, and uninstall</title> | |
<para> | |
Normally, the installation of an RPM archive is quite simple: <command>rpm | |
-i</command> <replaceable>PACKAGE</replaceable>.rpm. With this command the | |
package is installed, but only if its dependencies are fulfilled and if | |
there are no conflicts with other packages. With an error message, | |
<command>rpm</command> requests those packages that need to be installed to | |
meet dependency requirements. In the background, the RPM database ensures | |
that no conflicts arise—a specific file can only belong to one | |
package. By choosing different options, you can force <command>rpm</command> | |
to ignore these defaults, but this is only for experts. Otherwise, you risk | |
compromising the integrity of the system and possibly jeopardize the ability | |
to update the system. | |
</para> | |
<para> | |
The options <option>-U</option> or <option>--upgrade</option> and | |
<option>-F</option> or <option>--freshen</option> can be used to update a | |
package (for example, <command>rpm -F</command> | |
<replaceable>PACKAGE</replaceable>.rpm). This command removes the files of | |
the old version and immediately installs the new files. The difference | |
between the two versions is that <option>-U</option> installs packages that | |
previously did not exist in the system, while <option>-F</option> merely | |
updates previously installed packages. When updating, <command>rpm</command> | |
updates configuration files carefully using the following strategy: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
If a configuration file was not changed by the system administrator, | |
<command>rpm</command> installs the new version of the appropriate file. | |
No action by the system administrator is required. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
If a configuration file was changed by the system administrator before the | |
update, <command>rpm</command> saves the changed file with the extension | |
<filename>.rpmorig</filename> or <filename>.rpmsave</filename> (backup | |
file) and installs the version from the new package. This is done only if | |
the originally installed file and the newer version are different. If this is | |
the case, compare the backup file (<filename>.rpmorig</filename> or | |
<filename>.rpmsave</filename>) with the newly installed file and make your | |
changes again in the new file. Afterward, delete all | |
<filename>.rpmorig</filename> and <filename>.rpmsave</filename> files to | |
avoid problems with future updates. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<filename>.rpmnew</filename> files appear if the configuration file | |
already exists <emphasis>and</emphasis> if the <option>noreplace</option> | |
label was specified in the <filename>.spec</filename> file. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Following an update, <filename>.rpmsave</filename> and | |
<filename>.rpmnew</filename> files should be removed after comparing them, | |
so they do not obstruct future updates. The <filename>.rpmorig</filename> | |
extension is assigned if the file has not previously been recognized by the | |
RPM database. | |
</para> | |
<para> | |
Otherwise, <filename>.rpmsave</filename> is used. In other words, | |
<filename>.rpmorig</filename> results from updating from a foreign format to | |
RPM. <filename>.rpmsave</filename> results from updating from an older RPM | |
to a newer RPM. <filename>.rpmnew</filename> does not disclose any | |
information to whether the system administrator has made any changes to the | |
configuration file. A list of these files is available in | |
<filename>/var/adm/rpmconfigcheck</filename>. Some configuration files (like | |
<filename>/etc/httpd/httpd.conf</filename>) are not overwritten to allow | |
continued operation. | |
</para> | |
<para> | |
The <option>-U</option> switch is <emphasis>not</emphasis> only an | |
equivalent to uninstalling with the <option>-e</option> option and | |
installing with the <option>-i</option> option. Use <option>-U</option> | |
whenever possible. | |
</para> | |
<para> | |
To remove a package, enter <command>rpm -e</command> | |
<replaceable>PACKAGE</replaceable>. This command only deletes the package if | |
there are no unresolved dependencies. It is theoretically impossible to | |
delete Tcl/Tk, for example, as long as another application requires it. Even | |
in this case, RPM calls for assistance from the database. If such a deletion | |
is, for whatever reason, impossible (even if <emphasis>no</emphasis> | |
additional dependencies exist), it may be helpful to rebuild the RPM | |
database using the option <option>--rebuilddb</option>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-delta"> | |
<title>Delta RPM packages</title> | |
<para> | |
Delta RPM packages contain the difference between an old and a new version | |
of an RPM package. Applying a delta RPM onto an old RPM results in a | |
completely new RPM. It is not necessary to have a copy of the old RPM | |
because a delta RPM can also work with an installed RPM. The delta RPM | |
packages are even smaller in size than patch RPMs, which is an advantage | |
when transferring update packages over the Internet. The drawback is that | |
update operations with delta RPMs involved consume considerably more CPU | |
cycles than plain or patch RPMs. | |
</para> | |
<para> | |
The <command>makedeltarpm</command> and <command>applydelta</command> | |
binaries are part of the delta RPM suite (package | |
<systemitem>deltarpm</systemitem>) and help you create and apply delta RPM | |
packages. With the following commands, you can create a delta RPM called | |
<filename>new.delta.rpm</filename>. The following command assumes that | |
<filename>old.rpm</filename> and <filename>new.rpm</filename> are present: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> makedeltarpm old.rpm new.rpm new.delta.rpm</screen> | |
<para> | |
Using <command>applydeltarpm</command>, you can reconstruct the new RPM from | |
the file system if the old package is already installed: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> applydeltarpm new.delta.rpm new.rpm</screen> | |
<para> | |
To derive it from the old RPM without accessing the file system, use the | |
<option>-r</option> option: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> applydeltarpm -r old.rpm new.delta.rpm new.rpm</screen> | |
<para> | |
See <filename>/usr/share/doc/packages/deltarpm/README</filename> for | |
technical details. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-query"> | |
<title>RPM queries</title> | |
<para> | |
With the <option>-q</option> option <command>rpm</command> initiates | |
queries, making it possible to inspect an RPM archive (by adding the option | |
<option>-p</option>) and to query the RPM database of installed packages. | |
Several switches are available to specify the type of information required. | |
See <xref linkend="tab-rpm-query" role="internalbook"/>. | |
</para> | |
<table xml:id="tab-rpm-query"> | |
<title>Essential RPM query options</title> | |
<tgroup cols="2"> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<option>-i</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Package information | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>-l</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
File list | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>-f FILE</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Query the package that contains the file | |
<replaceable>FILE</replaceable> (the full path must be specified with | |
<replaceable>FILE</replaceable>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>-s</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
File list with status information (implies <option>-l</option>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>-d</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
List only documentation files (implies <literal>-l</literal>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>-c</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
List only configuration files (implies <option>-l</option>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>--dump</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
File list with complete details (to be used with <option>-l</option>, | |
<option>-c</option>, or <option>-d</option>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>--provides</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
List features of the package that another package can request with | |
<option>--requires</option> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>--requires</option>, <option>-R</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Capabilities the package requires | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>--scripts</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Installation scripts (preinstall, postinstall, uninstall) | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<para> | |
For example, the command <command>rpm -q -i wget</command> displays the | |
information shown in <xref linkend="aus-update-rpm-i" role="internalbook"/>. | |
</para> | |
<example xml:id="aus-update-rpm-i"> | |
<title><command>rpm -q -i wget</command></title> | |
<screen os="sles;sled"><?dbsuse-fo font-size="0.70em"?> | |
Name : wget | |
Version : 1.14 | |
Release : 17.1 | |
Architecture: x86_64 | |
Install Date: Mon 30 Jan 2017 14:01:29 CET | |
Group : Productivity/Networking/Web/Utilities | |
Size : 2046483 | |
License : GPL-3.0+ | |
Signature : RSA/SHA256, Thu 08 Dec 2016 07:48:44 CET, Key ID 70af9e8139db7c82 | |
Source RPM : wget-1.14-17.1.src.rpm | |
Build Date : Thu 08 Dec 2016 07:48:34 CET | |
Build Host : sheep09 | |
Relocations : (not relocatable) | |
Packager : https://www.suse.com/ | |
Vendor : SUSE LLC <https://www.suse.com/> | |
URL : http://www.gnu.org/software/wget/ | |
Summary : A Tool for Mirroring FTP and HTTP Servers | |
Description : | |
Wget enables you to retrieve WWW documents or FTP files from a server. | |
This can be done in script files or via the command line. | |
Distribution: SUSE Linux Enterprise 15 | |
</screen> | |
</example> | |
<para> | |
The option <option>-f</option> only works if you specify the complete file | |
name with its full path. Provide as many file names as desired. For example: | |
</para> | |
<screen><prompt>> </prompt>rpm -q -f /bin/rpm /usr/bin/wget | |
rpm-4.14.1-lp151.13.10.x86_64 | |
wget-1.19.5-lp151.4.1.x86_64 | |
</screen> | |
<para> | |
If only part of the file name is known, use a shell script as shown in | |
<xref linkend="dat-rpm-search" role="internalbook"/>. Pass the partial file name to the script | |
shown as a parameter when running it. | |
</para> | |
<example xml:id="dat-rpm-search"> | |
<title>Script to search for packages</title> | |
<screen>#! /bin/sh | |
for i in $(rpm -q -a -l | grep $1); do | |
echo "\"$i\" is in package:" | |
rpm -q -f $i | |
echo "" | |
done</screen> | |
</example> | |
<para> | |
The command <command>rpm -q --changelog</command> | |
<replaceable>PACKAGE</replaceable> displays a detailed list of change | |
information about a specific package, sorted by date. | |
</para> | |
<para> | |
With the installed RPM database, verification checks can be made. Initiate | |
these with <option>-V</option>, or <option>--verify</option>. With this | |
option, <command>rpm</command> shows all files in a package that have been | |
changed since installation. <command>rpm</command> uses eight character | |
symbols to give some hints about the following changes: | |
</para> | |
<table xml:id="tab-rpm-verify"> | |
<title>RPM verify options</title> | |
<tgroup cols="2"> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<option>5</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
MD5 check sum | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>S</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
File size | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>L</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Symbolic link | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>T</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Modification time | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>D</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Major and minor device numbers | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>U</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Owner | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>G</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Group | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<option>M</option> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Mode (permissions and file type) | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<para> | |
In the case of configuration files, the letter <option>c</option> is | |
printed. For example, for changes to <filename>/etc/wgetrc</filename> | |
(<systemitem class="resource">wget</systemitem> package): | |
</para> | |
<screen><prompt>> </prompt>rpm -V wget | |
S.5....T c /etc/wgetrc</screen> | |
<para> | |
The files of the RPM database are placed in | |
<filename>/var/lib/rpm</filename>. If the partition | |
<filename>/usr</filename> has a size of 1 GB, this database can occupy | |
nearly 30 MB, especially after a complete update. If the database is | |
much larger than expected, it is useful to rebuild the database with the | |
option <option>--rebuilddb</option>. Before doing this, make a backup of the | |
old database. The <command>cron</command> script | |
<command>cron.daily</command> makes daily copies of the database (packed | |
with gzip) and stores them in <filename>/var/adm/backup/rpmdb</filename>. | |
The number of copies is controlled by the variable | |
<systemitem>MAX_RPMDB_BACKUPS</systemitem> (default: <option>5</option>) in | |
<filename>/etc/sysconfig/backup</filename>. The size of a single backup is | |
approximately 1 MB for 1 GB in <filename>/usr</filename>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-sources"> | |
<title>Installing and compiling source packages</title> | |
<para> | |
All source packages carry a <filename>.src.rpm</filename> extension (source | |
RPM). | |
</para> | |
<note> | |
<title>Installed source packages</title> | |
<para> | |
Source packages can be copied from the installation medium to the hard disk | |
and unpacked with YaST. They are not, however, marked as installed | |
(<literal>[i]</literal>) in the package manager. This is because the source | |
packages are not entered in the RPM database. Only | |
<emphasis>installed</emphasis> operating system software is listed in the | |
RPM database. When you <quote>install</quote> a source package, only the | |
source code is added to the system. | |
</para> | |
</note> | |
<para> | |
The following directories must be available for <command>rpm</command> and | |
<command>rpmbuild</command> in <filename>/usr/src/packages</filename> | |
(unless you specified custom settings in a file like | |
<filename>/etc/rpmrc</filename>): | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><filename>SOURCES</filename> | |
</term> | |
<listitem> | |
<para> | |
for the original sources (<filename>.tar.bz2</filename> or | |
<filename>.tar.gz</filename> files, etc.) and for distribution-specific | |
adjustments (mostly <filename>.diff</filename> or | |
<filename>.patch</filename> files) | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>SPECS</filename> | |
</term> | |
<listitem> | |
<para> | |
for the <filename>.spec</filename> files, similar to a meta Makefile, | |
which control the <emphasis>build</emphasis> process | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>BUILD</filename> | |
</term> | |
<listitem> | |
<para> | |
all the sources are unpacked, patched and compiled in this directory | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>RPMS</filename> | |
</term> | |
<listitem> | |
<para> | |
where the completed binary packages are stored | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>SRPMS</filename> | |
</term> | |
<listitem> | |
<para> | |
here are the source RPMs | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
When you install a source package with YaST, all the necessary components | |
are installed in <filename>/usr/src/packages</filename>: the sources and the | |
adjustments in <filename>SOURCES</filename> and the relevant | |
<filename>.spec</filename> file in <filename>SPECS</filename>. | |
</para> | |
<warning> | |
<title>System integrity</title> | |
<para> | |
Do not experiment with system components | |
(<systemitem class="resource">glibc</systemitem>, | |
<systemitem class="resource">rpm</systemitem>, etc.), because this | |
endangers the stability of your system. | |
</para> | |
</warning> | |
<para> | |
The following example uses the <filename>wget.src.rpm</filename> package. | |
After installing the source package, you should have files similar to those | |
in the following list: | |
</para> | |
<screen>/usr/src/packages/SOURCES/wget-1.19.5.tar.bz2 | |
/usr/src/packages/SOURCES/wgetrc.patch | |
/usr/src/packages/SPECS/wget.spec</screen> | |
<para> | |
<command>rpmbuild</command> <option>-b<replaceable>X</replaceable></option> | |
<filename>/usr/src/packages/SPECS/wget.spec</filename> starts the | |
compilation. <replaceable>X</replaceable> is a wild card for various stages | |
of the build process (see the output of <option>--help</option> or the RPM | |
documentation for details). The following is merely a brief explanation: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><option>-bp</option> | |
</term> | |
<listitem> | |
<para> | |
Prepare sources in <filename>/usr/src/packages/BUILD</filename>: unpack | |
and patch. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-bc</option> | |
</term> | |
<listitem> | |
<para> | |
Do the same as <option>-bp</option>, but with additional compilation. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-bi</option> | |
</term> | |
<listitem> | |
<para> | |
Do the same as <option>-bp</option>, but with additional installation of | |
the built software. Caution: if the package does not support the | |
BuildRoot feature, you might overwrite configuration files. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-bb</option> | |
</term> | |
<listitem> | |
<para> | |
Do the same as <option>-bi</option>, but with the additional creation of | |
the binary package. If the compile was successful, the binary should be | |
in <filename>/usr/src/packages/RPMS</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-ba</option> | |
</term> | |
<listitem> | |
<para> | |
Do the same as <option>-bb</option>, but with the additional creation of | |
the source RPM. If the compilation was successful, the binary should be | |
in <filename>/usr/src/packages/SRPMS</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>--short-circuit</option> | |
</term> | |
<listitem> | |
<para> | |
Skip some steps. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The binary RPM created can now be installed with <command>rpm</command> | |
<option>-i</option> or, preferably, with <command>rpm</command> | |
<option>-U</option>. Installation with <command>rpm</command> makes it | |
appear in the RPM database. | |
</para> | |
<para> | |
Keep in mind that the <literal>BuildRoot</literal> directive in the spec | |
file is deprecated. If you still need this feature, use the | |
<option>--buildroot</option> option as a workaround. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-build"> | |
<title>Compiling RPM packages with build</title> | |
<para> | |
The danger with many packages is that unwanted files are added to the | |
running system during the build process. To prevent this use | |
<systemitem>build</systemitem>, which creates a defined environment in which | |
the package is built. To establish this chroot environment, the | |
<command>build</command> script must be provided with a complete package | |
tree. This tree can be made available on the hard disk, via NFS, or from | |
DVD. Set the position with <command>build --rpms</command> | |
<replaceable>DIRECTORY</replaceable>. Unlike <command>rpm</command>, the | |
<command>build</command> command looks for the <filename>.spec</filename> | |
file in the source directory. To build <filename>wget</filename> (like in | |
the above example) with the DVD mounted in the system under | |
<filename>/media/dvd</filename>, use the following commands as | |
<systemitem class="username">root</systemitem>: | |
</para> | |
<screen><prompt role="root"># </prompt>cd /usr/src/packages/SOURCES/ | |
<prompt role="root"># </prompt>mv ../SPECS/wget.spec . | |
<prompt role="root"># </prompt>build --rpms /media/dvd/suse/ wget.spec</screen> | |
<para> | |
Subsequently, a minimum environment is established at | |
<filename>/var/tmp/build-root</filename>. The package is built in this | |
environment. Upon completion, the resulting packages are located in | |
<filename>/var/tmp/build-root/usr/src/packages/RPMS</filename>. | |
</para> | |
<para> | |
The <command>build</command> script offers several additional options. For | |
example, cause the script to prefer your own RPMs, omit the initialization | |
of the build environment or limit the <command>rpm</command> command to one | |
of the above-mentioned stages. Access additional information with | |
<command>build</command> <option>--help</option> and by reading the | |
<command>build</command> man page. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-rpm-tools"> | |
<title>Tools for RPM archives and the RPM database</title> | |
<para> | |
Midnight Commander (<command>mc</command>) can display the contents of RPM | |
archives and copy parts of them. It represents archives as virtual file | |
systems, offering all usual menu options of Midnight Commander. Display the | |
<filename>HEADER</filename> with <keycap>F3</keycap>. View the archive | |
structure with the cursor keys and <keycap function="enter"/>. Copy archive | |
components with <keycap>F5</keycap>. | |
</para> | |
<para> | |
A full-featured package manager is available as a YaST module. For | |
details, see <xref linkend="cha-yast-software" role="internalbook"/>. | |
</para> | |
</sect2> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-snapper"> | |
<title>System recovery and snapshot management with Snapper</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
Snapper allows creating and managing file system snapshots. | |
File system snapshots allow keeping a copy of the state of a file system | |
at a certain point of time. | |
The standard setup of Snapper is designed to allow rolling back system | |
changes. | |
However, you can also use it to create on-disk backups of user data. | |
As the basis for this functionality, Snapper uses the Btrfs file system or | |
thinly-provisioned LVM volumes with an XFS or Ext4 file system. | |
</para> | |
</abstract> | |
</info> | |
<para> | |
Snapper has a command line interface and a YaST interface. | |
Snapper lets you create and manage file system snapshots on the following | |
types of file systems: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Btrfs, a copy-on-write file system for Linux that natively supports | |
file system snapshots of subvolumes. | |
(Subvolumes are separately mountable file systems within a physical | |
partition.) | |
</para> | |
<para> | |
You can also boot from <literal>Btrfs</literal> snapshots. For more | |
information, see <xref linkend="sec-snapper-snapshot-boot" role="internalbook"/>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Thinly-provisioned LVM volumes formatted with XFS or Ext4. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Using Snapper, you can perform the following tasks: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
Undo system changes made by <command>zypper</command> and YaST. See | |
<xref linkend="sec-snapper-undo" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Restore files from previous snapshots. See | |
<xref linkend="sec-snapper-undo-delete-file" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Do a system rollback by booting from a snapshot. See | |
<xref linkend="sec-snapper-snapshot-boot" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Manually create and manage snapshots, within the running system. See | |
<xref linkend="sec-snapper-manage" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<sect1 xml:id="sec-snapper-setup"> | |
<title>Default setup</title> | |
<para> | |
Snapper on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is set up as an undo and recovery | |
tool for system changes. By default, the root partition | |
(<filename>/</filename>) of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is formatted with | |
<literal>Btrfs</literal>. Taking snapshots is automatically enabled if the | |
root partition (<filename>/</filename>) is big enough (more | |
than approximately 16 GB). By default, snapshots are disabled on partitions | |
other than <filename>/</filename>. | |
</para> | |
<tip> | |
<title>Enabling Snapper in the installed system</title> | |
<para> | |
If you disabled Snapper during the installation, you can enable it at | |
any time later. To do so, create a default Snapper configuration for the | |
root file system by running: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c root create-config /</screen> | |
<para> | |
Afterward enable the different snapshot types as described in <xref linkend="sec-snapper-setup-customize-auto-snapshots" role="internalbook"/>. | |
</para> | |
<para> | |
Note that on a Btrfs root file system, snapshots require a file system with | |
subvolumes configured as proposed by the installer and a partition size of at | |
least 16 GB. | |
</para> | |
</tip> | |
<para> | |
When a snapshot is created, both the snapshot and the original point to the | |
same blocks in the file system. So, initially a snapshot does not occupy | |
additional disk space. If data in the original file system is modified, | |
changed data blocks are copied while the old data blocks are kept for the | |
snapshot. Therefore, a snapshot occupies the same amount of space as the | |
data modified. So, over time, the amount of space a snapshot allocates, | |
constantly grows. As a consequence, deleting files from a | |
<literal>Btrfs</literal> file system containing snapshots may | |
<emphasis>not</emphasis> free disk space! | |
</para> | |
<note> | |
<title>Snapshot location</title> | |
<para> | |
Snapshots always reside on the same partition or subvolume on which the | |
snapshot has been taken. It is not possible to store snapshots on a | |
different partition or subvolume. | |
</para> | |
</note> | |
<para> | |
As a result, partitions containing snapshots need to be larger than | |
partitions not containing snapshots. The exact amount depends strongly on the | |
number of snapshots you keep and the amount of data modifications. As a rule | |
of thumb, give partitions twice as much space as you normally would. | |
To prevent disks from running out of space, old snapshots are automatically | |
cleaned up. Refer to | |
<xref linkend="sec-snapper-setup-customize-archiving" role="internalbook"/> for details. | |
</para> | |
<sect2 xml:id="snapper-default-settings"> | |
<title>Default settings</title> | |
<variablelist> | |
<varlistentry> | |
<term>Disks larger than 16 GB</term> | |
<listitem> | |
<itemizedlist> | |
<listitem><para>Configuration file: <filename>/etc/snapper/configs/root</filename></para></listitem> | |
<listitem><para><literal>USE_SNAPPER=yes</literal></para></listitem> | |
<listitem><para><literal>TIMELINE_CREATE=no</literal></para></listitem> | |
</itemizedlist> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Disks smaller than 16 GB</term> | |
<listitem> | |
<itemizedlist> | |
<listitem><para>Configuration file: not created</para></listitem> | |
<listitem><para><literal>USE_SNAPPER=no</literal></para></listitem> | |
<listitem><para><literal>TIMELINE_CREATE=yes</literal></para></listitem> | |
</itemizedlist> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="snapper-snapshot-type"> | |
<title>Types of snapshots</title> | |
<para> | |
Although snapshots themselves do not differ in a technical sense, we | |
distinguish between three types of snapshots, based on the events that trigger them: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Timeline snapshots</term> | |
<listitem> | |
<para> | |
A single snapshot is created every hour. Old snapshots are automatically | |
deleted. By default, the first snapshot of the last ten days, months, | |
and years are kept. Using the YaST OS installation method (default), | |
timeline snapshots are enabled, except for the root file system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Installation snapshots</term> | |
<listitem> | |
<para> | |
Whenever one or more packages are installed with YaST or Zypper, a | |
pair of snapshots is created: one before the installation starts | |
(<quote>Pre</quote>) and another one after the installation has finished | |
(<quote>Post</quote>). In case an important system component such as the | |
kernel has been installed, the snapshot pair is marked as important | |
(<literal>important=yes</literal>). Old snapshots are automatically | |
deleted. By default the last ten important snapshots and the last ten | |
<quote>regular</quote> (including administration snapshots) snapshots | |
are kept. Installation snapshots are enabled by default. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Administration snapshots</term> | |
<listitem> | |
<para> | |
Whenever you administrate the system with YaST, a pair of snapshots is | |
created: one when a YaST module is started (<quote>Pre</quote>) and | |
another when the module is closed (<quote>Post</quote>). Old snapshots | |
are automatically deleted. By default the last ten important snapshots | |
and the last ten <quote>regular</quote> snapshots (including | |
installation snapshots) are kept. Administration snapshots are enabled | |
by default. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="snapper-dir-excludes"> | |
<title>Directories that are excluded from snapshots</title> | |
<para> | |
Some directories need to be excluded from snapshots for different reasons. | |
The following list shows all directories that are excluded: | |
</para> | |
<variablelist version="5.0"> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<varlistentry> | |
<term><filename>/boot/grub2/i386-pc</filename>, | |
<filename>/boot/grub2/x86_64-efi</filename>, | |
<filename>/boot/grub2/powerpc-ieee1275</filename>, | |
<filename>/boot/grub2/s390x-emu</filename> | |
</term> | |
<listitem> | |
<para> | |
A rollback of the boot loader configuration is not supported. The | |
directories listed above are architecture-specific. The first two | |
directories are present on AMD64/Intel 64 machines, the latter two on IBM | |
POWER and on IBM Z, respectively. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/home</filename> | |
</term> | |
<listitem> | |
<para> | |
If <filename>/home</filename> does not reside on a separate partition, it | |
is excluded to avoid data loss on rollbacks. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/opt</filename> | |
</term> | |
<listitem> | |
<para> | |
Third-party products usually get installed to <filename>/opt</filename>. It | |
is excluded to avoid uninstalling these applications on rollbacks. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/srv</filename> | |
</term> | |
<listitem> | |
<para> | |
Contains data for Web and FTP servers. It is excluded to avoid data loss on | |
rollbacks. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/tmp</filename> | |
</term> | |
<listitem> | |
<para> | |
All directories containing temporary files and caches are excluded from | |
snapshots. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/usr/local</filename> | |
</term> | |
<listitem> | |
<para> | |
This directory is used when manually installing software. It is excluded to | |
avoid uninstalling these installations on rollbacks. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/var</filename> | |
</term> | |
<listitem> | |
<para> | |
This directory contains many variable files, including logs, temporary | |
caches, third party products in <filename>/var/opt</filename>, and is the | |
default location for virtual machine images and databases. Therefore this | |
subvolume is created to exclude all of this variable data from snapshots | |
and has Copy-On-Write disabled. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-snapper-setup-customize"> | |
<title>Customizing the setup</title> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> comes with a reasonable default setup, which should be | |
sufficient for most use cases. However, all aspects of taking automatic | |
snapshots and snapshot keeping can be configured according to your needs. | |
</para> | |
<sect3 xml:id="sec-snapper-setup-customize-auto-snapshots"> | |
<title>Disabling/enabling snapshots</title> | |
<para> | |
Each of the three snapshot types (timeline, installation, administration) | |
can be enabled or disabled independently. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Disabling/enabling timeline snapshots</term> | |
<listitem> | |
<formalpara> | |
<title>Enabling</title> | |
<para> | |
<command>snapper -c root set-config "TIMELINE_CREATE=yes"</command> | |
</para> | |
</formalpara> | |
<formalpara> | |
<title>Disabling</title> | |
<para> | |
<command>snapper -c root set-config "TIMELINE_CREATE=no"</command> | |
</para> | |
</formalpara> | |
<para> | |
Using the YaST OS installation method (default), timeline snapshots | |
are enabled, except for the root file system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Disabling/enabling installation snapshots</term> | |
<listitem> | |
<formalpara> | |
<title>Enabling:</title> | |
<para> | |
Install the package | |
<systemitem class="resource">snapper-zypp-plugin</systemitem> | |
</para> | |
</formalpara> | |
<formalpara> | |
<title>Disabling:</title> | |
<para> | |
Uninstall the package | |
<systemitem class="resource">snapper-zypp-plugin</systemitem> | |
</para> | |
</formalpara> | |
<para> | |
Installation snapshots are enabled by default. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Disabling/enabling administration snapshots</term> | |
<listitem> | |
<formalpara> | |
<title>Enabling:</title> | |
<para> | |
Set <envar>USE_SNAPPER</envar> to <literal>yes</literal> in | |
<filename>/etc/sysconfig/yast2</filename>. | |
</para> | |
</formalpara> | |
<formalpara> | |
<title>Disabling:</title> | |
<para> | |
Set <envar>USE_SNAPPER</envar> to <literal>no</literal> in | |
<filename>/etc/sysconfig/yast2</filename>. | |
</para> | |
</formalpara> | |
<para> | |
Administration snapshots are enabled by default. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-snapper-setup-customize-inst-snapshots"> | |
<title>Controlling installation snapshots</title> | |
<para> | |
Taking snapshot pairs upon installing packages with YaST or Zypper is | |
handled by the | |
<systemitem class="resource">snapper-zypp-plugin</systemitem>. An XML | |
configuration file, <filename>/etc/snapper/zypp-plugin.conf</filename> | |
defines, when to make snapshots. By default the file looks like the | |
following: | |
</para> | |
<screen> 1 <?xml version="1.0" encoding="utf-8"?> | |
2 <snapper-zypp-plugin-conf> | |
3 <solvables> | |
4 <solvable match="w"<co xml:id="zypp-conf-match"/> important="true"<co xml:id="zypp-conf-important"/>>kernel-*<co xml:id="zypp-conf-kernel"/></solvable> | |
5 <solvable match="w" important="true">dracut</solvable> | |
6 <solvable match="w" important="true">glibc</solvable> | |
7 <solvable match="w" important="true">systemd*</solvable> | |
8 <solvable match="w" important="true">udev</solvable> | |
9 <solvable match="w">*</solvable><co xml:id="zypp-conf-packages"/> | |
10 </solvables> | |
11 </snapper-zypp-plugin-conf></screen> | |
<calloutlist> | |
<callout arearefs="zypp-conf-match"> | |
<para> | |
The match attribute defines whether the pattern is a Unix shell-style | |
wild card (<literal>w</literal>) or a Python regular expression | |
(<literal>re</literal>). | |
</para> | |
</callout> | |
<callout arearefs="zypp-conf-important"> | |
<para> | |
If the given pattern matches and the corresponding package is marked as | |
important (for example kernel packages), the snapshot will also be | |
marked as important. | |
</para> | |
</callout> | |
<callout arearefs="zypp-conf-kernel"> | |
<para> | |
Pattern to match a package name. Based on the setting of the | |
<literal>match</literal> attribute, special characters are either | |
interpreted as shell wild cards or regular expressions. This pattern | |
matches all package names starting with <literal>kernel-</literal>. | |
</para> | |
</callout> | |
<callout arearefs="zypp-conf-packages"> | |
<para> | |
This line unconditionally matches all packages. | |
</para> | |
</callout> | |
</calloutlist> | |
<para> | |
With this configuration snapshot, pairs are made whenever a package is | |
installed (line 9). When the kernel, dracut, glibc, systemd, or udev packages | |
marked as important are installed, the snapshot pair will also be marked | |
as important (lines 4 to 8). All rules are evaluated. | |
</para> | |
<para> | |
To disable a rule, either delete it or deactivate it using XML comments. | |
To prevent the system from making snapshot pairs for every package | |
installation for example, comment line 9: | |
</para> | |
<screen> 1 <?xml version="1.0" encoding="utf-8"?> | |
2 <snapper-zypp-plugin-conf> | |
3 <solvables> | |
4 <solvable match="w" important="true">kernel-*</solvable> | |
5 <solvable match="w" important="true">dracut</solvable> | |
6 <solvable match="w" important="true">glibc</solvable> | |
7 <solvable match="w" important="true">systemd*</solvable> | |
8 <solvable match="w" important="true">udev</solvable> | |
9 <!-- <solvable match="w">*</solvable> --> | |
10 </solvables> | |
11 </snapper-zypp-plugin-conf></screen> | |
</sect3> | |
<sect3 xml:id="sec-snapper-setup-customizing-new-subvolume"> | |
<title>Creating and mounting new subvolumes</title> | |
<para> | |
Creating a new subvolume underneath the <filename>/</filename> hierarchy | |
and permanently mounting it is supported. Such a subvolume will be | |
excluded from snapshots. You need to make sure not to create it inside an | |
existing snapshot, since you would not be able to delete snapshots anymore | |
after a rollback. | |
</para> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is configured with the <filename>/@/</filename> subvolume | |
which serves as an independent root for permanent subvolumes such as | |
<filename>/opt</filename>, <filename>/srv</filename>, | |
<filename>/home</filename> and others. Any new subvolumes you create and | |
permanently mount need to be created in this initial root file system. | |
</para> | |
<para> | |
To do so, run the following commands. In this example, a new subvolume | |
<filename>/usr/important</filename> is created from | |
<filename>/dev/sda2</filename>. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> mount /dev/sda2 -o subvol=@ /mnt | |
<prompt>> </prompt><command>sudo</command> btrfs subvolume create /mnt/usr/important | |
<prompt>> </prompt><command>sudo</command> umount /mnt</screen> | |
<para> | |
The corresponding entry in <filename>/etc/fstab</filename> needs to look | |
like the following: | |
</para> | |
<screen>/dev/sda2 /usr/important btrfs subvol=@/usr/important 0 0</screen> | |
<tip> | |
<title>Disable copy-on-write (cow)</title> | |
<para> | |
A subvolume may contain files that constantly change, such as | |
virtualized disk images, database files, or log files. If so, consider | |
disabling the copy-on-write feature for this volume, to avoid duplication | |
of disk blocks. Use the <option>nodatacow</option> mount option in | |
<filename>/etc/fstab</filename> to do so: | |
</para> | |
<screen>/dev/sda2 /usr/important btrfs nodatacow,subvol=@/usr/important 0 0</screen> | |
<para> | |
To alternatively disable copy-on-write for single files or directories, | |
use the command <command>chattr +C | |
<replaceable>PATH</replaceable></command>. | |
</para> | |
</tip> | |
</sect3> | |
<sect3 xml:id="sec-snapper-setup-customize-archiving"> | |
<title>Controlling snapshot archiving</title> | |
<para> | |
Snapshots occupy disk space. To prevent disks from running out of space | |
and thus causing system outages, old snapshots are automatically deleted. | |
By default, up to ten important installation and administration snapshots | |
and up to ten regular installation and administration snapshots are kept. | |
If these snapshots occupy more than 50% of the root file system size, | |
additional snapshots will be deleted. A minimum of four important and two | |
regular snapshots are always kept. | |
</para> | |
<para> | |
Refer to <xref linkend="sec-snapper-config-modify" role="internalbook"/> for instructions on | |
how to change these values. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-snapper-lvm"> | |
<title>Using Snapper on thinly provisioned LVM volumes</title> | |
<para> | |
Apart from snapshots on <literal>Btrfs</literal> file systems, Snapper | |
also supports taking snapshots on thinly-provisioned LVM volumes (snapshots | |
on regular LVM volumes are <emphasis>not</emphasis> supported) formatted | |
with XFS, Ext4 or Ext3. For more information and setup instructions on LVM | |
volumes, refer to <phrase role="externalbook-sec-yast-system-lvm">“LVM configuration” (Section “Expert Partitioner”, ↑Deployment Guide)</phrase>. | |
</para> | |
<para> | |
To use Snapper on a thinly-provisioned LVM volume you need to create a | |
Snapper configuration for it. On LVM it is required to specify the file | |
system with | |
<option>--fstype=lvm(<replaceable>FILESYSTEM</replaceable>)</option>. | |
<literal>ext3</literal>, <literal>etx4</literal> or <literal>xfs</literal> | |
are valid values for <replaceable>FILESYSTEM</replaceable>. Example: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c lvm create-config --fstype="lvm(xfs)" /thin_lvm</screen> | |
<para> | |
You can adjust this configuration according to your needs as described in | |
<xref linkend="sec-snapper-config-modify" role="internalbook"/>. | |
</para> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-undo"> | |
<title>Using Snapper to undo changes</title> | |
<para> | |
Snapper on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is preconfigured to serve as a tool that lets you | |
undo changes made by <command>zypper</command> and YaST. For this purpose, | |
Snapper is configured to create a pair of snapshots before and after each | |
run of <command>zypper</command> and YaST. Snapper also lets you restore | |
system files that have been accidentally deleted or modified. Timeline | |
snapshots for the root partition need to be enabled for this | |
purpose—see | |
<xref linkend="sec-snapper-setup-customize-auto-snapshots" role="internalbook"/> for details. | |
</para> | |
<para> | |
By default, automatic snapshots as described above are configured for the | |
root partition and its subvolumes. To make snapshots available for other | |
partitions such as <filename>/home</filename> for example, you can create | |
custom configurations. | |
</para> | |
<important> | |
<title>Undoing changes compared to rollback</title> | |
<para> | |
When working with snapshots to restore data, it is important to know that | |
there are two fundamentally different scenarios Snapper can handle: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Undoing changes</term> | |
<listitem> | |
<para> | |
When undoing changes as described in the following, two snapshots are | |
being compared and the changes between these two snapshots are made | |
undone. Using this method also allows to explicitly select the files | |
that should be restored. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Rollback</term> | |
<listitem> | |
<para> | |
When doing rollbacks as described in | |
<xref linkend="sec-snapper-snapshot-boot" role="internalbook"/>, the system is reset to the | |
state at which the snapshot was taken. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
When undoing changes, it is also possible to compare a snapshot against the | |
current system. When restoring <emphasis>all</emphasis> files from such a | |
comparison, this will have the same result as doing a rollback. However, | |
using the method described in <xref linkend="sec-snapper-snapshot-boot" role="internalbook"/> | |
for rollbacks should be preferred, since it is faster and allows you to | |
review the system before doing the rollback. | |
</para> | |
</important> | |
<warning> | |
<title>Data consistency</title> | |
<para> | |
There is no mechanism to ensure data consistency when creating a snapshot. | |
Whenever a file (for example, a database) is written at the same time as | |
the snapshot is being created, it will result in a corrupted or partly written | |
file. Restoring such a file will cause problems. Furthermore, some system | |
files such as <filename>/etc/mtab</filename> must never be restored. | |
Therefore it is strongly recommended to <emphasis>always</emphasis> closely | |
review the list of changed files and their diffs. Only restore files that | |
really belong to the action you want to revert. | |
</para> | |
</warning> | |
<sect2 xml:id="sec-snapper-undo-yast"> | |
<title>Undoing YaST and Zypper changes</title> | |
<para> | |
If you set up the root partition with <literal>Btrfs</literal> during the | |
installation, Snapper—preconfigured for doing rollbacks of YaST or | |
Zypper changes—will automatically be installed. Every time you start | |
a YaST module or a Zypper transaction, two snapshots are created: a | |
<quote>pre-snapshot</quote> capturing the state of the file system before | |
the start of the module and a <quote>post-snapshot</quote> after the module | |
has been finished. | |
</para> | |
<para> | |
Using the YaST Snapper module or the <command>snapper</command> command | |
line tool, you can undo the changes made by YaST/Zypper by restoring | |
files from the <quote>pre-snapshot</quote>. Comparing two snapshots the | |
tools also allow you to see which files have been changed. You can also | |
display the differences between two versions of a file (diff). | |
</para> | |
<procedure xml:id="proc-snapper-undo-yast"> | |
<title>Undoing changes using the YaST <guimenu>Snapper</guimenu> module</title> | |
<step> | |
<para> | |
Start the <guimenu>Snapper</guimenu> module from the | |
<guimenu>Miscellaneous</guimenu> section in YaST or by entering | |
<command>yast2 snapper</command>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Make sure <guimenu>Current Configuration</guimenu> is set to | |
<guimenu>root</guimenu>. This is always the case unless you have manually | |
added own Snapper configurations. | |
</para> | |
</step> | |
<step> | |
<para> | |
Choose a pair of pre- and post-snapshots from the list. Both, YaST and | |
Zypper snapshot pairs are of the type <guimenu>Pre & Post</guimenu>. | |
YaST snapshots are labeled as <literal>zypp(y2base)</literal> in the | |
<guimenu>Description column</guimenu>; Zypper snapshots are labeled | |
<literal>zypp(zypper)</literal>. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="snapper_yast2_list.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="snapper_yast2_list.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Show Changes</guimenu> to open the list of files that | |
differ between the two snapshots. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="snapper_yast2_changes.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="snapper_yast2_changes.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
Review the list of files. To display a <quote>diff</quote> between the | |
pre- and post-version of a file, select it from the list. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="snapper_yast2_diff.png" width="65%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="snapper_yast2_diff.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</step> | |
<step> | |
<para> | |
To restore one or more files, select the relevant files or directories by | |
activating the respective check box. Click <guimenu>Restore | |
Selected</guimenu> and confirm the action by clicking | |
<guimenu>Yes</guimenu>. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="snapper_yast2_restore.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="snapper_yast2_restore.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
<para> | |
To restore a single file, activate its diff view by clicking its name. | |
Click <guimenu>Restore From First</guimenu> and confirm your choice with | |
<guimenu>Yes</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
<procedure xml:id="proc-snapper-yast-cmdline"> | |
<title>Undoing changes using the <command>snapper</command> command</title> | |
<step> | |
<para> | |
Get a list of YaST and Zypper snapshots by running <command>snapper | |
list -t pre-post</command>. YaST snapshots are labeled | |
as <literal>yast <replaceable>MODULE_NAME</replaceable></literal> in the | |
<guimenu>Description column</guimenu>; Zypper snapshots are labeled | |
<literal>zypp(zypper)</literal>. | |
</para> | |
<screen><?dbsuse-fo font-size="0.60em"?> | |
<prompt>> </prompt><command>sudo</command> snapper list -t pre-post | |
Pre # | Post # | Pre Date | Post Date | Description | |
------+--------+-------------------------------+-------------------------------+-------------- | |
311 | 312 | Tue 06 May 2018 14:05:46 CEST | Tue 06 May 2018 14:05:52 CEST | zypp(y2base) | |
340 | 341 | Wed 07 May 2018 16:15:10 CEST | Wed 07 May 2018 16:15:16 CEST | zypp(zypper) | |
342 | 343 | Wed 07 May 2018 16:20:38 CEST | Wed 07 May 2018 16:20:42 CEST | zypp(y2base) | |
344 | 345 | Wed 07 May 2018 16:21:23 CEST | Wed 07 May 2018 16:21:24 CEST | zypp(zypper) | |
346 | 347 | Wed 07 May 2018 16:41:06 CEST | Wed 07 May 2018 16:41:10 CEST | zypp(y2base) | |
348 | 349 | Wed 07 May 2018 16:44:50 CEST | Wed 07 May 2018 16:44:53 CEST | zypp(y2base) | |
350 | 351 | Wed 07 May 2018 16:46:27 CEST | Wed 07 May 2018 16:46:38 CEST | zypp(y2base) </screen> | |
</step> | |
<step> | |
<para> | |
Get a list of changed files for a snapshot pair with <command>snapper | |
status</command> | |
<replaceable>PRE</replaceable>..<replaceable>POST</replaceable>. Files | |
with content changes are marked with <guimenu>c</guimenu>, files that | |
have been added are marked with <guimenu>+</guimenu> and deleted files | |
are marked with <guimenu>-</guimenu>. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper status 350..351 | |
+..... /usr/share/doc/packages/mikachan-fonts | |
+..... /usr/share/doc/packages/mikachan-fonts/COPYING | |
+..... /usr/share/doc/packages/mikachan-fonts/dl.html | |
c..... /usr/share/fonts/truetype/fonts.dir | |
c..... /usr/share/fonts/truetype/fonts.scale | |
+..... /usr/share/fonts/truetype/みかちゃん-p.ttf | |
+..... /usr/share/fonts/truetype/みかちゃん-pb.ttf | |
+..... /usr/share/fonts/truetype/みかちゃん-ps.ttf | |
+..... /usr/share/fonts/truetype/みかちゃん.ttf | |
c..... /var/cache/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-x86_64.cache-4 | |
c..... /var/lib/rpm/Basenames | |
c..... /var/lib/rpm/Dirnames | |
c..... /var/lib/rpm/Group | |
c..... /var/lib/rpm/Installtid | |
c..... /var/lib/rpm/Name | |
c..... /var/lib/rpm/Packages | |
c..... /var/lib/rpm/Providename | |
c..... /var/lib/rpm/Requirename | |
c..... /var/lib/rpm/Sha1header | |
c..... /var/lib/rpm/Sigmd5</screen> | |
</step> | |
<step> | |
<para> | |
To display the diff for a certain file, run <command>snapper | |
diff</command> | |
<replaceable>PRE</replaceable>..<replaceable>POST</replaceable> | |
<replaceable>FILENAME</replaceable>. If you do not specify | |
<replaceable>FILENAME</replaceable>, a diff for all files will be | |
displayed. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper diff 350..351 /usr/share/fonts/truetype/fonts.scale | |
--- /.snapshots/350/snapshot/usr/share/fonts/truetype/fonts.scale 2014-04-23 15:58:57.000000000 +0200 | |
+++ /.snapshots/351/snapshot/usr/share/fonts/truetype/fonts.scale 2014-05-07 16:46:31.000000000 +0200 | |
@@ -1,4 +1,4 @@ | |
-1174 | |
+1486 | |
ds=y:ai=0.2:luximr.ttf -b&h-luxi mono-bold-i-normal--0-0-0-0-c-0-iso10646-1 | |
ds=y:ai=0.2:luximr.ttf -b&h-luxi mono-bold-i-normal--0-0-0-0-c-0-iso8859-1 | |
[...]</screen> | |
</step> | |
<step> | |
<para> | |
To restore one or more files run <command>snapper -v undochange</command> | |
<replaceable>PRE</replaceable>..<replaceable>POST</replaceable> | |
<replaceable>FILENAMES</replaceable>. If you do not specify a | |
<replaceable>FILENAMES</replaceable>, all changed files will be restored. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -v undochange 350..351 | |
create:0 modify:13 delete:7 | |
undoing change... | |
deleting /usr/share/doc/packages/mikachan-fonts | |
deleting /usr/share/doc/packages/mikachan-fonts/COPYING | |
deleting /usr/share/doc/packages/mikachan-fonts/dl.html | |
deleting /usr/share/fonts/truetype/みかちゃん-p.ttf | |
deleting /usr/share/fonts/truetype/みかちゃん-pb.ttf | |
deleting /usr/share/fonts/truetype/みかちゃん-ps.ttf | |
deleting /usr/share/fonts/truetype/みかちゃん.ttf | |
modifying /usr/share/fonts/truetype/fonts.dir | |
modifying /usr/share/fonts/truetype/fonts.scale | |
modifying /var/cache/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-x86_64.cache-4 | |
modifying /var/lib/rpm/Basenames | |
modifying /var/lib/rpm/Dirnames | |
modifying /var/lib/rpm/Group | |
modifying /var/lib/rpm/Installtid | |
modifying /var/lib/rpm/Name | |
modifying /var/lib/rpm/Packages | |
modifying /var/lib/rpm/Providename | |
modifying /var/lib/rpm/Requirename | |
modifying /var/lib/rpm/Sha1header | |
modifying /var/lib/rpm/Sigmd5 | |
undoing change done</screen> | |
</step> | |
</procedure> | |
<warning> | |
<title>Reverting user additions</title> | |
<para> | |
Reverting user additions via undoing changes with Snapper is not | |
recommended. Since certain directories are excluded from snapshots, files | |
belonging to these users will remain in the file system. If a user with | |
the same user ID as a deleted user is created, this user will inherit the | |
files. Therefore it is strongly recommended to use the YaST | |
<guimenu>User and Group Management</guimenu> tool to remove users. | |
</para> | |
</warning> | |
</sect2> | |
<sect2 xml:id="sec-snapper-undo-delete-file"> | |
<title>Using Snapper to restore files</title> | |
<para> | |
Apart from the installation and administration snapshots, Snapper creates | |
timeline snapshots. You can use these backup snapshots to restore files | |
that have accidentally been deleted or to restore a previous version of a | |
file. By using Snapper's diff feature you can also find out which | |
modifications have been made at a certain point of time. | |
</para> | |
<para> | |
Being able to restore files is especially interesting for data, which may | |
reside on subvolumes or partitions for which snapshots are not taken by | |
default. To be able to restore files from home directories, for example, | |
create a separate Snapper configuration for <filename>/home</filename> | |
doing automatic timeline snapshots. See | |
<xref linkend="sec-snapper-config" role="internalbook"/> for instructions. | |
</para> | |
<warning> | |
<title>Restoring files compared to rollback</title> | |
<para> | |
Snapshots taken from the root file system (defined by Snapper's root | |
configuration), can be used to do a system rollback. The recommended way | |
to do such a rollback is to boot from the snapshot and then perform the | |
rollback. See <xref linkend="sec-snapper-snapshot-boot" role="internalbook"/> for details. | |
</para> | |
<para> | |
Performing a rollback would also be possible by restoring all files from a | |
root file system snapshot as described below. However, this is not | |
recommended. You may restore single files, for example a configuration | |
file from the <systemitem>/etc</systemitem> directory, but not the | |
complete list of files from the snapshot. | |
</para> | |
<para> | |
This restriction only affects snapshots taken from the root file system! | |
</para> | |
</warning> | |
<procedure xml:id="proc-snapper-restore-yast"> | |
<title>Restoring files using the YaST <guimenu>Snapper</guimenu> module</title> | |
<step> | |
<para> | |
Start the <guimenu>Snapper</guimenu> module from the | |
<guimenu>Miscellaneous</guimenu> section in YaST or by entering | |
<command>yast2 snapper</command>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Choose the <guimenu>Current Configuration</guimenu> from which to choose | |
a snapshot. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select a timeline snapshot from which to restore a file and choose | |
<guimenu>Show Changes</guimenu>. Timeline snapshots are of the type | |
<guimenu>Single</guimenu> with a description value of | |
<guimenu>timeline</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select a file from the text box by clicking the file name. The difference | |
between the snapshot version and the current system is shown. Activate | |
the check box to select the file for restore. Do so for all files you | |
want to restore. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Restore Selected</guimenu> and confirm the action by | |
clicking <guimenu>Yes</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
<procedure xml:id="proc-snapper-restore-cmdl"> | |
<title>Restoring files using the <command>snapper</command> command</title> | |
<step> | |
<para> | |
Get a list of timeline snapshots for a specific configuration by running | |
the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> list -t single | grep timeline</screen> | |
<para> | |
<replaceable>CONFIG</replaceable> needs to be replaced by an existing | |
Snapper configuration. Use <command>snapper list-configs</command> to | |
display a list. | |
</para> | |
</step> | |
<step> | |
<para> | |
Get a list of changed files for a given snapshot by running the following | |
command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> status <replaceable>SNAPSHOT_ID</replaceable>..0</screen> | |
<para> | |
Replace <replaceable>SNAPSHOT_ID</replaceable> by the ID for the snapshot | |
from which you want to restore the file(s). | |
</para> | |
</step> | |
<step> | |
<para> | |
Optionally list the differences between the current file version and the | |
one from the snapshot by running | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> diff <replaceable>SNAPSHOT_ID</replaceable>..0 <replaceable>FILE NAME</replaceable></screen> | |
<para> | |
If you do not specify <replaceable><FILE NAME></replaceable>, the | |
difference for all files are shown. | |
</para> | |
</step> | |
<step> | |
<para> | |
To restore one or more files, run | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> -v undochange <replaceable>SNAPSHOT_ID</replaceable>..0 <replaceable>FILENAME1</replaceable> <replaceable>FILENAME2</replaceable></screen> | |
<para> | |
If you do not specify file names, all changed files will be restored. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-snapshot-boot"> | |
<title>System rollback by booting from snapshots</title> | |
<para> | |
The GRUB 2 version included on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> can boot from Btrfs snapshots. | |
Together with Snapper's rollback feature, this allows to recover a | |
misconfigured system. Only snapshots created for the default Snapper | |
configuration (<literal>root</literal>) are bootable. | |
</para> | |
<important> | |
<title>Supported configuration</title> | |
<para> | |
As of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> <phrase role="productnumber"><phrase os="sles;sled">15 SP5</phrase></phrase> system rollbacks are only supported if | |
the default subvolume configuration of the root partition has not been | |
changed. | |
</para> | |
</important> | |
<para> | |
When booting a snapshot, the parts of the file system included in the | |
snapshot are mounted read-only; all other file systems and parts that are | |
excluded from snapshots are mounted read-write and can be modified. | |
</para> | |
<important> | |
<title>Undoing changes compared to rollback</title> | |
<para> | |
When working with snapshots to restore data, it is important to know that | |
there are two fundamentally different scenarios Snapper can handle: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Undoing changes</term> | |
<listitem> | |
<para> | |
When undoing changes as described in <xref linkend="sec-snapper-undo" role="internalbook"/>, | |
two snapshots are compared and the changes between these two snapshots | |
are reverted. Using this method also allows to explicitly exclude | |
selected files from being restored. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Rollback</term> | |
<listitem> | |
<para> | |
When doing rollbacks as described in the following, the system is reset | |
to the state at which the snapshot was taken. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</important> | |
<para> | |
To do a rollback from a bootable snapshot, the following requirements must | |
be met. When doing a default installation, the system is set up accordingly. | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<title>Requirements for a rollback from a bootable snapshot</title> | |
<listitem> | |
<para> | |
The root file system needs to be Btrfs. Booting from LVM volume snapshots | |
is not supported. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The root file system needs to be on a single device, a single partition | |
and a single subvolume. Directories that are excluded from snapshots such | |
as <filename>/srv</filename> (see <xref linkend="snapper-dir-excludes" role="internalbook"/> | |
for a full list) may reside on separate partitions. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The system needs to be bootable via the installed boot loader. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
To perform a rollback from a bootable snapshot, do as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Boot the system. In the boot menu choose <guimenu>Bootable | |
snapshots</guimenu> and select the snapshot you want to boot. The list of | |
snapshots is listed by date—the most recent snapshot is listed | |
first. | |
</para> | |
</step> | |
<step> | |
<para> | |
Log in to the system. Carefully check whether everything works as | |
expected. Note that you cannot write to any directory that is part of the | |
snapshot. Data you write to other directories will | |
<emphasis>not</emphasis> get lost, regardless of what you do next. | |
</para> | |
</step> | |
<step> | |
<para> | |
Depending on whether you want to perform the rollback or not, choose your | |
next step: | |
</para> | |
<substeps performance="required"> | |
<step> | |
<para> | |
If the system is in a state where you do not want to do a rollback, | |
reboot to boot into the current system state. You can then choose a different | |
snapshot, or start the rescue system. | |
</para> | |
</step> | |
<step> | |
<para> | |
To perform the rollback, run | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper rollback</screen> | |
<para> | |
and reboot afterward. On the boot screen, choose the default boot entry | |
to reboot into the reinstated system. A snapshot of the file system status | |
before the rollback is created. The default subvolume for root will | |
be replaced with a fresh read-write snapshot. | |
For details, see <xref linkend="sec-snapper-snapshot-boot-rollback" role="internalbook"/>. | |
</para> | |
<para> | |
It is useful to add a description for the snapshot with the <option>-d</option> option. | |
For example: | |
</para> | |
<screen>New file system root since rollback on <replaceable>DATE</replaceable> <replaceable>TIME</replaceable></screen> | |
</step> | |
</substeps> | |
</step> | |
</procedure> | |
<tip> | |
<title>Rolling back to a specific installation state</title> | |
<para> | |
If snapshots are not disabled during installation, an initial bootable | |
snapshot is created at the end of the initial system installation. You can | |
go back to that state at any time by booting this snapshot. The snapshot | |
can be identified by the description <literal>after installation</literal>. | |
</para> | |
<para> | |
A bootable snapshot is also created when starting a system upgrade to a | |
service pack or a new major release (provided snapshots are not disabled). | |
</para> | |
</tip> | |
<sect2 xml:id="sec-snapper-snapshot-boot-rollback"> | |
<title>Snapshots after rollback</title> | |
<para> | |
Before a rollback is performed, a snapshot of the running file system | |
is created. The description references the ID of the snapshot that | |
was restored in the rollback. | |
</para> | |
<para> | |
Snapshots created by rollbacks receive the value <literal>number</literal> | |
for the <literal>Cleanup</literal> attribute. The rollback snapshots are | |
therefore automatically deleted when the set number of snapshots is reached. | |
Refer to <xref linkend="sec-snapper-clean-up" role="internalbook"/> for details. | |
If the snapshot contains important data, extract the data from the snapshot | |
before it is removed. | |
</para> | |
<sect3 xml:id="sec-snapper-snapshot-boot-rollback-example"> | |
<title>Example of rollback snapshot</title> | |
<para> | |
For example, after a fresh installation the following snapshots are | |
available on the system: | |
</para> | |
<screen> | |
<prompt role="root"># </prompt><command>snapper</command> --iso list | |
Type | # | | Cleanup | Description | Userdata | |
-------+---+ ... +---------+-----------------------+-------------- | |
single | 0 | | | current | | |
single | 1 | | | first root filesystem | | |
single | 2 | | number | after installation | important=yes | |
</screen> | |
<para> | |
After running <command>sudo snapper rollback</command> snapshot | |
<literal>3</literal> is created and contains the state of the system | |
before the rollback was executed. Snapshot <literal>4</literal> is | |
the new default Btrfs subvolume and thus the system after a reboot. | |
</para> | |
<screen> | |
<prompt role="root"># </prompt><command>snapper</command> --iso list | |
Type | # | | Cleanup | Description | Userdata | |
-------+---+ ... +---------+-----------------------+-------------- | |
single | 0 | | | current | | |
single | 1 | | number | first root filesystem | | |
single | 2 | | number | after installation | important=yes | |
single | 3 | | number | rollback backup of #1 | important=yes | |
single | 4 | | | | | |
</screen> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-snapper-snapshot-boot-identify"> | |
<title>Accessing and identifying snapshot boot entries</title> | |
<para> | |
To boot from a snapshot, reboot your machine and choose <guimenu>Start | |
Bootloader from a read-only snapshot</guimenu>. A screen listing all | |
bootable snapshots opens. The most recent snapshot is listed first, the | |
oldest last. Use the keys <keycap function="down"/> and | |
<keycap function="up"/> to navigate and press <keycap function="enter"/> to | |
activate the selected snapshot. Activating a snapshot from the boot menu | |
does not reboot the machine immediately, but rather opens the boot loader | |
of the selected snapshot. | |
</para> | |
<figure xml:id="fig-snapper-snapshot-boot-identify"> | |
<title>Boot loader: snapshots</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="boot_snapshots.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="boot_snapshots.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<warning> | |
<title>Booting Xen from a Btrfs snapshot using UEFI currently fails</title> | |
<para> | |
Refer to <link xlink:href="https://www.suse.com/support/kb/doc/?id=000020602"/> for more | |
details. | |
</para> | |
</warning> | |
<para> | |
Each snapshot entry in the boot loader follows a naming scheme which makes | |
it possible to identify it easily: | |
</para> | |
<screen>[*]<co xml:id="snapper-boot-important"/><replaceable>OS</replaceable><co xml:id="snapper-boot-os"/> (<replaceable>KERNEL</replaceable><co xml:id="snapper-boot-kernel"/>,<replaceable>DATE</replaceable><co xml:id="snapper-boot-date"/>T<replaceable>TIME</replaceable><co xml:id="snapper-boot-time"/>,<replaceable>DESCRIPTION</replaceable><co xml:id="snapper-boot-description"/>)</screen> | |
<calloutlist> | |
<callout arearefs="snapper-boot-important"> | |
<para> | |
If the snapshot was marked <literal>important</literal>, the entry is | |
marked with a <literal>*</literal>. | |
</para> | |
</callout> | |
<callout arearefs="snapper-boot-os"> | |
<para> | |
Operating system label. | |
</para> | |
</callout> | |
<callout arearefs="snapper-boot-date"> | |
<para> | |
Date in the format <literal>YYYY-MM-DD</literal>. | |
</para> | |
</callout> | |
<callout arearefs="snapper-boot-time"> | |
<para> | |
Time in the format <literal>HH:MM</literal>. | |
</para> | |
</callout> | |
<callout arearefs="snapper-boot-description"> | |
<para> | |
This field contains a description of the snapshot. In case of a manually | |
created snapshot this is the string created with the option | |
<option>--description</option> or a custom string (see | |
<xref linkend="tip-snapper-snapshot-boot-custom-descr" role="internalbook"/>). In case | |
of an automatically created snapshot, it is the tool that was called, for | |
example <literal>zypp(zypper)</literal> or | |
<literal>yast_sw_single</literal>. Long descriptions may be truncated, | |
depending on the size of the boot screen. | |
</para> | |
</callout> | |
</calloutlist> | |
<tip xml:id="tip-snapper-snapshot-boot-custom-descr"> | |
<title>Setting a custom description for boot loader snapshot entries</title> | |
<para> | |
It is possible to replace the default string in the description field of a | |
snapshot with a custom string. This is for example useful if an | |
automatically created description is not sufficient, or a user-provided | |
description is too long. To set a custom string | |
<replaceable>STRING</replaceable> for snapshot | |
<replaceable>NUMBER</replaceable>, use the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper modify --userdata "bootloader=<replaceable>STRING</replaceable>" <replaceable>NUMBER</replaceable></screen> | |
<para> | |
The description should be no longer than 25 characters—everything | |
that exceeds this size will not be readable on the boot screen. | |
</para> | |
</tip> | |
</sect2> | |
<sect2 xml:id="sec-snapper-snapshot-boot-limits"> | |
<title>Limitations</title> | |
<para> | |
A <emphasis>complete</emphasis> system rollback, restoring the complete | |
system to the identical state as it was in when a snapshot was taken, is | |
not possible. | |
</para> | |
<sect3 xml:id="sec-snapper-limits-snapshot-boot-excludes"> | |
<title>Directories excluded from snapshots</title> | |
<para> | |
Root file system snapshots do not contain all directories. See | |
<xref linkend="snapper-dir-excludes" role="internalbook"/> for details and reasons. As a | |
general consequence, data from these directories is not restored, | |
resulting in the following limitations. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term> | |
Add-ons and third-party software may be unusable after a rollback | |
</term> | |
<listitem> | |
<para> | |
Applications and add-ons installing data in subvolumes excluded from | |
the snapshot, such as <filename>/opt</filename>, may not work after a | |
rollback, if others parts of the application data are also installed on | |
subvolumes included in the snapshot. Re-install the application or the | |
add-on to solve this problem. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>File access problems</term> | |
<listitem> | |
<para> | |
If an application had changed file permissions and/or ownership in | |
between snapshot and current system, the application may not be able to | |
access these files. Reset permissions and/or ownership for the affected | |
files after the rollback. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Incompatible data formats</term> | |
<listitem> | |
<para> | |
If a service or an application has established a new data format in | |
between snapshot and current system, the application may not be able to | |
read the affected data files after a rollback. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Subvolumes with a mixture of code and data</term> | |
<listitem> | |
<para> | |
Subvolumes like <filename>/srv</filename> may contain a mixture of code | |
and data. A rollback may result in non-functional code. A downgrade of | |
the PHP version, for example, may result in broken PHP scripts for the | |
Web server. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>User data</term> | |
<listitem> | |
<para> | |
If a rollback removes users from the system, data that is owned by | |
these users in directories excluded from the snapshot, is not removed. | |
If a user with the same user ID is created, this user will inherit the | |
files. Use a tool like <command>find</command> to locate and remove | |
orphaned files. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-snapper-limits-snapshot-boot-grub"> | |
<title>No rollback of boot loader data</title> | |
<para> | |
A rollback of the boot loader is not possible, since all | |
<quote>stages</quote> of the boot loader must fit together. This cannot be | |
guaranteed when doing rollbacks of <filename>/boot</filename>. | |
</para> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-homedirs"> | |
<title>Enabling Snapper in user home directories</title> | |
<para> | |
You may enable snapshots for users' <filename>/home</filename> | |
directories, which supports a number of use cases: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Individual users may manage their own snapshots and rollbacks. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
System users, for example database, system, and network admins | |
who want to track copies of configuration files, documentation, | |
and so on. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Samba shares with home directories and Btrfs back-end. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Each user's directory is a Btrfs subvolume of <filename>/home</filename>. | |
It is possible to set this up manually | |
(see <xref linkend="sec-snapper-manual-home-config" role="internalbook"/>). However, a | |
more convenient way is to use <literal>pam_snapper</literal>. | |
The <literal>pam_snapper</literal> package installs the | |
<literal>pam_snapper.so</literal> module and helper scripts, which | |
automate user creation and Snapper configuration. | |
</para> | |
<para> | |
<literal>pam_snapper</literal> provides integration with the | |
<command>useradd</command> command, pluggable | |
authentication modules (PAM), and Snapper. By default it creates snapshots | |
at user login and logout, and also creates time-based snapshots as some | |
users remain logged in for extended periods of time. You may change the | |
defaults using the normal Snapper commands and configuration files. | |
</para> | |
<sect2 xml:id="sec-snapper-install-pam-snapper"> | |
<title>Installing pam_snapper and creating users</title> | |
<para> | |
The easiest way is to start with a new <filename>/home</filename> | |
directory formatted with Btrfs, and no existing users. Install | |
<literal>pam_snapper</literal>: | |
</para> | |
<screen><prompt role="root"># </prompt>zypper in pam_snapper</screen> | |
<para> | |
Add this line to <filename>/etc/pam.d/common-session</filename>: | |
</para> | |
<screen>session optional pam_snapper.so</screen> | |
<para> | |
Use the <command>/usr/lib/pam_snapper/pam_snapper_useradd.sh</command> | |
script to create a new user and home directory. By default the script | |
performs a dry run. Edit the script to change | |
<literal>DRYRUN=1</literal> to <literal>DRYRUN=0</literal>. Now you | |
can create a new user: | |
</para> | |
<screen><prompt role="root"># </prompt>/usr/lib/pam_snapper/pam_snapper_useradd.sh \ | |
<replaceable>username</replaceable> <replaceable>group</replaceable> passwd=<replaceable>password</replaceable> | |
Create subvolume '/home/username' | |
useradd: warning: the home directory already exists. | |
Not copying any file from skel directory into it. | |
</screen> | |
<para> | |
The files from <filename>/etc/skel</filename> will be copied | |
into the user's home directory at their first login. Verify that | |
the user's configuration was created by listing your Snapper | |
configurations: | |
</para> | |
<screen><prompt role="root"># </prompt>snapper list --all | |
Config: home_username, subvolume: /home/username | |
Type | # | Pre # | Date | User | Cleanup | Description | Userdata | |
-------+---+-------+------+------+---------+-------------+--------- | |
single | 0 | | | root | | current | | |
</screen> | |
<para> | |
Over time, this output will become populated with a list of snapshots, | |
which the user can manage with the standard Snapper commands. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-snapper-remove-user"> | |
<title>Removing users</title> | |
<para> | |
Remove users with the | |
<command>/usr/lib/pam_snapper/pam_snapper_userdel.sh</command> | |
script. By default it performs a dry run, so edit it to change | |
<literal>DRYRUN=1</literal> to <literal>DRYRUN=0</literal>. This | |
removes the user, the user's home subvolume, Snapper configuration, | |
and deletes all snapshots. | |
</para> | |
<screen><prompt role="root"># </prompt>/usr/lib/pam_snapper/pam_snapper_userdel.sh username</screen> | |
</sect2> | |
<sect2 xml:id="sec-snapper-manual-home-config"> | |
<title>Manually enabling snapshots in home directories</title> | |
<para> | |
These are the steps for manually setting up users' home directories | |
with Snapper. <filename>/home</filename> must be formatted with Btrfs, | |
and the users not yet created. | |
</para> | |
<screen><prompt role="root"># </prompt>btrfs subvol create /home/<replaceable>username</replaceable> | |
<prompt role="root"># </prompt>snapper -c home_<replaceable>username</replaceable> create-config /home/<replaceable>username</replaceable> | |
<prompt role="root"># </prompt>sed -i -e "s/ALLOW_USERS=\"\"/ALLOW_USERS=\"<replaceable>username</replaceable>\"/g" \ | |
/etc/snapper/configs/home_<replaceable>username</replaceable> | |
<prompt role="root"># </prompt>yast users add username=<replaceable>username</replaceable> home=/home/<replaceable>username</replaceable> password=<replaceable>password</replaceable> | |
<prompt role="root"># </prompt>chown <replaceable>username</replaceable>.<replaceable>group</replaceable> /home/<replaceable>username</replaceable> | |
<prompt role="root"># </prompt>chmod 755 /home/<replaceable>username</replaceable>/.snapshots | |
</screen> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-config"> | |
<title>Creating and modifying Snapper configurations</title> | |
<para> | |
The way Snapper behaves is defined in a configuration file that is specific | |
for each partition or <literal>Btrfs</literal> subvolume. These | |
configuration files reside under <filename>/etc/snapper/configs/</filename>. | |
</para> | |
<para> | |
In case the root file system is big enough (approximately 12 GB), snapshots | |
are automatically enabled for the root file system <filename>/</filename> | |
upon installation. The corresponding default configuration is named | |
<filename>root</filename>. It creates and manages the YaST and Zypper | |
snapshot. See <xref linkend="sec-snapper-config-modify-values" role="internalbook"/> for a list | |
of the default values. | |
</para> | |
<note> | |
<title>Minimum root file system size for enabling snapshots</title> | |
<para> | |
As explained in <xref linkend="sec-snapper-setup" role="internalbook"/>, enabling snapshots | |
requires additional free space in the root file system. The amount depends | |
on the amount of packages installed and the amount of changes made to the | |
volume that is included in snapshots. The snapshot frequency and the number | |
of snapshots that get archived also matter. | |
</para> | |
<para> | |
There is a minimum root file system size that is required to automatically | |
enable snapshots during the installation. Currently this size is | |
approximately 12 GB. This value may change in the future, depending on | |
architecture and the size of the base system. It depends on the values for | |
the following tags in the file <filename>/control.xml</filename> from the | |
installation media: | |
</para> | |
<screen><root_base_size> | |
<btrfs_increase_percentage></screen> | |
<para> | |
It is calculated with the following formula: <replaceable>ROOT_BASE_SIZE</replaceable> * (1 + <replaceable>BTRFS_INCREASE_PERCENTAGE</replaceable>/100) | |
</para> | |
<para> | |
Keep in mind that this value is a minimum size. Consider using more space | |
for the root file system. As a rule of thumb, double the size you would use | |
when not having enabled snapshots. | |
</para> | |
</note> | |
<para> | |
You may create your own configurations for other partitions formatted with | |
<literal>Btrfs</literal> or existing subvolumes on a | |
<literal>Btrfs</literal> partition. In the following example we will set up | |
a Snapper configuration for backing up the Web server data residing on a | |
separate, <literal>Btrfs</literal>-formatted partition mounted at | |
<filename>/srv/www</filename>. | |
</para> | |
<para> | |
After a configuration has been created, you can either use | |
<command>snapper</command> itself or the YaST <guimenu>Snapper</guimenu> | |
module to restore files from these snapshots. In YaST you need to select | |
your <guimenu>Current Configuration</guimenu>, while you need to specify | |
your configuration for <command>snapper</command> with the global switch | |
<option>-c</option> (for example, <command>snapper -c myconfig | |
list</command>). | |
</para> | |
<para> | |
To create a new Snapper configuration, run <command>snapper | |
create-config</command>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c www-data<co xml:id="snapper-create-name"/> create-config /srv/www<co xml:id="snapper-create-volume"/></screen> | |
<calloutlist> | |
<callout arearefs="snapper-create-name"> | |
<para> | |
Name of configuration file. | |
</para> | |
</callout> | |
<callout arearefs="snapper-create-volume"> | |
<para> | |
Mount point of the partition or <literal>Btrfs</literal> subvolume on | |
which to take snapshots. | |
</para> | |
</callout> | |
</calloutlist> | |
<para> | |
This command will create a new configuration file | |
<filename>/etc/snapper/configs/www-data</filename> with reasonable default | |
values (taken from | |
<filename>/etc/snapper/config-templates/default</filename>). Refer to | |
<xref linkend="sec-snapper-config-modify" role="internalbook"/> for instructions on how to | |
adjust these defaults. | |
</para> | |
<tip> | |
<title>Configuration defaults</title> | |
<para> | |
Default values for a new configuration are taken from | |
<filename>/etc/snapper/config-templates/default</filename>. To use your own | |
set of defaults, create a copy of this file in the same directory and | |
adjust it to your needs. To use it, specify the <option>-t</option> option | |
with the create-config command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c www-data create-config -t <replaceable>MY_DEFAULTS</replaceable> /srv/www</screen> | |
</tip> | |
<sect2 xml:id="sec-snapper-config-modify"> | |
<title>Managing existing configurations</title> | |
<para> | |
The <command>snapper</command> command offers several subcommands for managing | |
existing configurations. You can list, show, delete and modify them: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Listing configurations</term> | |
<listitem> | |
<para> | |
Use the subcommand <command>snapper list-configs</command> to get all | |
existing configurations: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper list-configs | |
Config | Subvolume | |
-------+---------- | |
root | / | |
usr | /usr | |
local | /local</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Showing a configuration</term> | |
<listitem> | |
<para> | |
Use the subcommand <command>snapper -c | |
<replaceable>CONFIG</replaceable> get-config</command> to display the | |
specified configuration. Replace <replaceable>CONFIG</replaceable> with | |
one of the configuration names shown by | |
<command>snapper list-configs</command>. | |
For more information about the configuration options, see | |
<xref linkend="sec-snapper-config-modify-values" role="internalbook"/>. | |
</para> | |
<para> | |
To display the default configuration, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c root get-config</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Modifying a configuration</term> | |
<listitem> | |
<para> | |
Use the subcommand <command>snapper -c <replaceable>CONFIG</replaceable> | |
set-config | |
<replaceable>OPTION</replaceable>=<replaceable>VALUE</replaceable></command> | |
to modify an option in the specified configuration. | |
Replace <replaceable>CONFIG</replaceable> with one of the | |
configuration names shown by <command>snapper list-configs</command>. | |
Possible values for <replaceable>OPTION</replaceable> and | |
<replaceable>VALUE</replaceable> are listed in <xref linkend="sec-snapper-config-modify-values" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Deleting a configuration</term> | |
<listitem> | |
<para> | |
Use the subcommand <command>snapper -c | |
<replaceable>CONFIG</replaceable> delete-config</command> to delete a | |
configuration. Replace <replaceable>CONFIG</replaceable> with one of the | |
configuration names shown by <command>snapper list-configs</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<sect3 xml:id="sec-snapper-config-modify-values"> | |
<title>Configuration data</title> | |
<para> | |
Each configuration contains a list of options that can be modified from | |
the command line. The following list provides details for each option. To | |
change a value, run <command>snapper -c <replaceable>CONFIG</replaceable> | |
set-config | |
"<replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable>"</command>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>ALLOW_GROUPS</literal>, | |
<literal>ALLOW_USERS</literal> | |
</term> | |
<listitem> | |
<para> | |
Granting permissions to use snapshots to regular users. See | |
<xref linkend="sec-snapper-config-user" role="internalbook"/> for more information. | |
</para> | |
<para> | |
The default value is <literal>""</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>BACKGROUND_COMPARISON</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines whether pre and post snapshots should be compared in the | |
background after creation. | |
</para> | |
<para> | |
The default value is <literal>"yes"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>EMPTY_*</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines the clean-up algorithm for snapshots pairs with identical pre | |
and post snapshots. See <xref linkend="sec-snapper-clean-up-empty" role="internalbook"/> | |
for details. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>FSTYPE</literal> | |
</term> | |
<listitem> | |
<para> | |
File system type of the partition. Do not change. | |
</para> | |
<para> | |
The default value is <literal>"btrfs"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>NUMBER_*</literal></term> | |
<listitem> | |
<para> | |
Defines the clean-up algorithm for installation and admin snapshots. | |
See <xref linkend="sec-snapper-clean-up-number" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>QGROUP</literal> / <literal>SPACE_LIMIT</literal> | |
</term> | |
<listitem> | |
<para> | |
Adds quota support to the clean-up algorithms. See | |
<xref linkend="sec-snapper-clean-up-quota" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>SUBVOLUME</literal> | |
</term> | |
<listitem> | |
<para> | |
Mount point of the partition or subvolume to snapshot. Do not change. | |
</para> | |
<para> | |
The default value is <literal>"/"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>SYNC_ACL</literal> | |
</term> | |
<listitem> | |
<para> | |
If Snapper is used by regular users (see | |
<xref linkend="sec-snapper-config-user" role="internalbook"/>), the users must be able to | |
access the <filename>.snapshot</filename> directories and to read files | |
within them. If SYNC_ACL is set to <literal>yes</literal>, Snapper | |
automatically makes them accessible using ACLs for users and groups | |
from the ALLOW_USERS or ALLOW_GROUPS entries. | |
</para> | |
<para> | |
The default value is <literal>"no"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>TIMELINE_CREATE</literal> | |
</term> | |
<listitem> | |
<para> | |
If set to <literal>yes</literal>, hourly snapshots are created. Valid | |
values: <literal>yes</literal>, <literal>no</literal>. | |
</para> | |
<para> | |
The default value is <literal>"no"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>TIMELINE_CLEANUP</literal> / | |
<literal>TIMELINE_LIMIT_*</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines the clean-up algorithm for timeline snapshots. See | |
<xref linkend="sec-snapper-clean-up-timeline" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-snapper-config-user"> | |
<title>Using Snapper as regular user</title> | |
<para> | |
By default Snapper can only be used by <systemitem class="username">root</systemitem>. However, there are | |
cases in which certain groups or users need to be able to create snapshots | |
or undo changes by reverting to a snapshot: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
Web site administrators who want to take snapshots of | |
<filename>/srv/www</filename> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Users who want to take a snapshot of their home directory | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
For these purposes, you can create Snapper configurations that grant | |
permissions to users or/and groups. The corresponding | |
<filename>.snapshots</filename> directory needs to be readable and | |
accessible by the specified users. The easiest way to achieve this is to | |
set the SYNC_ACL option to <literal>yes</literal>. | |
</para> | |
<procedure> | |
<title>Enabling regular users to use Snapper</title> | |
<para> | |
Note that all steps in this procedure need to be run by <systemitem class="username">root</systemitem>. | |
</para> | |
<step> | |
<para> | |
If a Snapper configuration does not exist yet, create one for the partition or | |
subvolume on which the user should be able to use Snapper. Refer to | |
<xref linkend="sec-snapper-config" role="internalbook"/> for instructions. Example: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper --config web_data create /srv/www</screen> | |
</step> | |
<step> | |
<para> | |
The configuration file is created under | |
<filename>/etc/snapper/configs/<replaceable>CONFIG</replaceable></filename>, | |
where CONFIG is the value you specified with | |
<option>-c/--config</option> in the previous step (for example | |
<filename>/etc/snapper/configs/web_data</filename>). Adjust it according | |
to your needs. For more information, see | |
<xref linkend="sec-snapper-config-modify" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Set values for <envar>ALLOW_USERS</envar> and/or | |
<envar>ALLOW_GROUPS</envar> to grant permissions to users and/or groups, | |
respectively. Multiple entries need to be separated by | |
<keycap function="space"/>. To grant permissions to the user | |
<systemitem class="username">www_admin</systemitem> for example, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c web_data set-config "ALLOW_USERS=www_admin" SYNC_ACL="yes"</screen> | |
</step> | |
<step> | |
<para> | |
The given Snapper configuration can now be used by the specified user(s) | |
and/or group(s). You can test it with the <literal>list</literal> | |
command, for example: | |
</para> | |
<screen><prompt>www_admin:~ > </prompt>snapper -c web_data list</screen> | |
</step> | |
</procedure> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-manage"> | |
<title>Manually creating and managing snapshots</title> | |
<para> | |
Snapper is not restricted to creating and managing snapshots automatically | |
by configuration; you can also create snapshot pairs (<quote>before and | |
after</quote>) or single snapshots manually using either the command-line | |
tool or the YaST module. | |
</para> | |
<para> | |
All Snapper operations are carried out for an existing configuration (see | |
<xref linkend="sec-snapper-config" role="internalbook"/> for details). You can only take | |
snapshots of partitions or volumes for which a configuration exists. By | |
default the system configuration (<literal>root</literal>) is used. | |
To create or manage snapshots for your own configuration you need to | |
explicitly choose it. Use the <guimenu>Current Configuration</guimenu> | |
drop-down box in YaST or specify the <option>-c</option> on the command | |
line (<command>snapper -c <replaceable>MYCONFIG</replaceable> | |
<replaceable>COMMAND</replaceable></command>). | |
</para> | |
<sect2 xml:id="sec-snapper-manage-metadata"> | |
<title>Snapshot metadata</title> | |
<para> | |
Each snapshot consists of the snapshot itself and some metadata. When | |
creating a snapshot you also need to specify the metadata. Modifying a | |
snapshot means changing its metadata—you cannot modify its content. | |
Use <command>snapper list</command> to show existing snapshots and their | |
metadata: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><command>snapper --config home list</command> | |
</term> | |
<listitem> | |
<para> | |
Lists snapshots for the configuration <literal>home</literal>. To list | |
snapshots for the default configuration (root), use <command>snapper -c | |
root list</command> or <command>snapper list</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper list -a</command> | |
</term> | |
<listitem> | |
<para> | |
Lists snapshots for all existing configurations. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper list -t pre-post</command> | |
</term> | |
<listitem> | |
<para> | |
Lists all pre and post snapshot pairs for the default | |
(<literal>root</literal>) configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper list -t single</command> | |
</term> | |
<listitem> | |
<para> | |
Lists all snapshots of the type <literal>single</literal> for the | |
default (<literal>root</literal>) configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The following metadata is available for each snapshot: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
<emphasis role="bold">Type</emphasis>: Snapshot type, see | |
<xref linkend="sec-snapper-manage-metadata-type" role="internalbook"/> for details. This data | |
cannot be changed. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis role="bold">Number</emphasis>: Unique number of the snapshot. | |
This data cannot be changed. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis role="bold">Pre Number</emphasis>: Specifies the number of the | |
corresponding pre snapshot. For snapshots of type post only. This data | |
cannot be changed. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis role="bold">Description</emphasis>: A description of the | |
snapshot. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis role="bold">Userdata</emphasis>: An extended description where | |
you can specify custom data in the form of a comma-separated key=value | |
list: <literal>reason=testing, project=foo</literal>. This field is also | |
used to mark a snapshot as important (<literal>important=yes</literal>) | |
and to list the user that created the snapshot | |
(user=tux). | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<emphasis role="bold">Cleanup-Algorithm</emphasis>: Cleanup-algorithm for | |
the snapshot, see <xref linkend="sec-snapper-clean-up" role="internalbook"/> for details. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<sect3 xml:id="sec-snapper-manage-metadata-type"> | |
<title>Snapshot types</title> | |
<para> | |
Snapper knows three different types of snapshots: pre, post, and single. | |
Physically they do not differ, but Snapper handles them differently. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>pre</literal> | |
</term> | |
<listitem> | |
<para> | |
Snapshot of a file system <emphasis>before</emphasis> a modification. | |
Each <literal>pre</literal> snapshot corresponds to a | |
<literal>post</literal> snapshot. | |
For example, this is used for the automatic YaST/Zypper snapshots. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>post</literal> | |
</term> | |
<listitem> | |
<para> | |
Snapshot of a file system <emphasis>after</emphasis> a modification. | |
Each <literal>post</literal> snapshot corresponds to a | |
<literal>pre</literal> snapshot. | |
For example, this is used for the automatic YaST/Zypper snapshots. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>single</literal> | |
</term> | |
<listitem> | |
<para> | |
Stand-alone snapshot. | |
For example, this is used for the automatic hourly snapshots. | |
This is the default type when creating snapshots. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-snapper-manage-metadata-cleanup"> | |
<title>Cleanup algorithms</title> | |
<para> | |
Snapper provides three algorithms to clean up old snapshots. The | |
algorithms are executed in a daily | |
<systemitem class="daemon">cron</systemitem> job. | |
It is possible to define the | |
number of different types of snapshots to keep in the Snapper | |
configuration (see <xref linkend="sec-snapper-config-modify" role="internalbook"/> for | |
details). | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>number</term> | |
<listitem> | |
<para> | |
Deletes old snapshots when a certain snapshot count is reached. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>timeline</term> | |
<listitem> | |
<para> | |
Deletes old snapshots having passed a certain age, but keeps several | |
hourly, daily, monthly, and yearly snapshots. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>empty-pre-post</term> | |
<listitem> | |
<para> | |
Deletes pre/post snapshot pairs with empty diffs. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-snapper-manage-create"> | |
<title>Creating snapshots</title> | |
<para> | |
To create a snapshot, run <command>snapper create</command> or | |
click <guimenu>Create</guimenu> in the YaST module | |
<guimenu>Snapper</guimenu>. The following examples explain how to create | |
snapshots from the command line. | |
The YaST interface for Snapper is not explicitly described here but | |
provides equivalent functionality. | |
</para> | |
<tip> | |
<title>Snapshot description</title> | |
<para> | |
Always specify a meaningful description to later be able to | |
identify its purpose. You can also specify additional information via | |
the option <option>--userdata</option>. | |
</para> | |
</tip> | |
<para/> | |
<variablelist> | |
<varlistentry> | |
<term><command>snapper create --from <replaceable>17</replaceable> --description | |
"with package2"</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a stand-alone snapshot (type single) from an existing snapshot, which is specified | |
by the snapshot's number from <command>snapper list</command>. (This applies to Snapper version | |
0.8.4 and newer.) | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper create --description "Snapshot for week 2 | |
2014"</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a stand-alone snapshot (type single) for the default | |
(<literal>root</literal>) configuration with a description. Because no | |
cleanup-algorithm is specified, the snapshot will never be deleted | |
automatically. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper --config home create --description "Cleanup in | |
~tux"</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a stand-alone snapshot (type single) for a custom configuration | |
named <literal>home</literal> with a description. Because no | |
cleanup-algorithm is specified, the snapshot will never be deleted | |
automatically. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper --config home create --description "Daily data | |
backup" --cleanup-algorithm timeline</command>> | |
</term> | |
<listitem> | |
<para> | |
Creates a stand-alone snapshot (type single) for a custom configuration | |
named <literal>home</literal> with a description. The snapshot will | |
automatically be deleted when it meets the criteria specified for the | |
timeline cleanup-algorithm in the configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper create --type pre --print-number --description | |
"Before the Apache config cleanup" --userdata "important=yes"</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a snapshot of the type <literal>pre</literal> and prints the | |
snapshot number. First command needed to create a pair of snapshots used | |
to save a <quote>before</quote> and <quote>after</quote> state. The | |
snapshot is marked as important. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper create --type post --pre-number 30 --description | |
"After the Apache config cleanup" --userdata "important=yes"</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a snapshot of the type <literal>post</literal> paired with the | |
<literal>pre</literal> snapshot number <literal>30</literal>. Second | |
command needed to create a pair of snapshots used to save a | |
<quote>before</quote> and <quote>after</quote> state. The snapshot is | |
marked as important. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper create --command <replaceable>COMMAND</replaceable> | |
--description "Before and after COMMAND"</command> | |
</term> | |
<listitem> | |
<para> | |
Automatically creates a snapshot pair before and after running | |
<replaceable>COMMAND</replaceable>. This option is only available when | |
using snapper on the command line. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-snapper-manage-modify"> | |
<title>Modifying snapshot metadata</title> | |
<para> | |
Snapper allows you to modify the description, the cleanup algorithm, and | |
the user data of a snapshot. All other metadata cannot be changed. The | |
following examples explain how to modify snapshots from the command line. | |
It should be easy to adopt them when using the YaST interface. | |
</para> | |
<para> | |
To modify a snapshot on the command line, you need to know its number. Use | |
<command>snapper list</command> to display all snapshots | |
and their numbers. | |
</para> | |
<para> | |
The YaST <guimenu>Snapper</guimenu> module already lists all snapshots. | |
Choose one from the list and click <guimenu>Modify</guimenu>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><command>snapper modify --cleanup-algorithm "timeline"</command> | |
10 | |
</term> | |
<listitem> | |
<para> | |
Modifies the metadata of snapshot 10 for the default | |
(<literal>root</literal>) configuration. The cleanup algorithm is set to | |
<literal>timeline</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper --config home modify --description "daily backup" | |
-cleanup-algorithm "timeline" 120</command> | |
</term> | |
<listitem> | |
<para> | |
Modifies the metadata of snapshot 120 for a custom configuration named | |
<literal>home</literal>. A new description is set and the cleanup | |
algorithm is unset. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-snapper-manage-delete"> | |
<title>Deleting snapshots</title> | |
<para> | |
To delete a snapshot with the YaST <guimenu>Snapper</guimenu> module, | |
choose a snapshot from the list and click <guimenu>Delete</guimenu>. | |
</para> | |
<para> | |
To delete a snapshot with the command-line tool, you need to know its | |
number. Get it by running <command>snapper list</command>. To delete a | |
snapshot, run <command>snapper delete</command> | |
<replaceable>NUMBER</replaceable>. | |
</para> | |
<para> | |
Deleting the current default subvolume snapshot is not allowed. | |
</para> | |
<para> | |
When deleting snapshots with Snapper, the freed space will be claimed by a | |
Btrfs process running in the background. Thus the visibility and the | |
availability of free space is delayed. In case you need space freed by | |
deleting a snapshot to be available immediately, use the option | |
<option>--sync</option> with the delete command. | |
</para> | |
<tip> | |
<title>Deleting snapshot pairs</title> | |
<para> | |
When deleting a <literal>pre</literal> snapshot, you should always delete | |
its corresponding <literal>post</literal> snapshot (and vice versa). | |
</para> | |
</tip> | |
<variablelist> | |
<varlistentry> | |
<term><command>snapper delete 65</command> | |
</term> | |
<listitem> | |
<para> | |
Deletes snapshot 65 for the default (<literal>root</literal>) | |
configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper -c home delete 89 90</command> | |
</term> | |
<listitem> | |
<para> | |
Deletes snapshots 89 and 90 for a custom configuration named | |
<literal>home</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper delete --sync 23</command></term> | |
<listitem> | |
<para> | |
Deletes snapshot 23 for the default (<literal>root</literal>) | |
configuration and makes the freed space available immediately. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<tip> | |
<title>Delete unreferenced snapshots</title> | |
<para> | |
Sometimes the Btrfs snapshot is present but the XML file containing the | |
metadata for Snapper is missing. In this case the snapshot is not visible | |
for Snapper and needs to be deleted manually: | |
</para> | |
<screen>btrfs subvolume delete /.snapshots/<replaceable>SNAPSHOTNUMBER</replaceable>/snapshot | |
rm -rf /.snapshots/SNAPSHOTNUMBER</screen> | |
</tip> | |
<tip> | |
<title>Old snapshots occupy more disk space</title> | |
<para> | |
If you delete snapshots to free space on your hard disk, make sure to | |
delete old snapshots first. The older a snapshot is, the more disk space | |
it occupies. | |
</para> | |
</tip> | |
<para> | |
Snapshots are also automatically deleted by a daily cron job. Refer to | |
<xref linkend="sec-snapper-manage-metadata-cleanup" role="internalbook"/> for details. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-snapper-clean-up"> | |
<title>Automatic snapshot clean-up</title> | |
<para> | |
Snapshots occupy disk space and over time the amount of disk space occupied | |
by the snapshots may become large. To prevent disks from running out of | |
space, Snapper offers algorithms to automatically delete old snapshots. | |
These algorithms differentiate between timeline snapshots and numbered | |
snapshots (administration plus installation snapshot pairs). You can specify | |
the number of snapshots to keep for each type. | |
</para> | |
<para> | |
In addition to that, you can optionally specify a disk space quota, defining | |
the maximum amount of disk space the snapshots may occupy. It is also | |
possible to automatically delete pre and post snapshots pairs that do not | |
differ. | |
</para> | |
<para> | |
A clean-up algorithm is always bound to a single Snapper configuration, so | |
you need to configure algorithms for each configuration. To | |
prevent certain snapshots from being automatically deleted, refer to | |
<xref linkend="faq-snapper-permanent" role="internalbook"/>. | |
</para> | |
<para> | |
The default setup (<literal>root</literal>) is configured to do clean-up | |
for numbered snapshots and empty pre and post snapshot pairs. Quota support | |
is enabled—snapshots may not occupy more than 50% of the available | |
disk space of the root partition. Timeline snapshots are disabled by | |
default, therefore the timeline clean-up algorithm is also disabled. | |
</para> | |
<sect2 xml:id="sec-snapper-clean-up-number"> | |
<title>Cleaning up numbered snapshots</title> | |
<para> | |
Cleaning up numbered snapshots—administration plus installation | |
snapshot pairs—is controlled by the following parameters of a Snapper | |
configuration. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>NUMBER_CLEANUP</literal> | |
</term> | |
<listitem> | |
<para> | |
Enables or disables clean-up of installation and admin snapshot pairs. | |
If enabled, snapshot pairs are deleted when the total snapshot count | |
exceeds a number specified with <literal>NUMBER_LIMIT</literal> and/or | |
<literal>NUMBER_LIMIT_IMPORTANT</literal> <emphasis>and</emphasis> an | |
age specified with <literal>NUMBER_MIN_AGE</literal>. Valid values: | |
<literal>yes</literal> (enable), <literal>no</literal> (disable). | |
</para> | |
<para> | |
The default value is <literal>"yes"</literal>. | |
</para> | |
<para> | |
Example command to change or set: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> set-config "NUMBER_CLEANUP=no"</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>NUMBER_LIMIT</literal> / | |
<literal>NUMBER_LIMIT_IMPORTANT</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines how many regular and/or important installation and | |
administration snapshot pairs to keep. Ignored if | |
<literal>NUMBER_CLEANUP</literal> is set to | |
<literal>"no"</literal>. | |
</para> | |
<para> | |
The default value is <literal>"2-10"</literal> for | |
<literal>NUMBER_LIMIT</literal> and <literal>"4-10"</literal> | |
for <literal>NUMBER_LIMIT_IMPORTANT</literal>. The cleaning | |
algorithms delete snapshots above the specified maximum value, | |
without taking the snapshot and file system space into | |
account. The algorithms also delete snapshots above the minimum | |
value until the limits for the snapshot and file system are | |
reached. | |
</para> | |
<para> | |
Example command to change or set: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> set-config "NUMBER_LIMIT=10"</screen> | |
<important> | |
<title>Ranged compared to constant values</title> | |
<para> | |
In case quota support is enabled (see | |
<xref linkend="sec-snapper-clean-up-quota" role="internalbook"/>) the limit needs | |
to be specified as a minimum-maximum range, for example | |
<literal>2-10</literal>. If quota support is disabled, a constant | |
value, for example <literal>10</literal>, needs to be provided, | |
otherwise cleaning-up will fail with an error. | |
</para> | |
</important> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>NUMBER_MIN_AGE</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines the minimum age in seconds a snapshot must have before it can | |
automatically be deleted. Snapshots younger than the value specified | |
here will not be deleted, regardless of how many exist. | |
</para> | |
<para> | |
The default value is <literal>"1800"</literal>. | |
</para> | |
<para> | |
Example command to change or set: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> set-config "NUMBER_MIN_AGE=864000"</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<note> | |
<title>Limit and age</title> | |
<para> | |
<literal>NUMBER_LIMIT</literal>, <literal>NUMBER_LIMIT_IMPORTANT</literal> | |
and <literal>NUMBER_MIN_AGE</literal> are always evaluated. Snapshots are | |
only deleted when <emphasis>all</emphasis> conditions are met. | |
</para> | |
<para> | |
If you always want to keep the number of snapshots defined with | |
<literal>NUMBER_LIMIT*</literal> regardless of their age, set | |
<literal>NUMBER_MIN_AGE</literal> to <literal>0</literal>. | |
</para> | |
<para> | |
The following example shows a configuration to keep the last 10 important | |
and regular snapshots regardless of age: | |
</para> | |
<screen>NUMBER_CLEANUP=yes | |
NUMBER_LIMIT_IMPORTANT=10 | |
NUMBER_LIMIT=10 | |
NUMBER_MIN_AGE=0</screen> | |
<para> | |
On the other hand, if you do not want to keep snapshots beyond a certain | |
age, set <literal>NUMBER_LIMIT*</literal> to <literal>0</literal> and | |
provide the age with <literal>NUMBER_MIN_AGE</literal>. | |
</para> | |
<para> | |
The following example shows a configuration to only keep snapshots younger | |
than ten days: | |
</para> | |
<screen>NUMBER_CLEANUP=yes | |
NUMBER_LIMIT_IMPORTANT=0 | |
NUMBER_LIMIT=0 | |
NUMBER_MIN_AGE=864000</screen> | |
</note> | |
</sect2> | |
<sect2 xml:id="sec-snapper-clean-up-timeline"> | |
<title>Cleaning up timeline snapshots</title> | |
<para> | |
Cleaning up timeline snapshots is controlled by the following | |
parameters of a Snapper configuration. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>TIMELINE_CLEANUP</literal> | |
</term> | |
<listitem> | |
<para> | |
Enables or disables clean-up of timeline snapshots. If enabled, | |
snapshots are deleted when the total snapshot count exceeds a number | |
specified with <literal>TIMELINE_LIMIT_*</literal> | |
<emphasis>and</emphasis> an age specified with | |
<literal>TIMELINE_MIN_AGE</literal>. Valid values: | |
<literal>yes</literal>, <literal>no</literal>. | |
</para> | |
<para> | |
The default value is <literal>"yes"</literal>. | |
</para> | |
<para> | |
Example command to change or set: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper -c <replaceable>CONFIG</replaceable> set-config "TIMELINE_CLEANUP=yes"</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>TIMELINE_LIMIT_DAILY</literal>, | |
<literal>TIMELINE_LIMIT_HOURLY</literal>, | |
<literal>TIMELINE_LIMIT_MONTHLY</literal>, | |
<literal>TIMELINE_LIMIT_WEEKLY</literal>, | |
<literal>TIMELINE_LIMIT_YEARLY</literal> | |
</term> | |
<listitem> | |
<para> | |
Number of snapshots to keep for hour, day, month, week, and year. | |
</para> | |
<para> | |
The default value for each entry is <literal>"10"</literal>, except for | |
<literal>TIMELINE_LIMIT_WEEKLY</literal>, which is set to | |
<literal>"0"</literal> by default. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>TIMELINE_MIN_AGE</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines the minimum age in seconds a snapshot must have before it can | |
automatically be deleted. | |
</para> | |
<para> | |
The default value is <literal>"1800"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<example xml:id="ex-snapper-config-timeline"> | |
<title>Example timeline configuration</title> | |
<screen>TIMELINE_CLEANUP="yes" | |
TIMELINE_CREATE="yes" | |
TIMELINE_LIMIT_DAILY="7" | |
TIMELINE_LIMIT_HOURLY="24" | |
TIMELINE_LIMIT_MONTHLY="12" | |
TIMELINE_LIMIT_WEEKLY="4" | |
TIMELINE_LIMIT_YEARLY="2" | |
TIMELINE_MIN_AGE="1800"</screen> | |
<para> | |
This example configuration enables hourly snapshots which are | |
automatically cleaned up. <literal>TIMELINE_MIN_AGE</literal> and | |
<literal>TIMELINE_LIMIT_*</literal> are always both evaluated. In this | |
example, the minimum age of a snapshot before it can be deleted is set to | |
30 minutes (1800 seconds). Since we create hourly snapshots, this ensures | |
that only the latest snapshots are kept. If | |
<literal>TIMELINE_LIMIT_DAILY</literal> is set to not zero, this means | |
that the first snapshot of the day is kept, too. | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<title>Snapshots to be kept</title> | |
<listitem> | |
<para> | |
Hourly: The last 24 snapshots that have been made. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Daily: The first daily snapshot that has been made is kept from the last | |
seven days. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Monthly: The first snapshot made on the last day of the month is kept | |
for the last twelve months. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Weekly: The first snapshot made on the last day of the week is kept from | |
the last four weeks. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Yearly: The first snapshot made on the last day of the year is kept for | |
the last two years. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</example> | |
</sect2> | |
<sect2 xml:id="sec-snapper-clean-up-empty"> | |
<title>Cleaning up snapshot pairs that do not differ</title> | |
<para> | |
As explained in <xref linkend="snapper-snapshot-type" role="internalbook"/>, whenever you run a | |
YaST module or execute Zypper, a pre snapshot is created on start-up and | |
a post snapshot is created when exiting. In case you have not made any | |
changes there will be no difference between the pre and post snapshots. | |
Such <quote>empty</quote> snapshot pairs can be automatically be deleted by | |
setting the following parameters in a Snapper configuration: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>EMPTY_PRE_POST_CLEANUP</literal> | |
</term> | |
<listitem> | |
<para> | |
If set to <literal>yes</literal>, pre and post snapshot pairs that do | |
not differ will be deleted. | |
</para> | |
<para> | |
The default value is <literal>"yes"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>EMPTY_PRE_POST_MIN_AGE</literal> | |
</term> | |
<listitem> | |
<para> | |
Defines the minimum age in seconds a pre and post snapshot pair that | |
does not differ must have before it can automatically be deleted. | |
</para> | |
<para> | |
The default value is <literal>"1800"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-snapper-clean-up-manual"> | |
<title>Cleaning up manually created snapshots</title> | |
<para> | |
Snapper does not offer custom clean-up algorithms for manually created | |
snapshots. However, you can assign the number or timeline clean-up | |
algorithm to a manually created snapshot. If you do so, the snapshot will | |
join the <quote>clean-up queue</quote> for the algorithm you specified. | |
You can specify a clean-up algorithm when creating a snapshot, or by | |
modifying an existing snapshot: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><command>snapper create --description "Test" --cleanup-algorithm number</command> | |
</term> | |
<listitem> | |
<para> | |
Creates a stand-alone snapshot (type single) for the default (root) | |
configuration and assigns the <literal>number</literal> clean-up | |
algorithm. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>snapper modify --cleanup-algorithm "timeline" 25</command> | |
</term> | |
<listitem> | |
<para> | |
Modifies the snapshot with the number 25 and assigns the clean-up | |
algorithm <literal>timeline</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-snapper-clean-up-quota"> | |
<title>Adding disk quota support</title> | |
<para> | |
In addition to the number and/or timeline clean-up algorithms described | |
above, Snapper supports quotas. You can define what percentage of the | |
available space snapshots are allowed to occupy. This percentage value | |
always applies to the Btrfs subvolume defined in the respective Snapper | |
configuration. | |
</para> | |
<para> | |
Btrfs quotas are applied to subvolumes, not to users. You may apply | |
disk space quotas to users and groups (for example, with the | |
<command>quota</command> command) in addition to using Btrfs quotas. | |
</para> | |
<para> | |
If Snapper was enabled during the installation, quota support is | |
automatically enabled. In case you manually enable Snapper at a later point | |
in time, you can enable quota support by running <command>snapper | |
setup-quota</command>. This requires a valid configuration (see | |
<xref linkend="sec-snapper-config" role="internalbook"/> for more information). | |
</para> | |
<para> | |
Quota support is controlled by the following parameters of a Snapper | |
configuration. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>QGROUP</literal> | |
</term> | |
<listitem> | |
<para> | |
The Btrfs quota group used by Snapper. If not set, run <command>snapper | |
setup-quota</command>. If already set, only change if you are familiar | |
with <command>man 8 btrfs-qgroup</command>. This value is set with | |
<command>snapper setup-quota</command> and should not be changed. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>SPACE_LIMIT</literal> | |
</term> | |
<listitem> | |
<para> | |
Limit of space snapshots are allowed to use in fractions of 1 (100%). | |
Valid values range from 0 to 1 (0.1 = 10%, 0.2 = 20%, ...). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The following limitations and guidelines apply: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Quotas are only activated in <emphasis>addition</emphasis> to an existing | |
number and/or timeline clean-up algorithm. If no clean-up algorithm is | |
active, quota restrictions are not applied. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
With quota support enabled, Snapper will perform two clean-up runs if | |
required. The first run will apply the rules specified for number and | |
timeline snapshots. Only if the quota is exceeded after this run, the | |
quota-specific rules will be applied in a second run. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Even if quota support is enabled, Snapper will always keep the number of | |
snapshots specified with the <literal>NUMBER_LIMIT*</literal> and | |
<literal>TIMELINE_LIMIT*</literal> values, even if the quota will be | |
exceeded. It is therefore recommended to specify ranged values | |
(<literal><replaceable>MIN</replaceable>-<replaceable>MAX</replaceable></literal>) | |
for <literal>NUMBER_LIMIT*</literal> and | |
<literal>TIMELINE_LIMIT*</literal> to ensure the quota can be applied. | |
</para> | |
<para> | |
If, for example, <literal>NUMBER_LIMIT=5-20</literal> is set, Snapper | |
will perform a first clean-up run and reduce the number of regular | |
numbered snapshots to 20. In case these 20 snapshots exceed the | |
quota, Snapper will delete the oldest ones in a second run until the | |
quota is met. A minimum of five snapshots will always be kept, regardless | |
of the amount of space they occupy. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
</sect1> | |
<sect1> | |
<title>Showing exclusive disk space used by snapshots</title> | |
<para> | |
Snapshots share data, for efficient use of storage space, so using ordinary | |
commands like <command>du</command> and <command>df</command> will not measure | |
used disk space accurately. When you want to free up disk space on Btrfs | |
with quotas enabled, you need to know how much exclusive disk space is | |
used by each snapshot, rather than shared space. Snapper 0.6 and up reports | |
the used disk space for each snapshot in the | |
<literal>Used Space</literal> column: | |
</para> | |
<screen><prompt role="root"># </prompt>snapper--iso list | |
# | Type | Pre # | Date | User | Used Space | Cleanup | Description | Userdata | |
----+--------+-------+---------------------+------+------------+---------+-----------------------+-------------- | |
0 | single | | | root | | | current | | |
1* | single | | 2019-07-22 13:08:38 | root | 16.00 KiB | | first root filesystem | | |
2 | single | | 2019-07-22 14:21:05 | root | 14.23 MiB | number | after installation | important=yes | |
3 | pre | | 2019-07-22 14:26:03 | root | 144.00 KiB | number | zypp(zypper) | important=no | |
4 | post | 3 | 2019-07-22 14:26:04 | root | 112.00 KiB | number | | important=no | |
5 | pre | | 2019-07-23 08:19:36 | root | 128.00 KiB | number | zypp(zypper) | important=no | |
6 | post | 5 | 2019-07-23 08:19:43 | root | 80.00 KiB | number | | important=no | |
7 | pre | | 2019-07-23 08:20:50 | root | 256.00 KiB | number | yast sw_single | | |
8 | pre | | 2019-07-23 08:23:22 | root | 112.00 KiB | number | zypp(ruby.ruby2.5) | important=no | |
9 | post | 8 | 2019-07-23 08:23:35 | root | 64.00 KiB | number | | important=no | |
10 | post | 7 | 2019-07-23 08:24:05 | root | 16.00 KiB | number | | | |
</screen> | |
<para> | |
The <command>btrfs</command> command provides another view of space used by | |
snapshots: | |
</para> | |
<screen> | |
<prompt role="root"># </prompt>btrfs qgroup show -p / | |
qgroupid rfer excl parent | |
-------- ---- ---- ------ | |
0/5 16.00KiB 16.00KiB --- | |
[...] | |
0/272 3.09GiB 14.23MiB 1/0 | |
0/273 3.11GiB 144.00KiB 1/0 | |
0/274 3.11GiB 112.00KiB 1/0 | |
0/275 3.11GiB 128.00KiB 1/0 | |
0/276 3.11GiB 80.00KiB 1/0 | |
0/277 3.11GiB 256.00KiB 1/0 | |
0/278 3.11GiB 112.00KiB 1/0 | |
0/279 3.12GiB 64.00KiB 1/0 | |
0/280 3.12GiB 16.00KiB 1/0 | |
1/0 3.33GiB 222.95MiB --- | |
</screen> | |
<para> | |
The <literal>qgroupid</literal> column displays the identification number for | |
each subvolume, assigning a qgroup level/ID combination. | |
</para> | |
<para> | |
The <literal>rfer</literal> column displays the total amount of data | |
referred to in the subvolume. | |
</para> | |
<para> | |
The <literal>excl</literal> column displays the exclusive data in each | |
subvolume. | |
</para> | |
<para> | |
The <literal>parent</literal> column shows the parent qgroup of the subvolumes. | |
</para> | |
<para> | |
The final item, <literal>1/0</literal>, shows the totals for the parent | |
qgroup. In the above example, 222.95 MiB will be freed if all subvolumes | |
are removed. Run the following command to see which snapshots are associated | |
with each subvolume: | |
</para> | |
<screen><prompt role="root"># </prompt>btrfs subvolume list -st / | |
ID gen top level path | |
-- --- --------- ---- | |
267 298 266 @/.snapshots/1/snapshot | |
272 159 266 @/.snapshots/2/snapshot | |
273 170 266 @/.snapshots/3/snapshot | |
274 171 266 @/.snapshots/4/snapshot | |
275 287 266 @/.snapshots/5/snapshot | |
276 288 266 @/.snapshots/6/snapshot | |
277 292 266 @/.snapshots/7/snapshot | |
278 296 266 @/.snapshots/8/snapshot | |
279 297 266 @/.snapshots/9/snapshot | |
280 298 266 @/.snapshots/10/snapshot | |
</screen> | |
<para> | |
Doing an upgrade from one service pack to another results in snapshots | |
occupying a lot of disk space on the system subvolumes. Manually deleting | |
these snapshots after they are no longer needed is recommended. See | |
<xref linkend="sec-snapper-manage-delete" role="internalbook"/> for details. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-snapper-faqs"> | |
<title>Frequently asked questions</title> | |
<qandaset defaultlabel="qanda"> | |
<qandaentry> | |
<question> | |
<para> | |
Why does Snapper never show changes in <filename>/var/log</filename>, | |
<filename>/tmp</filename> and other directories? | |
</para> | |
</question> | |
<answer> | |
<para> | |
For some directories we decided to exclude them from snapshots. See | |
<xref linkend="snapper-dir-excludes" role="internalbook"/> for a list and reasons. To exclude | |
a path from snapshots we create a subvolume for that path. | |
</para> | |
</answer> | |
</qandaentry> | |
<qandaentry> | |
<question> | |
<para> | |
Can I boot a snapshot from the boot loader? | |
</para> | |
</question> | |
<answer> | |
<para> | |
Yes—refer to <xref linkend="sec-snapper-snapshot-boot" role="internalbook"/> for | |
details. | |
</para> | |
</answer> | |
</qandaentry> | |
<qandaentry xml:id="faq-snapper-permanent"> | |
<question> | |
<para> | |
Can a snapshot be protected from deletion? | |
</para> | |
</question> | |
<answer> | |
<para> | |
Currently Snapper does not offer means to prevent a snapshot from being | |
deleted manually. However, you can prevent snapshots from being | |
automatically deleted by clean-up algorithms. Manually created snapshots | |
(see <xref linkend="sec-snapper-manage-create" role="internalbook"/>) have no clean-up | |
algorithm assigned unless you specify one with | |
<option>--cleanup-algorithm</option>. Automatically created snapshots | |
always either have the <literal>number</literal> or | |
<literal>timeline</literal> algorithm assigned. To remove such an | |
assignment from one or more snapshots, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
List all available snapshots: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper list -a</screen> | |
</step> | |
<step> | |
<para> | |
Memorize the number of the snapshot(s) you want to prevent from being | |
deleted. | |
</para> | |
</step> | |
<step> | |
<para> | |
Run the following command and replace the number placeholders with the | |
number(s) you memorized: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> snapper modify --cleanup-algorithm "" <replaceable>#1</replaceable> <replaceable>#2</replaceable> <replaceable>#n</replaceable></screen> | |
</step> | |
<step> | |
<para> | |
Check the result by running <command>snapper list -a</command> again. | |
The entry in the column <literal>Cleanup</literal> should now be empty | |
for the snapshots you modified. | |
</para> | |
</step> | |
</procedure> | |
</answer> | |
</qandaentry> | |
<qandaentry> | |
<question> | |
<para> | |
Where can I get more information on Snapper? | |
</para> | |
</question> | |
<answer> | |
<para> | |
See the Snapper home page at <link xlink:href="http://snapper.io/"/>. | |
</para> | |
</answer> | |
</qandaentry> | |
</qandaset> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-klp" xml:lang="en"> | |
<title>Live kernel patching with KLP</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
This document describes the basic principles of the Kernel Live Patching (KLP) | |
technology, and provides usage guidelines for the SLE Live Patching | |
service. | |
</para> | |
</abstract> | |
</info> | |
<para> | |
KLP makes it possible to apply the latest security updates to Linux | |
kernels without rebooting. This maximizes system uptime and availability, | |
which is especially important for mission-critical systems. | |
</para> | |
<para> | |
The information provided in this document relates to the AMD64/Intel 64, | |
POWER, and IBM Z architectures. | |
</para> | |
<sect1 xml:id="sec-klp-advantages"> | |
<title>Advantages of Kernel Live Patching</title> | |
<para> | |
KLP offers several benefits. | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Keeping a large number of servers automatically up to date is essential | |
for organizations obtaining or maintaining certain compliance | |
certifications. KLP can help achieve compliance, while reducing the | |
need for costly maintenance windows. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Companies that work with service-level agreement contracts must guarantee | |
a specific level of their system accessibility and uptime. Live patching | |
makes it possible to patch systems without incurring downtime. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Since KLP is part of the standard system update mechanism, there is no | |
need for specialized training or introduction of complicated maintenance | |
routines. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 xml:id="sec-klp-overview"> | |
<title>Kernel Live Patching overview</title> | |
<para> | |
Kernel live patches are delivered as packages with modified code that are | |
separate from the main kernel package. The live patches are cumulative, so | |
the latest patch contains all fixes from the previous ones for the kernel | |
package. Each kernel live package is tied to the exact kernel revision for | |
which it is issued. The live patch package version number increases with | |
every addition of fixes. | |
</para> | |
<important> | |
<title>Live patches compared to kernel updates</title> | |
<para> | |
Live patches contain only critical fixes, and they do not replace regular | |
kernel updates that require a reboot. Consider live patches as temporary | |
measures that protect the kernel until a proper kernel update and a reboot | |
are performed. | |
</para> | |
</important> | |
<para> | |
The diagram below illustrates the overall relationship between live patches | |
and kernel updates. The list of CVEs and defect reports addressed by the | |
currently active live patch can be viewed using the <command>klp -v | |
patches</command> command. | |
</para> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="klp.png" width="80%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="klp.png" width="100%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
<para> | |
It is possible to have multiple versions of the kernel package installed | |
along with their live patches. These packages do not conflict. You can | |
install updated kernel packages along with live patches for the running | |
kernel. In this case, you may be prompted to reboot the system. Users with | |
SLE Live Patching subscriptions are eligible for technical support as | |
long as there are live patch updates for the running kernel (see | |
<xref linkend="sec-klp-lifecycle" role="internalbook"/>). | |
</para> | |
<para> | |
With KLP activated, every kernel update comes with a live patch package. | |
This live patch does not contain any fixes and serves as a seed for future | |
live patches for the corresponding kernel. These empty seed patches are | |
called <literal>initial patches</literal>. | |
</para> | |
<sect2 xml:id="sec-klp-scope"> | |
<title>Kernel Live Patching scope</title> | |
<para> | |
The scope of SLE Live Patching includes fixes for SUSE Common | |
Vulnerability Scoring System (CVSS; SUSE CVSS is based on the CVSS v3.0 | |
system) level 7+ vulnerabilities and bug fixes related to system stability | |
or data corruption. However, it may not be technically feasible to create | |
live patches for all fixes that fall under the specified categories. SUSE | |
therefore reserves the right to skip fixes in situations where creating a | |
kernel live patch is not possible for technical reasons. Currently, over | |
95% of qualifying fixes are released as live patches. For more information | |
on CVSS (the base for the SUSE CVSS rating), see | |
<link xlink:href="https://www.first.org/cvss/">Common Vulnerability Scoring | |
System SIG</link>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-klp-limitations"> | |
<title>Kernel Live Patching limitations</title> | |
<para> | |
KLP involves replacing functions and gracefully handling replacement of | |
interdependent function sets. This is done by redirecting calls to old code | |
to updated code in a different memory location. Changes in data structures | |
make the situation more complicated, as the data remain in place and cannot | |
be extended or reinterpreted. While there are techniques that allow | |
indirect alteration of data structures, some fixes cannot be converted to | |
live patches. In this situation, a system restart is the only way to apply | |
the fixes. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-klp-enable-with-yast2"> | |
<title>Activating Kernel Live Patching using YaST</title> | |
<para> | |
To activate KLP on your system, you need to have active SLES and SLE | |
Live Patching subscriptions. Visit | |
<link xlink:href="https://scc.suse.com/">SUSE Customer Center</link> to check the status of your | |
subscriptions and obtain a registration code for the SLE Live Patching | |
subscription. | |
</para> | |
<para> | |
To activate Kernel Live Patching on your system, follow these steps: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Run the <command>yast2 registration</command> command and click | |
<guimenu>Select Extensions</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select <guimenu>SUSE Linux Enterprise Live Patching 15</guimenu> in the | |
list of available extensions and click <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm the license terms and click <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter your SLE Live Patching registration code and click | |
<guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Check the <guimenu>Installation Summary</guimenu> and selected | |
<guimenu>Patterns</guimenu>. The patterns <systemitem>Live | |
Patching</systemitem> and <systemitem>SLE Live Patching Lifecycle | |
Data</systemitem> should be automatically selected for installation along | |
with additional packages to satisfy dependencies. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Accept</guimenu> to complete the installation. This will | |
install the base Kernel Live Patching components on your system, the initial live patch, | |
and the required dependencies. | |
</para> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-klp-enable-cli"> | |
<title>Activating Kernel Live Patching from the command line</title> | |
<para> | |
To activate Kernel Live Patching, you need to have active SLES and SLES Live Patching | |
subscriptions. Visit <link xlink:href="https://scc.suse.com/">SUSE Customer Center</link> to check the | |
status of your subscriptions and obtain a registration code for the SLES | |
Live Patching subscription. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Run <command>sudo SUSEConnect --list-extensions</command>. Note the exact | |
activation command for SLES Live Patching. Example command output | |
(abbreviated): | |
</para> | |
<screen>$ SUSEConnect --list-extensions | |
... | |
SUSE Linux Enterprise Live Patching <phrase role="productnumber"><phrase os="sles;sled">15 SP5</phrase></phrase> x86_64 | |
Activate with: SUSEConnect -p sle-module-live-patching/15.5/x86_64 \ | |
-r ADDITIONAL REGCODE</screen> | |
</step> | |
<step> | |
<para> | |
Activate SLES Live Patching using the obtained command followed by | |
<option>-r | |
<replaceable>LIVE_PATCHING_REGISTRATION_CODE</replaceable></option>, for | |
example: | |
</para> | |
<screen>SUSEConnect -p sle-module-live-patching/15.5/x86_64 \ | |
-r <replaceable>LIVE_PATCHING_REGISTRATION_CODE</replaceable></screen> | |
</step> | |
<step> | |
<para> | |
Install the required packages and dependencies using the command | |
<command>zypper install -t pattern lp_sles</command> | |
</para> | |
</step> | |
</procedure> | |
<para> | |
At this point, the system has already been live-patched. | |
</para> | |
<para> | |
Here is how the process works behind the scenes: When the | |
package installation system detects that there is an installed kernel that | |
can be live-patched, and that there is a live patch for it in the software | |
channel, the system selects the live patch for installation. The kernel then | |
receives the live patch fixes <emphasis>as part of the package | |
installation</emphasis>. The kernel gets live-patched even before the | |
product installation is complete. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-klp-perform"> | |
<title>Performing Kernel Live Patching</title> | |
<para> | |
Kernel live patches are installed as part of regular system updates. | |
However, there are several things you should be aware of. | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
The kernel is live-patched if a <package>kernel-livepatch-*</package> | |
package has been installed for the running kernel. You can use the command | |
<command>zypper se --details kernel-livepatch-*</command> to check what | |
kernel live patch packages are installed on your system. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
When <package>kernel-default</package> package is installed, the update | |
manager prompts you to reboot the system. To prevent this message from | |
appearing, you can filter out kernel updates from the patching operation. | |
This can be done by adding package locks with Zypper. SUSE Manager also makes | |
it possible to filter channel contents (see | |
<link xlink:href="https://documentation.suse.com/external-tree/en-us/suma/4.1/suse-manager/administration/live-patching.html">Live | |
Patching with SUSE Manager</link>). | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
You can check patching status using the <command>klp status</command> | |
command. To examine installed patches, run the <command>klp -v | |
patches</command> command. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Keep in mind that while there may be multiple kernel packages installed on | |
the system, only one of them is running at any given time. Similarly, | |
there may be multiple live patch packages installed, but only one live | |
patch is loaded into the kernel. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The active live patch is included in the <literal>initrd</literal>. This | |
means that in case of an unexpected reboot, the system comes up with the | |
live patch fixes applied, so there is no need to perform patching again. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<sect2 xml:id="sec-klp-lifecycle"> | |
<title>Checking expiration date of the live patch</title> | |
<para> | |
Make sure that the | |
<package>lifecycle-data-sle-module-live-patching</package> is installed, | |
then run the <command>zypper lifecycle</command> command. You should see | |
expiration dates for live patches in the <literal>Package end of support if | |
different from product</literal> section of the output. | |
</para> | |
<para> | |
Every live patch receives updates for one year from the release of the | |
underlying kernel package. The | |
<link xlink:href="https://www.suse.com/products/live-patching/current-patches/">Maintained | |
kernels, patch updates and lifecycle</link> page allows you to check | |
expiration dates based on the running kernel version without installing the | |
product extension. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-klp-troubleshoot"> | |
<title>Troubleshooting Kernel Live Patching issues</title> | |
<sect2 xml:id="sec-klp-man-patch-downgrade"> | |
<title>Manual patch downgrade</title> | |
<para> | |
If you find the latest live patch problematic, you can downgrade the | |
currently installed live patch back to its previous version. We recommend | |
performing patch downgrade before the system starts exhibiting issues. Keep | |
in mind that a system with kernel warnings or kernel error traces in the | |
system log may not be suitable for the patch downgrade procedure. If you | |
are unsure whether the system meets the requirements for a patch downgrade, | |
contact SUSE Technical Support for help. | |
</para> | |
<procedure> | |
<title>Manual patch downgrade</title> | |
<step> | |
<para> | |
Identify the running live patch using the <command>klp -v | |
patches</command> command. You can see the currently running patch on the | |
line starting with <literal>RPM:</literal>. For example: | |
</para> | |
<screen>RPM: kernel-livepatch-5_3_18-24_29-default-2-2.1.x86_64</screen> | |
<para> | |
The <literal>5_3_18-24_29-default</literal> in the example above denotes | |
the exact running kernel version. | |
</para> | |
</step> | |
<step> | |
<para> | |
Use the command <command>zypper search -s | |
kernel-livepatch-<replaceable>RUNNING_KERNEL_VERSION</replaceable>-default</command> | |
to search for previous versions of the patch. The command returns a list | |
of available package versions. Keep in mind that for every new live patch | |
package release, the version number increases by one. Make sure that you | |
choose the version number one release lower than the current one. | |
</para> | |
</step> | |
<step> | |
<para> | |
Install the desired version with the command <command>zypper in | |
--oldpackage | |
kernel-livepatch-<replaceable>RUNNING_KERNEL_VERSION</replaceable>-default=<replaceable>DESIRED_VERSION</replaceable></command>. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-ulp" xml:lang="en"> | |
<title>User space live patching</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
This chapter describes the basic principles and usage of user space live patching. | |
</para> | |
</abstract> | |
</info> | |
<sect1 xml:id="sec-ulp"> | |
<title>About user space live patching</title> | |
<para> | |
User space live patching (ULP) refers to the process of applying patches | |
to the libraries used by a running process, without interrupting it. Live | |
patching operations are performed using the <systemitem>ulp</systemitem> | |
tool that is part of the <systemitem>libpulp</systemitem>. | |
</para> | |
<para> | |
<systemitem>libpulp</systemitem> is a framework that enables user space live patching. It | |
consists of the <systemitem>libpulp.so</systemitem> library and tools for | |
making libraries live-patchable and applying live patches (the | |
<systemitem>ulp</systemitem> binary). | |
</para> | |
<sect2 xml:id="sec-ulp-prereqs"> | |
<title>Prerequisites</title> | |
<para> | |
For ULP to work, two requirements must be met. | |
</para> | |
<itemizedlist> | |
<listitem os="sles;sled"> | |
<para> | |
Install the ULP on your system by running: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> zypper in libpulp0 libpulp-tools</screen> | |
</listitem> | |
<listitem> | |
<para> | |
To be live-patchable, a library must be compiled with the | |
<option>-fpatchable-function-entry</option> GCC flag. No changes to the | |
library source code are required. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Processes must preload the <systemitem>libpulp.so</systemitem> library. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
<sect2 xml:id="sec-ulp-libpulp"> | |
<title>Using libpulp</title> | |
<para> | |
To use <systemitem>libpulp</systemitem> with an application, you must | |
perform the following steps: | |
</para> | |
<orderedlist> | |
<listitem> | |
<para> | |
Make a library live-patchable. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
When launching the application, preload <systemitem>libpulp</systemitem> | |
with the <command>LD_PRELOAD=/usr/lib64/libpulp.so | |
./<replaceable>APPLICATION</replaceable></command> command. | |
</para> | |
</listitem> | |
</orderedlist> | |
<sect3 xml:id="sec-ulp-prep-lib"> | |
<title>Preparing a library to be live-patchable</title> | |
<para> | |
For a library to be live-patchable, it must contain a | |
<literal>NOP</literal> prologue in all function calls. GCC version 8 and | |
higher, as well as the GCC version that ships with SUSE Linux Enterprise Server, provides the | |
<option>-fpatchable-function-entry</option> specifically for that purpose. | |
Thus, on the AMD64/Intel 64 architecture, compiling a library written in C with | |
<option>-fpatchable-function-entry=16,14</option> flag is sufficient to | |
make it live-patchable. | |
</para> | |
<para> | |
The libraries provided by the system packages glibc and openssl | |
(libopenssl_1_1) are already live-patchable on <phrase role="productname"><phrase os="sles">SLES</phrase></phrase> <phrase role="productnumber"><phrase os="sles;sled">15 SP5</phrase></phrase>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-ulp-livepatch-check"> | |
<title>Checking if a library is live-patchable</title> | |
<para> | |
To check whether a library is live-patchable, use the following command: | |
</para> | |
<screen>ulp livepatchable <replaceable>LIBRARY</replaceable></screen> | |
</sect3> | |
<sect3 xml:id="sec-ulp-livepatch-container-check"> | |
<title>Checking if a <filename>.so</filename> file is a live patch container</title> | |
<para> | |
A shared object (<filename>.so</filename>) is a live patch container if it | |
contains the ULP patch description embedded into it. You can verify it | |
with the following command: | |
</para> | |
<screen><prompt>> </prompt>readelf -S <replaceable>SHARED_OBJECT</replaceable> | grep .ulp</screen> | |
<para> | |
If the output shows that there are both <literal>.ulp</literal> and | |
<literal>.ulp.rev</literal> sections in the shared object, then it is a | |
live patch container. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-ulp-apply-livepatch"> | |
<title>Applying live patches</title> | |
<para> | |
Live patches are applied using the <systemitem>ulp trigger</systemitem> | |
command, for example: | |
</para> | |
<screen>ulp trigger -p <replaceable>PID</replaceable> <replaceable>LIVEPATCH</replaceable>.ulp</screen> | |
<para> | |
In this example, <literal>PID</literal> is the PID of the running process | |
that uses the library to be patched and <literal>LIVEPATCH.ulp</literal> | |
is the actual live patch file. | |
</para> | |
<para> | |
The <literal>live patching succeeded</literal> message indicates that the | |
live-patching operation was successful. | |
</para> | |
<para> | |
It is also possible to apply multiple live patches by using wildcards. For | |
example: | |
</para> | |
<screen><prompt>> </prompt>ulp trigger -p <replaceable>PID</replaceable> '*.so'</screen> | |
<para> | |
This command will try to apply every patch in the current folder to the | |
process holding <literal>PID</literal>. In the end, the tool will show how | |
many patches it successfully applied. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-ulp-revert-livepatch"> | |
<title>Reverting live patches</title> | |
<para> | |
<command>ulp trigger</command> can be used to revert live patches. There | |
are two ways to revert live patches. You can revert a live patch by using | |
the <option>--revert</option> switch and passing the live patch container: | |
</para> | |
<screen><prompt>> </prompt>ulp trigger -p <replaceable>PID</replaceable> --revert <replaceable>LIVEPATCH</replaceable>.so</screen> | |
<para> | |
Alternatively, it is possible to remove all patches associated with a | |
particular library. For example: | |
</para> | |
<screen>ulp trigger -p <replaceable>PID</replaceable> --revert-all=<replaceable>LIBRARY</replaceable></screen> | |
<para> | |
In the example above, <replaceable>LIBRARY</replaceable> refers to the | |
actual library, for example: <systemitem>libcrypto.so.1.1</systemitem>. | |
</para> | |
<para> | |
The latter approach can be useful when the source code of the original | |
live patch is not available, or you want to remove a specific old patch | |
and apply a new one, without the target application running potentially | |
unsecured code. For example: | |
</para> | |
<screen><prompt>> </prompt>ulp trigger -p <replaceable>PID</replaceable> --revert-all=libcrypto.so.1.1 new_livepatch2.so</screen> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-ulp-info"> | |
<title>More information</title> | |
<para> | |
Further information about <systemitem>libpulp</systemitem> is available in | |
the project's <link xlink:href="https://github.com/SUSE/libpulp">Git | |
repository</link>. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-transactional-updates" xml:lang="en"> | |
<title>Transactional updates</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
Transactional updates are available in <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> as a technology | |
preview, for updating SLES when the root file system is read-only. | |
Transactional updates are atomic (all updates are applied only if all | |
updates succeed) and support rollbacks. It does not affect a running system | |
as no changes are activated until after the system is rebooted. As reboots | |
are disruptive, the admin must decide if a reboot is more expensive than | |
disturbing running services. If reboots are too expensive then do not use | |
transactional updates. | |
</para> | |
<para> | |
Transactional updates are run daily by the | |
<command>transactional-update</command> script. The script checks for | |
available updates. If there are any updates, it creates a new snapshot of | |
the root file system in the background, and then fetches updates from the | |
release channels. After the new snapshot is completely updated, it is | |
marked as active and will be the new default root file system after the next | |
reboot of the system. When <command>transactional-update</command> is set to run | |
automatically (which is the default behavior) it also reboots the system. | |
Both the time that the update runs and the reboot maintenance window are | |
configurable. | |
</para> | |
<para> | |
Only packages that are part of the snapshot of the root file system can be | |
updated. If packages contain files that are not part of the snapshot, the | |
update could fail or break the system. | |
</para> | |
<para> | |
RPMs that require a license to be accepted cannot be updated. | |
</para> | |
</abstract> | |
</info> | |
<sect1 xml:id="sec-tu-limitations"> | |
<title>Limitations of technology preview</title> | |
<para> | |
As a technology preview, there are certain limitations in functionality. The | |
following packages will not work with <command>transactional-update</command>: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
The <package>nginx</package> default index.html page may not be available | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>tomcat-webapps</package> and | |
<package>tomcat-admin-webapps</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>phpMyAdmin</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>sca-appliance-*</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>mpi-selector</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>emacs</package> works except for Emacs games | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>bind</package> and <package>bind-chrootenv</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>docbook*</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>sblim-sfcb*</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>texlive*</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>iso_ent</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>openjade</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>opensp</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>pcp</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>plymouth</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>postgresql-server-10</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>pulseaudio-gdm-hooks</package> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>smartmontools</package> | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
The updater component of the system installer does not work with a read-only | |
file system as it has no support for transactional updates. | |
</para> | |
<para> | |
Further considerations: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
In general it is a good idea to minimize the time between updating the | |
system and rebooting the machine. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Only one update can be applied at a time. Be sure to reboot after an | |
update, and before the next update is applied. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<command>update-alternatives</command> should not be run after a | |
transactional update until the machine has been rebooted. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Do not create new system users or system groups after a transactional | |
update until after reboot. It is acceptable to create normal users and | |
groups (UID > 1000, GID > 1000). | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
YaST is not yet aware of transactional updates. If a YaST module needs | |
to install additional packages, this will not work. Normal system | |
operations only modifying configuration files in <filename>/etc</filename> | |
will work. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
For <package>php7-fastcgi</package>, you must manually create a symbolic link, | |
<filename>/srv/www/cgi-bin/php</filename>, that points to | |
<filename>/usr/bin/php-cgi</filename>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>ntp</package>is part of the Legacy Module for migration from | |
older SLES versions. It is not supported on a new <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> | |
installation, and has been replaced by <package>chrony</package>. If you | |
continue to use <package>ntp</package>, a fresh installation is required | |
to work correctly with transactional updates. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<package>sblim-sfcb</package>: The whole sblim ecosystem is incompatible | |
with transactional update. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<command>btrfs-defrag</command> from the | |
<package>btrfsmaintenance</package> package does not work with a read-only | |
root file system. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
For <command>btrfs-balance</command>, the variable | |
<literal>BTRFS_BALANCE_MOUNTPOINTS</literal> in | |
<filename>/etc/sysconfig/btrfsmaintenance</filename> must be changed from | |
<literal>/</literal> to <literal>/.snapshots</literal>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
For <command>btrfs-scrub</command>, the variable | |
<literal>BTRFS_SCRUB_MOUNTPOINTS</literal> in | |
<filename>/etc/sysconfig/btrfsmaintenance</filename> must be changed from | |
<literal>/</literal> to <literal>/.snapshots</literal>. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 xml:id="sec-install-tu"> | |
<title>Enabling <package>transactional-update</package></title> | |
<para> | |
You must enable the Transactional Server Module during system installation, | |
and then select the Transactional Server System Role. Installing any package | |
from the Transactional Server Module later in a running system is NOT | |
supported and may break the system. | |
</para> | |
<para> | |
Note that changing the subvolume layout of the root partition, or putting | |
sub-directories or subvolumes of the root partition on their own partitions | |
(except <filename>/home</filename>, <filename>/var</filename>, | |
<filename>/srv</filename>, and <filename>/opt</filename>) is not supported, | |
and will most likely break the system. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-tu-disable"> | |
<title>Managing automatic updates</title> | |
<para> | |
Automatic updates are controlled by a <command>systemd.timer</command> | |
that runs once per day. This applies all updates, and informs | |
<command>rebootmgrd</command> that the machine should be rebooted. You may | |
adjust the time when the update runs, see systemd.timer(5). To adjust the | |
maintenance window, which is when <command>rebootmgrd</command> reboots the | |
system, see rebootmgrd(8). | |
</para> | |
<para> | |
You can disable automatic transactional updates with this command: | |
</para> | |
<screen><prompt role="root"># </prompt><command>systemctl --now disable transactional-update.timer</command></screen> | |
</sect1> | |
<sect1> | |
<title>The <command>transactional-update</command> command</title> | |
<para> | |
The <command>transactional-update</command> command enables atomic installation | |
or removal of updates; updates are applied only | |
if all of them can be successfully installed. | |
<command>transactional-update</command> creates a snapshot of your system | |
before the update is applied, and you can restore this snapshot. All changes become | |
active only after reboot. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>--continue</literal></term> | |
<listitem> | |
<para> | |
The <command>--continue</command> option is for making multiple changes to an | |
existing snapshot without rebooting. | |
</para> | |
<para> | |
The default <command>transactional-update</command> behavior | |
is to create a new snapshot from the current root file system. If you | |
forget something, such as installing a new package, you have to reboot | |
to apply your previous changes, run <command>transactional-update</command> | |
again to install the forgotten package, and reboot again. You cannot run the | |
<command>transactional-update</command> command multiple times without rebooting | |
to add more changes to the snapshot, because that creates separate | |
independent snapshots that do not include changes from the previous snapshots. | |
</para> | |
<para> | |
Use the <command>--continue</command> option to make as many changes as you | |
want without rebooting. A separate snapshot is made each time, and each | |
snapshot contains all the changes you made in the previous snapshots, plus your | |
new changes. Repeat this process as many times as you want, and when the final | |
snapshot includes everything you want reboot the system, and your final snapshot | |
becomes the new root file system. | |
</para> | |
<para> | |
Another useful feature of the <command>--continue</command> option is you may | |
select any existing snapshot as the base for your new snapshot. The following example | |
demonstrates running <command>transactional-update</command> to install a new | |
package in a snapshot based on snapshot 13, and then running it again to install | |
another package: | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update pkg install <replaceable>package_1</replaceable></command></screen> | |
<screen><prompt role="root"># </prompt><command>transactional-update --continue 13 pkg install <replaceable>package_2</replaceable></command></screen> | |
<para> | |
The <command>--continue [num]</command> option calls <command>snapper create --from</command>, | |
see <xref linkend="sec-snapper-manage-create" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>cleanup</literal></term> | |
<listitem> | |
<para> | |
If the current root file system is identical to the active root | |
file system (after a reboot, before <command>transactional-update</command> | |
creates a new snapshot with updates), all old snapshots without a | |
cleanup algorithm get a cleanup algorithm set. This ensures that old | |
snapshots will be deleted by Snapper. (See the section about cleanup | |
algorithms in snapper(8).) This also removes all unreferenced (and thus | |
unused) <filename>/etc</filename> overlay directories in | |
<filename>/var/lib/overlay</filename>: | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update cleanup</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>pkg in/install</literal></term> | |
<listitem> | |
<para> | |
Installs individual packages from the available channels using the | |
<command>zypper install</command> command. This command can also be used | |
to install Program Temporary Fix (PTF) RPM files. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update pkg install <replaceable>package_name</replaceable></command></screen> | |
<para> | |
or | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update pkg install <replaceable>rpm1 rpm2</replaceable></command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>pkg rm/remove</literal></term> | |
<listitem> | |
<para> | |
Removes individual packages from the active snapshot using the | |
<command>zypper remove</command> command. This command can also be used | |
to remove PTF RPM files. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update pkg remove <replaceable>package_name</replaceable></command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>pkg up/update</literal></term> | |
<listitem> | |
<para> | |
Updates individual packages from the active snapshot using the | |
<command>zypper update</command> command. Only packages that are part of | |
the snapshot of the base file system can be updated. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update pkg remove <replaceable>package_name</replaceable></command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>up/update</literal></term> | |
<listitem> | |
<para> | |
If there are new updates available, a new snapshot is created and | |
<command>zypper up/update</command> updates the snapshot. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update up</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>dup</literal></term> | |
<listitem> | |
<para> | |
If there are new updates available, a new snapshot is created and | |
<command>zypper dup –no-allow-vendor-change</command> updates the | |
snapshot. The snapshot is activated afterwards and becomes the new root | |
file system after reboot. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update dup</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>patch</literal></term> | |
<listitem> | |
<para> | |
If there are new updates available, a new snapshot is created and | |
<command>zypper patch</command> updates the snapshot. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update patch</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>rollback</literal></term> | |
<listitem> | |
<para> | |
This sets the default subvolume. On systems with a read-write file system | |
<command>snapper rollback</command> is called. On a read-only file system | |
and without any argument, the current system is set to a new default root | |
file system. If you specify a number, that snapshot is used as the | |
default root file system. On a read-only file system, it does not create | |
any additional snapshots. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update rollback <replaceable>snapshot_number</replaceable></command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>grub.cfg</literal></term> | |
<listitem> | |
<para> | |
This creates a new GRUB2 configuration. Sometimes it is necessary to | |
adjust the boot configuration, for example adding additional kernel | |
parameters. Edit <replaceable>/etc/default/grub</replaceable>, run | |
<command>transactional-update grub.cfg</command>, and then reboot to | |
activate the change. You must immediately reboot, or the new GRUB2 | |
configuration will be overwritten with the default by the next | |
transactional-update. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update grub.cfg</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>reboot</literal></term> | |
<listitem> | |
<para> | |
This parameter triggers a reboot after the action is completed. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update <replaceable>dup</replaceable> reboot</command></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>--help</literal></term> | |
<listitem> | |
<para> | |
This prints a help screen with options and subcommands. | |
</para> | |
<screen><prompt role="root"># </prompt><command>transactional-update --help</command></screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-tu-troubleshooting"> | |
<title>Troubleshooting</title> | |
<para> | |
If the upgrade fails, run <command>supportconfig</command> to collect log | |
data. Provide the resulting files, including | |
<filename>/var/log/transactional-update.log</filename> to SUSE Support. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-vnc"> | |
<title>Remote graphical sessions with VNC</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
<abstract> | |
<para> | |
Virtual Network Computing (VNC) enables you to access a remote computer | |
via a graphical desktop, and run remote graphical applications. VNC is | |
platform-independent and accesses the remote machine from any operating | |
system. This chapter describes how to connect to a VNC server with the | |
desktop clients vncviewer and Remmina, and how to operate a VNC server. | |
</para> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> supports two different kinds of VNC sessions: One-time | |
sessions that <quote>live</quote> as long as the VNC connection from the | |
client is kept up, and persistent sessions that <quote>live</quote> until | |
they are explicitly terminated. | |
</para> | |
<para> | |
A VNC server can offer both kinds of sessions simultaneously on different | |
ports, but an open session cannot be converted from one type to the other. | |
</para> | |
</abstract> | |
</info> | |
<sect1 xml:id="sec-vnc-viewer"> | |
<title>The <command>vncviewer</command> client</title> | |
<para> | |
To connect to a VNC service provided by a server, a client is needed. The | |
default in <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> is <command>vncviewer</command>, provided by the | |
<systemitem class="resource">tigervnc</systemitem> package. | |
</para> | |
<sect2 xml:id="sec-vnc-viewer-connectcli"> | |
<title>Connecting using the vncviewer CLI</title> | |
<para> | |
To start your VNC viewer and initiate a session with the server, use the | |
command: | |
</para> | |
<screen><prompt>> </prompt>vncviewer jupiter.example.com:1</screen> | |
<para> | |
Instead of the VNC display number you can also specify the port number with | |
two colons: | |
</para> | |
<screen><prompt>> </prompt>vncviewer jupiter.example.com::5901</screen> | |
<note> | |
<title>Display and port number</title> | |
<para> | |
The actual display or port number you specify in the VNC client must be | |
the same as the display or port number picked by the | |
<command>vncserver</command> command on the target machine. See | |
<xref linkend="sec-vnc-persistent" role="internalbook"/> for further info. | |
</para> | |
</note> | |
</sect2> | |
<sect2 xml:id="sec-vnc-viewer-connectgui"> | |
<title>Connecting using the vncviewer GUI</title> | |
<para> | |
By running <command>vncviewer</command> without specifying | |
<command>--listen</command> or a host to connect to, it will show a window | |
to ask for connection details. Enter the host into the <guimenu>VNC | |
server</guimenu> field like in <xref linkend="sec-vnc-viewer-connectcli" role="internalbook"/> | |
and click <guimenu>Connect</guimenu>. | |
</para> | |
<figure xml:id="fig-vnc-viewer-connectgui"> | |
<title>vncviewer</title> | |
<mediaobject> | |
<textobject role="description"><phrase>vncviewer asking for connection details</phrase> | |
</textobject> | |
<imageobject role="html"> | |
<imagedata fileref="vnc_connect.png"/> | |
</imageobject> | |
<imageobject role="fo"> | |
<imagedata fileref="vnc_connect.png"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
</sect2> | |
<sect2 xml:id="sec-vnc-viewer-encrypt"> | |
<title>Notification of unencrypted connections</title> | |
<para> | |
The VNC protocol supports different kinds of encrypted connections, not to | |
be confused with password authentication. If a connection does not use TLS, | |
the text <quote>(Connection not encrypted!)</quote> can be seen in the | |
window title of the VNC viewer. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="vnc-remmina"> | |
<title>Remmina: the remote desktop client</title> | |
<para> | |
Remmina is a modern and feature rich remote desktop client. It supports | |
several access methods, for example VNC, SSH, RDP, and Spice. | |
</para> | |
<sect2 xml:id="vnc-remmina-install"> | |
<title>Installation</title> | |
<para> | |
To use Remmina, verify whether the <package>remmina</package> package is | |
installed on your system, and install it if not. Remember to install the | |
VNC plug-in for Remmina as well: | |
</para> | |
<screen> | |
<prompt role="root"># </prompt>zypper in remmina remmina-plugin-vnc | |
</screen> | |
</sect2> | |
<sect2 xml:id="vnc-remmina-usage"> | |
<title>Main window</title> | |
<para> | |
Run Remmina by entering the <command>remmina</command> command. | |
</para> | |
<figure> | |
<title>Remmina's main window</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="remmina.png" width="50%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="remmina.png" width="50%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The main application window shows the list of stored remote sessions. Here | |
you can add and save a new remote session, quick-start a new session | |
without saving it, start a previously saved session, or set Remmina's | |
global preferences. | |
</para> | |
</sect2> | |
<sect2 xml:id="vnc-remmina-addnew"> | |
<title>Adding remote sessions</title> | |
<para> | |
To add and save a new remote session, click <inlinemediaobject><textobject role="description"><phrase>Add new session</phrase></textobject><imageobject role="fo"><imagedata fileref="remmina_plus.png" width="1.2em" format="PNG"/></imageobject><imageobject role="html"><imagedata fileref="remmina_plus.png" width="1.2em" format="PNG"/></imageobject></inlinemediaobject> in the | |
top left of the main window. The | |
<guimenu>Remote Desktop Preference</guimenu> window opens. | |
</para> | |
<figure> | |
<title>Remote desktop preference</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="remmina_session_details.png" width="80%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="remmina_session_details.png" width="80%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
Complete the fields that specify your newly added remote session profile. | |
The most important are: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Name</term> | |
<listitem> | |
<para> | |
Name of the profile. It will be listed in the main window. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Protocol</term> | |
<listitem> | |
<para> | |
The protocol to use when connecting to the remote session, for example | |
VNC. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Server</term> | |
<listitem> | |
<para> | |
The IP or DNS address and display number of the remote server. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>User name, password</term> | |
<listitem> | |
<para> | |
Credentials to use for remote authentication. Leave empty for no | |
authentication. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Color depth, quality</term> | |
<listitem> | |
<para> | |
Select the best options according to your connection speed and quality. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Select the <guimenu>Advanced</guimenu> tab to enter more specific settings. | |
</para> | |
<tip> | |
<title>Disable encryption</title> | |
<para> | |
If the communication between the client and the remote server is not | |
encrypted, activate <guimenu>Disable encryption</guimenu>, otherwise the | |
connection fails. | |
</para> | |
</tip> | |
<para> | |
Select the <guimenu>SSH</guimenu> tab for advanced SSH tunneling and | |
authentication options. | |
</para> | |
<para> | |
Confirm with <guimenu>Save</guimenu>. Your new profile will be listed in | |
the main window. | |
</para> | |
</sect2> | |
<sect2 xml:id="vnc-remmina-start"> | |
<title>Starting remote sessions</title> | |
<para> | |
You can either start a previously saved session, or quick-start a remote | |
session without saving the connection details. | |
</para> | |
<sect3 xml:id="vnc-remmina-quickstart"> | |
<title>Quick-starting remote sessions</title> | |
<para> | |
To start a remote session quickly without adding and saving connection | |
details, use the drop-down box and text box at the top of the main window. | |
</para> | |
<figure> | |
<title>Quick-starting</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="remmina_quickstart.png" width="40%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="remmina_quickstart.png" width="40%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
Select the communication protocol from the drop-down box, for example | |
'VNC', then enter the VNC server DNS or IP address followed by a colon and | |
a display number, and confirm with <keycap function="enter"/>. | |
</para> | |
</sect3> | |
<sect3> | |
<title>Opening saved remote sessions</title> | |
<para> | |
To open a specific remote session, double-click it from the list of | |
sessions. | |
</para> | |
</sect3> | |
<sect3> | |
<title>Remote sessions window</title> | |
<para> | |
Remote sessions are opened in tabs of a separate window. Each tab hosts | |
one session. The toolbar on the left of the window helps you manage the | |
windows/sessions, such as toggle fullscreen mode, resize the window to | |
match the display size of the session, send specific keystrokes to the | |
session, take screenshots of the session, or set the image quality. | |
</para> | |
<figure> | |
<title>Remmina viewing remote session</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="remmina_sle15inside.png" width="80%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="remmina_sle15inside.png" width="80%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="vnc-remmina-edit-delete-clone"> | |
<title>Editing, copying, and deleting saved sessions</title> | |
<para> | |
To <emphasis>edit</emphasis> a saved remote session, right-click its name | |
in Remmina's main window and select <guimenu>Edit</guimenu>. Refer to | |
<xref linkend="vnc-remmina-addnew" role="internalbook"/> for the description of the relevant | |
fields. | |
</para> | |
<para> | |
To <emphasis>copy</emphasis> a saved remote session, right-click its name | |
in Remmina's main window and select <guimenu>Copy</guimenu>. In the | |
<guimenu>Remote Desktop Preference</guimenu> window, change the name of the | |
profile, optionally adjust relevant options, and confirm with | |
<guimenu>Save</guimenu>. | |
</para> | |
<para> | |
To <emphasis>Delete</emphasis> a saved remote session, right-click its name | |
in Remmina's main window and select <guimenu>Delete</guimenu>. Confirm | |
with <guimenu>Yes</guimenu> in the next dialog. | |
</para> | |
</sect2> | |
<sect2 xml:id="vnc-remmina-cmdline"> | |
<title>Running remote sessions from the command line</title> | |
<para> | |
If you need to open a remote session from the command line or from a batch | |
file without first opening the main application window, use the following | |
syntax: | |
</para> | |
<screen> | |
<prompt>> </prompt>remmina -c <replaceable>profile_name</replaceable>.remmina | |
</screen> | |
<para> | |
Remmina's profile files are stored in the | |
<filename>.local/share/remmina/</filename> directory in your home | |
directory. To determine which profile file belongs to the session you want | |
to open, run Remmina, click the session name in the main window, and read | |
the path to the profile file in the window's status line at the bottom. | |
</para> | |
<figure> | |
<title>Reading path to the profile file</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="remmina_status.png" width="50%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="remmina_status.png" width="50%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
While Remmina is not running, you can rename the profile file to a more | |
reasonable file name, such as <filename>sle15.remmina</filename>. You can | |
even copy the profile file to your custom directory and run it using the | |
<command>remmina -c</command> command from there. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-vnc-one-time"> | |
<title>Configuring one-time sessions on the VNC server</title> | |
<para> | |
A one-time session is initiated by the remote client. It starts a graphical | |
login screen on the server. This way you can choose the user which starts | |
the session and, if supported by the login manager, the desktop environment. | |
When you terminate the client connection to such a VNC session, all | |
applications started within that session will be terminated, too. One-time | |
VNC sessions cannot be shared, but it is possible to have multiple sessions | |
on a single host at the same time. | |
</para> | |
<procedure xml:id="pro-vnc-one-time-activate"> | |
<title>Enabling one-time VNC sessions</title> | |
<step> | |
<para> | |
Start <menuchoice> <guimenu>YaST</guimenu> <guimenu>Network | |
Services</guimenu> <guimenu>Remote Administration (VNC)</guimenu> | |
</menuchoice>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Check <guimenu>Allow Remote Administration Without Session | |
Management</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Activate <guimenu>Enable access using a web browser</guimenu> if you plan | |
to access the VNC session in a Web browser window. | |
</para> | |
</step> | |
<step> | |
<para> | |
If necessary, also check <guimenu>Open Port in Firewall</guimenu> (for | |
example, when your network interface is configured to be in the External | |
Zone). If you have more than one network interface, restrict opening the | |
firewall ports to a specific interface via <guimenu>Firewall | |
Details</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your settings with <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In case not all needed packages are available yet, you need to approve the | |
installation of missing packages. | |
</para> | |
<tip> | |
<title>Restart the display manager</title> | |
<para> | |
YaST makes changes to the display manager settings. You need to log out | |
of your current graphical session and restart the display manager for the | |
changes to take effect. | |
</para> | |
</tip> | |
</step> | |
</procedure> | |
<figure> | |
<title>Remote administration</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="vnc_nosession.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="vnc_nosession.png" width="70%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<sect2 xml:id="sec-vnc-one-time-configs"> | |
<title>Available configurations</title> | |
<para> | |
The default configuration on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> serves sessions with a | |
resolution of 1024x768 pixels at a color depth of 16-bit. The sessions are | |
available on ports <systemitem class="resource">5901</systemitem> for | |
<quote>regular</quote> VNC viewers (equivalent to VNC display | |
<literal>1</literal>) and on port | |
<systemitem class="resource">5801</systemitem> for Web browsers. | |
</para> | |
<para> | |
Other configurations can be made available on different | |
ports<phrase os="sles;osuse">, see | |
<xref linkend="sec-vnc-one-time-config" role="internalbook"/></phrase>. | |
</para> | |
<para> | |
VNC display numbers and X display numbers are independent in one-time | |
sessions. A VNC display number is manually assigned to every configuration | |
that the server supports (:1 in the example above). Whenever a VNC session | |
is initiated with one of the configurations, it automatically gets a free X | |
display number. | |
</para> | |
<para> | |
By default, both the VNC client and server try to communicate securely via a | |
self-signed SSL certificate, which is generated after installation. You can | |
either use the default one, or replace it with your own. When using the | |
self-signed certificate, you need to confirm its signature before the first | |
connection—both in the VNC viewer and the Web browser. | |
</para> | |
<tip> | |
<para> | |
Some VNC clients refuse to establish a secure connection via the default | |
self-signed certificate. For example, the Vinagre client verifies the | |
certification against the GnuTLS global trust store and fails if the | |
certificate is self-signed. In such a case, either use an encryption | |
method other than <literal>x509</literal>, or generate a properly signed | |
certificate for the VNC server and import it to the client's system trust | |
store. | |
</para> | |
</tip> | |
</sect2> | |
<sect2 xml:id="sec-vnc-one-time-connect"> | |
<title>Initiating a one-time VNC session</title> | |
<para> | |
To connect to a one-time VNC session, a VNC viewer must be installed, see | |
also <xref linkend="sec-vnc-viewer" role="internalbook"/>. Alternatively use a | |
JavaScript-capable Web browser to view the VNC session by entering the | |
following URL: <literal>http://jupiter.example.com:5801</literal> | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-vnc-one-time-config"> | |
<title>Configuring one-time VNC sessions</title> | |
<para> | |
You can skip this section, if you do not need or want to modify the default | |
configuration. | |
</para> | |
<para> | |
One-time VNC sessions are started via the <systemitem class="daemon">systemd</systemitem> socket | |
<systemitem>xvnc.socket</systemitem>. By default it offers six | |
configuration blocks: three for VNC viewers (<literal>vnc1</literal> to | |
<literal>vnc3</literal>), and three serving a JavaScript client | |
(<literal>vnchttpd1</literal> to <literal>vnchttpd3</literal>). By default | |
only <literal>vnc1</literal> and <literal>vnchttpd1</literal> are active. | |
</para> | |
<para> | |
To activate the VNC server socket at boot time, run the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl enable xvnc.socket</screen> | |
<para> | |
To start the socket immediately, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl start xvnc.socket</screen> | |
<para> | |
The <command>Xvnc</command> server can be configured via the | |
<literal>server_args</literal> option. For a list of options, see | |
<command>Xvnc --help</command>. | |
</para> | |
<para> | |
When adding custom configurations, make sure they are not using ports that | |
are already in use by other configurations, other services, or existing | |
persistent VNC sessions on the same host. | |
</para> | |
<para> | |
Activate configuration changes by entering the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl reload xvnc.socket</screen> | |
<important> | |
<title>Firewall and VNC ports</title> | |
<para> | |
When activating Remote Administration as described in | |
<xref linkend="pro-vnc-one-time-activate" role="internalbook"/>, the ports | |
<systemitem class="resource">5801</systemitem> and | |
<systemitem class="resource">5901</systemitem> are opened in the firewall. | |
If the network interface serving the VNC sessions is protected by a | |
firewall, you need to manually open the respective ports when activating | |
additional ports for VNC sessions. See | |
<phrase role="externalbook-cha-security-firewall">“Masquerading and firewalls” (↑Security and Hardening Guide)</phrase> for instructions. | |
</para> | |
</important> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-vnc-persistent"> | |
<title>Configuring persistent VNC server sessions</title> | |
<para> | |
A persistent session can be accessed from multiple clients simultaneously. | |
This is ideal for demonstration purposes where one client has full access | |
and all other clients have view-only access. Another use case are training sessions | |
where the trainer might need access to the trainee's desktop. | |
</para> | |
<tip xml:id="sec-vnc-persistent-connect"> | |
<title>Connecting to a persistent VNC session</title> | |
<para> | |
To connect to a persistent VNC session, a VNC viewer must be installed. | |
Refer to <xref linkend="sec-vnc-viewer" role="internalbook"/> for more details. Alternatively | |
use a JavaScript-capable Web browser to view the VNC session by entering the | |
following URL: <literal>http://jupiter.example.com:5801</literal> | |
</para> | |
</tip> | |
<para> | |
There are two types of persistent VNC sessions: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
<xref linkend="vnc-persistent-vncserver" xrefstyle="select:title" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref linkend="vnc-persistent-vncmanager" xrefstyle="select:title" role="internalbook"/> | |
</para> | |
</listitem> | |
</itemizedlist> | |
<sect2 xml:id="vnc-persistent-vncserver"> | |
<title>VNC session initiated using <systemitem>vncserver</systemitem></title> | |
<para> | |
This type of persistent VNC session is initiated on the server. The session | |
and all applications started in this session run regardless of client | |
connections until the session is terminated. Access to persistent sessions | |
is protected by two possible types of passwords: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
a regular password that grants full access or | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
an optional view-only password that grants a non-interactive (view-only) | |
access. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
A session can have multiple client connections of both kinds at once. | |
</para> | |
<procedure xml:id="pro-vnc-persistent-activate"> | |
<title>Starting a persistent VNC session using <command>vncserver</command></title> | |
<step> | |
<para> | |
Open a shell and make sure you are logged in as the user that should own | |
the VNC session. | |
</para> | |
</step> | |
<step> | |
<para> | |
If the network interface serving the VNC sessions is protected by a | |
firewall, you need to manually open the port used by your session in the | |
firewall. If starting multiple sessions you may alternatively open a | |
range of ports. See <phrase role="externalbook-cha-security-firewall">“Masquerading and firewalls” (↑Security and Hardening Guide)</phrase> for details | |
on how to configure the firewall. | |
</para> | |
<para> | |
<command>vncserver</command> uses the ports | |
<systemitem class="resource">5901</systemitem> for display | |
<literal>:1</literal>, <systemitem class="resource">5902</systemitem> for | |
display <literal>:2</literal>, and so on. For persistent sessions, the | |
VNC display and the X display usually have the same number. | |
</para> | |
</step> | |
<step> | |
<para> | |
To start a session with a resolution of 1024x768 pixel and with a color | |
depth of 16-bit, enter the following command: | |
</para> | |
<screen>vncserver -alwaysshared -geometry 1024x768 -depth 16</screen> | |
<para> | |
The <command>vncserver</command> command picks an unused display number | |
when none is given and prints its choice. See <command>man 1 | |
vncserver</command> for more options. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
When running <command>vncserver</command> for the first time, it asks for a | |
password for full access to the session. If needed, you can also provide a | |
password for view-only access to the session. | |
</para> | |
<para> | |
The password(s) you are providing here are also used for future sessions | |
started by the same user. They can be changed with the | |
<command>vncpasswd</command> command. | |
</para> | |
<important> | |
<title>Security considerations</title> | |
<para> | |
Make sure to use strong passwords of significant length (eight or more | |
characters). Do not share these passwords. | |
</para> | |
</important> | |
<para> | |
To terminate the session shut down the desktop environment that runs inside | |
the VNC session from the VNC viewer as you would shut it down if it was a | |
regular local X session. | |
</para> | |
<para> | |
If you prefer to manually terminate a session, open a shell on the VNC | |
server and make sure you are logged in as the user that owns the VNC | |
session you want to terminate. Run the following command to terminate the | |
session that runs on display <literal>:1</literal>: <command>vncserver | |
-kill :1</command> | |
</para> | |
<sect3 xml:id="sec-vnc-persistent-configure"> | |
<title>Configuring persistent VNC sessions</title> | |
<para> | |
Persistent VNC sessions can be configured by editing | |
<filename>$HOME/.vnc/xstartup</filename>. By default this shell script | |
starts the same GUI/window manager it was started from. In <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> | |
this will either be GNOME or IceWM. If you want to start your session | |
with a window manager of your choice, set the variable | |
<envar>WINDOWMANAGER</envar>: | |
</para> | |
<screen>WINDOWMANAGER=gnome vncserver -geometry 1024x768 | |
WINDOWMANAGER=icewm vncserver -geometry 1024x768</screen> | |
<note> | |
<title>One configuration for each user</title> | |
<para> | |
Persistent VNC sessions are configured in a single per-user | |
configuration. Multiple sessions started by the same user will all use | |
the same start-up and password files. | |
</para> | |
</note> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="vnc-persistent-vncmanager"> | |
<title>VNC session initiated using <systemitem>vncmanager</systemitem></title> | |
<para/> | |
<procedure xml:id="vnc-persistent-vncmanager-enable"> | |
<title>Enabling persistent VNC sessions</title> | |
<step> | |
<para> | |
Start <menuchoice> <guimenu>YaST</guimenu> <guimenu>Network | |
Services</guimenu> <guimenu>Remote Administration (VNC)</guimenu> | |
</menuchoice>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Activate <guimenu>Allow Remote Administration With Session | |
Management</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Activate <guimenu>Enable access using a web browser</guimenu> if you plan | |
to access the VNC session in a Web browser window. | |
</para> | |
</step> | |
<step> | |
<para> | |
If necessary, also check <guimenu>Open Port in Firewall</guimenu> (for | |
example, when your network interface is configured to be in the External | |
Zone). If you have more than one network interface, restrict opening the | |
firewall ports to a specific interface via <guimenu>Firewall | |
Details</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Confirm your settings with <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In case not all needed packages are available yet, you need to approve | |
the installation of missing packages. | |
</para> | |
<tip> | |
<title>Restart the display manager</title> | |
<para> | |
YaST makes changes to the display manager settings. You need to log | |
out of your current graphical session and restart the display manager | |
for the changes to take effect. | |
</para> | |
</tip> | |
</step> | |
</procedure> | |
<sect3 xml:id="vnc-persistent-vncmanager-configure"> | |
<title>Configuring persistent VNC sessions</title> | |
<para> | |
After you enable the VNC session management as described in <xref linkend="vnc-persistent-vncmanager-enable" role="internalbook"/>, you can normally connect to | |
the remote session with your favorite VNC viewer, such as | |
<command>vncviewer</command> or Remmina. You will be presented with the | |
login screen. After you log in, the 'VNC' icon will appear in the system | |
tray of your desktop environment. Click the icon to open the <guimenu>VNC | |
Session</guimenu> window. If it does not appear or if your desktop | |
environment does not support icons in the system tray, run | |
<command>vncmanager-controller</command> manually. | |
</para> | |
<figure> | |
<title>VNC session settings</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="vncmanager_session.png" width="85%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="vncmanager_session.png" width="85%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
There are several settings that influence the VNC session's behavior: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Non-persistent, private</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This is equivalent to a one-time session. It is not visible to others | |
and will be terminated after you disconnect from it. Refer to <xref linkend="sec-vnc-one-time" role="internalbook"/> for more information. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Persistent, visible</guimenu> | |
</term> | |
<listitem> | |
<para> | |
The session is visible to other users and keeps running even after you | |
disconnect from it. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Session name</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Here you can specify the name of the persistent session so that it is | |
easily identified when reconnecting. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>No password required</guimenu> | |
</term> | |
<listitem> | |
<para> | |
The session will be freely accessible without having to log in under | |
user credentials. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Require user login</guimenu> | |
</term> | |
<listitem> | |
<para> | |
You need to log in with a valid user name and password to access the | |
session. Lists the valid user names in the <guimenu>Allowed | |
users</guimenu> text box. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Allow one client at a time</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Prevents multiple users from joining the session at the same time. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Allow multiple clients at a time</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Allows multiple users to join the persistent session at the same time. | |
Useful for remote presentations or training sessions. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Confirm with <guimenu>OK</guimenu>. | |
</para> | |
</sect3> | |
<sect3 xml:id="vnc-persistent-vncmanager-join"> | |
<title>Joining persistent VNC sessions</title> | |
<para> | |
After you set up a persistent VNC session as described in | |
<xref linkend="vnc-persistent-vncmanager-configure" role="internalbook"/>, you can join | |
it with your VNC viewer. After your VNC client connects to the server, | |
you will be prompted to choose whether you want to create a new session, | |
or join the existing one: | |
</para> | |
<figure> | |
<title>Joining a persistent VNC session</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="vncmanager_whether.png" width="80%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="vncmanager_whether.png" width="80%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
After you click the name of the existing session, you may be asked for | |
login credentials, depending on the persistent session settings. | |
</para> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-vnc-encrypt"> | |
<title>Configuring encryption on the VNC server</title> | |
<para> | |
If the VNC server is set up properly, all communication between the VNC | |
server and the client is encrypted. The authentication happens at the | |
beginning of the session; the actual data transfer only begins afterward. | |
</para> | |
<para> | |
Whether for a one-time or a persistent VNC session, security options are | |
configured via the <option>-securitytypes</option> parameter of the | |
<command>/usr/bin/Xvnc</command> command located on the | |
<literal>server_args</literal> line. The <option>-securitytypes</option> | |
parameter selects both authentication method and encryption. It has the | |
following options: | |
</para> | |
<variablelist> | |
<title>Authentications</title> | |
<varlistentry> | |
<term>None, TLSNone, x509None</term> | |
<listitem> | |
<para> | |
No authentication. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>VncAuth, TLSVnc, x509Vnc</term> | |
<listitem> | |
<para> | |
Authentication using custom password. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Plain, TLSPlain, x509Plain</term> | |
<listitem> | |
<para> | |
Authentication using PAM to verify user's password. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<variablelist> | |
<title>Encryptions</title> | |
<varlistentry> | |
<term>None, vncAuth, plain</term> | |
<listitem> | |
<para> | |
No encryption. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>TLSNone, TLSVnc, TLSPlain</term> | |
<listitem> | |
<para> | |
Anonymous TLS encryption. Everything is encrypted, but there is no | |
verification of the remote host. So you are protected against passive | |
attackers, but not against man-in-the-middle attackers. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>X509None, x509Vnc, x509Plain</term> | |
<listitem> | |
<para> | |
TLS encryption with certificate. If you use a self-signed certificate, | |
you will be asked to verify it on the first connection. On subsequent | |
connections you will be warned only if the certificate changed. So you | |
are protected against everything except man-in-the-middle on the first | |
connection (similar to typical SSH usage). If you use a certificate | |
signed by a certificate authority matching the machine name, then you get | |
full security (similar to typical HTTPS usage). | |
</para> | |
<tip> | |
<para> | |
Some VNC clients refuse to establish a secure connection via the default | |
self-signed certificate. For example, the Vinagre client verifies the | |
certification against the GnuTLS global trust store and fails if the | |
certificate is self-signed. In such a case, either use an encryption | |
method other than <literal>x509</literal>, or generate a properly signed | |
certificate for the VNC server and import it to the client's system trust | |
store. | |
</para> | |
</tip> | |
<tip> | |
<title>Path to certificate and key</title> | |
<para> | |
With X509 based encryption, you need to specify the path to the X509 | |
certificate and the key with <option>-X509Cert</option> and | |
<option>-X509Key</option> options. | |
</para> | |
</tip> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
If you select multiple security types separated by comma, the first one | |
supported and allowed by both client and server will be used. That way you | |
can configure opportunistic encryption on the server. This is useful if you | |
need to support VNC clients that do not support encryption. | |
</para> | |
<para> | |
On the client, you can also specify the allowed security types to prevent a | |
downgrade attack if you are connecting to a server which you know has | |
encryption enabled (although our vncviewer will warn you with the | |
"Connection not encrypted!" message in that case). | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-vnc-wayland"> | |
<title>Compatibility with Wayland</title> | |
<para> | |
The Remote Administration (VNC) feature relies on X11 and may result in an | |
empty screen if Wayland is enabled. | |
The display manager must be configured to use X11 instead of Wayland. | |
For <package>gdm</package>, edit <filename>/etc/gdm/custom.conf</filename>. | |
In the <literal>[daemon]</literal> section, add | |
<literal>WaylandEnable=false</literal> to the configuration file. | |
When logging in, the user must choose an X11-compatible session as well. | |
If you wish to remove the Wayland option for GNOME, you can remove and lock | |
the <package>gnome-session-wayland</package> package. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-net-rsync"> | |
<title>File copying with RSync</title> | |
<info> | |
<abstract> | |
<para> | |
Today, a typical user has several computers: home and workplace machines, a | |
laptop, a smartphone or a tablet. This makes the task of keeping files and | |
documents in synchronization across multiple devices all the more important. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<warning> | |
<title>Risk of data loss</title> | |
<para> | |
Before you start using a synchronization tool, you should familiarize | |
yourself with its features and functionality. Make sure to back up your | |
important files. | |
</para> | |
</warning> | |
<sect1 xml:id="sec-net-rsync-overview"> | |
<title>Conceptual overview</title> | |
<para> | |
For synchronizing a large amount of data over a slow network connection, | |
Rsync offers a reliable method of transmitting only changes within files. | |
This applies not only to text files but also binary files. To detect the | |
differences between files, Rsync subdivides the files into blocks and | |
computes check sums over them. | |
</para> | |
<para> | |
Detecting changes requires some computing power. So make sure that machines | |
on both ends have enough resources, including RAM. | |
</para> | |
<para> | |
Rsync can be particularly useful when large amounts of data containing only | |
minor changes need to be transmitted regularly. This is often the case when | |
working with backups. Rsync can also be useful for mirroring staging servers | |
that store complete directory trees of Web servers to a Web server in a DMZ. | |
</para> | |
<para> | |
Despite its name, Rsync is not a synchronization tool. Rsync is a tool that | |
copies data only in one direction at a time. It does not and cannot do the | |
reverse. If you need a bidirectional tool which can synchronize both | |
source and destination, use Csync. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-net-rsync-syntax"> | |
<title>Basic syntax</title> | |
<para> | |
Rsync is a command-line tool that has the following basic syntax: | |
</para> | |
<screen>rsync [OPTION] SOURCE [SOURCE]... DEST</screen> | |
<para> | |
You can use Rsync on any local or remote machine, provided you have access | |
and write permissions. It is possible to have multiple | |
<replaceable>SOURCE</replaceable> entries. The | |
<replaceable>SOURCE</replaceable> and <replaceable>DEST</replaceable> | |
placeholders can be paths, URLs, or both. | |
</para> | |
<para> | |
Below are the most common Rsync options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><option>-v</option> | |
</term> | |
<listitem> | |
<para> | |
Outputs more verbose text | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-a</option> | |
</term> | |
<listitem> | |
<para> | |
Archive mode; copies files recursively and preserves time stamps, | |
user/group ownership, file permissions, and symbolic links | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>-z</option> | |
</term> | |
<listitem> | |
<para> | |
Compresses the transmitted data | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<note> | |
<title>Trailing slashes count</title> | |
<para> | |
When working with Rsync, you should pay particular attention to trailing | |
slashes. A trailing slash after the directory denotes the | |
<emphasis>content</emphasis> of the directory. No trailing slash denotes | |
the <emphasis>directory itself</emphasis>. | |
</para> | |
</note> | |
</sect1> | |
<sect1 xml:id="sec-net-rsync-local-copy"> | |
<title>Copying files and directories locally</title> | |
<para> | |
The following description assumes that the current user has write | |
permissions to the directory <filename>/var/backup</filename>. To copy a | |
single file from one directory on your machine to another path, use the | |
following command: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> -avz backup.tar.xz /var/backup/</screen> | |
<para> | |
The file <filename>backup.tar.xz</filename> is copied to | |
<filename>/var/backup/</filename>; the absolute path will be | |
<filename>/var/backup/backup.tar.xz</filename>. | |
</para> | |
<para> | |
Do not forget to add the <emphasis>trailing slash</emphasis> after the | |
<filename>/var/backup/</filename> directory! If you do not insert the slash, | |
the file <filename>backup.tar.xz</filename> is copied to | |
<filename>/var/backup</filename> (file) <emphasis>not</emphasis> inside the | |
directory <filename>/var/backup/</filename>! | |
</para> | |
<para> | |
Copying a directory is similar to copying a single file. The following | |
example copies the directory <filename>tux/</filename> and | |
its content into the directory <filename>/var/backup/</filename>: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> -avz tux /var/backup/</screen> | |
<para> | |
Find the copy in the absolute path | |
<filename>/var/backup/tux/</filename>. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-net-rsync-remote-copy"> | |
<title>Copying files and directories remotely</title> | |
<para> | |
The Rsync tool is required on both machines. To copy files from or to remote | |
directories requires an IP address or a domain name. A user name is optional | |
if your current user names on the local and remote machine are the same. | |
</para> | |
<para> | |
To copy the file <filename>file.tar.xz</filename> from your local host to | |
the remote host | |
<systemitem class="ipaddress">192.168.1.1</systemitem> with | |
same users (being local and remote), use the following command: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> -avz file.tar.xz [email protected]:</screen> | |
<para> | |
Depending on what you prefer, these commands are also possible and | |
equivalent: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> -avz file.tar.xz 192.168.1.1:~ | |
<prompt>> </prompt><command>rsync</command> -avz file.tar.xz 192.168.1.1:/home/tux</screen> | |
<para> | |
In all cases with standard configuration, you will be prompted to enter your | |
passphrase of the remote user. This command will copy | |
<filename>file.tar.xz</filename> to the home directory of user <systemitem class="username">tux</systemitem> | |
(usually <filename>/home/tux</filename>). | |
</para> | |
<para> | |
Copying a directory remotely is similar to copying a directory locally. The | |
following example copies the directory | |
<filename>tux/</filename> and its content into the remote | |
directory <filename>/var/backup/</filename> on the | |
<systemitem class="ipaddress">192.168.1.1</systemitem> host: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> -avz tux 192.168.1.1:/var/backup/</screen> | |
<para> | |
Assuming you have write permissions on the host | |
<systemitem class="ipaddress">192.168.1.1</systemitem>, you will | |
find the copy in the absolute path | |
<filename>/var/backup/tux</filename>. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-net-rsync-server"> | |
<title>Configuring and using an rsync server</title> | |
<para> | |
Rsync can run as a daemon | |
(<systemitem class="daemon">rsyncd</systemitem>) listening on default | |
port 873 for incoming connections. This daemon can receive <quote>copying | |
targets</quote>. | |
</para> | |
<para> | |
The following description explains how to create an Rsync server on | |
<systemitem>jupiter</systemitem> with a <emphasis>backup</emphasis> target. | |
This target can be used to store your backups. To create an Rsync server, do | |
the following: | |
</para> | |
<procedure> | |
<title>Setting up an rsync server</title> | |
<step xml:id="st-rsync-server-mkdir"> | |
<para> | |
On jupiter, create a directory to store all your backup files. In this | |
example, we use <filename>/var/backup</filename>: | |
</para> | |
<screen><prompt role="root"># </prompt><command>mkdir</command> /var/backup</screen> | |
</step> | |
<step> | |
<para> | |
Specify ownership. In this case, the directory is owned by user | |
<systemitem class="username">tux</systemitem> in group | |
<systemitem class="groupname">users</systemitem>: | |
</para> | |
<screen><prompt role="root"># </prompt><command>chown</command> tux.users /var/backup</screen> | |
</step> | |
<step> | |
<para> | |
Configure the rsyncd daemon. | |
</para> | |
<para> | |
We will separate the configuration file into a main file and some | |
<quote>modules</quote> which hold your backup target. This makes it easier | |
to add additional targets later. Global values can be stored in | |
<filename>/etc/rsyncd.d/*.inc</filename> files, whereas your modules are | |
placed in <filename>/etc/rsyncd.d/*.conf</filename> files: | |
</para> | |
<substeps> | |
<step> | |
<para> | |
Create a directory <filename>/etc/rsyncd.d/</filename>: | |
</para> | |
<screen><prompt role="root"># </prompt><command>mkdir</command> /etc/rsyncd.d/</screen> | |
</step> | |
<step> | |
<para> | |
In the main configuration file <filename>/etc/rsyncd.conf</filename>, | |
add the following lines: | |
</para> | |
<screen># rsyncd.conf main configuration file | |
log file = /var/log/rsync.log | |
pid file = /var/lock/rsync.lock | |
&merge /etc/rsyncd.d <co xml:id="co-rsync-conf-merge"/> | |
&include /etc/rsyncd.d <co xml:id="co-rsync-conf-include"/></screen> | |
<calloutlist> | |
<callout arearefs="co-rsync-conf-merge"> | |
<para> | |
Merges global values from <filename>/etc/rsyncd.d/*.inc</filename> | |
files into the main configuration file. | |
</para> | |
</callout> | |
<callout arearefs="co-rsync-conf-include"> | |
<para> | |
Loads any modules (or targets) from | |
<filename>/etc/rsyncd.d/*.conf</filename> files. These files should | |
not contain any references to global values. | |
</para> | |
</callout> | |
</calloutlist> | |
</step> | |
<step> | |
<para> | |
Create your module (your backup target) in the file | |
<filename>/etc/rsyncd.d/backup.conf</filename> with the following lines: | |
</para> | |
<screen># backup.conf: backup module | |
[backup] <co xml:id="co-rsync-conf-target"/> | |
uid = tux <co xml:id="co-rsync-conf-uid-gid"/> | |
gid = users <xref linkend="co-rsync-conf-uid-gid" role="internalbook"/> | |
path = /var/backup <co xml:id="co-rsync-conf-path"/> | |
auth users = tux <co xml:id="co-rsync-conf-authusers"/> | |
secrets file = /etc/rsyncd.secrets <co xml:id="co-rsync-conf-secretfiles"/> | |
comment = Our backup target</screen> | |
<calloutlist> | |
<callout arearefs="co-rsync-conf-target"> | |
<para> | |
The <emphasis>backup</emphasis> target. You can use any name you like. | |
However, it is a good idea to name a target according to its purpose | |
and use the same name in your <filename>*.conf</filename> file. | |
</para> | |
</callout> | |
<callout arearefs="co-rsync-conf-uid-gid"> | |
<para> | |
Specifies the user name or group name that is used when the file | |
transfer takes place. | |
</para> | |
</callout> | |
<callout arearefs="co-rsync-conf-path"> | |
<para> | |
Defines the path to store your backups (from | |
<xref linkend="st-rsync-server-mkdir" role="internalbook"/>). | |
</para> | |
</callout> | |
<callout arearefs="co-rsync-conf-authusers"> | |
<para> | |
Specifies a comma-separated list of allowed users. In its simplest | |
form, it contains the user names that are allowed to connect to this | |
module. In our case, only user <systemitem class="username">tux</systemitem> is allowed. | |
</para> | |
</callout> | |
<callout arearefs="co-rsync-conf-secretfiles"> | |
<para> | |
Specifies the path of a file that contains lines with user names and | |
plain passwords. | |
</para> | |
</callout> | |
</calloutlist> | |
</step> | |
<step> | |
<para> | |
Create the <filename>/etc/rsyncd.secrets</filename> file with the | |
following content and replace <replaceable>PASSPHRASE</replaceable>: | |
</para> | |
<screen># user:passwd | |
tux:<replaceable>PASSPHRASE</replaceable></screen> | |
</step> | |
<step> | |
<para> | |
Make sure the file is only readable by <systemitem class="username">root</systemitem>: | |
</para> | |
<screen><prompt role="root"># </prompt><command>chmod</command> 0600 /etc/rsyncd.secrets</screen> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<para> | |
Start and enable the rsyncd daemon with: | |
</para> | |
<screen><prompt role="root"># </prompt><command>systemctl</command> enable rsyncd | |
<prompt role="root"># </prompt><command>systemctl</command> start rsyncd</screen> | |
</step> | |
<step> | |
<para> | |
Test the access to your Rsync server: | |
</para> | |
<screen><prompt>> </prompt><command>rsync</command> jupiter::</screen> | |
<para> | |
You should see a response that looks like this: | |
</para> | |
<screen>backup Our backup target</screen> | |
<para> | |
Otherwise, check your configuration file, firewall and network settings. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
The above steps create an Rsync server that can now be used to store | |
backups. The example also creates a log file listing all connections. This | |
file is stored in <filename>/var/log/rsyncd.log</filename>. This is useful | |
if you want to debug your transfers. | |
</para> | |
<para> | |
To list the content of your backup target, use the following command: | |
</para> | |
<screen><prompt>> </prompt>rsync -avz jupiter::backup</screen> | |
<para> | |
This command lists all files present in the directory | |
<filename>/var/backup</filename> on the server. This request is also logged | |
in the log file <filename>/var/log/rsyncd.log</filename>. To start an actual | |
transfer, provide a source directory. Use <literal>.</literal> for the | |
current directory. For example, the following command copies the current | |
directory to your Rsync backup server: | |
</para> | |
<screen><prompt>> </prompt>rsync -avz . jupiter::backup</screen> | |
<para> | |
By default, Rsync does not delete files and directories when it runs. To | |
enable deletion, the additional option <option>--delete</option> must be | |
stated. To ensure that no newer files are deleted, the option | |
<option>--update</option> can be used instead. Any conflicts that arise must | |
be resolved manually. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-net-rsync-summary"> | |
<title>More information</title> | |
<variablelist> | |
<varlistentry> | |
<term>Csync</term> | |
<listitem> | |
<para> | |
Bidirectional file synchronization tool, see | |
<link xlink:href="https://csync.org/"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>RSnapshot</term> | |
<listitem> | |
<para> | |
Creates incremental backups, see | |
<link xlink:href="https://rsnapshot.org"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Unison</term> | |
<listitem> | |
<para> | |
A file synchronization tool similar to CSync but with a graphical interface, see | |
<link xlink:href="https://www.seas.upenn.edu/~bcpierce/unison/"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Rear</term> | |
<listitem> | |
<para> | |
A disaster recovery framework, see the | |
<link xlink:href="https://documentation.suse.com/sle-ha-15/html/SLE-HA-all/cha-ha-rear.html"><citetitle>Administration | |
Guide</citetitle> of the SUSE Linux Enterprise High Availability Extension, chapter <citetitle>Disaster Recovery with Rear (Relax-and-Recover)</citetitle></link>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
</chapter> | |
</part> | |
<part xml:id="part-boot"> | |
<title>Booting a Linux system</title> | |
<chapter version="5.0" xml:id="cha-boot"> | |
<title>Introduction to the boot process</title> | |
<info> | |
<abstract> | |
<para> | |
Booting a Linux system involves different components and tasks. After a | |
firmware and hardware initialization process, which depends on the | |
machine's architecture, the kernel is started by means of the boot loader | |
GRUB 2. After this point, the boot process is completely controlled by the | |
operating system and handled by <systemitem class="daemon">systemd</systemitem>. <systemitem class="daemon">systemd</systemitem> provides a set of | |
<quote>targets</quote> that boot configurations for everyday usage, | |
maintenance or emergencies. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 xml:id="sec-boot-terminology"> | |
<title>Terminology</title> | |
<para> | |
This chapter uses terms that can be interpreted ambiguously. To | |
understand how they are used here, read the definitions below: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><systemitem>init</systemitem></term> | |
<listitem> | |
<para> | |
Two different processes are commonly named <quote>init</quote>: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
The <systemitem>initramfs</systemitem> process mounting the root | |
file system | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The operating system process that starts all other processes that is | |
executed from the real root file system | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
In both cases, the <systemitem class="daemon">systemd</systemitem> program is taking care of this task. It is | |
first executed from the <systemitem>initramfs</systemitem> to mount the | |
root file system. When that has succeeded, it is re-executed from the | |
root file system as the initial process. To avoid confusing these two | |
<systemitem class="daemon">systemd</systemitem> processes, we refer to the first process as <emphasis>init on | |
initramfs</emphasis> and to the second one as | |
<emphasis>systemd</emphasis>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
<systemitem>initrd</systemitem>/<systemitem>initramfs</systemitem> | |
</term> | |
<listitem> | |
<para> | |
An <systemitem>initrd</systemitem> (initial RAM disk) is an image file | |
containing a root file system image which is loaded by the kernel and | |
mounted from <filename>/dev/ram</filename> as the temporary root file | |
system. Mounting this file system requires a file system driver. | |
</para> | |
<para> | |
Beginning with kernel 2.6.13, the initrd has been replaced by the | |
<systemitem>initramfs</systemitem> (initial RAM file system), which does | |
not require a file system driver to be mounted. <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> exclusively | |
uses an <systemitem>initramfs</systemitem>. However, since the | |
<systemitem>initramfs</systemitem> is stored as | |
<filename>/boot/initrd</filename>, it is often called | |
<quote>initrd</quote>. In this chapter we exclusively use the name | |
<systemitem>initramfs</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-boot-proc"> | |
<title>The Linux boot process</title> | |
<para> | |
The Linux boot process consists of several stages, each represented by a | |
different component: | |
</para> | |
<orderedlist> | |
<listitem> | |
<para> | |
<xref linkend="sec-boot-proc-initialization" xrefstyle="HeadingOnPage" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref linkend="sec-boot-proc-kernel" xrefstyle="HeadingOnPage" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref linkend="sec-boot-initramfs" xrefstyle="HeadingOnPage" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref linkend="sec-boot-systemd" xrefstyle="HeadingOnPage" role="internalbook"/> | |
</para> | |
</listitem> | |
</orderedlist> | |
<sect2 xml:id="sec-boot-proc-initialization"> | |
<title>The initialization and boot loader phase</title> | |
<para> | |
During the initialization phase the machine's hardware is set up and the | |
devices are prepared. This process differs significantly between hardware | |
architectures. | |
</para> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> uses the boot loader GRUB 2 on all architectures. Depending | |
on the architecture and firmware, starting the GRUB 2 boot loader can be a | |
multi-step process. The purpose of the boot loader is to load the kernel | |
and the initial, RAM-based file system (initramfs). For more information | |
about GRUB 2, refer to <xref linkend="cha-grub2" role="internalbook"/>. | |
</para> | |
<sect3 xml:id="sec-boot-proc-initialization-x86-aarch" arch="x86_64;aarch64"> | |
<title>Initialization and boot loader phase on AArch64 and AMD64/Intel 64</title> | |
<para> | |
After turning on the computer, the BIOS or the UEFI initializes the screen | |
and keyboard, and tests the main memory. Up to this stage, the machine | |
does not access any mass storage media. Subsequently, the information | |
about the current date, time, and the most important peripherals are | |
loaded from the CMOS values. When the boot media and its geometry are | |
recognized, the system control passes from the BIOS/UEFI to the boot | |
loader. | |
</para> | |
<para> | |
On a machine equipped with a traditional BIOS, only code from the first | |
physical 512-byte data sector (the Master Boot Record, MBR) of the boot | |
disk can be loaded. Only a minimal GRUB 2 fits into the MBR. Its sole | |
purpose is to load a GRUB 2 core image containing file system drivers from | |
the gap between the MBR and the first partition (MBR partition table) or | |
from the BIOS boot partition (GPT partition table). This image contains | |
file system drivers and therefore is able to access | |
<filename>/boot</filename> located on the root file | |
system. <filename>/boot</filename> contains additional modules for GRUB 2 | |
core as well as the kernel and the initramfs image. When it has access to | |
this partition, GRUB 2 loads the kernel and the initramfs image into | |
memory and hands control over to the kernel. | |
</para> | |
<para> | |
When booting a BIOS system from an encrypted file system that includes an | |
encrypted <filename>/boot</filename> partition, you need to enter the | |
password for decryption twice. It is first needed by GRUB 2 to decrypt | |
<filename>/boot</filename> and then for <systemitem class="daemon">systemd</systemitem> to mount the encrypted | |
volumes. | |
</para> | |
<para> | |
On machines with UEFI the boot process is much simpler than on machines | |
with a traditional BIOS. The firmware is able to read from a FAT formatted | |
system partition of disks with a GPT partition table. This EFI | |
system-partition (in the running system mounted as | |
<filename>/boot/efi</filename>) holds enough space to host a fully-fledged | |
GRUB 2 which is directly loaded and executed by the firmware. | |
</para> | |
<para> | |
If the BIOS/UEFI supports network booting, it is also possible to | |
configure a boot server that provides the boot loader. The system can then | |
be booted via PXE. The BIOS/UEFI acts as the boot loader. It gets the boot | |
image from the boot server and starts the system. This is completely | |
independent of local hard disks. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-boot-proc-initialization-zsystems" arch="zseries"> | |
<title> | |
Initialization and boot loader phase on IBM Z | |
</title> | |
<para> | |
On IBM Z the boot process must be initialized by a boot loader | |
called <command>zipl</command> (z initial program load). Although | |
<command>zipl</command> supports reading from various file systems, it | |
does not support the SLE default file system (Btrfs) or booting from | |
snapshots. <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> therefore uses a two-stage boot process that | |
ensures full Btrfs support at boot-time: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
<command>zipl</command> boots from the partition | |
<filename>/boot/zipl</filename>, which can be formatted with the Ext2, | |
Ext3, Ext4, or XFS file system. This partition contains a minimal kernel | |
and an initramfs that are loaded into memory. The initramfs contains a | |
Btrfs driver (among others) and the boot loader GRUB 2. The kernel is | |
started with a parameter <literal>initgrub</literal>, which tells it to | |
start GRUB 2. | |
</para> | |
</step> | |
<step> | |
<para> | |
The kernel mounts the root file system, so <filename>/boot</filename> | |
becomes accessible. Now GRUB 2 is started from the initramfs. It reads | |
its configuration from <filename>/boot/grub2/grub.cfg</filename> and | |
loads the final kernel and initramfs from | |
<filename>/boot</filename>. The new kernel now gets loaded via Kexec. | |
</para> | |
</step> | |
</procedure> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-boot-proc-kernel"> | |
<title>The kernel phase</title> | |
<para> | |
When the boot loader has passed on system control, the boot process is the | |
same on all architectures. The boot loader loads both the kernel and an | |
initial RAM-based file system (<systemitem>initramfs</systemitem>) into | |
memory and the kernel takes over. | |
</para> | |
<para> | |
After the kernel has set up memory management and has detected the CPU type | |
and its features, it initializes the hardware and mounts the temporary root | |
file system from the memory that was loaded with the | |
<systemitem>initramfs</systemitem>. | |
</para> | |
<sect3 xml:id="sec-boot-initrd"> | |
<title>The <systemitem>initramfs</systemitem> file</title> | |
<para> | |
<systemitem>initramfs</systemitem> (initial RAM file system) is a small | |
cpio archive that the kernel can load into a RAM disk. It is located at | |
<filename>/boot/initrd</filename>. It can be created with a tool called | |
<command>dracut</command>—refer to <command>man 8 dracut</command> | |
for details. | |
</para> | |
<para> | |
The <systemitem>initramfs</systemitem> provides a minimal Linux | |
environment that enables the execution of programs before the actual root | |
file system is mounted. This minimal Linux environment is loaded into | |
memory by BIOS or UEFI routines and does not have specific hardware | |
requirements other than sufficient memory. The | |
<systemitem>initramfs</systemitem> archive must always provide an | |
executable named <systemitem>init</systemitem> that executes the <systemitem class="daemon">systemd</systemitem> | |
daemon on the root file system for the boot process to proceed. | |
</para> | |
<para> | |
Before the root file system can be mounted and the operating system can be | |
started, the kernel needs the corresponding drivers to access the device | |
on which the root file system is located. These drivers may include | |
special drivers for certain kinds of hard disks or even network drivers to | |
access a network file system. The needed modules for the root file system | |
are loaded by <systemitem>init</systemitem> on | |
<systemitem>initramfs</systemitem>. After the modules are loaded, | |
<systemitem class="service">udev</systemitem> provides the | |
<systemitem>initramfs</systemitem> with the needed devices. Later in the | |
boot process, after changing the root file system, it is necessary to | |
regenerate the devices. This is done by the <systemitem class="daemon">systemd</systemitem> unit | |
<filename>systemd-udev-trigger.service</filename>. | |
</para> | |
<sect4 xml:id="sec-boot-initrd-regenerate"> | |
<title>Regenerating the initramfs</title> | |
<para> | |
Because the <systemitem>initramfs</systemitem> contains drivers, it needs | |
to be updated whenever a new version of one of its drivers is | |
available. This is done automatically when installing the package | |
containing the driver update. YaST or zypper will inform you about | |
this by showing the output of the command that generates the | |
<systemitem>initramfs</systemitem>. However, there are some occasions | |
when you need to regenerate an <systemitem>initramfs</systemitem> | |
manually: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
<xref xrefstyle="select:title" linkend="var-initrd-regenerate-drivers" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref xrefstyle="select:title" linkend="var-initrd-regenerate-raidroot" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref xrefstyle="select:title" linkend="var-initrd-regenerate-lvmadd" role="internalbook"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<xref xrefstyle="select:title" linkend="var-initrd-regenerate-kernelvars" role="internalbook"/> | |
</para> | |
</listitem> | |
</itemizedlist> | |
<variablelist> | |
<varlistentry xml:id="var-initrd-regenerate-drivers"> | |
<term>Adding drivers because of hardware changes</term> | |
<listitem> | |
<para> | |
If you need to change hardware (for example, hard disks), and this | |
hardware requires different drivers to be in the kernel at boot time, | |
you must update the <systemitem>initramfs</systemitem> file. | |
</para> | |
<para> | |
Open or create | |
<filename>/etc/dracut.conf.d/10-<replaceable>DRIVER</replaceable>.conf</filename> | |
and add the following line (mind the leading blank space): | |
</para> | |
<screen>force_drivers+=" <replaceable>DRIVER1</replaceable> "</screen> | |
<para> | |
Replace <replaceable>DRIVER1</replaceable> with the module name of the | |
driver. If you need to add more than one driver, list them | |
space-separated: | |
</para> | |
<screen>force_drivers+=" <replaceable>DRIVER1</replaceable> <replaceable>DRIVER2</replaceable> "</screen> | |
<para> | |
Proceed with <xref linkend="pro-generate-initramfs" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="var-initrd-regenerate-raidroot"> | |
<term>Moving system directories to a RAID or LVM</term> | |
<listitem> | |
<para> | |
Whenever you move swap files, or system directories like | |
<filename>/usr</filename> in a running system to a RAID or logical | |
volume, you need to create an <systemitem>initramfs</systemitem> that | |
contains support for software RAID or LVM drivers. | |
</para> | |
<para> | |
To do so, create the respective entries in | |
<filename>/etc/fstab</filename> and mount the new entries (for example | |
with <command>mount -a</command> and/or <command>swapon -a</command>). | |
</para> | |
<para> | |
Proceed with <xref linkend="pro-generate-initramfs" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="var-initrd-regenerate-lvmadd"> | |
<term>Adding disks to an LVM group or Btrfs RAID containing the root | |
file system</term> | |
<listitem> | |
<para> | |
Whenever you add (or remove) a disk to a logical volume group | |
or a Btrfs RAID containing the root file system, you need to create an | |
<systemitem>initramfs</systemitem> that contains support for the | |
enlarged volume. Follow the instructions at <xref linkend="pro-generate-initramfs" role="internalbook"/>. | |
</para> | |
<para> | |
Proceed with <xref linkend="pro-generate-initramfs" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="var-initrd-regenerate-kernelvars"> | |
<term>Changing kernel variables</term> | |
<listitem> | |
<para> | |
If you change the values of kernel variables via the | |
<command>sysctl</command> interface by editing related files | |
(<filename>/etc/sysctl.conf</filename> or | |
<filename>/etc/sysctl.d/*.conf</filename>), the change will be lost on | |
the next system reboot. Even if you load the values with <command>sysctl | |
--system</command> at runtime, the changes are not saved into the | |
<systemitem>initramfs</systemitem> file. You need to update it by | |
proceeding as outlined in <xref linkend="pro-generate-initramfs" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<procedure xml:id="pro-generate-initramfs"> | |
<title>Generate an initramfs</title> | |
<para> | |
Note that all commands in the following procedure need to be executed | |
as the <systemitem class="username">root</systemitem> user. | |
</para> | |
<step> | |
<para> | |
Enter your <filename>/boot</filename> directory: | |
</para> | |
<screen><prompt role="root"># </prompt>cd /boot</screen> | |
</step> | |
<step> | |
<para> | |
Generate a new <systemitem>initramfs</systemitem> file with | |
<command>dracut</command>, replacing | |
<replaceable>MY_INITRAMFS</replaceable> with a file name of | |
your choice: | |
</para> | |
<screen><prompt role="root"># </prompt>dracut <replaceable>MY_INITRAMFS</replaceable></screen> | |
<para> | |
Alternatively, run <command>dracut -f</command> | |
<replaceable>FILENAME</replaceable> | |
to replace an existing init file. | |
</para> | |
</step> | |
<step> | |
<para> | |
(Skip this step if you ran <command>dracut -f</command> in the previous | |
step.) Create a symbolic link from the <systemitem>initramfs</systemitem> | |
file you created in the previous step to <systemitem>initrd</systemitem>: | |
</para> | |
<screen><prompt role="root"># </prompt> ln -sf <replaceable>MY_INITRAMFS</replaceable> <systemitem>initrd</systemitem> </screen> | |
</step> | |
<step arch="zseries"> | |
<para> | |
On the IBM Z architecture, additionally run | |
<command>grub2-install</command>. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-boot-initramfs"> | |
<title>The init on initramfs phase</title> | |
<para> | |
The temporary root file system mounted by the kernel from the | |
<systemitem>initramfs</systemitem> contains the executable <systemitem class="daemon">systemd</systemitem> (which | |
is called <systemitem>init</systemitem> on | |
<systemitem>initramfs</systemitem> in the following, also see <xref linkend="sec-boot-terminology" role="internalbook"/>. This program performs all actions needed | |
to mount the proper root file system. It provides kernel functionality for | |
the needed file system and device drivers for mass storage controllers with | |
<systemitem class="service">udev</systemitem>. | |
</para> | |
<para> | |
The main purpose of <systemitem>init</systemitem> on | |
<systemitem>initramfs</systemitem> is to prepare the mounting of and access | |
to the real root file system. Depending on your system configuration, | |
<systemitem>init</systemitem> on <systemitem>initramfs</systemitem> is | |
responsible for the following tasks. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Loading kernel modules</term> | |
<listitem> | |
<para> | |
Depending on your hardware configuration, special drivers may be needed | |
to access the hardware components of your computer (the most important | |
component being your hard disk). To access the final root file system, | |
the kernel needs to load the proper file system drivers. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Providing block special files</term> | |
<listitem> | |
<para> | |
The kernel generates device events depending on loaded modules. | |
<systemitem class="service">udev</systemitem> handles these events and | |
generates the required special block files on a RAM file system in | |
<filename>/dev</filename>. Without those special files, the file system | |
and other devices would not be accessible. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Managing RAID and LVM setups</term> | |
<listitem> | |
<para> | |
If you configured your system to hold the root file system under RAID or | |
LVM, <systemitem>init</systemitem> on <systemitem>initramfs</systemitem> | |
sets up LVM or RAID to enable access to the root file system later. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Managing the network configuration</term> | |
<listitem> | |
<para> | |
If you configured your system to use a network-mounted root file system | |
(mounted via NFS), <systemitem>init</systemitem> must make sure that the | |
proper network drivers are loaded and that they are set up to allow | |
access to the root file system. | |
</para> | |
<para> | |
If the file system resides on a network block device like iSCSI or SAN, | |
the connection to the storage server is also set up by | |
<systemitem>init</systemitem> on <systemitem>initramfs</systemitem>. | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> supports booting from a secondary iSCSI target if the | |
primary target is not available. <phrase os="sles">For more details | |
regarding configuration of the booting iSCSI target refer to <phrase role="externalbook-sec-iscsi-initiator-yast">“Using YaST for the iSCSI initiator configuration” (Section “Mass storage over IP networks: iSCSI”, ↑Storage Administration Guide)</phrase></phrase>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<note> | |
<title>Handling of mount failures</title> | |
<para> | |
If the root file system fails to mount from within the boot environment, | |
it must be checked and repaired before the boot can continue. The file | |
system checker will be automatically started for Ext3 and Ext4 file | |
systems. The repair process is not automated for XFS and Btrfs file | |
systems, and the user is presented with information describing the | |
options available to repair the file system. When the file system has been | |
successfully repaired, exiting the boot environment will cause the system | |
to retry mounting the root file system. If successful, the boot will | |
continue normally. | |
</para> | |
</note> | |
<sect3 xml:id="sec-boot-linuxrc-initramfs"> | |
<title>The init on initramfs phase in the installation process</title> | |
<para> | |
When <systemitem>init</systemitem> on <systemitem>initramfs</systemitem> | |
is called during the initial boot as part of the installation process, its | |
tasks differ from those mentioned above. Note that the installation system | |
also does not start <systemitem class="daemon">systemd</systemitem> from | |
<systemitem>initramfs</systemitem>—these tasks are performed by | |
<command>linuxrc</command>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Finding the installation medium</term> | |
<listitem> | |
<para> | |
When starting the installation process, your machine loads an | |
installation kernel and a special <systemitem>init</systemitem> | |
containing the YaST installer. The YaST installer is running in a | |
RAM file system and needs to have information about the location of the | |
installation medium to access it for installing the operating system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term> | |
Initiating hardware recognition and loading appropriate kernel modules | |
</term> | |
<listitem> | |
<para> | |
As mentioned in <xref linkend="sec-boot-initrd" role="internalbook"/>, the boot process | |
starts with a minimum set of drivers that can be used with most | |
hardware configurations. On AArch64, POWER, and AMD64/Intel 64 machines, | |
<command>linuxrc</command> starts an initial hardware scanning process | |
that determines the set of drivers suitable for your hardware | |
configuration. On IBM Z, a list of drivers and their parameters | |
needs to be provided, for example via linuxrc or a parmfile. | |
</para> | |
<para> | |
These drivers are used to generate a custom | |
<systemitem>initramfs</systemitem> that is needed to boot the | |
system. If the modules are not needed for boot but for coldplug, the | |
modules can be loaded with <systemitem class="daemon">systemd</systemitem>; for more information, see <xref linkend="sec-boot-systemd-advanced-kernel-modules" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Loading the installation system</term> | |
<listitem> | |
<para> | |
When the hardware is properly recognized, the appropriate drivers are | |
loaded. The <systemitem class="service">udev</systemitem> program | |
creates the special device files and <command>linuxrc</command> | |
starts the installation system with the YaST installer. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Starting YaST</term> | |
<listitem> | |
<para> | |
Finally, <command>linuxrc</command> starts YaST, which starts | |
the package installation and the system configuration. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd"> | |
<title>The systemd phase</title> | |
<para> | |
After the <quote>real</quote> root file system has been found, it is | |
checked for errors and mounted. If this is successful, the | |
<systemitem>initramfs</systemitem> is cleaned and the <systemitem class="daemon">systemd</systemitem> daemon on | |
the root file system is executed. <systemitem class="daemon">systemd</systemitem> is Linux's system and service | |
manager. It is the parent process that is started as PID 1 and acts as an | |
init system which brings up and maintains user space services. See <xref linkend="cha-systemd" role="internalbook"/> for details. | |
</para> | |
</sect2> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-uefi"> | |
<title>UEFI (Unified Extensible Firmware Interface)</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
UEFI (Unified Extensible Firmware Interface) is the interface between the | |
firmware that comes with the system hardware, all the hardware components of | |
the system, and the operating system. | |
</para> | |
<para> | |
UEFI is becoming more and more available on PC systems and thus is replacing | |
the traditional PC-BIOS. UEFI, for example, properly supports 64-bit systems | |
and offers secure booting (<quote>Secure Boot</quote>, firmware version | |
2.3.1c or better required), which is one of its most important features. | |
Lastly, with UEFI a standard firmware will become available on all x86 | |
platforms. | |
</para> | |
<para> | |
UEFI additionally offers the following advantages: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
Booting from large disks (over 2 TiB) with a GUID Partition Table (GPT). | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
CPU-independent architecture and drivers. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Flexible pre-OS environment with network capabilities. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
CSM (Compatibility Support Module) to support booting legacy operating | |
systems via a PC-BIOS-like emulation. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
For more information, see | |
<link xlink:href="http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface"/>. | |
The following sections are not meant as a general UEFI overview; these are | |
only hints about how some features are implemented in <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
<sect1 xml:id="sec-uefi-secboot"> | |
<title>Secure boot</title> | |
<para> | |
In the world of UEFI, securing the bootstrapping process means establishing | |
a chain of trust. The <quote>platform</quote> is the root of this chain of | |
trust; in the context of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>, the mainboard and the on-board firmware | |
could be considered the <quote>platform</quote>. In other words, it is the hardware vendor, and the chain of trust flows from | |
that hardware vendor to the component manufacturers, the OS vendors, etc. | |
</para> | |
<para> | |
The trust is expressed via public key cryptography. The hardware vendor puts | |
a so-called Platform Key (PK) into the firmware, representing the root of | |
trust. The trust relationship with operating system vendors and others is | |
documented by signing their keys with the Platform Key. | |
</para> | |
<para> | |
Finally, security is established by requiring that no code will be executed | |
by the firmware unless it has been signed by one of these | |
<quote>trusted</quote> keys—be it an OS boot loader, some driver | |
located in the flash memory of some PCI Express card or on disk, or be it an | |
update of the firmware itself. | |
</para> | |
<para> | |
To use Secure Boot, you need to have your OS loader signed with | |
a key trusted by the firmware, and you need the OS loader to verify that the | |
kernel it loads can be trusted. | |
</para> | |
<para> | |
Key Exchange Keys (KEK) can be added to the UEFI key database. This way, you | |
can use other certificates, as long as they are signed with the private part | |
of the PK. | |
</para> | |
<sect2 xml:id="sec-uefi-secboot-sle"> | |
<title>Implementation on <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase></title> | |
<para> | |
Microsoft’s Key Exchange Key (KEK) is installed by default. | |
</para> | |
<note> | |
<title>GUID partitioning table (GPT) required</title> | |
<para> | |
The Secure Boot feature is enabled by default on UEFI/x86_64 | |
installations. You can find the <guimenu>Enable Secure Boot | |
Support</guimenu> option in the <guimenu>Boot Code Options</guimenu> tab | |
of the <guimenu>Boot Loader Settings</guimenu> dialog. It supports booting | |
when the secure boot is activated in the firmware, while making it | |
possible to boot when it is deactivated. | |
</para> | |
<figure> | |
<title>Secure boot support</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_bootloader_boot_code_efi.png" width="70%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_bootloader_boot_code_efi.png" width="70%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The Secure Boot feature requires that a GUID Partitioning Table (GPT) | |
replaces the old partitioning with a Master Boot Record (MBR). If YaST | |
detects EFI mode during the installation, it will try to create a GPT | |
partition. UEFI expects to find the EFI programs on a FAT-formatted EFI | |
System Partition (ESP). | |
</para> | |
</note> | |
<para> | |
Supporting UEFI Secure Boot requires having a boot loader with | |
a digital signature that the firmware recognizes as a trusted key. That key | |
is trusted by the firmware a priori, without requiring any manual | |
intervention. | |
</para> | |
<para> | |
There are two ways of getting there. One is to work with hardware vendors | |
to have them endorse a SUSE key, which SUSE then signs the boot loader | |
with. The other way is to go through Microsoft’s Windows Logo | |
Certification program to have the boot loader certified and have Microsoft | |
recognize the SUSE signing key (that is, have it signed with their KEK). By | |
now, SUSE got the loader signed by UEFI Signing Service (that is Microsoft | |
in this case). | |
</para> | |
<figure xml:id="fig-uefi-secure-boot-mok2"> | |
<title>UEFI: secure boot process</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="uefi-secure-boot-mok2.png" width="50%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="uefi-secure-boot-mok2.png" width="80%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
At the implementation layer, SUSE uses the <systemitem>shim</systemitem> | |
loader which is installed by default. It is a smart solution that avoids | |
legal issues, and simplifies the certification and signing step | |
considerably. The <systemitem>shim</systemitem> loader’s job is to load a | |
boot loader such as GRUB 2 and verify it; this boot loader in | |
turn will load kernels signed by a SUSE key only. <phrase os="sles;sled">SUSE provides this | |
functionality since SLE11 SP3 on fresh installations with UEFI Secure Boot | |
enabled.</phrase> | |
</para> | |
<para> | |
There are two types of trusted users: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
First, those who hold the keys. The Platform Key (PK) allows almost | |
everything. The Key Exchange Key (KEK) allows all a PK can except | |
changing the PK. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Second, anyone with physical access to the machine. A user with physical | |
access can reboot the machine, and configure UEFI. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
UEFI offers two types of variables to fulfill the needs of those users: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
The first is the so-called <quote>Authenticated Variables</quote>, which | |
can be updated from both within the boot process (the so-called Boot | |
Services Environment) and the running OS. This can be done only when the new value of | |
the variable is signed with the same key that the old value of the | |
variable was signed with. And they can only be appended to or changed to | |
a value with a higher serial number. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The second is the so-called <quote>Boot Services Only Variables</quote>. | |
These variables are accessible to any code that runs during the boot | |
process. After the boot process ends and before the OS starts, the boot | |
loader must call the <literal>ExitBootServices</literal> call. After | |
that, these variables are no longer accessible, and the OS cannot touch | |
them. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
The various UEFI key lists are of the first type, as this allows online | |
updating, adding, and blacklisting of keys, drivers, and firmware | |
fingerprints. It is the second type of variable, the <quote>Boot Services | |
Only Variable</quote>, that helps to implement Secure Boot in a secure and | |
open source-friendly manner, and thus compatible with | |
GPLv3. | |
</para> | |
<para> | |
SUSE starts with <systemitem>shim</systemitem>—a small and simple EFI | |
boot loader signed by SUSE and Microsoft. | |
</para> | |
<para> | |
This allows <systemitem>shim</systemitem> to load and execute. | |
</para> | |
<para> | |
<systemitem>shim</systemitem> then goes on to verify that the boot loader | |
it wants to load is trusted. | |
In a default situation <systemitem>shim</systemitem> will use an | |
independent SUSE certificate embedded in its body. In addition, | |
<systemitem>shim</systemitem> will allow to <quote>enroll</quote> | |
additional keys, overriding the default SUSE key. In the following, we call | |
them <quote>Machine Owner Keys</quote> or MOKs for short. | |
</para> | |
<para> | |
Next the boot loader will verify and then boot the kernel, and the kernel | |
will do the same on the modules. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-uefi-secboot-mok"> | |
<title>MOK (Machine Owner Key)</title> | |
<para> | |
To replace specific kernels, drivers, or other components that are part of | |
the boot process, you need to use Machine Owner Keys (MOKs). The | |
<systemitem>mokutil</systemitem> tool can help you to manage MOKs. | |
</para> | |
<para> | |
You can create a MOK enrollment request with | |
<systemitem>mokutil</systemitem>. The request is stored in a UEFI runtime | |
(RT) variable called <systemitem>MokNew</systemitem>. During the next boot, | |
the <systemitem>shim</systemitem> boot loader detects | |
<systemitem>MokNew</systemitem> and loads | |
<systemitem>MokManager</systemitem>, which presents you with several options. | |
You can use the <guimenu>Enroll key from disk</guimenu> and | |
<guimenu>Enroll hash from disk</guimenu> options to add the key to the | |
MokList. Use the <guimenu>Enroll MOK</guimenu> option to copy the key from | |
the <systemitem>MokNew</systemitem> variable. | |
</para> | |
<para> | |
Enrolling a key from disk is usually done when the shim fails to | |
load <systemitem>grub2</systemitem> and falls back to loading | |
MokManager. As <systemitem>MokNew</systemitem> does not exist yet, | |
you have the option of locating the key on the UEFI partition. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-uefi-secboot-custom"> | |
<title>Booting a custom kernel</title> | |
<para> | |
The following is based on | |
<link xlink:href="https://en.opensuse.org/openSUSE:UEFI#Booting_a_custom_kernel"/>. | |
</para> | |
<para> | |
Secure Boot does not prevent you from using a self-compiled kernel. You | |
must sign it with your own certificate and make that certificate known to | |
the firmware or MOK. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Create a custom X.509 key and certificate used for signing: | |
</para> | |
<screen>openssl req -new -x509 -newkey rsa:2048 -keyout key.asc \ | |
-out cert.pem -nodes -days 666 -subj "/CN=$USER/"</screen> | |
<para> | |
For more information about creating certificates, see | |
<link xlink:href="https://en.opensuse.org/openSUSE:UEFI_Image_File_Sign_Tools#Create_Your_Own_Certificate"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Package the key and the certificate as a PKCS#12 structure: | |
</para> | |
<screen><prompt>> </prompt>openssl pkcs12 -export -inkey key.asc -in cert.pem \ | |
-name kernel_cert -out cert.p12</screen> | |
</step> | |
<step> | |
<para> | |
Generate an NSS database for use with <command>pesign</command>: | |
</para> | |
<screen><prompt>> </prompt>certutil -d . -N</screen> | |
</step> | |
<step> | |
<para> | |
Import the key and the certificate contained in PKCS#12 into the NSS | |
database: | |
</para> | |
<screen><prompt>> </prompt>pk12util -d . -i cert.p12</screen> | |
</step> | |
<step> | |
<para> | |
<quote>Bless</quote> the kernel with the new signature using | |
<command>pesign</command>: | |
</para> | |
<screen><prompt>> </prompt>pesign -n . -c kernel_cert -i arch/x86/boot/bzImage \ | |
-o vmlinuz.signed -s</screen> | |
</step> | |
<step> | |
<para> | |
List the signatures on the kernel image: | |
</para> | |
<screen><prompt>> </prompt>pesign -n . -S -i vmlinuz.signed</screen> | |
<para> | |
At that point, you can install the kernel in <filename>/boot</filename> | |
as usual. Because the kernel now has a custom signature the certificate | |
used for signing needs to be imported into the UEFI firmware or MOK. | |
</para> | |
</step> | |
<step> | |
<para> | |
Convert the certificate to the DER format for import into the firmware or | |
MOK: | |
</para> | |
<screen><prompt>> </prompt>openssl x509 -in cert.pem -outform der -out cert.der</screen> | |
</step> | |
<step> | |
<para> | |
Copy the certificate to the ESP for easier access: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> cp cert.der /boot/efi/</screen> | |
</step> | |
<step> | |
<para> | |
Use <command>mokutil</command> to launch the MOK list automatically. | |
</para> | |
<stepalternatives> | |
<step> | |
<substeps> | |
<step> | |
<para> | |
Import the certificate to MOK: | |
</para> | |
<screen><prompt>> </prompt>mokutil --root-pw --import cert.der</screen> | |
<para> | |
The <option>--root-pw</option> option enables usage of the <systemitem class="username">root</systemitem> | |
user directly. | |
</para> | |
</step> | |
<step> | |
<para> | |
Check the list of certificates that are prepared to be enrolled: | |
</para> | |
<screen><prompt>> </prompt>mokutil --list-new</screen> | |
</step> | |
<step> | |
<para> | |
Reboot the system; <systemitem>shim</systemitem> should launch | |
MokManager. You need to enter the <systemitem class="username">root</systemitem> password to confirm the | |
import of the certificate to the MOK list. | |
</para> | |
</step> | |
<step> | |
<para> | |
Check if the newly imported key was enrolled: | |
</para> | |
<screen><prompt>> </prompt>mokutil --list-enrolled</screen> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<substeps> | |
<step> | |
<para> | |
Alternatively, this is the procedure if you want to launch MOK | |
manually: | |
</para> | |
<para> | |
Reboot | |
</para> | |
</step> | |
<step> | |
<para> | |
In the GRUB 2 menu press the '<literal>c</literal>' key. | |
</para> | |
</step> | |
<step> | |
<para> | |
Type: | |
</para> | |
<screen>chainloader $efibootdir/MokManager.efi | |
boot</screen> | |
</step> | |
<step> | |
<para> | |
Select <guimenu>Enroll key from disk</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Navigate to the <filename>cert.der</filename> file and press | |
<keycap function="enter"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Follow the instructions to enroll the key. Normally this should be | |
pressing '<literal>0</literal>' and then '<literal>y</literal>' to | |
confirm. | |
</para> | |
<para> | |
Alternatively, the firmware menu may provide ways to add a new key to | |
the Signature Database. | |
</para> | |
</step> | |
</substeps> | |
</step> | |
</stepalternatives> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-uefi-secboot-non-inbox"> | |
<title>Using non-inbox drivers</title> | |
<para> | |
There is no support for adding non-inbox drivers (that is, drivers that do | |
not come with <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>) during installation with Secure Boot enabled. The | |
signing key used for SolidDriver/PLDP is not trusted by default. | |
</para> | |
<para> | |
It is possible to install third party drivers during installation with | |
Secure Boot enabled in two different ways. In both cases: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
Add the needed keys to the firmware database via firmware/system | |
management tools before the installation. This option depends on the | |
specific hardware you are using. Consult your hardware vendor for more | |
information. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Use a bootable driver ISO from | |
<link xlink:href="https://drivers.suse.com/"/> or your hardware vendor to | |
enroll the needed keys in the MOK list at first boot. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
To use the bootable driver ISO to enroll the driver keys to the MOK list, | |
follow these steps: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Burn the ISO image above to an empty CD/DVD medium. | |
</para> | |
</step> | |
<step> | |
<para> | |
Start the installation using the new CD/DVD medium, having the standard | |
installation media at hand or a URL to a network installation | |
server. | |
</para> | |
<para> | |
If doing a network installation, enter the URL of the network | |
installation source on the boot command line using the | |
<option>install=</option> option. | |
</para> | |
<para> | |
If doing installation from optical media, the installer will first boot | |
from the driver kit and then ask to insert the first installation disk of | |
the product. | |
</para> | |
</step> | |
<step> | |
<para> | |
An initrd containing updated drivers will be used for installation. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
For more information, see | |
<link xlink:href="https://drivers.suse.com/doc/Usage/Secure_Boot_Certificate.html"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-uefi-secboot-feats"> | |
<title>Features and limitations</title> | |
<para> | |
When booting in Secure Boot mode, the following features apply: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
Installation to UEFI default boot loader location, a mechanism to keep or | |
restore the EFI boot entry. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Reboot via UEFI. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Xen hypervisor will boot with UEFI when there is no legacy BIOS to fall | |
back to. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
UEFI IPv6 PXE boot support. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
UEFI videomode support, the kernel can retrieve video mode from UEFI | |
to configure KMS mode with the same parameters. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
UEFI booting from USB devices is supported. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Since SUSE Linux Enterprise Server 15 SP3, Kexec and Kdump are supported in | |
Secure Boot mode. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
When booting in Secure Boot mode, the following limitations apply: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
To ensure that Secure Boot cannot be easily circumvented, some kernel | |
features are disabled when running under Secure Boot. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Boot loader, kernel, and kernel modules must be signed. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Hibernation (suspend on disk) is disabled. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Access to <filename>/dev/kmem</filename> and | |
<filename>/dev/mem</filename> is not possible, not even as root user. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Access to the I/O port is not possible, not even as root user. All X11 | |
graphical drivers must use a kernel driver. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
PCI BAR access through sysfs is not possible. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>custom_method</literal> in ACPI is not available. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
debugfs for asus-wmi module is not available. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
the <literal>acpi_rsdp</literal> parameter does not have any effect on | |
the kernel. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-uefi-moreinfo"> | |
<title>More information</title> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
<link xlink:href="https://www.uefi.org"/> —UEFI home page where you | |
can find the current UEFI specifications. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Blog posts by Olaf Kirch and Vojtěch Pavlík (the chapter above is | |
heavily based on these posts): | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
<link xlink:href="https://www.suse.com/c/uefi-secure-boot-plan/"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="https://www.suse.com/c/uefi-secure-boot-overview/"/> | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="https://www.suse.com/c/uefi-secure-boot-details/"/> | |
</para> | |
</listitem> | |
</itemizedlist> | |
</listitem> | |
<listitem> | |
<para> | |
<link xlink:href="https://en.opensuse.org/openSUSE:UEFI"/> —UEFI with | |
openSUSE. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-grub2"> | |
<title>The boot loader GRUB 2</title> | |
<info> | |
<abstract> | |
<para> | |
This chapter describes how to configure GRUB 2, the boot loader used in | |
<phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase>. <phrase os="sled;sles">It is the successor to the | |
traditional GRUB boot loader—now called <quote>GRUB Legacy</quote>. | |
GRUB 2 has been the default boot loader in <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> since | |
version 12.</phrase> A YaST module is available for configuring the most | |
important settings. The boot procedure as a whole is outlined in <xref linkend="cha-boot" role="internalbook"/>. For details on Secure Boot support for UEFI machines, | |
see <xref linkend="cha-uefi" role="internalbook"/>. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 xml:id="sec-grub2-new-features"> | |
<title>Main differences between GRUB legacy and GRUB 2</title> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
The configuration is stored in different files. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
More file systems are supported (for example, Btrfs). | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Can directly read files stored on LVM or RAID devices. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The user interface can be translated and altered with themes. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Includes a mechanism for loading modules to support additional features, | |
such as file systems, etc. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Automatically searches for and generates boot entries for other kernels | |
and operating systems, such as Windows. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Includes a minimal Bash-like console. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 xml:id="sec-grub2-file-structure"> | |
<title>Configuration file structure</title> | |
<para> | |
The configuration of GRUB 2 is based on the following files: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><filename>/boot/grub2/grub.cfg</filename> | |
</term> | |
<listitem> | |
<para> | |
This file contains the configuration of the GRUB 2 menu items. It | |
replaces <filename>menu.lst</filename> used in GRUB Legacy. | |
<filename>grub.cfg</filename> should not be edited—it is automatically | |
generated by the command <command>grub2-mkconfig -o /boot/grub2/grub.cfg</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/boot/grub2/custom.cfg</filename> | |
</term> | |
<listitem> | |
<para> | |
This optional file is directly sourced by <filename>grub.cfg</filename> | |
at boot time and can be used to add custom items to the boot menu. | |
Starting with <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> <phrase os="sles;sled">12 | |
SP2</phrase> these entries will also | |
be parsed when using <command>grub-once</command>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>/etc/default/grub</filename> | |
</term> | |
<listitem> | |
<para> | |
This file controls the user settings of GRUB 2 and usually includes | |
additional environmental settings such as backgrounds and themes. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Scripts under <filename>/etc/grub.d/</filename> | |
</term> | |
<listitem> | |
<para> | |
The scripts in this directory are read during execution of the command | |
<command>grub2-mkconfig -o /boot/grub2/grub.cfg</command>. Their instructions are | |
integrated into the main configuration file | |
<filename>/boot/grub/grub.cfg</filename>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-grub2-sysconfig"> | |
<term><filename>/etc/sysconfig/bootloader</filename> | |
</term> | |
<listitem> | |
<para> | |
This configuration file holds some basic settings like the boot loader | |
type and whether to enable UEFI Secure Boot support. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename arch="x86_64">/boot/grub2/x86_64-efi</filename>, | |
<filename arch="power">/boot/grub2/power-ieee1275</filename><phrase os="sles">, | |
<filename arch="zseries">/boot/grub2/s390x</filename></phrase> | |
</term> | |
<listitem> | |
<para> | |
These configuration files contain architecture-specific options. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
GRUB 2 can be controlled in various ways. Boot entries from an existing | |
configuration can be selected from the graphical menu (splash screen). The | |
configuration is loaded from the file | |
<filename>/boot/grub2/grub.cfg</filename> which is compiled from other | |
configuration files (see below). All GRUB 2 configuration files are | |
considered system files, and you need <systemitem class="username">root</systemitem> privileges to edit them. | |
</para> | |
<note> | |
<title>Activating configuration changes</title> | |
<para> | |
After having manually edited GRUB 2 configuration files, you need to run | |
<command>grub2-mkconfig -o /boot/grub2/grub.cfg</command> to activate the changes. However, this | |
is not necessary when changing the configuration with YaST, because YaST will | |
automatically run this command. | |
</para> | |
</note> | |
<sect2 xml:id="sec-grub2-cfg"> | |
<title>The file <filename>/boot/grub2/grub.cfg</filename></title> | |
<para> | |
The graphical splash screen with the boot menu is based on the GRUB 2 | |
configuration file <filename>/boot/grub2/grub.cfg</filename>, which | |
contains information about all partitions or operating systems that can be | |
booted by the menu. | |
</para> | |
<para> | |
Every time the system is booted, GRUB 2 loads the menu file directly from | |
the file system. For this reason, GRUB 2 does not need to be re-installed | |
after changes to the configuration file. <filename>grub.cfg</filename> is | |
automatically rebuilt with kernel installations or removals. | |
</para> | |
<para> | |
<filename>grub.cfg</filename> is compiled from the file | |
<filename>/etc/default/grub</filename> and scripts found in the | |
<filename>/etc/grub.d/</filename> directory when running the command | |
<command>grub2-mkconfig -o /boot/grub2/grub.cfg</command>. Therefore you should never | |
edit the file manually. Instead, edit the related source files or use the | |
YaST <guimenu>Boot Loader</guimenu> module to modify the configuration as | |
described in <xref linkend="sec-grub2-yast2-config" role="internalbook"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-grub2-etc-default-grub"> | |
<title>The file <filename>/etc/default/grub</filename></title> | |
<para> | |
More general options of GRUB 2 belong here, such as the time the menu is | |
displayed, or the default OS to boot. To list all available options, see | |
the output of the following command: | |
</para> | |
<screen><prompt>> </prompt>grep "export GRUB_DEFAULT" -A50 /usr/sbin/grub2-mkconfig | grep GRUB_</screen> | |
<para> | |
In addition to already defined variables, the user may introduce their own | |
variables, and use them later in the scripts found in the | |
<filename>/etc/grub.d</filename> directory. | |
</para> | |
<para> | |
After having edited <filename>/etc/default/grub</filename>, update the main | |
configuration file with <command>grub2-mkconfig -o /boot/grub2/grub.cfg</command>.</para> | |
<note> | |
<title>Scope</title> | |
<remark> | |
Do we really still have Xen-specific kernels? - sknorr, 2017-05-08 | |
</remark> | |
<para> | |
All options set in this file are general options that affect all boot | |
entries. Specific options for Xen kernels or the Xen hypervisor can be | |
set via the GRUB_*_XEN_* configuration options. See below for details. | |
</para> | |
</note> | |
<variablelist> | |
<varlistentry> | |
<term><literal>GRUB_DEFAULT</literal> | |
</term> | |
<listitem> | |
<para> | |
Sets the boot menu entry that is booted by default. Its value can be a | |
numeric value, the complete name of a menu entry, or | |
<quote>saved</quote>. | |
</para> | |
<para> | |
<literal>GRUB_DEFAULT=2</literal> boots the third (counted from zero) | |
boot menu entry. | |
</para> | |
<para> | |
<literal>GRUB_DEFAULT="2>0"</literal> boots the first submenu entry | |
of the third top-level menu entry. | |
</para> | |
<para> | |
<literal>GRUB_DEFAULT="Example boot menu entry"</literal> boots the menu | |
entry with the title <quote>Example boot menu entry</quote>. | |
</para> | |
<para> | |
<literal>GRUB_DEFAULT=saved</literal> boots the entry specified by the | |
<command>grub2-once</command> or <command>grub2-set-default</command> | |
commands. While <command>grub2-reboot</command> sets the | |
default boot entry for the next reboot only, | |
<command>grub2-set-default</command> sets the default boot entry until | |
changed. <command>grub2-editenv list</command> lists the next boot entry. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_HIDDEN_TIMEOUT</literal> | |
</term> | |
<listitem> | |
<para> | |
Waits the specified number of seconds for the user to press a key. | |
During the period no menu is shown unless the user presses a key. If no | |
key is pressed during the time specified, the control is passed to | |
<literal>GRUB_TIMEOUT</literal>. | |
<literal>GRUB_HIDDEN_TIMEOUT=0</literal> first checks whether | |
<keycap function="shift"/> is pressed and shows the boot menu if yes, | |
otherwise immediately boots the default menu entry. This is the default | |
when only one bootable OS is identified by GRUB 2. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_HIDDEN_TIMEOUT_QUIET</literal> | |
</term> | |
<listitem> | |
<para> | |
If <literal>false</literal> is specified, a countdown timer is displayed | |
on a blank screen when the <literal>GRUB_HIDDEN_TIMEOUT</literal> | |
feature is active. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_TIMEOUT</literal> | |
</term> | |
<listitem> | |
<para> | |
Time period in seconds the boot menu is displayed before automatically | |
booting the default boot entry. If you press a key, the timeout is | |
cancelled and GRUB 2 waits for you to make the selection manually. | |
<literal>GRUB_TIMEOUT=-1</literal> will cause the menu to be displayed | |
until you select the boot entry manually. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_LINUX</literal> | |
</term> | |
<listitem> | |
<para> | |
Entries on this line are added at the end of the boot entries for normal | |
and recovery mode. Use it to add kernel parameters to the boot entry. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_LINUX_DEFAULT</literal> | |
</term> | |
<listitem> | |
<para> | |
Same as <literal>GRUB_CMDLINE_LINUX</literal> but the entries are | |
appended in the normal mode only. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_LINUX_RECOVERY</literal> | |
</term> | |
<listitem> | |
<para> | |
Same as <literal>GRUB_CMDLINE_LINUX</literal> but the entries are | |
appended in the recovery mode only. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_LINUX_XEN_REPLACE</literal> | |
</term> | |
<listitem> | |
<para> | |
This entry will completely replace the | |
<literal>GRUB_CMDLINE_LINUX</literal> parameters for all Xen boot | |
entries. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT</literal> | |
</term> | |
<listitem> | |
<para> | |
Same as <literal>GRUB_CMDLINE_LINUX_XEN_REPLACE</literal> but it will | |
only replace parameters of<literal>GRUB_CMDLINE_LINUX_DEFAULT</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_XEN</literal> | |
</term> | |
<listitem> | |
<para> | |
This entry specifies the kernel parameters for the Xen guest kernel | |
only—the operation principle is the same as for | |
<literal>GRUB_CMDLINE_LINUX</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_CMDLINE_XEN_DEFAULT</literal> | |
</term> | |
<listitem> | |
<para> | |
Same as <literal>GRUB_CMDLINE_XEN</literal>—the operation | |
principle is the same as for | |
<literal>GRUB_CMDLINE_LINUX_DEFAULT</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_TERMINAL</literal> | |
</term> | |
<listitem> | |
<para> | |
Enables and specifies an input/output terminal device. Can be | |
<literal>console</literal> (PC BIOS and EFI consoles), | |
<literal>serial</literal> (serial terminal), | |
<literal>ofconsole</literal> (Open Firmware console), or the default | |
<literal>gfxterm</literal> (graphics-mode output). It is also possible | |
to enable more than one device by quoting the required options, for | |
example <literal>GRUB_TERMINAL="console serial"</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_GFXMODE</literal> | |
</term> | |
<listitem> | |
<para> | |
The resolution used for the <literal>gfxterm</literal> graphical | |
terminal. Note that you can only use modes supported by your graphics | |
card (VBE). The default is ‘auto’, which tries to select a preferred | |
resolution. You can display the screen resolutions available to GRUB 2 | |
by typing <command>videoinfo</command> in the GRUB 2 command line. The | |
command line is accessed by typing <keycap>C</keycap> when the GRUB 2 | |
boot menu screen is displayed. | |
</para> | |
<para> | |
You can also specify a color depth by appending it to the resolution | |
setting, for example <literal>GRUB_GFXMODE=1280x1024x24</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_BACKGROUND</literal> | |
</term> | |
<listitem> | |
<para> | |
Set a background image for the <literal>gfxterm</literal> graphical | |
terminal. The image must be a file readable by GRUB 2 at boot time, and | |
it must end with the <literal>.png</literal>, <literal>.tga</literal>, | |
<literal>.jpg</literal>, or <literal>.jpeg</literal> suffix. If | |
necessary, the image will be scaled to fit the screen. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>GRUB_DISABLE_OS_PROBER</literal> | |
</term> | |
<listitem> | |
<para> | |
If this option is set to <literal>true</literal>, automatic searching | |
for other operating systems is disabled. Only the kernel images in | |
<filename>/boot/</filename> and the options from your own scripts in | |
<filename>/etc/grub.d/</filename> are detected. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>SUSE_BTRFS_SNAPSHOT_BOOTING</literal> | |
</term> | |
<listitem> | |
<para> | |
If this option is set to <literal>true</literal>, GRUB 2 can boot | |
directly into Snapper snapshots. For more information, see | |
<xref linkend="sec-snapper-snapshot-boot" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
For a complete list of options, see the | |
<link xlink:href="http://www.gnu.org/software/grub/manual/grub.html#Simple-configuration"> | |
GNU GRUB manual</link>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-grub2-etc-grub-d"> | |
<title>Scripts in <filename>/etc/grub.d</filename></title> | |
<para> | |
The scripts in this directory are read during execution of the | |
command <command>grub2-mkconfig -o /boot/grub2/grub.cfg</command>. Their instructions are | |
incorporated into <filename>/boot/grub2/grub.cfg</filename>. The order of | |
menu items in <filename>grub.cfg</filename> is determined by the order in | |
which the files in this directory are run. Files with a leading numeral are | |
executed first, beginning with the lowest number. | |
<filename>00_header</filename> is run before <filename>10_linux</filename>, | |
which would run before <filename>40_custom</filename>. If files with | |
alphabetic names are present, they are executed after the numerically-named | |
files. Only executable files generate output to | |
<filename>grub.cfg</filename> during execution of | |
<command>grub2-mkconfig</command>. By default all files in the | |
<filename>/etc/grub.d</filename> directory are executable. | |
</para> | |
<tip> | |
<title>Persistent custom content in <filename>grub.cfg</filename></title> | |
<para> | |
Because <filename>/boot/grub2/grub.cfg</filename> is recompiled each time | |
<command>grub2-mkconfig</command> is run, any custom content is lost. | |
If you want to insert your lines directly into | |
<filename>/boot/grub2/grub.cfg</filename> without losing them after | |
<command>grub2-mkconfig</command> is run, insert them between | |
</para> | |
<screen>### BEGIN /etc/grub.d/90_persistent ###</screen> | |
<para> | |
and | |
</para> | |
<screen>### END /etc/grub.d/90_persistent ###</screen> | |
<para> | |
The <filename>90_persistent</filename> script ensures that such | |
content will be preserved. | |
</para> | |
<para> | |
A list of the most important scripts follows: | |
</para> | |
</tip> | |
<variablelist> | |
<varlistentry> | |
<term><filename>00_header</filename> | |
</term> | |
<listitem> | |
<para> | |
Sets environmental variables such as system file locations, display | |
settings, themes, and previously saved entries. It also imports | |
preferences stored in the <filename>/etc/default/grub</filename>. | |
Normally you do not need to make changes to this file. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>10_linux</filename> | |
</term> | |
<listitem> | |
<para> | |
Identifies Linux kernels on the root device and creates relevant menu | |
entries. This includes the associated recovery mode option if enabled. | |
Only the latest kernel is displayed on the main menu page, with | |
additional kernels included in a submenu. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>30_os-prober</filename> | |
</term> | |
<listitem> | |
<para> | |
This script uses <command>os-prober</command> to search for Linux and | |
other operating systems and places the results in the GRUB 2 menu. There | |
are sections to identify specific other operating systems, such as | |
Windows or macOS. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><filename>40_custom</filename> | |
</term> | |
<listitem> | |
<para> | |
This file provides a simple way to include custom boot entries into | |
<filename>grub.cfg</filename>. Make sure that you do not change the | |
<literal>exec tail -n +3 $0</literal> part at the beginning. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The processing sequence is set by the preceding numbers with the lowest | |
number being executed first. If scripts are preceded by the same number the | |
alphabetical order of the complete name decides the order. | |
</para> | |
<tip> | |
<title><filename>/boot/grub2/custom.cfg</filename></title> | |
<para> | |
If you create <filename>/boot/grub2/custom.cfg</filename> and fill | |
it with content, it will be automatically included into | |
<filename>/boot/grub2/grub.cfg</filename> right after | |
<filename>40_custom</filename> at boot time. | |
</para> | |
</tip> | |
</sect2> | |
<sect2 xml:id="sec-grub2-map"> | |
<title>Mapping between BIOS drives and Linux devices</title> | |
<para> | |
In GRUB Legacy, the <filename>device.map</filename> configuration file was | |
used to derive Linux device names from BIOS drive numbers. The mapping | |
between BIOS drives and Linux devices cannot always be guessed correctly. | |
For example, GRUB Legacy would get a wrong order if the boot sequence of | |
IDE and SCSI drives is exchanged in the BIOS configuration. | |
</para> | |
<para> | |
GRUB 2 avoids this problem by using device ID strings (UUIDs) or file | |
system labels when generating <filename>grub.cfg</filename>. GRUB 2 | |
utilities create a temporary device map on the fly, which is usually | |
sufficient, particularly in the case of single-disk systems. | |
</para> | |
<para> | |
However, if you need to override the GRUB 2's automatic device mapping | |
mechanism, create your custom mapping file | |
<filename>/boot/grub2/device.map</filename>. The following example changes | |
the mapping to make <literal>DISK 3</literal> the boot disk. Note that | |
GRUB 2 partition numbers start with <literal>1</literal> and not with | |
<literal>0</literal> as in GRUB Legacy. | |
</para> | |
<screen>(hd1) /dev/disk-by-id/<replaceable>DISK3 ID</replaceable> | |
(hd2) /dev/disk-by-id/<replaceable>DISK1 ID</replaceable> | |
(hd3) /dev/disk-by-id/<replaceable>DISK2 ID</replaceable></screen> | |
</sect2> | |
<sect2 xml:id="sec-grub2-menu-change"> | |
<title>Editing menu entries during the boot procedure</title> | |
<para> | |
Being able to directly edit menu entries is useful when the system does not | |
boot anymore because of a faulty configuration. It can also be used to test | |
new settings without altering the system configuration. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
In the graphical boot menu, select the entry you want to edit with the | |
arrow keys. | |
</para> | |
</step> | |
<step> | |
<para> | |
Press <keycap>E</keycap> to open the text-based editor. | |
</para> | |
</step> | |
<step> | |
<para> | |
Use the arrow keys to move to the line you want to edit. | |
</para> | |
<figure xml:id="fig-grub2-boot-editor"> | |
<title>GRUB 2 boot editor</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="grub2_edit_config.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="grub2_edit_config.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
Now you have two options: | |
</para> | |
<substeps performance="required"> | |
<step> | |
<para> | |
Add space-separated parameters to the end of the line starting with | |
<literal>linux</literal> or <literal>linuxefi</literal> to edit the | |
kernel parameters. A complete list of parameters is available at | |
<link xlink:href="https://en.opensuse.org/Linuxrc"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Or edit the general options to change for example the kernel version. | |
The <keycap function="tab"/> key suggests all possible completions. | |
</para> | |
</step> | |
</substeps> | |
</step> | |
<step> | |
<para> | |
Press <keycap>F10</keycap> to boot the system with the changes you made | |
or press <keycap function="escape"/> to discard your edits and return to | |
the GRUB 2 menu. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
Changes made this way only apply to the current boot process and are not | |
saved permanently. | |
</para> | |
<important> | |
<title>Keyboard layout during the boot procedure</title> | |
<para> | |
The US keyboard layout is the only one available when booting. See | |
<phrase role="externalbook-fig-trouble-install-keyboard-us"/>. | |
</para> | |
</important> | |
<note arch="x86_64"> | |
<title>Boot loader on the installation media</title> | |
<para> | |
The Boot Loader of the installation media on systems with a traditional | |
BIOS is still GRUB Legacy. To add boot parameters, select an entry and start | |
typing. Additions you make to the installation boot entry will be | |
permanently saved in the installed system. | |
</para> | |
</note> | |
<note os="sles" arch="zseries"> | |
<title>Editing GRUB 2 menu entries on IBM Z</title> | |
<para> | |
Cursor movement and editing commands on IBM Z differ—see | |
<xref linkend="sec-grub2-zseries" role="internalbook"/> for details. | |
</para> | |
</note> | |
</sect2> | |
<sect2 xml:id="sec-grub2-password"> | |
<title>Setting a boot password</title> | |
<para> | |
Even before the operating system is booted, GRUB 2 enables access to file | |
systems. Users without root permissions can access files in your Linux | |
system to which they have no access after the system is booted. To block | |
this kind of access or to prevent users from booting certain menu entries, | |
set a boot password. | |
</para> | |
<important> | |
<title>Booting requires a password</title> | |
<para> | |
If set, the boot password is required on every boot, which means the | |
system does not boot automatically. | |
</para> | |
</important> | |
<para> | |
Proceed as follows to set a boot password. Alternatively use YaST | |
(<xref linkend="vle-grub2-yast2-boot-password" role="internalbook"/>). | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Encrypt the password using <command>grub2-mkpasswd-pbkdf2:</command> | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> grub2-mkpasswd-pbkdf2 | |
Password: **** | |
Reenter password: **** | |
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A... | |
</screen> | |
</step> | |
<step> | |
<para> | |
Paste the resulting string into the file | |
<filename>/etc/grub.d/40_custom</filename> together with the <command>set | |
superusers</command> command. | |
</para> | |
<screen>set superusers="root" | |
password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...</screen> | |
</step> | |
<step> | |
<para> | |
To import the changes into the main configuration file, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> grub2-mkconfig -o /boot/grub2/grub.cfg</screen> | |
</step> | |
</procedure> | |
<para> | |
After you reboot, you will be prompted for a user name and a password when | |
trying to boot a menu entry. Enter <literal>root</literal> and the password | |
you typed during the <command>grub2-mkpasswd-pbkdf2</command> command. If | |
the credentials are correct, the system will boot the selected boot entry. | |
</para> | |
<para> | |
For more information, see | |
<link xlink:href="https://www.gnu.org/software/grub/manual/grub.html#Security"/>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-grub2-authorization"> | |
<title>Authorized access to boot menu entries</title> | |
<para> | |
You can configure GRUB 2 to allow access to boot menu entries depending | |
on the level of authorization. You can configure multiple user accounts | |
protected with passwords and assign them access to different menu entries. | |
To configure authorization in GRUB 2, follow these steps: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Create and encrypt one password for each user account you want to use in | |
GRUB 2. Use the <command>grub2-mkpasswd-pbkdf2</command> command as | |
described in <xref linkend="sec-grub2-password" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Delete the file <filename>/etc/grub.d/10_linux</filename>. | |
This prevents outputting the default GRUB 2 menu entries. | |
</para> | |
</step> | |
<step> | |
<para> | |
Edit the <filename>/boot/grub2/custom.cfg</filename> file and add custom | |
menu entries manually. The following template is an example, adjust | |
it to better match your use case: | |
</para> | |
<screen> | |
set superusers=admin | |
password admin <replaceable>ADMIN_PASSWORD</replaceable> | |
password maintainer <replaceable>MAINTAINER_PASSWORD</replaceable> | |
menuentry 'Operational mode' { | |
insmod ext2 | |
set root=hd0,1 | |
echo 'Loading Linux ...' | |
linux /boot/vmlinuz root=/dev/vda1 $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_CMDLINE_LINUX mode=operation | |
echo 'Loading Initrd ...' | |
initrd /boot/initrd | |
} | |
menuentry 'Maintenance mode' --users maintainer { | |
insmod ext2 | |
set root=hd0,1 | |
echo 'Loading Linux ...' | |
linux /boot/vmlinuz root=/dev/vda1 $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_CMDLINE_LINUX mode=maintenance | |
echo 'Loading Initrd ...' | |
initrd /boot/initrd | |
} | |
</screen> | |
</step> | |
<step> | |
<para> | |
Import the changes into the main configuration file: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> grub2-mkconfig -o /boot/grub2/grub.cfg</screen> | |
</step> | |
</procedure> | |
<para> | |
In the above example: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
The GRUB 2 menu has two entries, <guimenu>Operational mode</guimenu> | |
and <guimenu>Maintenance mode</guimenu>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
If no user is specified, both boot menu entries are accessible, but | |
no one can access GRUB 2 command line or edit existing menu entries. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>admin</literal> user can access GRUB 2 command line and edit | |
existing menu entries. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>maintenance</literal> user can select the recovery menu item. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-grub2-yast2-config"> | |
<title>Configuring the boot loader with YaST</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
The easiest way to configure general options of the boot loader in your | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> system is to use the YaST module. In the <guimenu>YaST Control Center</guimenu>, select | |
<menuchoice> <guimenu>System</guimenu> <guimenu>Boot | |
Loader</guimenu></menuchoice>. The module shows the current boot loader | |
configuration of your system and allows you to make changes. | |
</para> | |
<para> | |
Use the <guimenu>Boot Code Options</guimenu> tab to view and change settings | |
related to type, location and advanced loader settings. You can choose | |
whether to use GRUB 2 in standard or EFI mode. | |
</para> | |
<important> | |
<title>EFI systems require GRUB2-EFI</title> | |
<para> | |
If you have an EFI system you can only install GRUB2-EFI, otherwise your | |
system is no longer bootable. | |
</para> | |
</important> | |
<important> | |
<title>Reinstalling the boot loader</title> | |
<para> | |
To reinstall the boot loader, make sure to change a setting in YaST and | |
then change it back. For example, to reinstall GRUB2-EFI, select | |
<guimenu>GRUB2</guimenu> first and then immediately switch back to | |
<guimenu>GRUB2-EFI</guimenu>. | |
</para> | |
<para> | |
Otherwise, the boot loader may only be partially reinstalled. | |
</para> | |
</important> | |
<note> | |
<title>Custom boot loader</title> | |
<para> | |
To use a boot loader other than the ones listed, select <guimenu>Do Not | |
Install Any Boot Loader</guimenu>. Read the documentation of your boot | |
loader carefully before choosing this option. | |
</para> | |
</note> | |
<sect2 xml:id="sec-grub2-yast2-location"> | |
<title>Boot loader location and boot code options</title> | |
<para> | |
The default location of the boot loader depends on the partition setup and | |
is either the Master Boot Record (MBR) or the boot sector of the | |
<filename>/</filename> partition. To modify the location of the boot loader, | |
follow these steps: | |
</para> | |
<procedure xml:id="pro-sec-grub2-yast2-location"> | |
<title>Changing the boot loader location</title> | |
<step> | |
<para> | |
Select the <guimenu>Boot Code Options</guimenu> tab and then choose one of | |
the following options for <guimenu>Boot Loader Location</guimenu>: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Boot from Master Boot Record</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This installs the boot loader in the MBR of the disk containing the | |
directory <filename>/boot</filename>. Usually this will be the disk | |
mounted to <filename>/</filename>, but if <filename>/boot</filename> is | |
mounted to a separate partition on a different disk, the MBR of that | |
disk will be used. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Boot from Root Partition</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This installs the boot loader in the boot sector of the | |
<filename>/</filename> partition. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Custom Root Partition</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Use this option to specify the location of the boot loader manually. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> to apply the changes. | |
</para> | |
</step> | |
</procedure> | |
<figure xml:id="fig-grub2-yast-boot-code-options0"> | |
<title>Boot code options</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_bootloader_boot_code.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_bootloader_boot_code.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The <guimenu>Boot Code Options</guimenu> tab includes the following | |
additional options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Set Active Flag in Partition Table for Boot | |
Partition</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Activates the partition that contains the | |
<filename>/boot</filename> directory. For POWER systems it | |
activates the PReP partition. Use this option on systems with | |
old BIOS and/or legacy operating systems because they may fail | |
to boot from a non-active partition. It is safe to leave this | |
option active. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Write Generic Boot Code to MBR</guimenu> | |
</term> | |
<listitem> | |
<para> | |
If MBR contains a custom 'non-GRUB' code, this option replaces it with a | |
generic, operating system independent code. If you deactivate this | |
option, the system may become unbootable. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Enable Trusted Boot Support</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Starts TrustedGRUB2, which supports trusted computing functionality | |
(Trusted Platform Module (TPM)). For more information refer to | |
<link xlink:href="https://github.com/Sirrix-AG/TrustedGRUB2"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The <guimenu>Protective MBR flag</guimenu> section includes the following | |
options: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>set</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This is appropriate for traditional legacy BIOS booting. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>remove</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This is appropriate for UEFI booting. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>do not change</guimenu> | |
</term> | |
<listitem> | |
<para> | |
This is usually the best choice if you have an already working | |
system. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
In most cases YaST defaults to the appropriate choice. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-grub2-yast2-config-order"> | |
<title>Adjusting the disk order</title> | |
<para> | |
If your computer has more than one hard disk, you can specify the boot | |
sequence of the disks. The first disk in the list is where GRUB 2 will be | |
installed in the case of booting from MBR. It is the disk where <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> | |
is installed by default. The rest of the list is a hint for | |
GRUB 2's device mapper (see <xref linkend="sec-grub2-map" role="internalbook"/>). | |
</para> | |
<warning> | |
<title>Unbootable system</title> | |
<para> | |
The default value is usually valid for almost all deployments. If you change | |
the boot order of disks wrongly, the system may become unbootable on the | |
next reboot. For example, if the first disk in the list is not part of the | |
BIOS boot order, and the other disks in the list have empty MBRs. | |
</para> | |
</warning> | |
<procedure xml:id="pro-sec-grub2-yast2-config-order"> | |
<title>Setting the disk order</title> | |
<step> | |
<para> | |
Open the <guimenu>Boot Code Options</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Edit Disk Boot Order</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
If more than one disk is listed, select a disk and click | |
<guimenu>Up</guimenu> or <guimenu>Down</guimenu> to reorder the displayed | |
disks. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>OK</guimenu> two times to save the changes. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
<sect2 xml:id="sec-grub2-yast2-config-advanced"> | |
<title>Configuring advanced options</title> | |
<para> | |
Advanced boot parameters can be configured via the <guimenu>Boot Loader | |
Options</guimenu> tab. | |
</para> | |
<sect3 xml:id="sec-grub2-yast2-config-advanced-boot-loader"> | |
<title><guimenu>Boot Loader Options</guimenu> tab</title> | |
<figure xml:id="fig-grub2-yast-bootloader-options"> | |
<title>Boot loader options</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_bootloader_options.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_bootloader_options.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Boot Loader Time-Out</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Change the value of <guimenu>Time-Out in Seconds</guimenu> by typing in | |
a new value and clicking the appropriate arrow key with your mouse. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Probe Foreign OS</guimenu> | |
</term> | |
<listitem> | |
<para> | |
When selected, the boot loader searches for other systems like Windows | |
or other Linux installations. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Hide Menu on Boot</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Hides the boot menu and boots the default entry. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Adjusting the Default Boot Entry</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Select the desired entry from the <quote>Default Boot Section</quote> | |
list. Note that the <quote>></quote> sign in the boot entry name | |
delimits the boot section and its subsection. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-grub2-yast2-boot-password"> | |
<term><guimenu>Protect Boot Loader with Password</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Protects the boot loader and the system with an additional password. For | |
details on manual configuration, see <xref linkend="sec-grub2-password" role="internalbook"/>. | |
If this option is activated, the boot password is required on every boot, | |
which means the system does not boot automatically. However, if you prefer | |
the behavior of GRUB 1, additionally enable <guimenu>Protect Entry | |
Modification Only</guimenu>. With this setting, anybody is allowed to select | |
a boot entry and boot the system, whereas the password for the GRUB 2 <systemitem class="username">root</systemitem> | |
user is only required for modifying boot entries. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-grub2-yast2-config-advanced-kernel-parameters"> | |
<title><guimenu>Kernel Parameters</guimenu> tab</title> | |
<figure xml:id="fig-grub2-yast-kernel-parameters"> | |
<title>Kernel parameters</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_bootloader_kernel_parameters.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_bootloader_kernel_parameters.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<variablelist> | |
<varlistentry> | |
<term><guimenu>Optional Kernel Command Line Parameter</guimenu> | |
</term> | |
<listitem> | |
<para> | |
Specify optional kernel parameters here to enable/disable system | |
features, add drivers, etc. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-grub2-yast2-cpu-mitigations"> | |
<term><guimenu>CPU Mitigations</guimenu></term> | |
<listitem> | |
<para> | |
SUSE has released one or more kernel boot command line parameters for | |
all software mitigations that have been deployed to prevent CPU side-channel | |
attacks. Some of those may result in performance loss. Choose | |
one the following options to strike a balance between security and | |
performance, depending on your setting: | |
</para> | |
<formalpara> | |
<title><guimenu>Auto</guimenu></title> | |
<para> | |
Enables all mitigations required for your CPU model, but does | |
not protect against cross-CPU thread attacks. This setting may impact | |
performance to some degree, depending on the workload. | |
</para> | |
</formalpara> | |
<formalpara> | |
<title><guimenu>Auto + No SMT</guimenu></title> | |
<para> | |
Provides the full set of available security mitigations. Enables all | |
mitigations required for your CPU model. In addition, it disables | |
Simultaneous Multithreading (SMT) to avoid side-channel attacks across | |
multiple CPU threads. This setting may further impact performance, | |
depending on the workload. | |
</para> | |
</formalpara> | |
<formalpara> | |
<title><guimenu>Off</guimenu></title> | |
<para> | |
Disables all mitigations. Side-channel attacks against your CPU | |
are possible, depending on the CPU model. This setting has no impact | |
on performance. | |
</para> | |
</formalpara> | |
<formalpara> | |
<title><guimenu>Manual</guimenu></title> | |
<para> | |
Does not set any mitigation level. Specify your CPU mitigations manually | |
by using the kernel command line options. | |
</para> | |
</formalpara> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Use Graphical Console</guimenu> | |
</term> | |
<listitem> | |
<para> | |
When checked, the boot menu appears on a graphical splash screen rather | |
than in a text mode. The resolution of the boot screen is set | |
automatically by default, but you can manually set it | |
via <guimenu>Console resolution</guimenu>. The graphical theme | |
definition file can be specified with the <guimenu>Console | |
theme</guimenu> file chooser. Only change this if you want to apply | |
your own, custom-made theme. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><guimenu>Use Serial Console</guimenu> | |
</term> | |
<listitem> | |
<para> | |
If your machine is controlled via a serial console, activate this option | |
and specify which COM port to use at which speed. See <command>info | |
grub</command> or | |
<link xlink:href="http://www.gnu.org/software/grub/manual/grub.html#Serial-terminal"/> | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 os="sles" xml:id="sec-grub2-zseries"> | |
<title>Differences in terminal usage on IBM Z</title> | |
<para> | |
On 3215 and 3270 terminals there are some differences and limitations on how | |
to move the cursor and how to issue editing commands within GRUB 2. | |
</para> | |
<sect2 xml:id="sec-grub2-zseries-limitations"> | |
<title>Limitations</title> | |
<variablelist> | |
<varlistentry> | |
<term>Interactivity</term> | |
<listitem> | |
<para> | |
Interactivity is strongly limited. Typing often does not result in | |
visual feedback. To see where the cursor is, type an underscore | |
(<keycap>_</keycap>). | |
</para> | |
<note> | |
<title>3270 compared to 3215</title> | |
<para> | |
The 3270 terminal is much better at displaying and refreshing screens | |
than the 3215 terminal. | |
</para> | |
</note> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Cursor movement</term> | |
<listitem> | |
<para> | |
<quote>Traditional</quote> cursor movement is not possible. | |
<keycap function="alt"/>, <keycap function="meta"/>, | |
<keycap function="control"/> and the cursor keys do not work. To move | |
the cursor, use the key combinations listed in | |
<xref linkend="sec-grub2-zseries-keys" role="internalbook"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Caret</term> | |
<listitem> | |
<para> | |
The caret (<keycap>^</keycap>) is used as a control character. To type a | |
literal <keycap>^</keycap> followed by a letter, type | |
<keycap>^</keycap>, <keycap>^</keycap>, | |
<replaceable>LETTER</replaceable>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Enter</term> | |
<listitem> | |
<para> | |
The <keycap function="enter"/> key does not work, use | |
<keycombo><keycap>^</keycap> <keycap>J</keycap></keycombo> instead. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-grub2-zseries-keys"> | |
<title>Key combinations</title> | |
<informaltable> | |
<tgroup cols="3"> | |
<tbody> | |
<row> | |
<entry morerows="2" valign="top"> | |
<para> | |
Common Substitutes: | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap> <keycap>J</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
engage (<quote>Enter</quote>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>L</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
abort, return to previous <quote>state</quote> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>I</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
tab completion (in edit and shell mode) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry morerows="8" valign="top"> | |
<para> | |
Keys Available in Menu Mode: | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>A</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
first entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>E</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
last entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>P</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
previous entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>N</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
next entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>G</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
previous page | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>C</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
next page | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>F</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
boot selected entry or enter submenu (same as | |
<keycombo><keycap>^</keycap><keycap>J</keycap></keycombo>) | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>E</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
edit selected entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>C</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
enter GRUB-Shell | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry morerows="13" valign="top"> | |
<para> | |
Keys Available in Edit Mode: | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>P</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
previous line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>N</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
next line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>B</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
backward char | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>F</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
forward char | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>A</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
beginning of line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>E</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
end of line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>H</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
backspace | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>D</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
delete | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>K</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
kill line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>Y</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
yank | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>O</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
open line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>L</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
refresh screen | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>X</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
boot entry | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>C</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
enter GRUB-Shell | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry morerows="10" valign="top"> | |
<para> | |
Keys Available in Command Line Mode: | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>P</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
previous command | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>N</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
next command from history | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>A</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
beginning of line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>E</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
end of line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>B</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
backward char | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>F</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
forward char | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>H</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
backspace | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>D</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
delete | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>K</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
kill line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>U</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
discard line | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<keycombo><keycap>^</keycap><keycap>Y</keycap></keycombo> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
yank | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</informaltable> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-grub2-commands"> | |
<title>Helpful GRUB 2 commands</title> | |
<variablelist> | |
<varlistentry xml:id="vle-grub2-mkconfig"> | |
<term><command>grub2-mkconfig</command> | |
</term> | |
<listitem> | |
<para> | |
Generates a new <filename>/boot/grub2/grub.cfg</filename> based on | |
<filename>/etc/default/grub</filename> and the scripts from | |
<filename>/etc/grub.d/</filename>. | |
</para> | |
<example> | |
<title>Usage of grub2-mkconfig</title> | |
<screen>grub2-mkconfig -o /boot/grub2/grub.cfg</screen> | |
</example> | |
<tip> | |
<title>Syntax check</title> | |
<para> | |
Running <command>grub2-mkconfig</command> without any parameters prints | |
the configuration to STDOUT where it can be reviewed. Use | |
<xref linkend="vle-grub2-script-check" role="internalbook"/> after | |
<filename>/boot/grub2/grub.cfg</filename> has been written to check its | |
syntax. | |
</para> | |
</tip> | |
<important> | |
<title><command>grub2-mkconfig</command> cannot repair UEFI Secure Boot tables</title> | |
<para> | |
If you are using UEFI Secure Boot and your system is not reaching GRUB 2 | |
correctly anymore, you may need to additionally reinstall the Shim and | |
regenerate the UEFI boot table. To do so, use: | |
</para> | |
<screen><prompt role="root"># </prompt>shim-install --config-file=/boot/grub2/grub.cfg</screen> | |
</important> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-grub2-mkrescue"> | |
<term><command>grub2-mkrescue</command></term> | |
<listitem> | |
<para> | |
Creates a bootable rescue image of your installed GRUB 2 configuration. | |
</para> | |
<example> | |
<title>Usage of grub2-mkrescue</title> | |
<screen>grub2-mkrescue -o save_path/name.iso iso</screen> | |
</example> | |
</listitem> | |
</varlistentry> | |
<varlistentry xml:id="vle-grub2-script-check"> | |
<term><command>grub2-script-check</command> | |
</term> | |
<listitem> | |
<para> | |
Checks the given file for syntax errors. | |
</para> | |
<example> | |
<title>Usage of grub2-script-check</title> | |
<screen>grub2-script-check /boot/grub2/grub.cfg</screen> | |
</example> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>grub2-once</command> | |
</term> | |
<listitem> | |
<para> | |
Set the default boot entry for the next boot only. To get the list of | |
available boot entries use the <option>--list</option> option. | |
</para> | |
<example> | |
<title>Usage of grub2-once</title> | |
<screen>grub2-once number_of_the_boot_entry</screen> | |
</example> | |
<tip> | |
<title><command>grub2-once</command> help</title> | |
<para> | |
Call the program without any option to get a full list of all possible | |
options. | |
</para> | |
</tip> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-grub2-info"> | |
<title>More information</title> | |
<para> | |
Extensive information about GRUB 2 is available at <link xlink:href="https://www.gnu.org/software/grub/"/>. Also refer to the | |
<command>grub</command> info page. <phrase os="sles;sled">You can also | |
search for the keyword <quote>GRUB 2</quote> in the Technical Information | |
Search at <link xlink:href="https://www.suse.com/support"/> to get | |
information about special issues.</phrase> | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-systemd"> | |
<title>The <systemitem class="daemon">systemd</systemitem> daemon</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> is responsible for initializing the system, and it has the | |
process ID 1. <systemitem class="daemon">systemd</systemitem> is started directly by the kernel and resists | |
signal 9, which normally terminates processes. | |
All other programs are either started directly by <systemitem class="daemon">systemd</systemitem> or by one of its | |
child processes. <systemitem class="daemon">systemd</systemitem> is a replacement for the System V init daemon and | |
fully compatible with System V init (by supporting init scripts). | |
</para> | |
<para> | |
The main advantage of <systemitem class="daemon">systemd</systemitem> is that it considerably speeds up boot time by | |
parallelizing service starts. Furthermore, <systemitem class="daemon">systemd</systemitem> only starts a service when | |
it is really needed. Daemons are not started unconditionally at | |
boot time, but when being required for the first time. <systemitem class="daemon">systemd</systemitem> also | |
supports Kernel Control Groups (cgroups), creating snapshots, and restoring | |
the system state. For more details see <link xlink:href="http://www.freedesktop.org/wiki/Software/systemd/"/>. | |
</para> | |
<sect1 xml:id="sec-boot-systemd-concept"> | |
<title>The <systemitem class="daemon">systemd</systemitem> concept</title> | |
<para> | |
The following section explains the concept behind <systemitem class="daemon">systemd</systemitem>. | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> is a system and session manager for Linux, compatible with System V | |
and LSB init scripts. | |
The main features of <systemitem class="daemon">systemd</systemitem> include: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
parallelization capabilities | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
socket and D-Bus activation for starting services | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
on-demand starting of daemons | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
tracking of processes using Linux cgroups | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
creating snapshots and restoring of the system state | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
maintains mount and automount points | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
implements an elaborate transactional dependency-based service control | |
logic | |
</para> | |
</listitem> | |
</itemizedlist> | |
<sect2 xml:id="sec-boot-systemd-unitfile"> | |
<title>Unit file</title> | |
<para> | |
A unit configuration file contains information about a service, a socket, a | |
device, a mount point, an automount point, a swap file or partition, a | |
start-up target, a watched file system path, a timer controlled and supervised | |
by <systemitem class="daemon">systemd</systemitem>, a temporary system state snapshot, a resource management slice | |
or a group of externally created processes. | |
</para> | |
<para> | |
<quote>Unit file</quote> is a generic term used by <systemitem class="daemon">systemd</systemitem> for the following: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<formalpara> | |
<title>Service</title> | |
<para> | |
Information about a process (for example running a daemon); file ends with | |
.service | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Targets</title> | |
<para> | |
Used for grouping units and as synchronization points during start-up; file | |
ends with .target | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Sockets</title> | |
<para> | |
Information about an IPC or network socket or a file system FIFO, for | |
socket-based activation (like <systemitem class="daemon">inetd</systemitem>); | |
file ends with .socket | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Path</title> | |
<para> | |
Used to trigger other units (for example running a service when files change); | |
file ends with .path | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Timer</title> | |
<para> | |
Information about a timer controlled, for timer-based activation; file ends with | |
.timer | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Mount point</title> | |
<para> | |
Usually auto-generated by the fstab generator; file ends with .mount | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Automount point</title> | |
<para> | |
Information about a file system automount point; file ends with .automount | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Swap</title> | |
<para> | |
Information about a swap device or file for memory paging; file ends with .swap | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Device</title> | |
<para> | |
Information about a device unit as exposed in the sysfs/udev(7) device tree; file | |
ends with .device | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Scope / slice</title> | |
<para> | |
A concept for hierarchically managing resources of a group of processes; file ends | |
with .scope/.slice | |
</para> | |
</formalpara> | |
</listitem> | |
</itemizedlist> | |
<para> | |
For more information about <systemitem class="daemon">systemd</systemitem> unit files, see | |
<link xlink:href="http://www.freedesktop.org/software/systemd/man/systemd.unit.html"/> | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-basics"> | |
<title>Basic usage</title> | |
<para> | |
The System V init system uses several commands to handle services—the init scripts, <command>insserv</command>, <command>telinit</command> and others. <systemitem class="daemon">systemd</systemitem> makes it easier to manage services, since there is only one command to memorize for the majority of service-handling tasks: <command>systemctl</command>. | |
It uses the <quote>command plus subcommand</quote> notation like <command>git</command> or <command>zypper</command>: | |
</para> | |
<screen>systemctl <replaceable>GENERAL OPTIONS</replaceable> <replaceable>SUBCOMMAND</replaceable> <replaceable>SUBCOMMAND OPTIONS</replaceable></screen> | |
<para> | |
See <command>man 1 systemctl</command> for a complete manual. | |
</para> | |
<tip> | |
<title>Terminal output and Bash completion</title> | |
<para> | |
If the output goes to a terminal (and not to a pipe or a file, for example), <systemitem class="daemon">systemd</systemitem> commands send long output to a pager by default. | |
Use the <option>--no-pager</option> option to turn off paging mode. | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> also supports bash-completion, allowing you to enter the first letters of a subcommand and then press <keycap function="tab"/>. | |
This feature is only available in the <systemitem>bash</systemitem> shell and requires the installation of the package <systemitem class="resource">bash-completion</systemitem>. | |
</para> | |
</tip> | |
<sect2 xml:id="sec-boot-systemd-basics-services"> | |
<title>Managing services in a running system</title> | |
<para> | |
Subcommands for managing services are the same as for managing a service with System V init (<command>start</command>, <command>stop</command>, ...). | |
The general syntax for service management commands is as follows: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><systemitem class="daemon">systemd</systemitem></term> | |
<listitem> | |
<screen>systemctl reload|restart|start|status|stop|<replaceable>...</replaceable> <replaceable>MY_SERVICE(S)</replaceable></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>System V init</term> | |
<listitem> | |
<screen>rc<replaceable>MY_SERVICE(S)</replaceable> reload|restart|start|status|stop|<replaceable>...</replaceable></screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> allows you to manage several services in one go. | |
Instead of executing init scripts one after the other as with System V init, execute a command like the following: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl start <replaceable>MY_1ST_SERVICE</replaceable> <replaceable>MY_2ND_SERVICE</replaceable></screen> | |
<para> | |
To list all services available on the system: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl list-unit-files --type=service</screen> | |
<para> | |
The following table lists the most important service management commands for <systemitem class="daemon">systemd</systemitem> and System V init: | |
</para> | |
<table rowsep="1"> | |
<title>Service management commands</title> | |
<tgroup cols="3"> | |
<colspec colnum="1" colname="1" colwidth="50*"/> | |
<colspec colnum="2" colname="2" colwidth="30*"/> | |
<colspec colnum="3" colname="3" colwidth="20*"/> | |
<thead> | |
<row> | |
<entry colname="1"> | |
<para> | |
Task | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> Command | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
System V init Command | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Starting</title> | |
<para/> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>start</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>start</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Stopping</title> | |
<para/> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>stop</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>stop</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Restarting</title> | |
<para> | |
Shuts down services and starts them afterward. | |
If a service is not yet running it will be started. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>restart</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>restart</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Restarting conditionally</title> | |
<para> | |
Restarts services if they are currently running. | |
Does nothing for services that are not running. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>try-restart</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>try-restart</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Reloading</title> | |
<para> | |
Tells services to reload their configuration files without interrupting operation. | |
Use case: Tell Apache to reload a modified <filename>httpd.conf</filename> configuration file. | |
Note that not all services support reloading. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>reload</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>reload</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Reloading or restarting</title> | |
<para> | |
Reloads services if reloading is supported, otherwise restarts them. | |
If a service is not yet running it will be started. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>reload-or-restart</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>n/a</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Reloading or restarting conditionally</title> | |
<para> | |
Reloads services if reloading is supported, otherwise restarts them if currently running. | |
Does nothing for services that are not running. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>reload-or-try-restart</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>n/a</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Getting detailed status information</title> | |
<para> | |
Lists information about the status of services. | |
The <systemitem class="daemon">systemd</systemitem> command shows details such as description, executable, status, cgroup, and messages last issued by a service (see <xref linkend="sec-boot-systemd-basics-services-debugging" role="internalbook"/>). | |
The level of details displayed with the System V init differs from service to service. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>status</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>status</screen> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Getting short status information</title> | |
<para> | |
Shows whether services are active or not. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<screen>is-active</screen> | |
</entry> | |
<entry colname="3"> | |
<screen>status</screen> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-basics-services-enabling"> | |
<title>Permanently enabling/disabling services</title> | |
<para> | |
The service management commands mentioned in the previous section let you manipulate services for the current session. <systemitem class="daemon">systemd</systemitem> also lets you permanently enable or disable services, so they are automatically started when requested or are always unavailable. | |
You can either do this by using YaST, or on the command line. | |
</para> | |
<sect3 xml:id="sec-boot-systemd-basics-services-enabling-cmd"> | |
<title>Enabling/disabling services on the command line</title> | |
<para> | |
The following table lists enabling and disabling commands for <systemitem class="daemon">systemd</systemitem> and System V init: | |
</para> | |
<important> | |
<title>Service start</title> | |
<para> | |
When enabling a service on the command line, it is not started automatically. | |
It is scheduled to be started with the next system start-up or runlevel/target change. | |
To immediately start a service after having enabled it, explicitly run <command>systemctl start <replaceable>MY_SERVICE</replaceable></command> or <command>rc <replaceable>MY_SERVICE</replaceable> start</command>. | |
</para> | |
</important> | |
<table rowsep="1"> | |
<title>Commands for enabling and disabling services</title> | |
<tgroup cols="3"> | |
<colspec colnum="1" colname="1" colwidth="32*"/> | |
<colspec colnum="2" colname="2" colwidth="40*"/> | |
<colspec colnum="3" colname="3" colwidth="28*"/> | |
<thead> | |
<row> | |
<entry colname="1"> | |
<para> | |
Task | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> Command | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
System V init Command | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Enabling</title> | |
<para/> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl enable <replaceable>MY_SERVICE(S)</replaceable></command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
<command>insserv <replaceable>MY_SERVICE(S)</replaceable></command>, <command>chkconfig -a <replaceable>MY_SERVICE(S)</replaceable></command> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Disabling</title> | |
<para/> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl disable <replaceable>MY_SERVICE(S)</replaceable>.service</command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
<command>insserv -r <replaceable>MY_SERVICE(S)</replaceable></command>, <command>chkconfig -d <replaceable>MY_SERVICE(S)</replaceable></command> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Checking</title> | |
<para> | |
Shows whether a service is enabled or not. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl is-enabled <replaceable>MY_SERVICE</replaceable></command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
<command>chkconfig <replaceable>MY_SERVICE</replaceable></command> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Re-enabling</title> | |
<para> | |
Similar to restarting a service, this command first disables and then enables a service. | |
Useful to re-enable a service with its defaults. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl reenable <replaceable>MY_SERVICE</replaceable></command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
n/a | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Masking</title> | |
<para> | |
After <quote>disabling</quote> a service, it can still be started manually. | |
To completely disable a service, you need to mask it. | |
Use with care. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl mask <replaceable>MY_SERVICE</replaceable></command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
n/a | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<formalpara> | |
<title>Unmasking</title> | |
<para> | |
A service that has been masked can only be used again after it has been unmasked. | |
</para> | |
</formalpara> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl unmask <replaceable>MY_SERVICE</replaceable></command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
n/a | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-boot"> | |
<title>System start and target management</title> | |
<para> | |
The entire process of starting the system and shutting it down is maintained by <systemitem class="daemon">systemd</systemitem>. | |
From this point of view, the kernel can be considered a background process to maintain all other processes and adjust CPU time and hardware access according to requests from other programs. | |
</para> | |
<sect2 xml:id="sec-boot-systemd-targets"> | |
<title>Targets compared to runlevels</title> | |
<para> | |
With System V init the system was booted into a so-called <quote>Runlevel</quote>. | |
A runlevel defines how the system is started and what services are available in the running system. | |
Runlevels are numbered; the most commonly known ones are <literal>0</literal> (shutting down the system), <literal>3</literal> (multiuser with network) and <literal>5</literal> (multiuser with network and display manager). | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> introduces a new concept by using so-called <quote>target units</quote>. | |
However, it remains fully compatible with the runlevel concept. | |
Target units are named rather than numbered and serve specific purposes. | |
For example, the targets <systemitem>local-fs.target</systemitem> and <systemitem>swap.target</systemitem> mount local file systems and swap spaces. | |
</para> | |
<para> | |
The target <systemitem>graphical.target</systemitem> provides a multiuser system with network and display manager capabilities and is equivalent to runlevel 5. | |
Complex targets, such as <systemitem>graphical.target</systemitem> act as <quote>meta</quote> targets by combining a subset of other targets. | |
Since <systemitem class="daemon">systemd</systemitem> makes it easy to create custom targets by combining existing targets, it offers great flexibility. | |
</para> | |
<para> | |
The following list shows the most important <systemitem class="daemon">systemd</systemitem> target units. | |
For a full list refer to <command>man 7 systemd.special</command>. | |
</para> | |
<variablelist> | |
<title>Selected <systemitem class="daemon">systemd</systemitem> target units</title> | |
<varlistentry> | |
<term><systemitem>default.target</systemitem></term> | |
<listitem> | |
<para> | |
The target that is booted by default. | |
Not a <quote>real</quote> target, but rather a symbolic link to another target like <systemitem>graphic.target</systemitem>. | |
Can be permanently changed via YaST (see <xref linkend="sec-boot-runlevel-edit" role="internalbook"/>). | |
To change it for a session, use the kernel parameter <literal>systemd.unit=<replaceable>MY_TARGET.target</replaceable></literal> at the boot prompt. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>emergency.target</systemitem></term> | |
<listitem> | |
<para> | |
Starts an emergency shell on the console. | |
Only use it at the boot prompt as <literal>systemd.unit=emergency.target</literal>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>graphical.target</systemitem></term> | |
<listitem> | |
<para> | |
Starts a system with network, multiuser support and a display manager. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>halt.target</systemitem></term> | |
<listitem> | |
<para> | |
Shuts down the system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>mail-transfer-agent.target</systemitem></term> | |
<listitem> | |
<para> | |
Starts all services necessary for sending and receiving mails. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>multi-user.target</systemitem></term> | |
<listitem> | |
<para> | |
Starts a multiuser system with network. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>reboot.target</systemitem></term> | |
<listitem> | |
<para> | |
Reboots the system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>rescue.target</systemitem></term> | |
<listitem> | |
<para> | |
Starts a single-user system without network. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
To remain compatible with the System V init runlevel system, <systemitem class="daemon">systemd</systemitem> provides special targets named <literal>runlevel<replaceable>X</replaceable>.target</literal> mapping the corresponding runlevels numbered <replaceable>X</replaceable>. | |
</para> | |
<para> | |
If you want to know the current target, use the command: <command>systemctl get-default</command> | |
</para> | |
<table rowsep="1"> | |
<title>System V runlevels and <systemitem class="daemon">systemd</systemitem> target units</title> | |
<tgroup cols="3"> | |
<colspec colnum="1" colname="1" colwidth="20*"/> | |
<colspec colnum="2" colname="2" colwidth="40*"/> | |
<colspec colnum="3" colname="3" colwidth="40*"/> | |
<thead> | |
<row> | |
<entry> | |
<para> | |
System V runlevel | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> target | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Purpose | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
0 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel0.target</systemitem>, <systemitem>halt.target</systemitem>, <systemitem>poweroff.target</systemitem> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
System shutdown | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
1, S | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel1.target</systemitem>, <systemitem>rescue.target</systemitem>, | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Single-user mode | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
2 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel2.target</systemitem>, <systemitem>multi-user.target</systemitem>, | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Local multiuser without remote network | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
3 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel3.target</systemitem>, <systemitem>multi-user.target</systemitem>, | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Full multiuser with network | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
4 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel4.target</systemitem> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Unused/User-defined | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
5 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel5.target</systemitem>, <systemitem>graphical.target</systemitem>, | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Full multiuser with network and display manager | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
6 | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem>runlevel6.target</systemitem>, <systemitem>reboot.target</systemitem>, | |
</para> | |
</entry> | |
<entry> | |
<para> | |
System reboot | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
<important> | |
<title><systemitem class="daemon">systemd</systemitem> ignores <filename>/etc/inittab</filename></title> | |
<para> | |
The runlevels in a System V init system are configured in <filename>/etc/inittab</filename>. <systemitem class="daemon">systemd</systemitem> does <emphasis>not</emphasis> use this configuration. | |
Refer to <xref linkend="sec-boot-systemd-custom-targets" role="internalbook"/> for instructions on how to create your own bootable target. | |
</para> | |
</important> | |
<sect3 xml:id="sec-boot-systemd-targets-commands"> | |
<title>Commands to change targets</title> | |
<para> | |
Use the following commands to operate with target units: | |
</para> | |
<informaltable rowsep="1"> | |
<tgroup cols="3"> | |
<colspec colnum="1" colname="1" colwidth="20*"/> | |
<colspec colnum="2" colname="2" colwidth="50*"/> | |
<colspec colnum="3" colname="3" colwidth="30*"/> | |
<thead> | |
<row> | |
<entry colname="1"> | |
<para> | |
Task | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> Command | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
System V init Command | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry colname="1"> | |
<para> | |
Change the current target/runlevel | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl isolate</command> <replaceable>MY_TARGET</replaceable>.target | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
<command>telinit</command> <replaceable>X</replaceable> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<para> | |
Change to the default target/runlevel | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl default</command> | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
n/a | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<para> | |
Get the current target/runlevel | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl list-units --type=target</command> | |
</para> | |
<para> | |
With <systemitem class="daemon">systemd</systemitem> there is usually more than one active target. | |
The command lists all currently active targets. | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
<command>who -r</command> | |
</para> | |
<para> | |
or | |
</para> | |
<para> | |
<command>runlevel</command> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<para> | |
persistently change the default runlevel | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
Use the Services Manager or run the following command: | |
</para> | |
<para> | |
<command>ln -sf /usr/lib/systemd/system/</command> <replaceable>MY_TARGET</replaceable>.target /etc/systemd/system/default.target | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
Use the Services Manager or change the line | |
</para> | |
<para> | |
<command>id:</command> <replaceable>X</replaceable>:initdefault: | |
</para> | |
<para> | |
in <filename>/etc/inittab</filename> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<para> | |
Change the default runlevel for the current boot process | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
Enter the following option at the boot prompt | |
</para> | |
<para> | |
<command>systemd.unit=</command> <replaceable>MY_TARGET</replaceable>.target | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
Enter the desired runlevel number at the boot prompt. | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry colname="1"> | |
<para> | |
Show a target's/runlevel's dependencies | |
</para> | |
</entry> | |
<entry colname="2"> | |
<para> | |
<command>systemctl show -p "Requires"</command> <replaceable>MY_TARGET</replaceable>.target | |
</para> | |
<para> | |
<command>systemctl show -p "Wants"</command> <replaceable>MY_TARGET</replaceable>.target | |
</para> | |
<para> | |
<quote>Requires</quote> lists the hard dependencies (the ones that must be resolved), whereas <quote>Wants</quote> lists the soft dependencies (the ones that get resolved if possible). | |
</para> | |
</entry> | |
<entry colname="3"> | |
<para> | |
n/a | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</informaltable> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-debug"> | |
<title>Debugging system start-up</title> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> offers the means to analyze the system start-up process. | |
You can review the list of all services and their status (rather than having to parse <filename>/var/log/</filename>). <systemitem class="daemon">systemd</systemitem> also allows you to scan the start-up procedure to find out how much time each service start-up consumes. | |
</para> | |
<sect3 xml:id="sec-boot-systemd-debug-review"> | |
<title>Review start-up of services</title> | |
<para> | |
To review the complete list of services that have been started since booting the system, enter the command <command>systemctl</command>. | |
It lists all active services like shown below (shortened). | |
To get more information on a specific service, use <command>systemctl status <replaceable>MY_SERVICE</replaceable></command>. | |
</para> | |
<example> | |
<title>List active services</title> | |
<screen><prompt role="root"># </prompt>systemctl | |
UNIT LOAD ACTIVE SUB JOB DESCRIPTION | |
[...] | |
iscsi.service loaded active exited Login and scanning of iSC+ | |
kmod-static-nodes.service loaded active exited Create list of required s+ | |
libvirtd.service loaded active running Virtualization daemon | |
nscd.service loaded active running Name Service Cache Daemon | |
chronyd.service loaded active running NTP Server Daemon | |
polkit.service loaded active running Authorization Manager | |
postfix.service loaded active running Postfix Mail Transport Ag+ | |
rc-local.service loaded active exited /etc/init.d/boot.local Co+ | |
rsyslog.service loaded active running System Logging Service | |
[...] | |
LOAD = Reflects whether the unit definition was properly loaded. | |
ACTIVE = The high-level unit activation state, i.e. generalization of SUB. | |
SUB = The low-level unit activation state, values depend on unit type. | |
161 loaded units listed. Pass --all to see loaded but inactive units, too. | |
To show all installed unit files use 'systemctl list-unit-files'.</screen> | |
</example> | |
<para> | |
To restrict the output to services that failed to start, use the <option>--failed</option> option: | |
</para> | |
<example> | |
<title>List failed services</title> | |
<screen><prompt role="root"># </prompt>systemctl --failed | |
UNIT LOAD ACTIVE SUB JOB DESCRIPTION | |
apache2.service loaded failed failed apache | |
NetworkManager.service loaded failed failed Network Manager | |
plymouth-start.service loaded failed failed Show Plymouth Boot Screen | |
[...]</screen> | |
</example> | |
</sect3> | |
<sect3 xml:id="sec-boot-systemd-debug-time"> | |
<title>Debug start-up time</title> | |
<para> | |
To debug system start-up time, <systemitem class="daemon">systemd</systemitem> offers the <command>systemd-analyze</command> command. | |
It shows the total start-up time, a list of services ordered by start-up time and can also generate an SVG graphic showing the time services took to start in relation to the other services. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Listing the system start-up time</term> | |
<listitem> | |
<screen><prompt role="root"># </prompt>systemd-analyze | |
Startup finished in 2666ms (kernel) + 21961ms (userspace) = 24628ms</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Listing the services start-up time</term> | |
<listitem> | |
<screen><prompt role="root"># </prompt>systemd-analyze blame | |
15.000s backup-rpmdb.service | |
14.879s mandb.service | |
7.646s backup-sysconfig.service | |
4.940s postfix.service | |
4.921s logrotate.service | |
4.640s libvirtd.service | |
4.519s display-manager.service | |
3.921s btrfsmaintenance-refresh.service | |
3.466s lvm2-monitor.service | |
2.774s plymouth-quit-wait.service | |
2.591s firewalld.service | |
2.137s initrd-switch-root.service | |
1.954s ModemManager.service | |
1.528s rsyslog.service | |
1.378s apparmor.service | |
[...] | |
</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Services start-up time graphics</term> | |
<listitem> | |
<screen><prompt role="root"># </prompt>systemd-analyze plot > jupiter.example.com-startup.svg</screen> | |
<informalfigure> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="systemd_startup.svg" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="systemd_startup.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</informalfigure> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect3> | |
<sect3 xml:id="sec-boot-systemd-debug-complete"> | |
<title>Review the complete start-up process</title> | |
<para> | |
The commands above list the services that are started and their start-up times. | |
For a more detailed overview, specify the following parameters at the boot prompt to instruct <systemitem class="daemon">systemd</systemitem> to create a verbose log of the complete start-up procedure. | |
</para> | |
<screen>systemd.log_level=debug systemd.log_target=kmsg</screen> | |
<para> | |
Now <systemitem class="daemon">systemd</systemitem> writes its log messages into the kernel ring buffer. | |
View that buffer with <command>dmesg</command>: | |
</para> | |
<screen><prompt>> </prompt>dmesg -T | less</screen> | |
</sect3> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-sysv-compatibility"> | |
<title>System V compatibility</title> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> is compatible with System V, allowing you to still use existing System V init scripts. | |
However, there is at least one known issue where a System V init script does not work with <systemitem class="daemon">systemd</systemitem> out of the box: starting a service as a different user via <command>su</command> or <command>sudo</command> in init scripts will result in a failure of the script, producing an <quote>Access denied</quote> error. | |
</para> | |
<para> | |
When changing the user with <command>su</command> or <command>sudo</command>, a PAM session is started. | |
This session will be terminated after the init script is finished. | |
As a consequence, the service that has been started by the init script will also be terminated. | |
To work around this error, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Create a service file wrapper with the same name as the init script plus the file name extension <filename>.service</filename>: | |
</para> | |
<screen>[Unit] | |
Description=<replaceable>DESCRIPTION</replaceable> | |
After=network.target | |
[Service] | |
User=<replaceable>USER</replaceable> | |
Type=forking<co xml:id="co-service-wrapper-type"/> | |
PIDFile=<replaceable>PATH TO PID FILE</replaceable><xref linkend="co-service-wrapper-type" xrefstyle="select:label nopage" role="internalbook"/> | |
ExecStart=<replaceable>PATH TO INIT SCRIPT</replaceable> start | |
ExecStop=<replaceable>PATH TO INIT SCRIPT</replaceable> stop | |
ExecStopPost=/usr/bin/rm -f <replaceable>PATH TO PID FILE</replaceable><xref linkend="co-service-wrapper-type" xrefstyle="select:label nopage" role="internalbook"/> | |
[Install] | |
WantedBy=multi-user.target<co xml:id="co-service-wrapper-target"/></screen> | |
<para> | |
Replace all values written in <replaceable>UPPERCASE LETTERS</replaceable> with appropriate values. | |
</para> | |
<calloutlist> | |
<callout arearefs="co-service-wrapper-type"> | |
<para> | |
Optional—only use if the init script starts a daemon. | |
</para> | |
</callout> | |
<callout arearefs="co-service-wrapper-target"> | |
<para> | |
<literal>multi-user.target</literal> also starts the init script when booting into <literal>graphical.target</literal>. | |
If it should only be started when booting into the display manager, user <literal>graphical.target</literal> here. | |
</para> | |
</callout> | |
</calloutlist> | |
</step> | |
<step> | |
<para> | |
Start the daemon with <command>systemctl start <replaceable>APPLICATION</replaceable></command>. | |
</para> | |
</step> | |
</procedure> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-runlevel-edit"> | |
<title>Managing services with YaST</title> | |
<para> | |
Basic service management can also be done with the YaST Services Manager module. | |
It supports starting, stopping, enabling and disabling services. | |
It also lets you show a service's status and change the default target. | |
Start the YaST module with <menuchoice> <guimenu>YaST</guimenu> <guimenu>System</guimenu> <guimenu>Services Manager</guimenu> </menuchoice>. | |
</para> | |
<figure xml:id="fig-yast2-runlevel"> | |
<title>Services Manager</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_runlevel.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_runlevel.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<variablelist> | |
<varlistentry> | |
<term>Changing the <guimenu>Default system target</guimenu></term> | |
<listitem> | |
<para> | |
To change the target the system boots into, choose a target from the <guimenu>Default System Target</guimenu> drop-down box. | |
The most often used targets are <guimenu>Graphical Interface</guimenu> (starting a graphical login screen) and <guimenu>Multi-User</guimenu> (starting the system in command line mode). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Starting or stopping a service</term> | |
<listitem> | |
<para> | |
Select a service from the table. | |
The <guimenu>State</guimenu> column shows whether it is currently running (<guimenu>Active</guimenu>) or not (<guimenu>Inactive</guimenu>). | |
Toggle its status by choosing <guimenu>Start</guimenu> or <guimenu>Stop</guimenu>. | |
</para> | |
<para> | |
Starting or stopping a service changes its status for the currently running session. | |
To change its status throughout a reboot, you need to enable or disable it. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Defining service start-up behavior</term> | |
<listitem> | |
<para> | |
Services can either be started automatically at boot time or manually. | |
Select a service from the table. | |
The <guimenu>Start</guimenu> column shows whether it is currently started <guimenu>Manually</guimenu> or <guimenu>On Boot</guimenu>. | |
Toggle its status by choosing <guimenu>Start Mode</guimenu>. | |
</para> | |
<para> | |
To change a service status in the current session, you need to start or stop it as described above. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>View a status messages</term> | |
<listitem> | |
<para> | |
To view the status message of a service, select it from the list and choose <guimenu>Show Details</guimenu>. | |
The output you will see is identical to the one generated by the command <command>systemctl</command> <option>-l</option> status <replaceable>MY_SERVICE</replaceable>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-custom"> | |
<title>Customizing <systemitem>systemd</systemitem></title> | |
<para> | |
The following sections contain some examples for <systemitem>systemd</systemitem> customization. | |
</para> | |
<warning> | |
<title>Preventing your customization from being overwritten</title> | |
<para> | |
When customizing <systemitem class="daemon">systemd</systemitem>, always use the directory <filename>/etc/systemd/</filename>, <emphasis>never</emphasis> use <filename>/usr/lib/systemd/</filename>. | |
Otherwise your changes will be overwritten by the next update of <systemitem class="daemon">systemd</systemitem>. | |
</para> | |
</warning> | |
<sect2 xml:id="sec-boot-systemd-custom-service"> | |
<title>Customizing unit files</title> | |
<para> | |
The recommended way to customize unit files is to use the <command>systemctl edit <replaceable>SERVICE</replaceable></command> command. | |
This command starts the default text editor and creates a directory with the <filename>override.conf</filename> file in <filename>/etc/systemd/system/<replaceable>NAME</replaceable>.service.d/</filename>. | |
The command also ensures that the running <systemitem class="daemon">systemd</systemitem> process is notified about the changes. | |
</para> | |
<para> | |
Alternatively, you can open a copy of the original file for editing instead of a blank file by running <command>systemctl edit --full <replaceable>SERVICE</replaceable></command>. | |
When editing the file, make sure that you do not remove any of the existing sections. | |
</para> | |
<para> | |
As an exercise, change how long the system waits for MariaDB to start. | |
As root, run <command>systemctl edit --full mariadb.service</command>. | |
The file opened will look similar to the following: | |
</para> | |
<screen> | |
[Unit] | |
Description=MySQL server | |
Wants=basic.target | |
Conflicts=mariadb.target | |
After=basic.target network.target | |
[Install] | |
WantedBy=multi-user.target | |
Alias=mysql.service | |
[Service] | |
Restart=on-abort | |
Type=notify | |
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install | |
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade | |
ExecStart=/usr/lib/mysql/mysql-systemd-helper start | |
# Configures the time to wait for start-up/stop | |
TimeoutSec=300 | |
# Prevent writes to /usr, /boot, and /etc | |
ProtectSystem=full | |
# Prevent accessing /home, /root and /run/user | |
ProtectHome=true | |
UMask=007</screen> | |
<para> | |
Adjust the <literal>TimeoutSec</literal> value and save the changes. | |
To enable the changes, as root, run <command>systemctl daemon-reload</command>. | |
</para> | |
<para> | |
For further information, refer to the man pages that can be evoked with the <command>man 1 systemctl</command> command. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-custom-drop-in"> | |
<title>Creating drop-in files</title> | |
<para> | |
For minor changes of a configuration file, use so-called drop-in files. | |
Drop-in files let you extend the configuration of unit files without having to edit or override the unit files themselves. | |
</para> | |
<para> | |
For example, to change a single value for the <replaceable>FOOBAR</replaceable> service located in <filename>/usr/lib/systemd/system/<replaceable>FOOBAR.SERVICE</replaceable></filename>, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Create a directory called <filename>/etc/systemd/system/<replaceable>FOOBAR</replaceable>.service.d/</filename>. | |
</para> | |
<para> | |
Note the <literal>.d</literal> suffix. | |
The directory must otherwise be named like the service that you want to patch with the drop-in file. | |
</para> | |
</step> | |
<step> | |
<para> | |
In that directory, create a file <filename><replaceable>your_modification</replaceable>.conf</filename>. | |
</para> | |
<para> | |
Make sure it only contains the line with the value that you want to modify. | |
</para> | |
</step> | |
<step> | |
<para> | |
Save your changes to the file. | |
</para> | |
</step> | |
</procedure> | |
<note> | |
<title>Avoiding name conflicts</title> | |
<para> | |
To avoid name conflicts between your drop-in files and files shipped by | |
SUSE, it is recommended to prefix all drop-in file names with a two-digit | |
number and a dash: for example, <filename>80-override.conf</filename>. | |
</para> | |
<para> | |
The following ranges are reserved: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
<literal>0-19</literal> is reserved for <systemitem class="daemon">systemd</systemitem> upstream | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>20-25</literal> is reserved for <systemitem class="daemon">systemd</systemitem> shipped by SUSE | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>26-29</literal> is reserved for SUSE packages (other than systemd) | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>50</literal> is reserved for drop-in files created with <command>systemctl set-property</command>. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Use a two-digit number above this range to ensure that none of the drop-in | |
files shipped by SUSE will override your own drop-in files. | |
</para> | |
<para> | |
You can use <command>systemctl cat $UNIT</command> to list and verify which | |
files are taken into account in the units configuration. | |
</para> | |
</note> | |
</sect2> | |
<sect2 xml:id="systemd-xinetd-conversion"> | |
<title>Converting <systemitem>xinetd</systemitem> services to <systemitem class="daemon">systemd</systemitem></title> | |
<para> | |
Since the release of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> 15, the <systemitem>xinetd</systemitem> infrastructure has been removed. | |
This section outlines how to convert existing custom <systemitem>xinetd</systemitem> service files to <systemitem class="daemon">systemd</systemitem> sockets. | |
</para> | |
<para> | |
For each <systemitem>xinetd</systemitem> service file, you need at least two <systemitem class="daemon">systemd</systemitem> unit files: the socket file (<filename>*.socket</filename>) and an associated service file (<filename>*.service</filename>). | |
The socket file tells <systemitem class="daemon">systemd</systemitem> which socket to create, and the service file tells <systemitem class="daemon">systemd</systemitem> which executable to start. | |
</para> | |
<para> | |
Consider the following example <systemitem>xinetd</systemitem> service file: | |
</para> | |
<screen><prompt role="root"># </prompt>cat /etc/xinetd.d/example | |
service example | |
{ | |
socket_type = stream | |
protocol = tcp | |
port = 10085 | |
wait = no | |
user = user | |
group = users | |
groups = yes | |
server = /usr/libexec/example/exampled | |
server_args = -auth=bsdtcp exampledump | |
disable = no | |
}</screen> | |
<para> | |
To convert it to <systemitem class="daemon">systemd</systemitem>, you need the following two matching files: | |
</para> | |
<screen><prompt role="root"># </prompt>cat /usr/lib/systemd/system/example.socket | |
[Socket] | |
ListenStream=0.0.0.0:10085 | |
Accept=false | |
[Install] | |
WantedBy=sockets.target</screen> | |
<screen><prompt role="root"># </prompt>cat /usr/lib/systemd/system/example.service | |
[Unit] | |
Description=example | |
[Service] | |
ExecStart=/usr/libexec/example/exampled -auth=bsdtcp exampledump | |
User=user | |
Group=users | |
StandardInput=socket | |
</screen> | |
<para> | |
For a complete list of the <systemitem class="daemon">systemd</systemitem> 'socket' and 'service' file options, refer to the systemd.socket and systemd.service manual pages (<command>man 5 systemd.socket</command>, <command>man 5 systemd.service</command>). | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-custom-targets"> | |
<title>Creating custom targets</title> | |
<para> | |
On System V init SUSE systems, runlevel 4 is unused to allow administrators to create their own runlevel configuration. <systemitem class="daemon">systemd</systemitem> allows you to create any number of custom targets. | |
It is suggested to start by adapting an existing target such as <systemitem>graphical.target</systemitem>. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Copy the configuration file <filename>/usr/lib/systemd/system/graphical.target</filename> to <filename>/etc/systemd/system/<replaceable>MY_TARGET</replaceable>.target</filename> and adjust it according to your needs. | |
</para> | |
</step> | |
<step> | |
<para> | |
The configuration file copied in the previous step already covers the required (<quote>hard</quote>) dependencies for the target. | |
To also cover the wanted (<quote>soft</quote>) dependencies, create a directory <filename>/etc/systemd/system/<replaceable>MY_TARGET</replaceable>.target.wants</filename>. | |
</para> | |
</step> | |
<step> | |
<para> | |
For each wanted service, create a symbolic link from <filename>/usr/lib/systemd/system</filename> into <filename>/etc/systemd/system/<replaceable>MY_TARGET</replaceable>.target.wants</filename>. | |
</para> | |
</step> | |
<step> | |
<para> | |
When you have finished setting up the target, reload the <systemitem class="daemon">systemd</systemitem> configuration to make the new target available: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl daemon-reload</screen> | |
</step> | |
</procedure> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-advanced"> | |
<title>Advanced usage</title> | |
<para> | |
The following sections cover advanced topics for system administrators. | |
For even more advanced <systemitem class="daemon">systemd</systemitem> documentation, refer to Lennart Pöttering's series about <systemitem class="daemon">systemd</systemitem> for administrators at <link xlink:href="http://0pointer.de/blog/projects"/>. | |
</para> | |
<sect2 xml:id="sec-boot-systemd-advanced-tmp"> | |
<title>Cleaning temporary directories</title> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> supports cleaning temporary directories regularly. | |
The configuration from the previous system version is automatically migrated and active. <literal>tmpfiles.d</literal>—which is responsible for managing temporary files—reads its configuration from <filename>/etc/tmpfiles.d/*.conf</filename>, <filename>/run/tmpfiles.d/*.conf</filename>, and <filename>/usr/lib/tmpfiles.d/*.conf</filename> files. | |
Configuration placed in <filename>/etc/tmpfiles.d/*.conf</filename> overrides related configurations from the other two directories (<filename>/usr/lib/tmpfiles.d/*.conf</filename> is where packages store their configuration files). | |
</para> | |
<para> | |
The configuration format is one line per path containing action and path, and optionally mode, ownership, age and argument fields, depending on the action. | |
The following example unlinks the X11 lock files: | |
</para> | |
<screen>Type Path Mode UID GID Age Argument | |
r /tmp/.X[0-9]*-lock</screen> | |
<para> | |
To get the status the tmpfile timer: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl status systemd-tmpfiles-clean.timer | |
systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories | |
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static) | |
Active: active (waiting) since Tue 2018-04-09 15:30:36 CEST; 1 weeks 6 days ago | |
Docs: man:tmpfiles.d(5) | |
man:systemd-tmpfiles(8) | |
Apr 09 15:30:36 jupiter systemd[1]: Starting Daily Cleanup of Temporary Directories. | |
Apr 09 15:30:36 jupiter systemd[1]: Started Daily Cleanup of Temporary Directories.</screen> | |
<para> | |
For more information on temporary files handling, see <command>man 5 tmpfiles.d</command>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-logging"> | |
<title>System log</title> | |
<para> | |
<xref linkend="sec-boot-systemd-basics-services-debugging" role="internalbook"/> explains how to view log messages for a given service. | |
However, displaying log messages is not restricted to service logs. | |
You can also access and query the complete log messages written by <systemitem class="daemon">systemd</systemitem>—the so-called <quote>Journal</quote>. | |
Use the command <command>journalctl</command> to display the complete log messages starting with the oldest entries. | |
Refer to <command>man 1 journalctl</command> for options such as applying filters or changing the output format. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-snapshots"> | |
<title>Snapshots</title> | |
<para> | |
You can save the current state of <systemitem class="daemon">systemd</systemitem> to a named snapshot and later revert to it with the <command>isolate</command> subcommand. | |
This is useful when testing services or custom targets, because it allows you to return to a defined state at any time. | |
A snapshot is only available in the current session and will automatically be deleted on reboot. | |
A snapshot name must end in <filename>.snapshot</filename>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Create a snapshot</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl snapshot <replaceable>MY_SNAPSHOT</replaceable>.snapshot</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Delete a snapshot</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl delete <replaceable>MY_SNAPSHOT</replaceable>.snapshot</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>View a snapshot</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl show <replaceable>MY_SNAPSHOT</replaceable>.snapshot</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Activate a snapshot</term> | |
<listitem> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl isolate <replaceable>MY_SNAPSHOT</replaceable>.snapshot</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-kernel-modules"> | |
<title>Loading kernel modules</title> | |
<para> | |
With <systemitem class="daemon">systemd</systemitem>, kernel modules can automatically be loaded at boot time via a configuration file in <filename>/etc/modules-load.d</filename>. | |
The file should be named <replaceable>MODULE</replaceable>.conf and have the following content: | |
</para> | |
<screen># load module <replaceable>MODULE</replaceable> at boot time | |
<replaceable>MODULE</replaceable></screen> | |
<para> | |
In case a package installs a configuration file for loading a kernel module, the file gets installed to <filename>/usr/lib/modules-load.d</filename>. | |
If two configuration files with the same name exist, the one in <filename>/etc/modules-load.d</filename> tales precedence. | |
</para> | |
<para> | |
For more information, see the <systemitem>modules-load.d(5)</systemitem> man page. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-before-local"> | |
<title>Performing actions before loading a service</title> | |
<para> | |
With System V init actions that need to be performed before loading a service, needed to be specified in <filename>/etc/init.d/before.local </filename>. | |
This procedure is no longer supported with <systemitem class="daemon">systemd</systemitem>. | |
If you need to do actions before starting services, do the following: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Loading kernel modules</term> | |
<listitem> | |
<para> | |
Create a drop-in file in <filename>/etc/modules-load.d</filename> directory (see <command>man modules-load.d</command> for the syntax) | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Creating Files or Directories, Cleaning-up Directories, Changing Ownership</term> | |
<listitem> | |
<para> | |
Create a drop-in file in <filename>/etc/tmpfiles.d</filename> (see <command>man tmpfiles.d</command> for the syntax) | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Other tasks</term> | |
<listitem> | |
<para> | |
Create a system service file, for example <filename>/etc/systemd/system/before.service</filename>, from the following template: | |
</para> | |
<screen>[Unit] | |
Before=<replaceable>NAME OF THE SERVICE YOU WANT THIS SERVICE TO BE STARTED BEFORE</replaceable> | |
[Service] | |
Type=oneshot | |
RemainAfterExit=true | |
ExecStart=<replaceable>YOUR_COMMAND</replaceable> | |
# beware, executable is run directly, not through a shell, check the man pages | |
# systemd.service and systemd.unit for full syntax | |
[Install] | |
# target in which to start the service | |
WantedBy=multi-user.target | |
#WantedBy=graphical.target</screen> | |
<para> | |
When the service file is created, you should run the following commands (as <systemitem class="username">root</systemitem>): | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl daemon-reload | |
<prompt>> </prompt><command>sudo</command> systemctl enable before</screen> | |
<para> | |
Every time you modify the service file, you need to run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl daemon-reload</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-cgroups"> | |
<title>Kernel control groups (cgroups)</title> | |
<para> | |
On a traditional System V init system it is not always possible to clearly assign a process to the service that spawned it. | |
Some services, such as Apache, spawn a lot of third-party processes (for example CGI or Java processes), which themselves spawn more processes. | |
This makes a clear assignment difficult or even impossible. | |
Additionally, a service may not terminate correctly, leaving some children alive. | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> solves this problem by placing each service into its own cgroup. cgroups are a kernel feature that allows aggregating processes and all their children into hierarchical organized groups. <systemitem class="daemon">systemd</systemitem> names each cgroup after its service. | |
Since a non-privileged process is not allowed to <quote>leave</quote> its cgroup, this provides an effective way to label all processes spawned by a service with the name of the service. | |
</para> | |
<para> | |
To list all processes belonging to a service, use the command <command>systemd-cgls</command>. | |
The result will look like the following (shortened) example: | |
</para> | |
<example> | |
<title>List all processes belonging to a service</title> | |
<screen><prompt role="root"># </prompt>systemd-cgls --no-pager | |
├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 20 | |
├─user.slice | |
│ └─user-1000.slice | |
│ ├─session-102.scope | |
│ │ ├─12426 gdm-session-worker [pam/gdm-password] | |
│ │ ├─15831 gdm-session-worker [pam/gdm-password] | |
│ │ ├─15839 gdm-session-worker [pam/gdm-password] | |
│ │ ├─15858 /usr/lib/gnome-terminal-server | |
[...] | |
└─system.slice | |
├─systemd-hostnamed.service | |
│ └─17616 /usr/lib/systemd/systemd-hostnamed | |
├─cron.service | |
│ └─1689 /usr/sbin/cron -n | |
├─postfix.service | |
│ ├─ 1676 /usr/lib/postfix/master -w | |
│ ├─ 1679 qmgr -l -t fifo -u | |
│ └─15590 pickup -l -t fifo -u | |
├─sshd.service | |
│ └─1436 /usr/sbin/sshd -D | |
[...]</screen> | |
</example> | |
<para> | |
See <phrase role="externalbook-cha-tuning-cgroups">“Kernel control groups” (↑System Analysis and Tuning Guide)</phrase> for more information about cgroups. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-advanced-kill"> | |
<title>Terminating services (sending signals)</title> | |
<para> | |
As explained in <xref linkend="sec-boot-systemd-advanced-cgroups" role="internalbook"/>, it is not always possible to assign a process to its parent service process in a System V init system. | |
This makes it difficult to terminate a service and all of its children. | |
Child processes that have not been terminated will remain as zombie processes. | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem>'s concept of confining each service into a cgroup makes it possible to clearly identify all child processes of a service and therefore allows you to send a signal to each of these processes. | |
Use <command>systemctl kill</command> to send signals to services. | |
For a list of available signals refer to <command>man 7 signals</command>. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Sending <systemitem>SIGTERM</systemitem> to a service</term> | |
<listitem> | |
<para> | |
<systemitem>SIGTERM</systemitem> is the default signal that is sent. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl kill <replaceable>MY_SERVICE</replaceable></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Sending <replaceable>SIGNAL</replaceable> to a service</term> | |
<listitem> | |
<para> | |
Use the <option>-s</option> option to specify the signal that should be sent. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl kill -s <replaceable>SIGNAL</replaceable> <replaceable>MY_SERVICE</replaceable></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Selecting processes</term> | |
<listitem> | |
<para> | |
By default the <command>kill</command> command sends the signal to <option>all</option> processes of the specified cgroup. | |
You can restrict it to the <option>control</option> or the <option>main</option> process. | |
The latter is for example useful to force a service to reload its configuration by sending <systemitem>SIGHUP</systemitem>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl kill -s SIGHUP --kill-who=main <replaceable>MY_SERVICE</replaceable></screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-dbus"> | |
<title>Important notes on the D-Bus service</title> | |
<para> | |
The D-Bus service is the message bus for communication between <systemitem class="daemon">systemd</systemitem> clients and the systemd manager that is running as pid 1. | |
Even though <systemitem class="daemon">dbus</systemitem> is a stand-alone daemon, it is an integral part of the init infrastructure. | |
</para> | |
<para> | |
Terminating <systemitem class="daemon">dbus</systemitem> or restarting it in the running system is similar to an attempt to terminate or restart pid 1. | |
It will break <systemitem class="daemon">systemd</systemitem> client/server communication and make most <systemitem class="daemon">systemd</systemitem> functions unusable. | |
</para> | |
<para> | |
Therefore, terminating or restarting <systemitem class="daemon">dbus</systemitem> is neither recommended nor supported. | |
</para> | |
<para> | |
Updating the <systemitem>dbus</systemitem> or <systemitem>dbus</systemitem>-related packages requires a reboot. | |
When in doubt whether a reboot is necessary, run the <command>sudo zypper ps -s</command>. | |
If <literal>dbus</literal> appears among the listed services, you need to reboot the system. | |
</para> | |
<para> | |
Keep in mind that <systemitem>dbus</systemitem> is updated even when automatic updates are configured to skip the packages that require reboot. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-basics-services-debugging"> | |
<title>Debugging services</title> | |
<para> | |
By default, <systemitem class="daemon">systemd</systemitem> is not overly verbose. | |
If a service was started successfully, no output will be produced. | |
In case of a failure, a short error message will be displayed. | |
However, <command>systemctl status</command> provides means to debug start-up and operation of a service. | |
</para> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> comes with its own logging mechanism (<quote>The Journal</quote>) that logs system messages. | |
This allows you to display the service messages together with status messages. | |
The <command>status</command> command works similar to <command>tail</command> and can also display the log messages in different formats, making it a powerful debugging tool. | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Show service start-up failure</term> | |
<listitem> | |
<para> | |
Whenever a service fails to start, use <command>systemctl status <replaceable>MY_SERVICE</replaceable></command> to get a detailed error message: | |
</para> | |
<screen><prompt role="root"># </prompt>systemctl start apache2 | |
Job failed. See system journal and 'systemctl status' for details. | |
<prompt role="root"># </prompt>systemctl status apache2 | |
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled) | |
Active: failed (Result: exit-code) since Mon, 04 Apr 2018 16:52:26 +0200; 29s ago | |
Process: 3088 ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -k start (code=exited, status=1/FAILURE) | |
CGroup: name=systemd:/system/apache2.service | |
Apr 04 16:52:26 g144 start_apache2[3088]: httpd2-prefork: Syntax error on line | |
205 of /etc/apache2/httpd.conf: Syntax error on li...alHost></screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Show last <replaceable>N</replaceable> service messages</term> | |
<listitem> | |
<para> | |
The default behavior of the <command>status</command> subcommand is to display the last ten messages a service issued. | |
To change the number of messages to show, use the <option>--lines=<replaceable>N</replaceable></option> parameter: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl status chronyd | |
<prompt>> </prompt><command>sudo</command> systemctl --lines=20 status chronyd</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Show service messages in append mode</term> | |
<listitem> | |
<para> | |
To display a <quote>live stream</quote> of service messages, use the <option>--follow</option> option, which works like <command>tail</command> <option>-f</option>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl --follow status chronyd</screen> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Messages output format</term> | |
<listitem> | |
<para> | |
The <option>--output=<replaceable>MODE</replaceable></option> parameter allows you to change the output format of service messages. | |
The most important modes available are: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><option>short</option></term> | |
<listitem> | |
<para> | |
The default format. | |
Shows the log messages with a human readable time stamp. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>verbose</option></term> | |
<listitem> | |
<para> | |
Full output with all fields. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><option>cat</option></term> | |
<listitem> | |
<para> | |
Terse output without time stamps. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-timer-units"> | |
<title><systemitem class="daemon">systemd</systemitem> timer units</title> | |
<para> | |
Similar to cron, <systemitem class="daemon">systemd</systemitem> timer units provide a mechanism for scheduling jobs on Linux. | |
Although <systemitem class="daemon">systemd</systemitem> timer units serve the same purpose as cron, they offer several advantages. | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Jobs scheduled using a timer unit can depend on other <systemitem class="daemon">systemd</systemitem> services. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Timer units are treated as regular <systemitem class="daemon">systemd</systemitem> services, so can be managed with <command>systemctl</command>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Timers can be realtime and monotonic. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Time units are logged to the <systemitem class="daemon">systemd</systemitem> journal, which makes it easier to monitor and troubleshoot them. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> timer units are identified by the <literal>.timer</literal> file name extension. | |
</para> | |
<sect2 xml:id="sec-boot-systemd-timer-types"> | |
<title><systemitem class="daemon">systemd</systemitem> timer types</title> | |
<para> | |
Timer units can use monotonic and realtime timers. | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Similar to cronjobs, realtime timers are triggered on calendar events. | |
Realtime timers are defined using the option <option>OnCalendar</option>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Monotonic timers are triggered at a specified time elapsed from a certain starting point. | |
The latter could be a system boot or system unit activation event. | |
There are several options for defining monotonic timers including <option>OnBootSec</option>, <option>OnUnitActiveSec</option>, and <option>OnTypeSec</option>. | |
Monotonic timers are not persistent, and they are reset after each reboot. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-timer-service-units"> | |
<title><systemitem class="daemon">systemd</systemitem> timers and service units</title> | |
<para> | |
Every timer unit must have a corresponding <systemitem class="daemon">systemd</systemitem> unit file it controls. | |
In other words, a <filename>.timer</filename> file activates and manages the corresponding <filename>.service</filename> file. | |
When used with a timer, the <filename>.service</filename> file does not require an <literal>[Install]</literal> section, as the service is managed by the timer. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-timer-example"> | |
<title>Practical example</title> | |
<para> | |
To understand the basics of <systemitem class="daemon">systemd</systemitem> timer units, we set up a timer that triggers the <filename>foo.sh</filename> shell script. | |
</para> | |
<para> | |
First step is to create a <systemitem class="daemon">systemd</systemitem> service unit that controls the shell script. | |
To do this, open a new text file for editing and add the following service unit definition: | |
</para> | |
<screen>[Unit] | |
Description="Foo shell script" | |
[Service] | |
ExecStart=/usr/local/bin/foo.sh</screen> | |
<para> | |
Save the file under the name <filename>foo.service</filename> in the directory <filename>/etc/systemd/system/</filename>. | |
</para> | |
<para> | |
Next, open a new text file for editing and add the following timer definition: | |
</para> | |
<screen>[Unit] | |
Description="Run foo shell script" | |
[Timer] | |
OnBootSec=5min | |
OnUnitActiveSec=24h | |
Unit=foo.service | |
[Install] | |
WantedBy=multi-user.target</screen> | |
<para> | |
The <literal>[Timer]</literal> section in the example above specifies what service to trigger (<literal>foo.service</literal>) and when to trigger it. | |
In this case, the option <option>OnBootSec</option> specifies a monotonic timer that triggers the service five minutes after the system boot, while the option <option>OnUnitActiveSec</option> triggers the service 24 hours after the service has been activated (that is, the timer will trigger the service once a day). | |
Finally the option <option>WantedBy</option> specifies that the timer should start when the system has reached the multi-user target. | |
</para> | |
<para> | |
Instead of a monotonic timer, you can specify a realtime one using the option <option>OnCalendar</option>. | |
The following realtime timer definition triggers the related service unit once a week, starting on Monday at 12:00. | |
</para> | |
<screen>[Timer] | |
OnCalendar=weekly | |
Persistent=true</screen> | |
<para> | |
The option <option>Persistent=true</option> indicates that the service will be triggered immediately after the timer activation if the timer missed the last start time (for example, because of the system being powered off). | |
</para> | |
<para> | |
The option <option>OnCalendar</option> can also be used to define specific dates times for triggering a service using the following format: <literal>DayOfWeek Year-Month-Day Hour:Minute:Second</literal>. | |
The example below triggers a service at 5am every day: | |
</para> | |
<screen>OnCalendar=*-*-* 5:00:00</screen> | |
<para> | |
You can use an asterisk to specify any value, and commas to list possible values. | |
Use two values separated by .. to indicate a contiguous range. | |
The following example triggers a service at 6pm on Friday of every month: | |
</para> | |
<screen>OnCalendar=Fri *-*-1..7 18:00:00</screen> | |
<para> | |
To trigger a service at different times, you can specify several <option>OnCalendar</option> entries: | |
</para> | |
<screen>OnCalendar=Mon..Fri 10:00 | |
OnCalendar=Sat,Sun 22:00</screen> | |
<para> | |
In the example above, a service is triggered at 10am on week days and at 10pm on weekends. | |
</para> | |
<para> | |
When you are done editing the timer unit file, save it under the name <filename>foo.timer</filename> in the <filename>/etc/systemd/system/</filename> directory. | |
To check the correctness of the created unit files, run the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemd-analyze verify /etc/systemd/system/foo.*</screen> | |
<para> | |
If the command returns no output, the files have passed the verification successfully. | |
</para> | |
<para> | |
To start the timer, use the command <command>sudo systemctl start foo.timer</command>. | |
To enable the timer on boot, run the command <command>sudo systemctl enable foo.timer</command>. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-boot-systemd-timer-manage"> | |
<title>Managing <systemitem class="daemon">systemd</systemitem> timers</title> | |
<para> | |
Since timers are treated as regular <systemitem class="daemon">systemd</systemitem> units, you can manage them using <command>systemctl</command>. | |
You can start a timer with <command>systemctl start</command>, enable a timer with <command>systemctl enable</command>, and so on. | |
In addition to that, you can list all active timers using the command <command>systemctl list-timers</command>. | |
To list all timers, including inactive ones, run the command <command>systemctl list-timers --all</command>. | |
</para> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-boot-systemd-info"> | |
<title>More information</title> | |
<para> | |
For more information on <systemitem class="daemon">systemd</systemitem> refer to the following online resources: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Homepage</term> | |
<listitem> | |
<para> | |
<link xlink:href="http://www.freedesktop.org/wiki/Software/systemd"/> | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="daemon">systemd</systemitem> for administrators</term> | |
<listitem> | |
<para> | |
Lennart Pöttering, one of the <systemitem class="daemon">systemd</systemitem> authors, has written a series of blog entries (13 at the time of writing this chapter). | |
Find them at <link xlink:href="http://0pointer.de/blog/projects"/>. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect1> | |
</chapter> | |
</part> | |
<part xml:id="part-system"> | |
<title>System</title> | |
<chapter version="5.0" xml:id="cha-64bit"> | |
<title>32-bit and 64-bit applications in a 64-bit system environment</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> is available for <phrase os="sles">several</phrase> 64-bit | |
platforms. The developers have not ported all 32-bit applications to 64-bit | |
systems. This chapter offers a brief overview of 32-bit support implementation | |
on 64-bit <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> platforms. | |
</para> | |
<para> | |
<phrase os="sles"><phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> for the 64-bit platforms POWER, IBM Z and | |
AMD64/Intel 64</phrase> is designed so that existing | |
32-bit applications run in the 64-bit environment | |
<quote>out-of-the-box.</quote> <phrase os="sles">The corresponding 32-bit | |
platforms are POWER for POWER, and x86 for AMD64/Intel 64.</phrase> This | |
support means that you can continue to use your preferred 32-bit applications | |
without waiting for a corresponding 64-bit port to become | |
available.<phrase os="sles"> The current POWER system runs most | |
applications in 32-bit mode, but you can run 64-bit applications.</phrase> | |
</para> | |
<note> | |
<title>No support for building 32-bit applications</title> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> does not support compilation of 32-bit applications. It only offers | |
runtime support for 32-bit binaries. | |
</para> | |
</note> | |
<sect1 xml:id="sec-64bit-runt"> | |
<title>Runtime support</title> | |
<important> | |
<title>Conflicts between application versions</title> | |
<para> | |
If an application is available for both 32-bit and 64-bit environments, | |
installing both versions may cause problems. In such cases, decide on one version | |
to install to avoid potential runtime errors. | |
</para> | |
<para> | |
An exception to this rule is PAM (pluggable authentication modules). | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> uses PAM in the authentication process as a layer that | |
mediates between user and application. Always install both PAM versions | |
on 64-bit operating systems that also run 32-bit applications. | |
</para> | |
</important> | |
<para> | |
For correct execution, every application requires a range of libraries. | |
Unfortunately, the names are identical for the 32-bit and 64-bit versions of these | |
libraries. They must be differentiated from each other in | |
another way. | |
</para> | |
<para> | |
To retain compatibility with 32-bit versions, 64-bit and | |
32-bit libraries are stored in the same location. The 32-bit | |
version of <filename>libc.so.6</filename> is located under | |
<filename>/lib/libc.so.6</filename> in both 32-bit and 64-bit | |
environments. | |
</para> | |
<para> | |
All 64-bit libraries and object files are located in directories called | |
<filename>lib64</filename>. The 64-bit object files normally | |
found under <filename>/lib</filename> and | |
<filename>/usr/lib</filename> are now found under | |
<filename>/lib64</filename> and <filename>/usr/lib64</filename>. This means | |
that space is available for 32-bit libraries under <filename>/lib</filename> | |
and <filename>/usr/lib</filename>, so the file name for both versions can | |
remain unchanged. | |
</para> | |
<para> | |
If the data content of 32-bit subdirectories under <filename>/lib</filename> does not | |
depend on word size, they are not moved. This scheme conforms to LSB (Linux Standards Base) | |
and FHS (File System Hierarchy Standard). | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-64bit-kernel"> | |
<title>Kernel specifications</title> | |
<para> | |
The 64-bit kernels for AMD64/Intel 64<phrase os="sles">, POWER and | |
IBM Z</phrase> offer both a 64-bit and a 32-bit kernel ABI (application | |
binary interface). The latter is identical to the ABI for the | |
corresponding 32-bit kernel. This means that communication between | |
both 32-bit and 64-bit applications with 64-bit kernels are identical. | |
</para> | |
<para> | |
The 32-bit system call emulation for 64-bit kernels does not support | |
all the APIs used by system programs. This depends on the platform. For this | |
reason, few applications, like <command>lspci</command>, must be | |
compiled<phrase os="sles"> on non-POWER platforms as 64-bit programs to | |
function properly. On IBM Z, not all ioctls are available in the | |
32-bit kernel ABI</phrase>. | |
</para> | |
<para> | |
A 64-bit kernel can only load 64-bit kernel modules. You must | |
compile 64-bit modules specifically for 64-bit kernels. It is not possible to use 32-bit kernel modules | |
with 64-bit kernels. | |
</para> | |
<tip> | |
<title>Kernel-loadable modules</title> | |
<para> | |
Some applications require separate kernel-loadable modules. If you intend | |
to use a 32-bit application in a 64-bit system environment, contact | |
the provider of the application and SUSE. Make sure that the 64-bit | |
version of the kernel-loadable module and the 32-bit compiled version of | |
the kernel API are available for this module. | |
</para> | |
</tip> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-journalctl"> | |
<title><command>journalctl</command>: Query the <systemitem class="daemon">systemd</systemitem> journal</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
<systemitem class="daemon">systemd</systemitem> features its own logging system called | |
<emphasis>journal</emphasis>. There is no need to run a | |
<systemitem>syslog</systemitem>-based service, as all system events are | |
written to the journal. | |
</para> | |
<para> | |
The journal itself is a system service managed by <systemitem class="daemon">systemd</systemitem>. Its full name is | |
<literal>systemd-journald.service</literal>. It collects and stores logging | |
data by maintaining structured indexed journals based on logging information | |
received from the kernel, user processes, standard input, and system service errors. The <literal>systemd-journald</literal> service is on | |
by default: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl status systemd-journald | |
systemd-journald.service - Journal Service | |
Loaded: loaded (/usr/lib/systemd/system/systemd-journald.service; static) | |
Active: active (running) since Mon 2014-05-26 08:36:59 EDT; 3 days ago | |
Docs: man:systemd-journald.service(8) | |
man:journald.conf(5) | |
Main PID: 413 (systemd-journal) | |
Status: "Processing requests..." | |
CGroup: /system.slice/systemd-journald.service | |
└─413 /usr/lib/systemd/systemd-journald | |
[...]</screen> | |
<sect1 xml:id="sec-journalctl-persistent"> | |
<title>Making the journal persistent</title> | |
<para> | |
The journal stores log data in <filename>/run/log/journal/</filename> by | |
default. Because the <filename>/run/</filename> directory is volatile by | |
nature, log data is lost at reboot. To make the log data persistent, the | |
directory <filename>/var/log/journal/</filename> must exist with correct | |
ownership and permissions so the systemd-journald service can store its | |
data. <systemitem class="daemon">systemd</systemitem> will create the directory for you—and switch to | |
persistent logging—if you do the following: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
As <systemitem class="username">root</systemitem>, open <filename>/etc/systemd/journald.conf</filename> for | |
editing. | |
</para> | |
<screen><prompt role="root"># </prompt>vi /etc/systemd/journald.conf</screen> | |
</step> | |
<step> | |
<para> | |
Uncomment the line containing <literal>Storage=</literal> and change it to | |
</para> | |
<screen>[...] | |
[Journal] | |
Storage=persistent | |
#Compress=yes | |
[...]</screen> | |
</step> | |
<step> | |
<para> | |
Save the file and restart systemd-journald: | |
</para> | |
<screen><prompt role="root"># </prompt>systemctl restart systemd-journald</screen> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-switches"> | |
<title><command>journalctl</command>: Useful switches</title> | |
<para> | |
This section introduces several common useful options to enhance the default | |
<command>journalctl</command> behavior. All switches are described in the | |
<command>journalctl</command> manual page, <command>man 1 | |
journalctl</command>. | |
</para> | |
<tip> | |
<title>Messages related to a specific executable</title> | |
<para> | |
To show all journal messages related to a specific executable, specify the | |
full path to the executable: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl /usr/lib/systemd/systemd</screen> | |
</tip> | |
<variablelist> | |
<varlistentry> | |
<term>-f</term> | |
<listitem> | |
<para> | |
Shows only the most recent journal messages, and prints new log entries | |
as they are added to the journal. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term/> | |
<listitem> | |
<para> | |
Prints the messages and jumps to the end of the journal, so that the | |
latest entries are visible within the pager. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>-r</term> | |
<listitem> | |
<para> | |
Prints the messages of the journal in reverse order, so that the latest | |
entries are listed first. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>-k</term> | |
<listitem> | |
<para> | |
Shows only kernel messages. This is equivalent to the field match | |
<literal>_TRANSPORT=kernel</literal> (see | |
<xref linkend="sec-journalctl-filter-fields" role="internalbook"/>). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>-u</term> | |
<listitem> | |
<para> | |
Shows only messages for the specified <systemitem class="daemon">systemd</systemitem> unit. This is equivalent | |
to the field match | |
<literal>_SYSTEMD_UNIT=<replaceable>UNIT</replaceable></literal> (see | |
<xref linkend="sec-journalctl-filter-fields" role="internalbook"/>). | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl -u apache2 | |
[...] | |
Jun 03 10:07:11 pinkiepie systemd[1]: Starting The Apache Webserver... | |
Jun 03 10:07:12 pinkiepie systemd[1]: Started The Apache Webserver.</screen> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para/> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-filter"> | |
<title>Filtering the journal output</title> | |
<para> | |
When called without switches, <command>journalctl</command> shows the full | |
content of the journal, the oldest entries listed first. The output can be | |
filtered by specific switches and fields. | |
</para> | |
<sect2 xml:id="sec-journalctl-filter-boot"> | |
<title>Filtering based on a boot number</title> | |
<para> | |
<command>journalctl</command> can filter messages based on a specific | |
system boot. To list all available boots, run | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl --list-boots | |
-1 097ed2cd99124a2391d2cffab1b566f0 Mon 2014-05-26 08:36:56 EDT—Fri 2014-05-30 05:33:44 EDT | |
0 156019a44a774a0bb0148a92df4af81b Fri 2014-05-30 05:34:09 EDT—Fri 2014-05-30 06:15:01 EDT</screen> | |
<para> | |
The first column lists the boot offset: <literal>0</literal> for the | |
current boot, <literal>-1</literal> for the previous one, | |
<literal>-2</literal> for the one prior to that, etc. The second column | |
contains the boot ID followed by the limiting time stamps of the specific | |
boot. | |
</para> | |
<para> | |
Show all messages from the current boot: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl -b</screen> | |
<para> | |
If you need to see journal messages from the previous boot, add an offset | |
parameter. The following example outputs the previous boot messages: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl -b -1</screen> | |
<para> | |
Another way is to list boot messages based on the boot ID. For this | |
purpose, use the _BOOT_ID field: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _BOOT_ID=156019a44a774a0bb0148a92df4af81b</screen> | |
</sect2> | |
<sect2 xml:id="sec-journalctl-filter-time"> | |
<title>Filtering based on time interval</title> | |
<para> | |
You can filter the output of <command>journalctl</command> by specifying | |
the starting and/or ending date. The date specification should be of the | |
format "2014-06-30 9:17:16". If the time part is omitted, midnight is | |
assumed. If seconds are omitted, ":00" is assumed. If the date part is | |
omitted, the current day is assumed. Instead of numeric expression, you can | |
specify the keywords "yesterday", "today", or "tomorrow". They refer to | |
midnight of the day before the current day, of the current day, or of the | |
day after the current day. If you specify "now", it refers to the current | |
time. You can also specify relative times prefixed with | |
<literal>-</literal> or <literal>+</literal>, referring to times before or | |
after the current time. | |
</para> | |
<para> | |
Show only new messages since now, and update the output continuously: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl --since "now" -f</screen> | |
<para> | |
Show all messages since last midnight till 3:20am: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl --since "today" --until "3:20"</screen> | |
</sect2> | |
<sect2 xml:id="sec-journalctl-filter-fields"> | |
<title>Filtering based on fields</title> | |
<para> | |
You can filter the output of the journal by specific fields. The syntax of | |
a field to be matched is <literal>FIELD_NAME=MATCHED_VALUE</literal>, such | |
as <literal>_SYSTEMD_UNIT=httpd.service</literal>. You can specify multiple | |
matches in a single query to filter the output messages even more. See | |
<command>man 7 systemd.journal-fields</command> for a list of default | |
fields. | |
</para> | |
<para> | |
Show messages produced by a specific process ID: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _PID=1039</screen> | |
<para> | |
Show messages belonging to a specific user ID: | |
</para> | |
<screen># journalctl _UID=1000</screen> | |
<para> | |
Show messages from the kernel ring buffer (the same as | |
<command>dmesg</command> produces): | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _TRANSPORT=kernel</screen> | |
<para> | |
Show messages from the service's standard or error output: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _TRANSPORT=stdout</screen> | |
<para> | |
Show messages produced by a specified service only: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _SYSTEMD_UNIT=avahi-daemon.service</screen> | |
<para> | |
If two different fields are specified, only entries that match both | |
expressions at the same time are shown: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1488</screen> | |
<para> | |
If two matches refer to the same field, all entries matching either | |
expression are shown: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</screen> | |
<para> | |
You can use the '+' separator to combine two expressions in a logical 'OR'. | |
The following example shows all messages from the Avahi service process | |
with the process ID 1480 together with all messages from the D-Bus service: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1480 + _SYSTEMD_UNIT=dbus.service</screen> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-investigate"> | |
<title>Investigating <systemitem class="daemon">systemd</systemitem> errors</title> | |
<para> | |
This section introduces a simple example to illustrate how to find and fix | |
the error reported by <systemitem class="daemon">systemd</systemitem> during <command>apache2</command> start-up. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Try to start the apache2 service: | |
</para> | |
<screen># systemctl start apache2 | |
Job for apache2.service failed. See 'systemctl status apache2' and 'journalctl -xn' for details.</screen> | |
</step> | |
<step> | |
<para> | |
Let us see what the service's status says: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl status apache2 | |
apache2.service - The Apache Webserver | |
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled) | |
Active: failed (Result: exit-code) since Tue 2014-06-03 11:08:13 CEST; 7min ago | |
Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND \ | |
-k graceful-stop (code=exited, status=1/FAILURE)</screen> | |
<para> | |
The ID of the process causing the failure is 11026. | |
</para> | |
</step> | |
<step> | |
<para> | |
Show the verbose version of messages related to process ID 11026: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> journalctl -o verbose _PID=11026 | |
[...] | |
MESSAGE=AH00526: Syntax error on line 6 of /etc/apache2/default-server.conf: | |
[...] | |
MESSAGE=Invalid command 'DocumenttRoot', perhaps misspelled or defined by a module | |
[...]</screen> | |
</step> | |
<step> | |
<para> | |
Fix the typo inside <filename>/etc/apache2/default-server.conf</filename>, | |
start the apache2 service, and print its status: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl start apache2 && systemctl status apache2 | |
apache2.service - The Apache Webserver | |
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled) | |
Active: active (running) since Tue 2014-06-03 11:26:24 CEST; 4ms ago | |
Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND | |
-k graceful-stop (code=exited, status=1/FAILURE) | |
Main PID: 11263 (httpd2-prefork) | |
Status: "Processing requests..." | |
CGroup: /system.slice/apache2.service | |
├─11263 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
├─11280 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
├─11281 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
├─11282 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
├─11283 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
└─11285 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...] | |
</screen> | |
</step> | |
</procedure> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-config"> | |
<title>Journald configuration</title> | |
<para> | |
The behavior of the systemd-journald service can be adjusted by modifying | |
<filename>/etc/systemd/journald.conf</filename>. This section introduces | |
only basic option settings. For a complete file description, see | |
<command>man 5 journald.conf</command>. Note that you need to restart the | |
journal for the changes to take effect with | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl restart systemd-journald</screen> | |
<sect2 xml:id="sec-journalctl-config-systemmaxuse"> | |
<title>Changing the journal size limit</title> | |
<para> | |
If the journal log data is saved to a persistent location (see | |
<xref linkend="sec-journalctl-persistent" role="internalbook"/>), it uses up to 10% of the file | |
system the <filename>/var/log/journal</filename> resides on. For example, | |
if <filename>/var/log/journal</filename> is located on a 30 GB | |
<filename>/var</filename> partition, the journal may use up to 3 GB of the | |
disk space. To change this limit, change (and uncomment) the | |
<option>SystemMaxUse</option> option: | |
</para> | |
<screen>SystemMaxUse=50M</screen> | |
</sect2> | |
<sect2 xml:id="sec-journalctl-config-ttypath"> | |
<title>Forwarding the journal to <filename>/dev/ttyX</filename></title> | |
<para> | |
You can forward the journal to a terminal device to inform you about system | |
messages on a preferred terminal screen, for example | |
<literal>/dev/tty12</literal>. Change the following journald options to | |
</para> | |
<screen>ForwardToConsole=yes | |
TTYPath=/dev/tty12</screen> | |
</sect2> | |
<sect2 xml:id="sec-journalctl-config-forwardtosyslog"> | |
<title>Forwarding the journal to syslog facility</title> | |
<para> | |
Journald is backward compatible with traditional syslog implementations | |
such as <systemitem>rsyslog</systemitem>. Make sure the following is valid: | |
</para> | |
<itemizedlist mark="bullet" spacing="normal"> | |
<listitem> | |
<para> | |
rsyslog is installed. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> rpm -q rsyslog | |
rsyslog-7.4.8-2.16.x86_64</screen> | |
</listitem> | |
<listitem> | |
<para> | |
rsyslog service is enabled. | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> systemctl is-enabled rsyslog | |
enabled</screen> | |
</listitem> | |
<listitem> | |
<para> | |
Forwarding to syslog is enabled in | |
<filename>/etc/systemd/journald.conf</filename>. | |
</para> | |
<screen>ForwardToSyslog=yes</screen> | |
</listitem> | |
</itemizedlist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-yast"> | |
<title>Using YaST to filter the <systemitem class="daemon">systemd</systemitem> journal</title> | |
<para> | |
For an easy way of filtering the systemd journal (without dealing | |
with the journalctl syntax), you can use the YaST journal module. After | |
installing it with <command>sudo zypper in yast2-journal</command>, start it | |
from YaST by selecting <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Systemd Journal</guimenu> </menuchoice>. Alternatively, start it | |
from command line by entering <command>sudo yast2 journal</command>. | |
</para> | |
<figure xml:id="fig-journalctl-yast"> | |
<title>YaST systemd journal</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_journal.png" width="80%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_journal.png" width="85%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The module displays the log entries in a table. The search box on top allows | |
you to search for entries that contain certain characters, similar to using | |
<command>grep</command>. To filter the entries by date and time, unit, file, | |
or priority, click <guimenu>Change filters</guimenu> and set the respective | |
options. | |
</para> | |
</sect1> | |
<sect1 xml:id="sec-journalctl-gnome-logs"> | |
<title>Viewing logs in GNOME</title> | |
<para> | |
You can view the journal with <emphasis>GNOME Logs</emphasis>. | |
Start it from the application menu. To view system log messages, it | |
needs to be run as root, for example with <command>xdg-su | |
gnome-logs</command>. This command can be executed when pressing | |
<keycombo> <keycap function="alt"/> | |
<keycap>F2</keycap></keycombo>. | |
</para> | |
</sect1> | |
</chapter> | |
<?xml-stylesheet href="urn:x-suse:xslt:profiling:docbook51-profile.xsl" | |
type="text/xml" | |
title="Profiling step"?><chapter version="5.1" xml:id="cha-update-alternative"> | |
<title><command>update-alternatives</command>: Managing multiple versions of commands and files</title> | |
<info> | |
<abstract> | |
<para> | |
Often, there are several versions of the same tool installed on a | |
system. | |
To give administrators a choice and to make it possible to install and | |
use different versions side by side, the alternatives system allows | |
managing such versions consistently. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<sect1 xml:id="sec-ua-concept"> | |
<title>Overview</title> | |
<para> | |
On <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>, some programs perform the same or similar tasks. For example, | |
if Java 1.7 and Java 1.8 are both installed on the system, the alternatives system script | |
(<command>update-alternatives</command>) is called from inside the RPM package. | |
By default, the alternatives system will refer to version 1.8: Higher versions also have a | |
higher priority. However, the administrator can change the default and | |
can point the generic name to version 1.7. | |
</para> | |
<para> | |
The following terminology is used in this chapter: | |
</para> | |
<variablelist> | |
<title>Terminology</title> | |
<varlistentry> | |
<term>Administrative directory</term> | |
<listitem> | |
<para> | |
The default <filename class="directory">/var/lib/rpm/alternatives</filename> directory contains information | |
about the current state of alternatives. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Alternative</term> | |
<listitem> | |
<para> | |
The name of a specific file in the file system, which can be made | |
accessible via a generic name using the alternatives system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Alternatives directory</term> | |
<listitem> | |
<para> | |
The default <filename class="directory">/etc/alternatives</filename> | |
directory containing symbolic links. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Generic name</term> | |
<listitem> | |
<para> | |
A name (for example, <command>/usr/bin/edit</command>) that refers to | |
one file out of several available using the alternatives system. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Link group</term> | |
<listitem> | |
<para> | |
A set of related symbolic links that can be updated as a group. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Master link</term> | |
<listitem> | |
<para> | |
The link in a link group that determines how the other links in the | |
group are configured. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Slave link</term> | |
<listitem> | |
<para> | |
A link in a link group controlled by the master link. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Symbolic link (symlink)</term> | |
<listitem> | |
<para> | |
A file that is a reference to another file in the same file system. | |
The alternatives system uses symbolic links in the alternatives directory to switch | |
between versions of a file. | |
</para> | |
<para> | |
Symbolic links in the alternatives directory can be modified by the | |
administrator through the <command>update-alternatives</command> | |
command. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The alternatives system provides the <command>update-alternatives</command> command to | |
create, remove, maintain, and show information about symbolic links. | |
While these symbolic links usually point to commands, they can also point | |
to JAR archives, man pages, and other files. | |
Examples in this chapter use commands and man pages, but they are also | |
applicable to other file types. | |
</para> | |
<para> | |
The alternatives system uses the alternatives directory to collect links to possible | |
alternatives. When a new package with an alternative is installed, | |
the new alternative is added to the system. Whether the new package's | |
alternative is selected as the default depends on its priority and on the | |
mode that is set. Usually, packages | |
with a higher version also have a higher priority. The alternatives system can operate | |
in two modes: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<formalpara> | |
<title>Automatic mode</title> | |
<para> | |
In this mode, the alternatives system ensures that the links in the group point to | |
the highest priority alternatives appropriate for the group. | |
</para> | |
</formalpara> | |
</listitem> | |
<listitem> | |
<formalpara> | |
<title>Manual mode</title> | |
<para> | |
In this mode, the alternatives system does not make any changes to the system | |
administrator's settings. | |
</para> | |
</formalpara> | |
</listitem> | |
</itemizedlist> | |
<para> | |
For example, the <command>java</command> command has the following link | |
hierarchy in the alternatives system: | |
</para> | |
<example> | |
<title>Alternatives System of the <command>java</command> command</title> | |
<screen>/usr/bin/java <co xml:id="co-ua-java-name"/> | |
-> /etc/alternatives/java <co xml:id="co-ua-java-symbolic-link"/> | |
-> /usr/lib64/jvm/jre-10-openjdk/bin/java <co xml:id="co-ua-java-alternatives"/></screen> | |
<calloutlist> | |
<callout arearefs="co-ua-java-name"> | |
<para> | |
The generic name. | |
</para> | |
</callout> | |
<callout arearefs="co-ua-java-symbolic-link"> | |
<para> | |
The symbolic link in the alternatives directory. | |
</para> | |
</callout> | |
<callout arearefs="co-ua-java-alternatives"> | |
<para> | |
One of the alternatives. | |
</para> | |
</callout> | |
</calloutlist> | |
</example> | |
</sect1> | |
<sect1 xml:id="sec-ua-use-cases"> | |
<title>Use cases</title> | |
<para> | |
By default, the <command>update-alternatives</command> script is called | |
from inside an RPM package. When a package is installed or removed, the | |
script takes care of all its symbolic links. | |
But you can run it manually from the command line for: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
displaying the current alternatives for a generic name. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
changing the defaults of an alternative. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
creating a set of related files for an alternative. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 xml:id="sec-ua-view-all"> | |
<title>Getting an overview of alternatives</title> | |
<para> | |
To retrieve the names of all configured alternatives, use: | |
</para> | |
<screen><prompt>> </prompt><command>ls /var/lib/alternatives</command></screen> | |
<para> | |
To get an overview of all configured alternatives and their values, use | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --get-selections</command> | |
asadmin auto /usr/bin/asadmin-2.7 | |
awk auto /usr/bin/gawk | |
chardetect auto /usr/bin/chardetect-3.6 | |
dbus-launch auto /usr/bin/dbus-launch.x11 | |
default-displaymanager auto /usr/lib/X11/displaymanagers/gdm | |
[...]</screen> | |
</sect1> | |
<sect1 xml:id="sec-ua-view"> | |
<title>Viewing details on specific alternatives</title> | |
<para> | |
The easiest way to check the alternatives is to follow the symbolic links of | |
your command. | |
For example, if you want to know what the <command>java</command> | |
command is referring to, use the following command: | |
</para> | |
<screen><prompt>> </prompt><command>readlink --canonicalize /usr/bin/java</command> | |
/usr/lib64/jvm/jre-10-openjdk/bin/java</screen> | |
<para> | |
If you see the same path (in our example, it is | |
<filename>/usr/bin/java</filename>), | |
there are no alternatives available for this command. | |
</para> | |
<para> | |
To see the full alternatives (including slaves), use the | |
<option>--display</option> option: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --display java</command> | |
java - auto mode | |
link best version is /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java | |
link currently points to /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java | |
link java is /usr/bin/java | |
slave java.1.gz is /usr/share/man/man1/java.1.gz | |
slave jre is /usr/lib64/jvm/jre | |
slave jre_exports is /usr/lib64/jvm-exports/jre | |
slave keytool is /usr/bin/keytool | |
slave keytool.1.gz is /usr/share/man/man1/keytool.1.gz | |
slave orbd is /usr/bin/orbd | |
slave orbd.1.gz is /usr/share/man/man1/orbd.1.gz | |
[...]</screen> | |
</sect1> | |
<sect1 xml:id="sec-ua-set"> | |
<title>Setting the default version of alternatives</title> | |
<para> | |
By default, commands in <filename>/usr/bin</filename> refer to the | |
alternatives directory with the highest priority. For example, | |
by default, the command <command>java</command> shows the following | |
version number: | |
</para> | |
<screen><prompt>> </prompt><command>java -version</command> | |
openjdk version "10.0.1" 2018-04-17 | |
OpenJDK Runtime Environment (build 10.0.1+10-suse-lp150.1.11-x8664) | |
OpenJDK 64-Bit Server VM (build 10.0.1+10-suse-lp150.1.11-x8664, mixed mode)</screen> | |
<para> | |
To change the default <command>java</command> command to refer | |
to a previous version, run: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --config java</command> | |
root's password: | |
There are 2 choices for the alternative java (providing /usr/bin/java). | |
Selection Path Priority Status | |
------------------------------------------------------------ | |
* 0 /usr/lib64/jvm/jre-10-openjdk/bin/java 2005 auto mode | |
1 /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java 1805 manual mode | |
2 /usr/lib64/jvm/jre-10-openjdk/bin/java 2005 manual mode | |
3 /usr/lib64/jvm/jre-11-openjdk/bin/java 0 manual mode | |
Press <enter> to keep the current choice[*], or type selection number:</screen> | |
<para> | |
Depending on your system and installed versions, the exact Java version | |
number will be different. | |
After you have selected <literal>1</literal>, <command>java</command> | |
shows the following version number: | |
</para> | |
<screen><prompt>> </prompt><command>java -version</command> | |
java version "1.8.0_171" | |
OpenJDK Runtime Environment (IcedTea 3.8.0) (build 1.8.0_171-b11 suse-lp150.2.3.1-x86_64) | |
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)</screen> | |
<para> | |
Also, keep in mind the following points: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
When working in manual mode and installing another Java | |
version, the alternatives system neither touches the links nor changes the | |
generic name. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
When working in automatic mode and installing another Java version, | |
the alternatives system changes the Java master link and all slave links (as you can | |
see in <xref linkend="sec-ua-view" role="internalbook"/>). | |
To check the master-slave relationships, use: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --display java</command></screen> | |
</listitem> | |
</itemizedlist> | |
</sect1> | |
<sect1 xml:id="sec-ua-install"> | |
<title>Installing custom alternatives</title> | |
<para> | |
This section describes how to set up custom alternatives on a system. | |
The example makes the following assumptions: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
There are two scripts, <command>foo-2</command> and <command>foo-3</command>, | |
with similar functionality. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The scripts are stored in the <filename>/usr/local/bin</filename> | |
directory to avoid any conflicts with the system tools in | |
<filename>/usr/bin</filename>. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
There is a master link <command>foo</command> that points to either | |
<command>foo-2</command> or <command>foo-3</command>. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
To provide alternatives on your system, follow these steps: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Copy your scripts into the <filename>/usr/local/bin</filename> directory. | |
</para> | |
</step> | |
<step> | |
<para> | |
Make the scripts executable: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>chmod +x /usr/local/bin/foo-{2,3}</command></screen> | |
</step> | |
<step> | |
<para> | |
Run <command>update-alternatives</command> for both scripts: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> update-alternatives --install \ | |
/usr/local/bin/foo <co xml:id="co-ua-ua-install-usr-local-bin-foo"/>\ | |
foo <co xml:id="co-ua-ua-install-foo"/>\ | |
/usr/local/bin/foo-2 <co xml:id="co-ua-ua-install-usr-local-bin-foo-path"/>\ | |
200 <co xml:id="co-ua-ua-install-prio"/> | |
<prompt>> </prompt><command>sudo</command> update-alternatives --install \ | |
/usr/local/bin/foo <xref linkend="co-ua-ua-install-usr-local-bin-foo" role="internalbook"/>\ | |
foo <xref linkend="co-ua-ua-install-foo" role="internalbook"/>\ | |
/usr/local/bin/foo-3 <xref linkend="co-ua-ua-install-usr-local-bin-foo-path" role="internalbook"/>\ | |
300 <xref linkend="co-ua-ua-install-prio" role="internalbook"/></screen> | |
<para> | |
The options after <option>--install</option> have the following meanings: | |
</para> | |
<calloutlist> | |
<callout arearefs="co-ua-ua-install-usr-local-bin-foo"> | |
<para> | |
The generic name. To avoid confusion, this is usually the script | |
name without any version numbers. | |
</para> | |
</callout> | |
<callout arearefs="co-ua-ua-install-foo"> | |
<para> | |
The name of the master link. Must be the same. | |
</para> | |
</callout> | |
<callout arearefs="co-ua-ua-install-usr-local-bin-foo-path"> | |
<para> | |
The path to the original script(s) located in | |
<filename>/usr/local/bin</filename>. | |
</para> | |
</callout> | |
<callout arearefs="co-ua-ua-install-prio"> | |
<para> | |
The priority. | |
We give <command>foo-2</command> a lower priority than | |
<command>foo-3</command>. | |
It is good practice to use a significant number increase to separate | |
priorities. For example, a priority of 200 for <command>foo-2</command> | |
and 300 for <command>foo-3</command>. | |
</para> | |
</callout> | |
</calloutlist> | |
</step> | |
<step> | |
<para> | |
Check the master link: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --display foo</command> | |
foo - auto mode | |
link best version is /usr/local/bin/foo-3 | |
link currently points to /usr/local/bin/foo-3 | |
link foo is /usr/local/bin/foo | |
/usr/local/bin/foo-2 - priority 200 | |
/usr/local/bin/foo-3 - priority 300</screen> | |
</step> | |
</procedure> | |
<para> | |
After you completed the described steps, you can use the master link | |
<command>/usr/local/bin/foo</command>. | |
</para> | |
<para> | |
If needed, you can install additional alternatives. | |
To remove an alternative, use the following command: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --remove foo /usr/local/bin/foo-2</command></screen> | |
<para> | |
After this script has been removed, the alternatives system for the foo group looks | |
like this: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --display foo</command> | |
foo - auto mode | |
link best version is /usr/local/bin/foo-3 | |
link currently points to /usr/local/bin/foo-3 | |
link foo is /usr/local/bin/foo | |
/usr/local/bin/foo-3 - priority 300</screen> | |
</sect1> | |
<sect1 xml:id="sec-ua-slave"> | |
<title>Defining dependent alternatives</title> | |
<para> | |
If you have alternatives, the script itself is not enough. Most commands | |
are not completely stand-alone: They usually ship with additional files, | |
such as extensions, configurations, or man pages. | |
To create alternatives which are dependent on a master | |
link, use <emphasis>slave alternatives</emphasis>. | |
</para> | |
<para> | |
Let us assume we want to extend our example in <xref linkend="sec-ua-install" role="internalbook"/> | |
and provide man pages and configuration files: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Two man pages, <filename>foo-2.1.gz</filename> and <filename>foo-3.1.gz</filename> | |
stored in the <filename>/usr/local/man/man1</filename> directory. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Two configuration files, <filename>foo-2.conf</filename> and | |
<filename>foo-3.conf</filename>, stored in <filename>/etc</filename>. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Follow these steps to add the additional files to your alternatives: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Copy the configuration files into <filename>/etc</filename>: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>cp foo-{2,3}.conf /etc</command></screen> | |
</step> | |
<step> | |
<para> | |
Copy the man pages into the <filename>/usr/local/man/man1</filename> | |
directory: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>cp foo-{2,3}.1.gz /usr/local/man/man1/</command></screen> | |
</step> | |
<step> | |
<para> | |
Add the slave links to the main scripts with the <option>--slave</option> | |
option: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> <command>update-alternatives --install \ | |
/usr/local/bin/foo foo /usr/local/bin/foo-2 200 \ | |
--slave /usr/local/man/man1/foo.1.gz \ | |
foo.1.gz \ | |
/usr/local/man/man1/foo-2.1.gz \ | |
--slave /etc/foo.conf \ | |
foo.conf \ | |
/etc/foo-2.conf</command> | |
<prompt>> </prompt><command>sudo</command> <command>update-alternatives --install \ | |
/usr/local/bin/foo foo /usr/local/bin/foo-3 300 \ | |
--slave /usr/local/man/man1/foo.1.gz \ | |
foo.1.gz \ | |
/usr/local/man/man1/foo-3.1.gz \ | |
--slave /etc/foo.conf \ | |
foo.conf \ | |
/etc/foo-3.conf</command></screen> | |
</step> | |
<step> | |
<para>Check the master link:</para> | |
<screen>foo - auto mode | |
link best version is /usr/local/bin/foo-3 | |
link currently points to /usr/local/bin/foo-3 | |
link foo is /usr/local/bin/foo | |
slave foo.1.gz is /usr/local/man/man1/foo.1.gz | |
slave foo.conf is /etc/foo.conf | |
/usr/local/bin/foo-2 - priority 200 | |
slave foo.1.gz: /usr/local/man/man1/foo-2.1.gz | |
slave foo.conf: /etc/foo-2.conf | |
/usr/local/bin/foo-3 - priority 300 | |
slave foo.1.gz: /usr/local/man/man1/foo-3.1.gz | |
slave foo.conf: /etc/foo-3.conf</screen> | |
</step> | |
</procedure> | |
<para> | |
If you change the links with <command>update-alternatives --config foo</command> | |
to <command>foo-2</command>, then all slave links will change as well. | |
</para> | |
</sect1> | |
</chapter> | |
<chapter version="5.0" xml:id="cha-network"> | |
<title>Basic networking</title> | |
<info> | |
<abstract> | |
<para> | |
Linux offers the necessary networking tools and features for integration | |
into all types of network structures. Network access using a network card | |
can be configured with YaST. Manual configuration is also possible. In | |
this chapter, only the fundamental mechanisms and the relevant network | |
configuration files are covered. | |
</para> | |
</abstract> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Linux and other Unix operating systems use the TCP/IP protocol. It is not a | |
single network protocol, but a family of network protocols that offer various | |
services. The protocols listed in <xref linkend="tab-net-basic-tcpproto" role="internalbook"/> | |
are provided for exchanging data between two machines via TCP/IP. Networks | |
combined by TCP/IP, comprising a worldwide network, are also called | |
<quote>the Internet.</quote> | |
</para> | |
<para> | |
RFC stands for <emphasis>Request for Comments</emphasis>. RFCs are documents | |
that describe various Internet protocols and implementation procedures for | |
the operating system and its applications. The RFC documents describe the | |
setup of Internet protocols. For more information about RFCs, see | |
<link xlink:href="https://datatracker.ietf.org/"/>. | |
</para> | |
<variablelist xml:id="tab-net-basic-tcpproto"> | |
<title>Several protocols in the TCP/IP protocol family</title> | |
<varlistentry> | |
<term>TCP</term> | |
<listitem> | |
<para> | |
Transmission Control Protocol: a connection-oriented secure protocol. The | |
data to transmit is first sent by the application as a stream of data and | |
converted into the appropriate format by the operating system. The data | |
arrives at the respective application on the destination host in the | |
original data stream format it was initially sent. TCP determines whether | |
any data has been lost or jumbled during the transmission. TCP is | |
implemented wherever the data sequence matters. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>UDP</term> | |
<listitem> | |
<para> | |
User Datagram Protocol: a connectionless, insecure protocol. The data to | |
transmit is sent in the form of packets generated by the application. The | |
order in which the data arrives at the recipient is not guaranteed and | |
data loss is possible. UDP is suitable for record-oriented applications. | |
It features a smaller latency period than TCP. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>ICMP</term> | |
<listitem> | |
<para> | |
Internet Control Message Protocol: This is not a protocol for the end | |
user, but a special control protocol that issues error reports and can | |
control the behavior of machines participating in TCP/IP data transfer. In | |
addition, it provides a special echo mode that can be viewed using the | |
program ping. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>IGMP</term> | |
<listitem> | |
<para> | |
Internet Group Management Protocol: This protocol controls machine | |
behavior when implementing IP multicast. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
As shown in <xref linkend="fig-net-basic-OSI" role="internalbook"/>, data exchange takes place in | |
different layers. The actual network layer is the insecure data transfer via | |
IP (Internet protocol). On top of IP, TCP (transmission control protocol) | |
guarantees, to a certain extent, security of the data transfer. The IP layer | |
is supported by the underlying hardware-dependent protocol, such as Ethernet. | |
</para> | |
<figure xml:id="fig-net-basic-OSI"> | |
<title>Simplified layer model for TCP/IP</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata width="100%" fileref="net_basic_osi.svg"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata width="75%" fileref="net_basic_osi.png"/> | |
</imageobject> | |
<textobject><phrase>OSI and TCP</phrase> | |
</textobject> | |
</mediaobject> | |
</figure> | |
<para> | |
The diagram provides one or two examples for each layer. The layers are | |
ordered according to <emphasis>abstraction levels</emphasis>. The lowest | |
layer is very close to the hardware. The uppermost layer, however, is almost | |
a complete abstraction from the hardware. Every layer has its own special | |
function. The special functions of each layer are mostly implicit in their | |
description. The data link and physical layers represent the physical network | |
used, such as Ethernet. | |
</para> | |
<para> | |
Almost all hardware protocols work on a packet-oriented basis. The data to | |
transmit is collected into <emphasis>packets</emphasis> (it cannot be sent | |
all at once). The maximum size of a TCP/IP packet is approximately 64 KB. | |
Packets are normally quite small, as the network hardware can be a limiting | |
factor. The maximum size of a data packet on Ethernet is about fifteen | |
hundred bytes. The size of a TCP/IP packet is limited to this amount when the | |
data is sent over Ethernet. If more data is transferred, more data packets | |
need to be sent by the operating system. | |
</para> | |
<para> | |
For the layers to serve their designated functions, additional information | |
regarding each layer must be saved in the data packet. This takes place in | |
the <emphasis>header</emphasis> of the packet. Every layer attaches a small | |
block of data, called the protocol header, to the front of each emerging | |
packet. A sample TCP/IP data packet traveling over an Ethernet cable is | |
illustrated in <xref linkend="fig-net-basic-TCPPaket" role="internalbook"/>. The proof sum is | |
located at the end of the packet, not at the beginning. This simplifies | |
things for the network hardware. | |
</para> | |
<figure xml:id="fig-net-basic-TCPPaket"> | |
<title>TCP/IP Ethernet packet</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata width="80%" fileref="net_basic_tcppacket.svg"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata width="75%" fileref="net_basic_tcppacket.png"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
When an application sends data over the network, the data passes through each | |
layer, all implemented in the Linux kernel except the physical layer. Each | |
layer is responsible for preparing the data so it can be passed to the next | |
layer. The lowest layer is ultimately responsible for sending the data. The | |
entire procedure is reversed when data is received. Like the layers of an | |
onion, in each layer the protocol headers are removed from the transported | |
data. Finally, the transport layer is responsible for making the data | |
available for use by the applications at the destination. In this manner, one | |
layer only communicates with the layer directly above or below it. For | |
applications, it is irrelevant whether data is transmitted via a wireless or | |
wired connection. Likewise, it is irrelevant for the data line which kind of | |
data is transmitted, as long as packets are in the correct format. | |
</para> | |
<sect1 xml:id="sec-network-addresses"> | |
<title>IP addresses and routing</title> | |
<para> | |
The discussion in this section is limited to IPv4 networks. For information | |
about IPv6 protocol, the successor to IPv4, refer to | |
<xref linkend="sec-network-ipv6" role="internalbook"/>. | |
</para> | |
<sect2 xml:id="sec-network-addresses-ip"> | |
<title>IP addresses</title> | |
<para> | |
Every computer on the Internet has a unique 32-bit address. These 32 bits | |
(or 4 bytes) are normally written as illustrated in the second row in | |
<xref linkend="aus-net-basic-ipaddress" role="internalbook"/>. | |
</para> | |
<example xml:id="aus-net-basic-ipaddress"> | |
<title>Writing IP addresses</title> | |
<screen>IP Address (binary): 11000000 10101000 00000000 00010100 | |
IP Address (decimal): 192. 168. 0. 20</screen> | |
</example> | |
<para> | |
In decimal form, the four bytes are written in the decimal number system, | |
separated by periods. The IP address is assigned to a host or a network | |
interface. It can be used only once throughout the world. There are | |
exceptions to this rule, but these are not relevant to the following | |
passages. | |
</para> | |
<para> | |
The points in IP addresses indicate the hierarchical system. Until the | |
1990s, IP addresses were strictly categorized in classes. However, this | |
system proved too inflexible and was discontinued. Now, <emphasis>classless | |
routing</emphasis> (CIDR, classless interdomain routing) is used. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-network-addresses-route"> | |
<title>Netmasks and routing</title> | |
<para> | |
Netmasks are used to define the address range of a subnet. If two hosts are | |
in the same subnet, they can reach each other directly. If they are not in | |
the same subnet, they need the address of a gateway that handles all the | |
traffic for the subnet. To check if two IP addresses are in the same | |
subnet, simply <quote>AND</quote> both addresses with the netmask. If the | |
result is identical, both IP addresses are in the same local network. If | |
there are differences, the remote IP address, and thus the remote | |
interface, can only be reached over a gateway. | |
</para> | |
<para> | |
To understand how the netmask works, look at | |
<xref linkend="tab-net-basic-netmask" role="internalbook"/>. The netmask consists of 32 bits | |
that identify how much of an IP address belongs to the network. All those | |
bits that are <literal>1</literal> mark the corresponding bit in the IP | |
address as belonging to the network. All bits that are <literal>0</literal> | |
mark bits inside the subnet. This means that the more bits are | |
<literal>1</literal>, the smaller the subnet is. Because the netmask always | |
consists of several successive <literal>1</literal> bits, it is also | |
possible to count the number of bits in the netmask. In | |
<xref linkend="tab-net-basic-netmask" role="internalbook"/> the first net with 24 bits could | |
also be written as <literal>192.168.0.0/24</literal>. | |
</para> | |
<example xml:id="tab-net-basic-netmask"> | |
<title>Linking IP addresses to the netmask</title> | |
<screen>IP address (192.168.0.20): 11000000 10101000 00000000 00010100 | |
Netmask (255.255.255.0): 11111111 11111111 11111111 00000000 | |
--------------------------------------------------------------- | |
Result of the link: 11000000 10101000 00000000 00000000 | |
In the decimal system: 192. 168. 0. 0 | |
IP address (213.95.15.200): 11010101 10111111 00001111 11001000 | |
Netmask (255.255.255.0): 11111111 11111111 11111111 00000000 | |
--------------------------------------------------------------- | |
Result of the link: 11010101 10111111 00001111 00000000 | |
In the decimal system: 213. 95. 15. 0</screen> | |
</example> | |
<para> | |
To give another example: all machines connected with the same Ethernet | |
cable are usually located in the same subnet and are directly accessible. | |
Even when the subnet is physically divided by switches or bridges, these | |
hosts can still be reached directly. | |
</para> | |
<para> | |
IP addresses outside the local subnet can only be reached if a gateway is | |
configured for the target network. In the most common case, there is only | |
one gateway that handles all traffic that is external. However, it is also | |
possible to configure several gateways for different subnets. | |
</para> | |
<para> | |
If a gateway has been configured, all external IP packets are sent to the | |
appropriate gateway. This gateway then attempts to forward the packets in | |
the same manner—from host to host—until it reaches the | |
destination host or the packet's TTL (time to live) expires. | |
</para> | |
<variablelist xml:id="net-basic-spezial-net"> | |
<title>Specific addresses</title> | |
<varlistentry> | |
<term>Base Network Address</term> | |
<listitem> | |
<para> | |
This is the netmask AND any address in the network, as shown in | |
<xref linkend="tab-net-basic-netmask" role="internalbook"/> under <literal>Result</literal>. | |
This address cannot be assigned to any hosts. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Broadcast Address</term> | |
<listitem> | |
<para> | |
This could be paraphrased as: <quote>Access all hosts in this | |
subnet.</quote> To generate this, the netmask is inverted in binary form | |
and linked to the base network address with a logical OR. The above | |
example therefore results in 192.168.0.255. This address cannot be | |
assigned to any hosts. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Local Host</term> | |
<listitem> | |
<para> | |
The address <systemitem class="ipaddress">127.0.0.1</systemitem> is | |
assigned to the <quote>loopback device</quote> on each host. A | |
connection can be set up to your own machine with this address and with | |
all addresses from the complete | |
<systemitem class="ipaddress">127.0.0.0/8</systemitem> loopback network | |
as defined with IPv4. With IPv6 there is only one loopback address | |
(<systemitem class="ipaddress">::1</systemitem>). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Because IP addresses must be unique all over the world, you cannot select | |
random addresses. There are three address domains to use if you want to set | |
up a private IP-based network. These cannot get any connection from the | |
rest of the Internet, because they cannot be transmitted over the Internet. | |
These address domains are specified in RFC 1597 and listed in | |
<xref linkend="tab-net-basic-privat-net" role="internalbook"/>. | |
</para> | |
<table xml:id="tab-net-basic-privat-net"> | |
<title>Private IP address domains</title> | |
<tgroup cols="2"> | |
<thead> | |
<row> | |
<entry> | |
<para> | |
Network/Netmask | |
</para> | |
</entry> | |
<entry> | |
<para> | |
Domain | |
</para> | |
</entry> | |
</row> | |
</thead> | |
<tbody> | |
<row> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">10.0.0.0</systemitem>/<systemitem class="netmask">255.0.0.0</systemitem> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">10.x.x.x</systemitem> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">172.16.0.0</systemitem>/<systemitem class="netmask">255.240.0.0</systemitem> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">172.16.x.x</systemitem> – | |
<systemitem class="ipaddress">172.31.x.x</systemitem> | |
</para> | |
</entry> | |
</row> | |
<row> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">192.168.0.0</systemitem>/<systemitem class="netmask">255.255.0.0</systemitem> | |
</para> | |
</entry> | |
<entry> | |
<para> | |
<systemitem class="ipaddress">192.168.x.x</systemitem> | |
</para> | |
</entry> | |
</row> | |
</tbody> | |
</tgroup> | |
</table> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-network-ipv6"> | |
<title>IPv6—the next generation Internet</title> | |
<important arch="zseries" os="sles"> | |
<title>IBM Z: IPv6 support</title> | |
<para> | |
IPv6 is not supported by the CTC and IUCV network connections of the | |
IBM Z hardware. | |
</para> | |
</important> | |
<para> | |
Because of the emergence of the World Wide Web (WWW), the Internet has | |
experienced explosive growth, with an increasing number of computers | |
communicating via TCP/IP in the past fifteen years. Since Tim Berners-Lee at | |
CERN (<link xlink:href="http://public.web.cern.ch"/>) invented the WWW in | |
1990, the number of Internet hosts has grown from a few thousand to about a | |
hundred million. | |
</para> | |
<para> | |
As mentioned, an IPv4 address consists of only 32 bits. Also, quite a few IP | |
addresses are lost—they cannot be used because of the way in which | |
networks are organized. The number of addresses available in your subnet is | |
two to the power of the number of bits, minus two. A subnet has, for | |
example, 2, 6, or 14 addresses available. To connect 128 hosts to the | |
Internet, for example, you need a subnet with 256 IP addresses, from which | |
only 254 are usable, because two IP addresses are needed for the structure | |
of the subnet itself: the broadcast and the base network address. | |
</para> | |
<para> | |
Under the current IPv4 protocol, DHCP or NAT (network address translation) | |
are the typical mechanisms used to circumvent the potential address | |
shortage. Combined with the convention to keep private and public address | |
spaces separate, these methods can certainly mitigate the shortage. To set | |
up a host in an IPv4 network, you need several address items, such as the | |
host's own IP address, the subnetmask, the gateway address, and maybe a name | |
server address. All these items need to be known and cannot be derived from | |
somewhere else. | |
</para> | |
<para> | |
With IPv6, both the address shortage and the complicated configuration | |
should be a thing of the past. The following sections tell more about the | |
improvements and benefits brought by IPv6 and about the transition from the | |
old protocol to the new one. | |
</para> | |
<sect2 xml:id="sec-network-ipv6-adv"> | |
<title>Advantages</title> | |
<para> | |
The most important and most visible improvement brought by the IPv6 | |
protocol is the enormous expansion of the available address space. An IPv6 | |
address is made up of 128 bit values instead of the traditional 32 bits. | |
This provides for as many as several quadrillion IP addresses. | |
</para> | |
<para> | |
However, IPv6 addresses are not only different from their predecessors with | |
regard to their length. They also have a different internal structure that | |
may contain more specific information about the systems and the networks to | |
which they belong. More details about this are found in | |
<xref linkend="sec-network-ipv6-address" role="internalbook"/>. | |
</para> | |
<para> | |
The following is a list of other advantages of the IPv6 protocol: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Autoconfiguration</term> | |
<listitem> | |
<para> | |
IPv6 makes the network <quote>plug and play</quote> capable, which means | |
that a newly configured system integrates into the (local) network | |
without any manual configuration. The new host uses its automatic | |
configuration mechanism to derive its own address from the information | |
made available by the neighboring routers, relying on a protocol called | |
the <emphasis>neighbor discovery</emphasis> (ND) protocol. This method | |
does not require any intervention on the administrator's part and there | |
is no need to maintain a central server for address allocation—an | |
additional advantage over IPv4, where automatic address allocation | |
requires a DHCP server. | |
</para> | |
<para> | |
Nevertheless if a router is connected to a switch, the router should | |
send periodic advertisements with flags telling the hosts of a network | |
how they should interact with each other. For more information, see | |
RFC 2462 and the <systemitem>radvd.conf(5)</systemitem> man page, and | |
RFC 3315. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Mobility</term> | |
<listitem> | |
<para> | |
IPv6 makes it possible to assign several addresses to one network | |
interface at the same time. This allows users to access several networks | |
easily, something that could be compared with the international roaming | |
services offered by mobile phone companies. When you take your mobile | |
phone abroad, the phone automatically logs in to a foreign service when | |
it enters the corresponding area, so you can be reached under the same | |
number everywhere and can place an outgoing call, as you would in your | |
home area. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Secure communication</term> | |
<listitem> | |
<para> | |
With IPv4, network security is an add-on function. IPv6 includes IPsec | |
as one of its core features, allowing systems to communicate over a | |
secure tunnel to avoid eavesdropping by outsiders on the Internet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Backward compatibility</term> | |
<listitem> | |
<para> | |
Realistically, it would be impossible to switch the entire Internet from | |
IPv4 to IPv6 at one time. Therefore, it is crucial that both protocols | |
can coexist not only on the Internet, but also on one system. This is | |
ensured by compatible addresses (IPv4 addresses can easily be translated | |
into IPv6 addresses) and by using several tunnels. See | |
<xref linkend="sec-network-ipv6-coexist" role="internalbook"/>. Also, systems can rely on a | |
<emphasis>dual stack IP</emphasis> technique to support both protocols | |
at the same time, meaning that they have two network stacks that are | |
completely separate, such that there is no interference between the two | |
protocol versions. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry os="sles;sled;osuse"> | |
<term>Custom tailored services through multicasting</term> | |
<listitem> | |
<para> | |
With IPv4, some services, such as SMB, need to broadcast their packets | |
to all hosts in the local network. IPv6 allows a much more fine-grained | |
approach by enabling servers to address hosts through | |
<emphasis>multicasting</emphasis>, that is by addressing several hosts | |
as parts of a group. This is different from addressing all hosts through | |
<emphasis>broadcasting</emphasis> or each host individually through | |
<emphasis>unicasting</emphasis>. Which hosts are addressed as a group | |
may depend on the concrete application. There are some predefined groups | |
to address all name servers (the <emphasis>all name servers multicast | |
group</emphasis>), for example, or all routers (the <emphasis>all | |
routers multicast group</emphasis>). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-network-ipv6-address"> | |
<title>Address types and structure</title> | |
<para> | |
As mentioned, the current IP protocol has two major limitations: there is | |
an increasing shortage of IP addresses and configuring the network and | |
maintaining the routing tables is becoming a more complex and burdensome | |
task. IPv6 solves the first problem by expanding the address space to | |
128 bits. The second one is mitigated by introducing a hierarchical address | |
structure combined with sophisticated techniques to allocate network | |
addresses, and <emphasis>multihoming</emphasis> (the ability to assign | |
several addresses to one device, giving access to several networks). | |
</para> | |
<para> | |
When dealing with IPv6, it is useful to know about three different types of | |
addresses: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Unicast</term> | |
<listitem> | |
<para> | |
Addresses of this type are associated with exactly one network | |
interface. Packets with such an address are delivered to only one | |
destination. Accordingly, unicast addresses are used to transfer packets | |
to individual hosts on the local network or the Internet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Multicast</term> | |
<listitem> | |
<para> | |
Addresses of this type relate to a group of network interfaces. Packets | |
with such an address are delivered to all destinations that belong to | |
the group. Multicast addresses are mainly used by certain network | |
services to communicate with certain groups of hosts in a well-directed | |
manner. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Anycast</term> | |
<listitem> | |
<para> | |
Addresses of this type are related to a group of interfaces. Packets | |
with such an address are delivered to the member of the group that is | |
closest to the sender, according to the principles of the underlying | |
routing protocol. Anycast addresses are used to make it easier for hosts | |
to find out about servers offering certain services in the given network | |
area. All servers of the same type have the same anycast address. | |
Whenever a host requests a service, it receives a reply from the server | |
with the closest location, as determined by the routing protocol. If | |
this server should fail for some reason, the protocol automatically | |
selects the second closest server, then the third one, and so forth. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
An IPv6 address is made up of eight four-digit fields, each representing 16 | |
bits, written in hexadecimal notation. They are separated by colons | |
(<literal>:</literal>). Any leading zero bytes within a given field may be | |
dropped, but zeros within the field or at its end may not. Another | |
convention is that more than four consecutive zero bytes may be collapsed | |
into a double colon. However, only one such <literal>::</literal> is | |
allowed per address. This kind of shorthand notation is shown in | |
<xref linkend="aus-net-ipv6-add" role="internalbook"/>, where all three lines represent the | |
same address. | |
</para> | |
<example xml:id="aus-net-ipv6-add"> | |
<title>Sample IPv6 address</title> | |
<screen>fe80 : 0000 : 0000 : 0000 : 0000 : 10 : 1000 : 1a4 | |
fe80 : 0 : 0 : 0 : 0 : 10 : 1000 : 1a4 | |
fe80 : : 10 : 1000 : 1a4</screen> | |
</example> | |
<para> | |
Each part of an IPv6 address has a defined function. The first bytes form | |
the prefix and specify the type of address. The center part is the network | |
portion of the address, but it may be unused. The end of the address forms | |
the host part. With IPv6, the netmask is defined by indicating the length | |
of the prefix after a slash at the end of the address. An address, as shown | |
in <xref linkend="aus-net-ipv6-addpre" role="internalbook"/>, contains the information that the | |
first 64 bits form the network part of the address and the last 64 form its | |
host part. In other words, the <literal>64</literal> means that the netmask | |
is filled with 64 1-bit values from the left. As with IPv4, the IP address | |
is combined with AND with the values from the netmask to determine whether | |
the host is located in the same subnet or in another one. | |
</para> | |
<example xml:id="aus-net-ipv6-addpre"> | |
<title>IPv6 address specifying the prefix length</title> | |
<screen>fe80::10:1000:1a4/64</screen> | |
</example> | |
<para> | |
IPv6 knows about several predefined types of prefixes. Some are shown in | |
<xref linkend="list-net-basic-ipv6-prefix" role="internalbook"/>. | |
</para> | |
<variablelist xml:id="list-net-basic-ipv6-prefix"> | |
<title>Various IPv6 prefixes</title> | |
<varlistentry> | |
<term><systemitem class="ipaddress">00</systemitem></term> | |
<listitem> | |
<para> | |
IPv4 addresses and IPv4 over IPv6 compatibility addresses. These are | |
used to maintain compatibility with IPv4. Their use still requires a | |
router able to translate IPv6 packets into IPv4 packets. Several special | |
addresses, such as the one for the loopback device, have this prefix as | |
well. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="ipaddress">2</systemitem> or <systemitem class="ipaddress">3</systemitem> as the first digit</term> | |
<listitem> | |
<para> | |
Aggregatable global unicast addresses. As is the case with IPv4, an | |
interface can be assigned to form part of a certain subnet. Currently, | |
there are the following address spaces: | |
<systemitem class="ipaddress">2001::/16</systemitem> (production quality | |
address space) and <systemitem class="ipaddress">2002::/16</systemitem> | |
(6to4 address space). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="ipaddress">fe80::/10</systemitem></term> | |
<listitem> | |
<para> | |
Link-local addresses. Addresses with this prefix should not be routed | |
and should therefore only be reachable from within the same subnet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="ipaddress">fec0::/10</systemitem></term> | |
<listitem> | |
<para> | |
Site-local addresses. These may be routed, but only within the network | |
of the organization to which they belong. In effect, they are the IPv6 | |
equivalent of the current private network address space, such as | |
<systemitem class="ipaddress">10.x.x.x</systemitem>. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="ipaddress">ff</systemitem></term> | |
<listitem> | |
<para> | |
These are multicast addresses. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
A unicast address consists of three basic components: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Public topology</term> | |
<listitem> | |
<para> | |
The first part (which also contains one of the prefixes mentioned above) | |
is used to route packets through the public Internet. It includes | |
information about the company or institution that provides the Internet | |
access. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Site topology</term> | |
<listitem> | |
<para> | |
The second part contains routing information about the subnet to which | |
to deliver the packet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Interface ID</term> | |
<listitem> | |
<para> | |
The third part identifies the interface to which to deliver the packet. | |
This also allows for the MAC to form part of the address. Given that the | |
MAC is a globally unique, fixed identifier coded into the device by the | |
hardware maker, the configuration procedure is substantially simplified. | |
In fact, the first 64 address bits are consolidated to form the | |
<literal>EUI-64</literal> token, with the last 48 bits taken from the | |
MAC, and the remaining 24 bits containing special information about the | |
token type. This also makes it possible to assign an | |
<literal>EUI-64</literal> token to interfaces that do not have a MAC, | |
such as those based on point-to-point protocol (PPP). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
On top of this basic structure, IPv6 distinguishes between five different | |
types of unicast addresses: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><systemitem class="ipaddress">::</systemitem> (unspecified)</term> | |
<listitem> | |
<para> | |
This address is used by the host as its source address when the | |
interface is initialized for the first time (at which point, the address | |
cannot yet be determined by other means). | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem class="ipaddress">::1</systemitem> (loopback)</term> | |
<listitem> | |
<para> | |
The address of the loopback device. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>IPv4 compatible addresses</term> | |
<listitem> | |
<para> | |
The IPv6 address is formed by the IPv4 address and a prefix consisting | |
of 96 zero bits. This type of compatibility address is used for | |
tunneling (see <xref linkend="sec-network-ipv6-coexist" role="internalbook"/>) to allow IPv4 | |
and IPv6 hosts to communicate with others operating in a pure IPv4 | |
environment. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>IPv4 addresses mapped to IPv6</term> | |
<listitem> | |
<para> | |
This type of address specifies a pure IPv4 address in IPv6 notation. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Local addresses</term> | |
<listitem> | |
<para> | |
There are two address types for local use: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>link-local</term> | |
<listitem> | |
<para> | |
This type of address can only be used in the local subnet. Packets | |
with a source or target address of this type should not be routed to | |
the Internet or other subnets. These addresses contain a special | |
prefix (<systemitem class="ipaddress">fe80::/10</systemitem>) and the | |
interface ID of the network card, with the middle part consisting of | |
zero bytes. Addresses of this type are used during automatic | |
configuration to communicate with other hosts belonging to the same | |
subnet. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>site-local</term> | |
<listitem> | |
<para> | |
Packets with this type of address may be routed to other subnets, but | |
not to the wider Internet—they must remain inside the | |
organization's own network. Such addresses are used for intranets and | |
are an equivalent of the private address space defined by IPv4. They | |
contain a special prefix | |
(<systemitem class="ipaddress">fec0::/10</systemitem>), the interface | |
ID, and a 16-bit field specifying the subnet ID. Again, the rest is | |
filled with zero bytes. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
As a completely new feature introduced with IPv6, each network interface | |
normally gets several IP addresses, with the advantage that several | |
networks can be accessed through the same interface. One of these networks | |
can be configured completely automatically using the MAC and a known prefix | |
with the result that all hosts on the local network can be reached when | |
IPv6 is enabled (using the link-local address). With the MAC forming part | |
of it, any IP address used in the world is unique. The only variable parts | |
of the address are those specifying the <emphasis>site topology</emphasis> | |
and the <emphasis>public topology</emphasis>, depending on the actual | |
network in which the host is currently operating. | |
</para> | |
<para> | |
For a host to go back and forth between different networks, it needs at | |
least two addresses. One of them, the <emphasis>home address</emphasis>, | |
not only contains the interface ID but also an identifier of the home | |
network to which it normally belongs (and the corresponding prefix). The | |
home address is a static address and, as such, it does not normally change. | |
Still, all packets destined to the mobile host can be delivered to it, | |
regardless of whether it operates in the home network or somewhere outside. | |
This is made possible by the completely new features introduced with IPv6, | |
such as <emphasis>stateless autoconfiguration</emphasis> and | |
<emphasis>neighbor discovery</emphasis>. In addition to its home address, a | |
mobile host gets one or more additional addresses that belong to the | |
foreign networks where it is roaming. These are called | |
<emphasis>care-of</emphasis> addresses. The home network has a facility | |
that forwards any packets destined to the host when it is roaming outside. | |
In an IPv6 environment, this task is performed by the <emphasis>home | |
agent</emphasis>, which takes all packets destined to the home address and | |
relays them through a tunnel. On the other hand, those packets destined to | |
the care-of address are directly transferred to the mobile host without any | |
special detours. | |
</para> | |
</sect2> | |
<sect2 xml:id="sec-network-ipv6-coexist"> | |
<title>Coexistence of IPv4 and IPv6</title> | |
<para> | |
The migration of all hosts connected to the Internet from IPv4 to IPv6 is a | |
gradual process. Both protocols will coexist for some time to come. The | |
coexistence on one system is guaranteed where there is a <emphasis>dual | |
stack</emphasis> implementation of both protocols. That still leaves the | |
question of how an IPv6 enabled host should communicate with an IPv4 host | |
and how IPv6 packets should be transported by the current networks, which | |
are predominantly IPv4-based. The best solutions offer tunneling and | |
compatibility addresses (see <xref linkend="sec-network-ipv6-address" role="internalbook"/>). | |
</para> | |
<para> | |
IPv6 hosts that are more or less isolated in the (worldwide) IPv4 network | |
can communicate through tunnels: IPv6 packets are encapsulated as IPv4 | |
packets to move them across an IPv4 network. Such a connection between two | |
IPv4 hosts is called a <emphasis>tunnel</emphasis>. To achieve this, | |
packets must include the IPv6 destination address (or the corresponding | |
prefix) and the IPv4 address of the remote host at the receiving end of the | |
tunnel. A basic tunnel can be configured manually according to an agreement | |
between the hosts' administrators. This is also called <emphasis>static | |
tunneling</emphasis>. | |
</para> | |
<para> | |
However, the configuration and maintenance of static tunnels is often too | |
labor-intensive to use them for daily communication needs. Therefore, IPv6 | |
provides for three different methods of <emphasis>dynamic | |
tunneling</emphasis>: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>6over4</term> | |
<listitem> | |
<para> | |
IPv6 packets are automatically encapsulated as IPv4 packets and sent | |
over an IPv4 network capable of multicasting. IPv6 is tricked into | |
seeing the whole network (Internet) as a huge local area network (LAN). | |
This makes it possible to determine the receiving end of the IPv4 tunnel | |
automatically. However, this method does not scale very well and is also | |
hampered because IP multicasting is far from widespread on the Internet. | |
Therefore, it only provides a solution for smaller corporate or | |
institutional networks where multicasting can be enabled. The | |
specifications for this method are laid down in RFC 2529. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>6to4</term> | |
<listitem> | |
<para> | |
With this method, IPv4 addresses are automatically generated from IPv6 | |
addresses, enabling isolated IPv6 hosts to communicate over an IPv4 | |
network. However, several problems have been reported regarding the | |
communication between those isolated IPv6 hosts and the Internet. The | |
method is described in RFC 3056. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>IPv6 tunnel broker</term> | |
<listitem> | |
<para> | |
This method relies on special servers that provide dedicated tunnels for | |
IPv6 hosts. It is described in RFC 3053. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
<sect2 xml:id="sec-network-ipv6-config"> | |
<title>Configuring IPv6</title> | |
<para> | |
To configure IPv6, you normally do not need to make any changes on the | |
individual workstations. IPv6 is enabled by default. To disable or enable | |
IPv6 on an installed system, use the YaST <guimenu>Network | |
Settings</guimenu> module. On the <guimenu>Global Options</guimenu> tab, | |
select or deselect the <guimenu>Enable IPv6</guimenu> option as necessary. | |
To enable it temporarily until the next reboot, enter | |
<command>modprobe</command> <option>-i ipv6</option> as | |
<systemitem class="username">root</systemitem>. It is impossible to unload | |
the IPv6 module after it has been loaded. | |
</para> | |
<para> | |
Because of the autoconfiguration concept of IPv6, the network card is | |
assigned an address in the <emphasis>link-local</emphasis> network. | |
Normally, no routing table management takes place on a workstation. The | |
network routers can be queried by the workstation, using the | |
<emphasis>router advertisement protocol</emphasis>, for what prefix and | |
gateways should be implemented. The radvd program can be used to set up an | |
IPv6 router. This program informs the workstations which prefix to use for | |
the IPv6 addresses and which routers. Alternatively, use zebra/quagga for | |
automatic configuration of both addresses and routing. | |
</para> | |
<para os="sles;sled;osuse"> | |
For information about how to set up various types of tunnels using the | |
<filename>/etc/sysconfig/network</filename> files, see the man page of | |
<literal>ifcfg-tunnel</literal> (<command>man ifcfg-tunnel</command>). | |
</para> | |
</sect2> | |
<sect2 os="sles;sled;osuse" xml:id="sec-network-ipv6-moreinfo"> | |
<title>More information</title> | |
<para> | |
The above overview does not cover the topic of IPv6 comprehensively. For a | |
more in-depth look at the newer protocol, refer to the following online | |
documentation and books: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><link xlink:href="http://www.ipv6.org/"/></term> | |
<listitem> | |
<para> | |
The starting point for everything about IPv6. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><link xlink:href="http://www.ipv6day.org"/></term> | |
<listitem> | |
<para> | |
All information needed to start your own IPv6 network. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><link xlink:href="http://www.ipv6-to-standard.org/"/></term> | |
<listitem> | |
<para> | |
The list of IPv6-enabled products. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><link xlink:href="http://www.bieringer.de/linux/IPv6/"/></term> | |
<listitem> | |
<para> | |
Here, find the Linux IPv6-HOWTO and many links related to the topic. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>RFC 2460</term> | |
<listitem> | |
<para> | |
The fundamental RFC about IPv6. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>IPv6 essentials</term> | |
<listitem> | |
<para> | |
A book describing all the important aspects of the topic is | |
<emphasis>IPv6 Essentials</emphasis> by Silvia Hagen (ISBN | |
0-596-00125-8). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</sect2> | |
</sect1> | |
<sect1 xml:id="sec-network-nameres"> | |
<title>Name resolution</title> | |
<para> | |
DNS assists in assigning an IP address to one or more names and assigning a | |
name to an IP address. In Linux, this conversion is usually carried out by a | |
special type of software known as bind. The machine that takes care of this | |
conversion is called a <emphasis>name server</emphasis>. The names make up a | |
hierarchical system in which each name component is separated by a period. | |
The name hierarchy is, however, independent of the IP address hierarchy | |
described above. | |
</para> | |
<para> | |
Consider a complete name, such as | |
<systemitem class="fqdomainname">jupiter.example.com</systemitem>, written in the | |
format <systemitem class="fqdomainname">hostname.domain</systemitem>. A full | |
name, called a <emphasis>fully qualified domain name</emphasis> (FQDN), | |
consists of a host name and a domain name | |
(<systemitem class="domainname">example.com</systemitem>). The latter | |
also includes the <emphasis>top level domain</emphasis> or TLD | |
(<systemitem class="domainname">com</systemitem>). | |
</para> | |
<para> | |
TLD assignment has become quite confusing for historical reasons. | |
Traditionally, three-letter domain names are used in the USA. In the rest of | |
the world, the two-letter ISO national codes are the standard. In addition | |
to that, longer TLDs were introduced in 2000 that represent certain spheres | |
of activity (for example, <systemitem class="domainname">.info</systemitem>, | |
<systemitem class="domainname">.name</systemitem>, | |
<systemitem class="domainname">.museum</systemitem>). | |
</para> | |
<para> | |
In the early days of the Internet (before 1990), the file | |
<filename>/etc/hosts</filename> was used to store the names of all the | |
machines represented over the Internet. This quickly proved to be | |
impractical in the face of the rapidly growing number of computers connected | |
to the Internet. For this reason, a decentralized database was developed to | |
store the host names in a widely distributed manner. This database, similar | |
to the name server, does not have the data pertaining to all hosts in the | |
Internet readily available, but can dispatch requests to other name servers. | |
</para> | |
<para> | |
The top of the hierarchy is occupied by <emphasis>root name | |
servers</emphasis>. These root name servers manage the top level domains and | |
are run by the Network Information Center (NIC). Each root name server knows | |
about the name servers responsible for a given top level domain. Information | |
about top level domain NICs is available at | |
<link xlink:href="http://www.internic.net"/>. | |
</para> | |
<para> | |
DNS can do more than resolve host names. The name server also knows which | |
host is receiving e-mails for an entire domain—the <emphasis>mail | |
exchanger (MX)</emphasis>. | |
</para> | |
<para> | |
For your machine to resolve an IP address, it must know about at least one | |
name server and its IP address. <phrase os="sled;sles;osuse">Easily specify | |
such a name server using YaST.</phrase> <phrase os="sles;osuse">The | |
configuration of name server access with <phrase role="productname"><phrase os="sles">SUSE® Linux Enterprise Server</phrase></phrase> is described in | |
<xref linkend="sec-network-yast-change-host" role="internalbook"/>. Setting up your own name | |
server is described in <xref linkend="cha-dns" role="internalbook"/>.</phrase> | |
</para> | |
<para os="sles;sled;osuse"> | |
The protocol <literal>whois</literal> is closely related to DNS. With this | |
program, quickly find out who is responsible for a given domain. | |
</para> | |
<note> | |
<title>MDNS and .local domain names</title> | |
<para> | |
The <literal>.local</literal> top level domain is treated as link-local | |
domain by the resolver. DNS requests are sent as multicast DNS requests | |
instead of normal DNS requests. If you already use the | |
<literal>.local</literal> domain in your name server configuration, you | |
must switch this option off in <filename>/etc/host.conf</filename>. For | |
more information, see the <filename>host.conf</filename> manual page. | |
</para> | |
<para> | |
To switch off MDNS during installation, use <literal>nomdns=1</literal> as | |
a boot parameter. | |
</para> | |
<para> | |
For more information on multicast DNS, see | |
<link xlink:href="http://www.multicastdns.org"/>. | |
</para> | |
</note> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-network-yast"> | |
<title>Configuring a network connection with YaST</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
There are many supported networking types on Linux. Most of them use | |
different device names and the configuration files are spread over several | |
locations in the file system. For a detailed overview of the aspects of | |
manual network configuration, see <xref linkend="sec-network-manconf" role="internalbook"/>. | |
</para> | |
<para> | |
<phrase os="sles;osuse">All network interfaces with link | |
up (with a network cable connected) are automatically configured.</phrase> | |
Additional hardware can be configured any time on the installed system. The | |
following sections describe the network configuration for all types of | |
network connections supported by <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
<tip arch="zseries" os="sles"> | |
<title>IBM Z: hotpluggable network cards</title> | |
<para> | |
On IBM Z platforms, hotpluggable network cards are supported, but | |
not their automatic network integration via DHCP (as is the case on the PC). | |
After they have been detected, you need to manually configure the interface. | |
</para> | |
</tip> | |
<sect2 xml:id="sec-network-yast-netcard"> | |
<title>Configuring the network card with YaST</title> | |
<para> | |
To configure your Ethernet or Wi-Fi/Bluetooth card in YaST, select | |
<menuchoice> <guimenu>System</guimenu> <guimenu>Network Settings</guimenu> | |
</menuchoice>. After starting the module, YaST displays the | |
<guimenu>Network Settings</guimenu> dialog with four tabs: <guimenu>Global | |
Options</guimenu>, <guimenu>Overview</guimenu>, | |
<guimenu>Hostname/DNS</guimenu> and <guimenu>Routing</guimenu>. | |
</para> | |
<para> | |
The <guimenu>Global Options</guimenu> tab allows you to set general | |
networking options such as the network setup method, IPv6, and general DHCP | |
options. For more information, see | |
<xref linkend="sec-network-yast-netcard-global" role="internalbook"/>. | |
</para> | |
<para> | |
The <guimenu>Overview</guimenu> tab contains information about installed | |
network interfaces and configurations. Any properly detected network card is | |
listed with its name. You can manually configure new cards, remove or change | |
their configuration in this dialog. To manually configure a card | |
that was not automatically detected, see | |
<xref linkend="sec-network-yast-netcard-man" role="internalbook"/>. To change the | |
configuration of an already configured card, see | |
<xref linkend="sec-network-yast-netcard-change" role="internalbook"/>. | |
</para> | |
<para> | |
The <guimenu>Hostname/DNS</guimenu> tab allows to set the host name of the | |
machine and name the servers to be used. For more information, see | |
<xref linkend="sec-network-yast-change-host" role="internalbook"/>. | |
</para> | |
<para> | |
The <guimenu>Routing</guimenu> tab is used for the configuration of routing. | |
See <xref linkend="sec-network-yast-change-route" role="internalbook"/> for more information. | |
</para> | |
<figure xml:id="fig-yast2-neticard"> | |
<title>Configuring network settings</title> | |
<mediaobject> | |
<imageobject role="fo"> | |
<imagedata fileref="yast2_net_icard.png" width="75%"/> | |
</imageobject> | |
<imageobject role="html"> | |
<imagedata fileref="yast2_net_icard.png" width="75%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<sect3 xml:id="sec-network-yast-netcard-global"> | |
<title>Configuring global networking options</title> | |
<para> | |
The <guimenu>Global Options</guimenu> tab of the YaST <guimenu>Network | |
Settings</guimenu> module allows you to set important global networking | |
options, such as the use of NetworkManager, IPv6 and DHCP client options. These | |
settings are applicable for all network interfaces. | |
</para> | |
<note os="sles"> | |
<title>NetworkManager provided by workstation extension</title> | |
<para> | |
NetworkManager is now provided by the SUSE Linux Enterprise Workstation Extension. To install NetworkManager, activate the | |
Workstation Extension repository, and select the NetworkManager packages. | |
</para> | |
</note> | |
<para> | |
In the <guimenu>Network Setup Method</guimenu> choose the way network | |
connections are managed. If you want a NetworkManager desktop applet to manage | |
connections for all interfaces, choose <guimenu>NetworkManager Service</guimenu>. | |
NetworkManager is well suited for switching between multiple wired and wireless | |
networks. If you do not run a desktop environment, or if your computer is a | |
Xen server, virtual system, or provides network services such as DHCP or | |
DNS in your network, use the <guimenu>Wicked Service</guimenu> method. If | |
NetworkManager is used, <command>nm-applet</command> should be used to configure | |
network options and the <guimenu>Overview</guimenu>, | |
<guimenu>Hostname/DNS</guimenu> and <guimenu>Routing</guimenu> tabs of the | |
<guimenu>Network Settings</guimenu> module are disabled. | |
<phrase os="sles">For more information | |
on NetworkManager, see the SUSE Linux Enterprise Desktop documentation.</phrase> | |
</para> | |
<para> | |
In the <guimenu>IPv6 Protocol Settings</guimenu> choose whether to use the | |
IPv6 protocol. It is possible to use IPv6 together with IPv4. By default, | |
IPv6 is enabled. However, in networks not using IPv6 protocol, response | |
times can be faster with IPv6 protocol disabled. To disable IPv6, | |
deactivate <guimenu>Enable IPv6</guimenu>. If IPv6 is disabled, the kernel | |
no longer loads the IPv6 module automatically. This setting will be applied | |
after reboot. | |
</para> | |
<para> | |
In the <guimenu>DHCP Client Options</guimenu> configure options for the | |
DHCP client. | |
The <guimenu>DHCP Client Identifier</guimenu> must be different for each | |
DHCP client on a single network. If left empty, it defaults to the hardware | |
address of the network interface. However, if you are running several | |
virtual machines using the same network interface and, therefore, the same | |
hardware address, specify a unique free-form identifier here. | |
</para> | |
<para> | |
The <guimenu>Hostname to Send</guimenu> specifies a string used for the | |
host name option field when the DHCP client sends messages to DHCP server. | |
Some DHCP servers update name server zones (forward and reverse records) | |
according to this host name (Dynamic DNS). Also, some DHCP servers require | |
the <guimenu>Hostname to Send</guimenu> option field to contain a specific | |
string in the DHCP messages from clients. Leave <literal>AUTO</literal> to | |
send the current host name (that is the one defined in | |
<filename>/etc/HOSTNAME</filename>). Make the option field empty for not | |
sending any host name. | |
</para> | |
<para> | |
If you do not want to change the default route according to the information | |
from DHCP, deactivate <guimenu>Change Default Route via DHCP</guimenu>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-netcard-change"> | |
<title>Changing the configuration of a network card</title> | |
<para> | |
To change the configuration of a network card, select a card from the list | |
of the detected cards in <menuchoice> <guimenu>Network Settings</guimenu> | |
<guimenu>Overview</guimenu> </menuchoice> in YaST and click | |
<guimenu>Edit</guimenu>. The <guimenu>Network Card Setup</guimenu> dialog | |
appears in which to adjust the card configuration using the | |
<guimenu>General</guimenu>, <guimenu>Address</guimenu> and | |
<guimenu>Hardware</guimenu> tabs. | |
</para> | |
<sect4 xml:id="sec-network-yast-change-address"> | |
<title>Configuring IP addresses</title> | |
<para> | |
You can set the IP address of the network card or the way its IP address | |
is determined in the <guimenu>Address</guimenu> tab of the | |
<guimenu>Network Card Setup</guimenu> dialog. Both IPv4 and IPv6 addresses | |
are supported. The network card can have <guimenu>No IP Address</guimenu> | |
(which is useful for bonding devices), a <guimenu>Statically Assigned IP | |
Address</guimenu> (IPv4 or IPv6) or a <guimenu>Dynamic Address</guimenu> | |
assigned via <guimenu>DHCP</guimenu> or <guimenu>Zeroconf</guimenu> or | |
both. | |
</para> | |
<para> | |
If using <guimenu>Dynamic Address</guimenu>, select whether to use | |
<guimenu>DHCP Version 4 Only</guimenu> (for IPv4), <guimenu>DHCP Version 6 | |
Only</guimenu> (for IPv6) or <guimenu>DHCP Both Version 4 and 6</guimenu>. | |
</para> | |
<para> | |
If possible, the first network card with link that is available during the | |
installation is automatically configured to use automatic address setup | |
via DHCP. | |
</para> | |
<note arch="zseries" os="sles"> | |
<title>IBM Z and DHCP</title> | |
<para> | |
On IBM Z platforms, DHCP-based address configuration is only | |
supported with network cards that have a MAC address. This is only the | |
case with OSA and OSA Express cards. | |
</para> | |
</note> | |
<para> | |
DHCP should also be used if you are using a DSL line but with no static IP | |
assigned by the ISP (Internet Service Provider). If you decide to use | |
DHCP, configure the details in <guimenu>DHCP Client Options</guimenu> in | |
the <guimenu>Global Options</guimenu> tab of the <guimenu>Network | |
Settings</guimenu> dialog of the YaST network card configuration module. | |
If you have a virtual host setup where different hosts communicate through | |
the same interface, an <guimenu>DHCP Client Identifier</guimenu> is | |
necessary to distinguish them. | |
</para> | |
<para> | |
DHCP is a good choice for client configuration but it is not ideal for | |
server configuration. To set a static IP address, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Select a card from the list of detected cards in the | |
<guimenu>Overview</guimenu> tab of the YaST network card configuration | |
module and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>Address</guimenu> tab, choose <guimenu>Statically | |
Assigned IP Address</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the <guimenu>IP Address</guimenu>. Both IPv4 and IPv6 addresses | |
can be used. Enter the network mask in <guimenu>Subnet Mask</guimenu>. | |
If the IPv6 address is used, use <guimenu>Subnet Mask</guimenu> for | |
prefix length in format <literal>/64</literal>. | |
</para> | |
<para> | |
Optionally, you can enter a fully qualified <guimenu>Hostname</guimenu> | |
for this address, which will be written to the | |
<filename>/etc/hosts</filename> configuration file. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, click <guimenu>OK</guimenu>. | |
</para> | |
</step> | |
</procedure> | |
<note> | |
<title>Interface activation and link detection</title> | |
<para> | |
During activation of a network interface, <command>wicked</command> | |
checks for a carrier and only applies the IP configuration when a link | |
has been detected. If you need to apply the configuration regardless of | |
the link status (for example, when you want to test a service listening to a | |
certain address), you can skip link detection by adding the variable | |
<literal>LINK_REQUIRED=no</literal> to the configuration file of the | |
interface in <filename>/etc/sysconfig/network/ifcfg</filename>. | |
</para> | |
<para> | |
Additionally, you can use the variable | |
<literal>LINK_READY_WAIT=<replaceable>5</replaceable></literal> to | |
specify the timeout for waiting for a link in seconds. | |
</para> | |
<para> | |
For more information about the <filename>ifcfg-*</filename> configuration | |
files, refer to <xref linkend="sec-network-manconf-files-ifcfg" role="internalbook"/> and | |
<command>man 5 ifcfg</command>. | |
</para> | |
</note> | |
<para> | |
If you use the static address, the name servers and default gateway are | |
not configured automatically. To configure name servers, proceed as | |
described in <xref linkend="sec-network-yast-change-host" role="internalbook"/>. To configure | |
a gateway, proceed as described in | |
<xref linkend="sec-network-yast-change-route" role="internalbook"/>. | |
</para> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-configure-addresses"> | |
<title>Configuring multiple addresses</title> | |
<para> | |
A single network device can have multiple IP addresses called aliases or labels. | |
</para> | |
<note> | |
<title>Aliases are a compatibility feature</title> | |
<para> | |
Aliases or labels work with IPv4 only. Using <command>iproute2</command> network interfaces makes it possible to have one or more addresses. | |
</para> | |
</note> | |
<para> | |
To set additional addresses for your network card using YaST, proceed as | |
follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Select a card from the list of detected cards in the | |
<guimenu>Overview</guimenu> tab of the YaST <guimenu>Network | |
Settings</guimenu> dialog and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <menuchoice> <guimenu>Address</guimenu> <guimenu>Additional | |
Addresses</guimenu> </menuchoice> tab, click <guimenu>Add</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter <guimenu>IPv4 Address Label</guimenu>, <guimenu>IP | |
Address</guimenu>, and <guimenu>Netmask</guimenu>. Note that IP aliases must be added with the <literal>/32</literal> netmask. Do not include the | |
interface name in the alias name. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-udev"> | |
<title>Changing the device name and udev rules</title> | |
<para> | |
It is possible to change the device name of the network card when it is | |
used. It is also possible to determine whether the network card should be | |
identified by udev via its hardware (MAC) address or via the bus ID. The | |
latter option is preferable in large servers to simplify hotplugging of | |
cards. To set these options with YaST, proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Select a card from the list of detected cards in the | |
<guimenu>Overview</guimenu> tab of the YaST <guimenu>Network | |
Settings</guimenu> dialog and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Go to the <guimenu>General</guimenu> tab. The current device name is | |
shown in <guimenu>Udev Rules</guimenu>. Click <guimenu>Change</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select whether udev should identify the card by its <guimenu>MAC | |
Address</guimenu> or <guimenu>Bus ID</guimenu>. The current MAC address | |
and bus ID of the card are shown in the dialog. | |
</para> | |
</step> | |
<step> | |
<para> | |
To change the device name, check the <guimenu>Change Device | |
Name</guimenu> option and edit the name. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-driver"> | |
<title>Changing network card kernel driver</title> | |
<para> | |
For some network cards, several kernel drivers may be available. If the | |
card is already configured, YaST allows you to select a kernel driver to | |
be used from a list of available suitable drivers. It is also possible to | |
specify options for the kernel driver. To set these options with YaST, | |
proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Select a card from the list of detected cards in the | |
<guimenu>Overview</guimenu> tab of the YaST Network Settings module | |
and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Go to the <guimenu>Hardware</guimenu> tab. | |
</para> | |
</step> | |
<step> | |
<para> | |
Select the kernel driver to be used in <guimenu>Module Name</guimenu>. | |
Enter any options for the selected driver in <guimenu>Options</guimenu> | |
in the form | |
<command>=</command> =<replaceable>VALUE</replaceable>. If more options | |
are used, they should be space-separated. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-start"> | |
<title>Activating the network device</title> | |
<para> | |
If you use the method with <command>wicked</command>, you can configure | |
your device to either start during boot, on cable connection, on card | |
detection, manually, or never. To change device start-up, proceed as | |
follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
In YaST select a card from the list of detected cards in <menuchoice> | |
<guimenu>System</guimenu> <guimenu>Network Settings</guimenu> | |
</menuchoice> and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>General</guimenu> tab, select the desired entry from | |
<guimenu>Device Activation</guimenu>. | |
</para> | |
<para> | |
Choose <guimenu>At Boot Time</guimenu> to start the device during the | |
system boot. With <guimenu>On Cable Connection</guimenu>, the interface | |
is watched for any existing physical connection. With <guimenu>On | |
Hotplug</guimenu>, the interface is set when available. It is similar to | |
the <guimenu>At Boot Time</guimenu> option, and only differs in that no | |
error occurs if the interface is not present at boot time. Choose | |
<guimenu>Manually</guimenu> to control the interface manually with | |
<command>ifup</command>. Choose <guimenu>Never</guimenu> to not start | |
the device. The <guimenu>On NFSroot</guimenu> is similar to <guimenu>At | |
Boot Time</guimenu>, but the interface does not shut down with the | |
<command>systemctl stop network</command> command; the | |
<option>network</option> service also cares about the | |
<option>wicked</option> service if <command>wicked</command> is active. | |
Use this if you use an NFS or iSCSI root file system. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
<tip> | |
<title>NFS as a root file system</title> | |
<para> | |
On (diskless) systems where the root partition is mounted via network as | |
an NFS share, you need to be careful when configuring the network device | |
with which the NFS share is accessible. | |
</para> | |
<para> | |
When shutting down or rebooting the system, the default processing order | |
is to turn off network connections, then unmount the root partition. With | |
NFS root, this order causes problems as the root partition cannot be | |
cleanly unmounted as the network connection to the NFS share is already | |
not activated. To prevent the system from deactivating the relevant | |
network device, open the network device configuration tab as described in | |
<xref linkend="sec-network-yast-change-start" role="internalbook"/> and choose <guimenu>On | |
NFSroot</guimenu> in the <guimenu>Device Activation</guimenu> pane. | |
</para> | |
</tip> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-mtu"> | |
<title>Setting up maximum transfer unit size</title> | |
<para> | |
You can set a maximum transmission unit (MTU) for the interface. MTU | |
refers to the largest allowed packet size in bytes. A higher MTU brings | |
higher bandwidth efficiency. However, large packets can block up a slow | |
interface for some time, increasing the lag for further packets. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
In YaST select a card from the list of detected cards in <menuchoice> | |
<guimenu>System</guimenu> <guimenu>Network Settings</guimenu> | |
</menuchoice> and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>General</guimenu> tab, select the desired entry from the | |
<guimenu>Set MTU</guimenu> list. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-pciemulti"> | |
<title>PCIe multifunction devices</title> | |
<para> | |
Multifunction devices that support LAN, iSCSI, and FCoE are supported. | |
The YaST FCoE client (<command>yast2 fcoe-client</command>) shows the | |
private flags in additional columns to allow the user to select the device | |
meant for FCoE. The YaST network module (<command>yast2 lan</command>) | |
excludes <quote>storage only devices</quote> for network configuration. | |
</para> | |
<para os="sles"> | |
For more information about FCoE, see <phrase role="externalbook-sec-fcoe-yast">“Managing FCoE services with YaST” (Section “Fibre Channel storage over Ethernet networks: FCoE”, ↑Storage Administration Guide)</phrase>. | |
</para> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-infiniband"> | |
<title>Infiniband configuration for IP-over-InfiniBand (IPoIB)</title> | |
<procedure> | |
<step> | |
<para> | |
In YaST select the InfiniBand device in <menuchoice> | |
<guimenu>System</guimenu> <guimenu>Network Settings</guimenu> | |
</menuchoice> and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>General</guimenu> tab, select one of the | |
<guimenu>IP-over-InfiniBand</guimenu> (IPoIB) modes: | |
<guimenu>connected</guimenu> (default) or <guimenu>datagram</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
For more information about InfiniBand, see | |
<filename>/usr/src/linux/Documentation/infiniband/ipoib.txt</filename>. | |
</para> | |
</sect4> | |
<sect4 xml:id="sec-network-yast-change-fire"> | |
<title>Configuring the firewall</title> | |
<para> | |
Without having to perform the detailed firewall setup as described in | |
<phrase role="externalbook-sec-security-firewall-firewalld">“firewalld” (Section “Masquerading and firewalls”, ↑Security and Hardening Guide)</phrase>, you can determine the | |
basic firewall configuration for your device as part of the device setup. | |
Proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Open the YaST <menuchoice> <guimenu>System</guimenu> <guimenu>Network | |
Settings</guimenu> </menuchoice> module. In the | |
<guimenu>Overview</guimenu> tab, select a card from the list of detected | |
cards and click <guimenu>Edit</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the <guimenu>General</guimenu> tab of the <guimenu>Network | |
Settings</guimenu> dialog. | |
</para> | |
</step> | |
<step> | |
<para> | |
Determine the <guimenu>Firewall Zone</guimenu> to which your interface | |
should be assigned. The following options are available: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>Firewall disabled</term> | |
<listitem> | |
<para> | |
This option is available only if the firewall is disabled and the | |
firewall does not run. Only use this option if your machine is part | |
of a greater network that is protected by an outer firewall. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Automatically assign zone</term> | |
<listitem> | |
<para> | |
This option is available only if the firewall is enabled. The | |
firewall is running and the interface is automatically assigned to a | |
firewall zone. The zone which contains the keyword | |
<literal>any</literal> or the external zone will be used for such an | |
interface. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Internal zone (unprotected)</term> | |
<listitem> | |
<para> | |
The firewall is running, but does not enforce any rules to protect | |
this interface. Use this option if your machine is part of a greater | |
network that is protected by an outer firewall. It is also useful for | |
the interfaces connected to the internal network, when the machine | |
has more network interfaces. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>Demilitarized zone</term> | |
<listitem> | |
<para> | |
A demilitarized zone is an additional line of defense in front of an | |
internal network and the (hostile) Internet. Hosts assigned to this | |
zone can be reached from the internal network and from the Internet, | |
but cannot access the internal network. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>External zone</term> | |
<listitem> | |
<para> | |
The firewall is running on this interface and fully protects it | |
against other—presumably hostile—network traffic. This is | |
the default option. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect4> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-netcard-man"> | |
<title>Configuring an undetected network card</title> | |
<para> | |
If a network card is not detected correctly, the card is not included in | |
the list of detected cards. If you are sure that your system includes a | |
driver for your card, you can configure it manually. You can also configure | |
special network device types, such as bridge, bond, TUN or TAP. To | |
configure an undetected network card (or a special device) proceed as | |
follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
In the <menuchoice> <guimenu>System</guimenu> <guimenu>Network | |
Settings</guimenu> <guimenu>Overview</guimenu> </menuchoice> dialog in | |
YaST click <guimenu>Add</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In the <guimenu>Hardware</guimenu> dialog, set the <guimenu>Device | |
Type</guimenu> of the interface from the available options and | |
<guimenu>Configuration Name</guimenu>. If the network card is a | |
USB device, activate the respective check box and exit this dialog with | |
<guimenu>Next</guimenu>. Otherwise, you can define the kernel | |
<guimenu>Module Name</guimenu> to be used for the card and its | |
<guimenu>Options</guimenu>, if necessary. | |
</para> | |
<para> | |
In <guimenu>Ethtool Options</guimenu>, you can set | |
<command>ethtool</command> options used by <command>ifup</command> for | |
the interface. For information about available options, see the | |
<command>ethtool</command> manual page. | |
</para> | |
<para> | |
If the option string starts with a | |
<literal>-</literal> (for example, <literal>-K | |
<replaceable>INTERFACE_NAME</replaceable> rx on</literal>), the second | |
word in the string is replaced with the current interface name. Otherwise | |
(for example, <literal>autoneg off speed 10</literal>) | |
<command>ifup</command> adds <literal>-s | |
<replaceable>INTERFACE_NAME</replaceable></literal> to the beginning. | |
</para> | |
</step> | |
<step> | |
<para> | |
Click <guimenu>Next</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Configure any needed options, such as the IP address, device activation | |
or firewall zone for the interface in the <guimenu>General</guimenu>, | |
<guimenu>Address</guimenu>, and <guimenu>Hardware</guimenu> tabs. For | |
more information about the configuration options, see | |
<xref linkend="sec-network-yast-netcard-change" role="internalbook"/>. | |
</para> | |
</step> | |
<step> | |
<para> | |
If you selected <guimenu>Wireless</guimenu> as the device type of the | |
interface, configure the wireless connection in the next dialog. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the new network configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-change-host"> | |
<title>Configuring host name and DNS</title> | |
<para> | |
If you did not change the network configuration during installation and the | |
Ethernet card was already available, a host name was automatically | |
generated for your computer and DHCP was activated. The same applies to the | |
name service information your host needs to integrate into a network | |
environment. If DHCP is used for network address setup, the list of domain | |
name servers is automatically filled with the appropriate data. If a static | |
setup is preferred, set these values manually. | |
</para> | |
<para> | |
To change the name of your computer and adjust the name server search list, | |
proceed as follows: | |
</para> | |
<procedure> | |
<step> | |
<para> | |
Go to the <menuchoice> <guimenu>Network Settings</guimenu> | |
<guimenu>Hostname/DNS</guimenu> </menuchoice> tab in the | |
<guimenu>System</guimenu> module in YaST. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the <guimenu>Hostname</guimenu>. Note that the host name is global | |
and applies to all network interfaces. | |
</para> | |
<para> | |
If you are using DHCP to get an IP address, the host name of your | |
computer will be automatically set by the DHCP server. You should disable this | |
behavior if you connect to different networks, because they may assign | |
different host names and changing the host name at runtime may confuse | |
the graphical desktop. To disable using DHCP to get an IP address | |
deactivate <guimenu>Change Hostname via DHCP</guimenu>. | |
</para> | |
</step> | |
<step> | |
<para> | |
In <guimenu>Modify DNS Configuration</guimenu>, select the way the DNS | |
configuration (name servers, search list, the content of the | |
<filename>/run/netconfig/resolv.conf</filename> file) is modified. | |
</para> | |
<para> | |
If the <guimenu>Use Default Policy</guimenu> option is selected, the | |
configuration is handled by the <command>netconfig</command> script which | |
merges the data defined statically (with YaST or in the configuration | |
files) with data obtained dynamically (from the DHCP client or | |
NetworkManager). This default policy is usually sufficient. | |
</para> | |
<para> | |
If the <guimenu>Only Manually</guimenu> option is selected, | |
<command>netconfig</command> is not allowed to modify the | |
<filename>/run/netconfig/resolv.conf</filename> file. However, this file can be | |
edited manually. | |
</para> | |
<para> | |
If the <guimenu>Custom Policy</guimenu> option is selected, a | |
<guimenu>Custom Policy Rule</guimenu> string defining the merge policy | |
should be specified. The string consists of a comma-separated list of | |
interface names to be considered a valid source of settings. Except for | |
complete interface names, basic wild cards to match multiple interfaces | |
are allowed, as well. For example, <literal>eth* ppp?</literal> will | |
first target all eth and then all ppp0-ppp9 interfaces. There are two | |
special policy values that indicate how to apply the static settings | |
defined in the <filename>/etc/sysconfig/network/config</filename> file: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><literal>STATIC</literal> | |
</term> | |
<listitem> | |
<para> | |
The static settings need to be merged together with the dynamic | |
settings. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><literal>STATIC_FALLBACK</literal> | |
</term> | |
<listitem> | |
<para> | |
The static settings are used only when no dynamic configuration is | |
available. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
For more information, see the man page of <command>netconfig</command>(8) | |
(<command>man 8 netconfig</command>). | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the <guimenu>Name Servers</guimenu> and fill in the <guimenu>Domain | |
Search</guimenu> list. Name servers must be specified by IP addresses, | |
such as 192.168.1.116, not by host names. Names specified in the | |
<guimenu>Domain Search</guimenu> tab are domain names used for resolving | |
host names without a specified domain. If more than one <guimenu>Domain | |
Search</guimenu> is used, separate domains with commas or white space. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
<para> | |
It is also possible to edit the host name using YaST from the command | |
line. The changes made by YaST take effect immediately (which is not the | |
case when editing the <filename>/etc/HOSTNAME</filename> file manually). To | |
change the host name, use the following command: | |
</para> | |
<screen><prompt role="root"># </prompt>yast dns edit hostname=<replaceable>HOSTNAME</replaceable></screen> | |
<para> | |
To change the name servers, use the following commands: | |
</para> | |
<screen><prompt role="root"># </prompt>yast dns edit nameserver1=192.168.1.116 | |
<prompt role="root"># </prompt>yast dns edit nameserver2=192.168.1.117 | |
<prompt role="root"># </prompt>yast dns edit nameserver3=192.168.1.118</screen> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-change-route"> | |
<title>Configuring routing</title> | |
<para> | |
To make your machine communicate with other machines and other networks, | |
routing information must be given to make network traffic take the correct | |
path. If DHCP is used, this information is automatically provided. If a | |
static setup is used, this data must be added manually. | |
</para> | |
<procedure> | |
<step> | |
<para> | |
In YaST go to <menuchoice> <guimenu>Network Settings</guimenu> | |
<guimenu>Routing</guimenu> </menuchoice>. | |
</para> | |
</step> | |
<step> | |
<para> | |
Enter the IP address of the <guimenu>Default Gateway</guimenu> (IPv4 and | |
IPv6 if necessary). The default gateway matches every possible | |
destination, but if a routing table entry exists that matches the | |
required address, this will be used instead of the default route via the | |
Default Gateway. | |
</para> | |
</step> | |
<step> | |
<para> | |
More entries can be entered in the <guimenu>Routing Table</guimenu>. | |
Enter the <guimenu>Destination</guimenu> network IP address, | |
<guimenu>Gateway</guimenu> IP address and the <guimenu>Netmask</guimenu>. | |
Select the <guimenu>Device</guimenu> through which the traffic to the | |
defined network will be routed (the minus sign stands for any device). | |
<remark>mdejmek: ok, what does the minus exactly do? you are using it here for different things;</remark> | |
To omit any of these values, use the minus sign <literal>-</literal>. To | |
enter a default gateway into the table, use <literal>default</literal> in | |
the <guimenu>Destination</guimenu> field. | |
</para> | |
<note> | |
<title>Route prioritization</title> | |
<para> | |
If more default routes are used, it is possible to specify the metric | |
option to determine which route has a higher priority. To specify the | |
metric option, enter <option>- metric | |
<replaceable>NUMBER</replaceable></option> in <guimenu>Options</guimenu>. | |
The lowest possible metric is 0. The route with the lowest metric has the | |
highest priority and is used as default. If the network device is | |
disconnected, its route will be removed and the next one will be used. | |
</para> | |
</note> | |
</step> | |
<step> | |
<para> | |
If the system is a router, enable <guimenu>IPv4 Forwarding</guimenu> and | |
<guimenu>IPv6 Forwarding</guimenu> in the <guimenu>Network | |
Settings</guimenu> as needed. | |
</para> | |
</step> | |
<step> | |
<para> | |
To activate the configuration, confirm the settings. | |
</para> | |
</step> | |
</procedure> | |
</sect3> | |
</sect2> | |
<sect2 version="5.0" xml:id="sec-network-yast-s390" arch="zseries" os="sles"> | |
<title>IBM Z: configuring network devices</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
<phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> for IBM Z supports several types of network interfaces. | |
YaST can be used to configure all of them. | |
</para> | |
<sect3 xml:id="sec-network-yast-s390-hsi"> | |
<title>The qeth-hsi device</title> | |
<para> | |
To add a <literal>qeth-hsi</literal> (HiperSockets) interface to the | |
installed system, start the <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Network Settings</guimenu> </menuchoice> module in YaST. Select | |
one of the devices marked <guimenu>Hipersocket</guimenu> to use as the READ | |
device address and click <guimenu>Edit</guimenu>. Enter the device numbers | |
for the read, write and control channels (example device number format: | |
<literal>0.0.0800</literal>). Then click next. In the <guimenu>Network | |
Address Setup</guimenu> dialog, specify the IP address and netmask for the | |
new interface and leave the network configuration by clicking | |
<guimenu>Next</guimenu> and <guimenu>OK</guimenu>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-s390-eth"> | |
<title>The qeth-ethernet device</title> | |
<para> | |
To add a <literal>qeth-ethernet</literal> (IBM OSA Express Ethernet Card) | |
interface to the installed system, start the <menuchoice> | |
<guimenu>System</guimenu> <guimenu>Network Settings</guimenu> </menuchoice> | |
module in YaST. Select one of the devices marked <guimenu>IBM OSA Express | |
Ethernet Card</guimenu> to use as the READ device address and click | |
<guimenu>Edit</guimenu>. Enter a device number for the read, write and | |
control channels (example device number format: | |
<literal>0.0.0700</literal>). Enter the needed port name, port number (if | |
applicable) and some additional options, your IP address, and an appropriate | |
netmask. Leave the network configuration with <guimenu>Next</guimenu> and | |
<guimenu>OK</guimenu>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-s390-ctc"> | |
<title>The ctc device</title> | |
<para> | |
To add a <literal>ctc</literal> (IBM parallel CTC Adapter) interface to the | |
installed system, start the <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Network Settings</guimenu> </menuchoice> module in YaST. Select | |
one of the devices marked <guimenu>IBM Parallel CTC Adapter</guimenu> to use | |
as your read channel and click <guimenu>Configure</guimenu>. Choose the | |
<guimenu>Device Settings</guimenu> that fit your devices (usually this would | |
be <guimenu>Compatibility Mode</guimenu>). Specify both your IP address and | |
the IP address of the remote partner. If needed, adjust the MTU size with | |
<menuchoice> <guimenu>Advanced</guimenu> <guimenu>Detailed | |
Settings</guimenu> </menuchoice>. Leave the network configuration with | |
<guimenu>Next</guimenu> and <guimenu>OK</guimenu>. | |
</para> | |
<warning> | |
<title>CTC is no longer supported</title> | |
<para> | |
The use of this interface is deprecated. This interface will not be | |
supported in future versions of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
</warning> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-s390-lcs"> | |
<title>The lcs device</title> | |
<para> | |
To add an <literal>lcs</literal> (IBM OSA-2 Adapter) interface to the | |
installed system, start the <menuchoice> <guimenu>System</guimenu> | |
<guimenu>Network Settings</guimenu> </menuchoice> module in YaST. Select | |
one of the devices marked <guimenu>IBM OSA-2 Adapter</guimenu> and click | |
<guimenu>Configure</guimenu>. Enter the needed port number, some additional | |
options, your IP address and an appropriate netmask. Leave the network | |
configuration with <guimenu>Next</guimenu> and <guimenu>OK</guimenu>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-yast-s390-iucv"> | |
<title>The IUCV device</title> | |
<para> | |
To add an <literal>iucv</literal> (IUCV) interface to the installed system, | |
start the <menuchoice> <guimenu>System</guimenu> <guimenu>Network | |
Settings</guimenu> </menuchoice> module in YaST. Select a device marked | |
<guimenu>IUCV</guimenu> and click <guimenu>Edit</guimenu>. YaST prompts | |
you for the name of your IUCV partner (<guimenu>Peer</guimenu>). Enter the | |
name (this entry is case-sensitive) and select <guimenu>Next</guimenu>. | |
Specify both the <guimenu>IP Address</guimenu> and the <guimenu>Remote IP | |
Address</guimenu> of your partner. If needed, <guimenu>Set MTU</guimenu> | |
size on <guimenu>General</guimenu> tab. Leave the network configuration with | |
<guimenu>Next</guimenu> and <guimenu>OK</guimenu>. | |
</para> | |
<warning> | |
<title>IUCV is no longer supported</title> | |
<para> | |
The use of this interface is deprecated. This interface will not be | |
supported in future versions of <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase>. | |
</para> | |
</warning> | |
</sect3> | |
</sect2> | |
</sect1> | |
<sect1 version="5.0" xml:id="sec-network-manconf"> | |
<title>Configuring a network connection manually</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
Manual configuration of the network software should be the last alternative. | |
Using YaST is recommended. However, this background information about the | |
network configuration can also assist your work with YaST. | |
</para> | |
<sect2 xml:id="sec-network-manconf-wicked"> | |
<title>The <command>wicked</command> network configuration</title> | |
<para> | |
The tool and library called <command>wicked</command> provides a new | |
framework for network configuration. | |
</para> | |
<para> | |
One of the challenges with traditional network interface management is that | |
different layers of network management get jumbled together into one single | |
script, or at most two different scripts. These scripts interact with each other in a | |
way that is not well defined. This leads to unpredictable issues, obscure | |
constraints and conventions, etc. Several layers of special hacks for a variety of different scenarios increase the maintenance | |
burden. Address configuration protocols are being used that are implemented | |
via daemons like dhcpcd, which interact rather poorly with the rest of the | |
infrastructure. Funky interface naming schemes that require heavy udev | |
support are introduced to achieve persistent identification of interfaces. | |
</para> | |
<para> | |
The idea of wicked is to decompose the problem in several ways. None of them | |
is entirely novel, but trying to put ideas from different projects together | |
is hopefully going to create a better solution overall. | |
</para> | |
<para> | |
One approach is to use a client/server model. This allows wicked to define | |
standardized facilities for things like address configuration that are well | |
integrated with the overall framework. For example, using a specific address | |
configuration, the administrator may request that an interface should be | |
configured via DHCP or IPv4 zeroconf. In this case, the address configuration | |
service simply obtains the lease from its server and passes it on to the | |
wicked server process that installs the requested addresses and routes. | |
</para> | |
<para> | |
The other approach to decomposing the problem is to enforce the layering | |
aspect. For any type of network interface, it is possible to define a dbus | |
service that configures the network interface's device layer—a VLAN, a | |
bridge, a bonding, or a paravirtualized device. Common functionality, such | |
as address configuration, is implemented by joint services that are layered | |
on top of these device specific services without having to implement them | |
specifically. | |
</para> | |
<para> | |
The wicked framework implements these two aspects by using a variety of dbus | |
services, which get attached to a network interface depending on its type. | |
Here is a rough overview of the current object hierarchy in wicked. | |
</para> | |
<para> | |
Each network interface is represented via a child object of | |
<systemitem>/org/opensuse/Network/Interfaces</systemitem>. The name of the | |
child object is given by its ifindex. For example, the loopback interface, | |
which usually gets ifindex 1, is | |
<systemitem>/org/opensuse/Network/Interfaces/1</systemitem>, the first | |
Ethernet interface registered is | |
<systemitem>/org/opensuse/Network/Interfaces/2</systemitem>. | |
</para> | |
<para> | |
Each network interface has a <quote>class</quote> associated with it, which | |
is used to select the dbus interfaces it supports. By default, each network | |
interface is of class <literal>netif</literal>, and | |
<systemitem class="daemon">wickedd</systemitem> will automatically | |
attach all interfaces compatible with this class. In the current | |
implementation, this includes the following interfaces: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term>org.opensuse.Network.Interface</term> | |
<listitem> | |
<para> | |
Generic network interface functions, such as taking the link up or down, | |
assigning an MTU, etc. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term>org.opensuse.Network.Addrconf.ipv4.dhcp</term> | |
<term>org.opensuse.Network.Addrconf.ipv6.dhcp</term> | |
<term>org.opensuse.Network.Addrconf.ipv4.auto</term> | |
<listitem> | |
<para> | |
Address configuration services for DHCP, | |
IPv4 zeroconf, etc. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
Beyond this, network interfaces may require or offer special configuration | |
mechanisms. For an Ethernet device, for example, you should be able to | |
control the link speed, offloading of checksumming, etc. To achieve this, | |
Ethernet devices have a class of their own, called | |
<literal>netif-ethernet</literal>, which is a subclass of | |
<literal>netif</literal>. As a consequence, the dbus interfaces assigned to | |
an Ethernet interface include all the services listed above, plus the | |
<systemitem>org.opensuse.Network.Ethernet</systemitem> service available only to objects belonging to the <literal>netif-ethernet</literal> | |
class. | |
</para> | |
<para> | |
Similarly, there exist classes for interface types like bridges, VLANs, | |
bonds, or infinibands. | |
</para> | |
<para> | |
How do you interact with an interface like VLAN (which is really a virtual network interface that | |
sits on top of an Ethernet device) that needs to be created | |
first? For this, wicked defines factory | |
interfaces, such as | |
<systemitem>org.opensuse.Network.VLAN.Factory</systemitem>. Such a factory | |
interface offers a single function that lets you create an interface of the | |
requested type. These factory interfaces are attached to the | |
<systemitem>/org/opensuse/Network/Interfaces</systemitem> list node. | |
</para> | |
<sect3 xml:id="sec-network-manconf-supported"> | |
<title><literal>wicked</literal> architecture and features</title> | |
<para> | |
The <literal>wicked</literal> service comprises several parts as depicted | |
in <xref linkend="wicked-architecture" role="internalbook"/>. | |
</para> | |
<figure xml:id="wicked-architecture"> | |
<title><literal>wicked</literal> architecture</title> | |
<mediaobject> | |
<imageobject role="html"> | |
<imagedata fileref="wicked_scheme.png"/> | |
</imageobject> | |
<imageobject role="fo"> | |
<imagedata fileref="wicked_scheme.png" width="80%"/> | |
</imageobject> | |
</mediaobject> | |
</figure> | |
<para> | |
<literal>wicked</literal> currently supports the following: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
Configuration file back-ends to parse SUSE style | |
<filename>/etc/sysconfig/network</filename> files. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
An internal configuration back-end to represent network interface | |
configuration in XML. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
Bring up and shutdown of <quote>normal</quote> network interfaces such as | |
Ethernet or InfiniBand, VLAN, bridge, bonds, tun, tap, dummy, macvlan, | |
macvtap, hsi, qeth, iucv, and wireless (currently limited to one | |
wpa-psk/eap network) devices. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
A built-in DHCPv4 client and a built-in DHCPv6 client. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
The nanny daemon (enabled by default) helps to automatically bring up | |
configured interfaces when the device is available (interface | |
hotplugging) and set up the IP configuration when a link (carrier) is | |
detected. See <xref linkend="sec-network-manconf-using-nanny" role="internalbook"/> for more | |
information. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>wicked</literal> was implemented as a group of DBus services | |
that are integrated with systemd. So the usual | |
<command>systemctl</command> commands will apply to | |
<literal>wicked</literal>. | |
</para> | |
</listitem> | |
</itemizedlist> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-using-wicked"> | |
<title>Using <literal>wicked</literal></title> | |
<para os="sles;sled"> | |
On SUSE Linux Enterprise, <literal>wicked</literal> runs by default. If you want to check | |
what is currently enabled and whether it is running, call: | |
</para> | |
<screen>systemctl status network</screen> | |
<para> | |
If <literal>wicked</literal> is enabled, you will see something along these | |
lines: | |
</para> | |
<screen>wicked.service - wicked managed network interfaces | |
Loaded: loaded (/usr/lib/systemd/system/wicked.service; enabled) | |
...</screen> | |
<para> | |
In case something different is running (for example, NetworkManager) and you want to | |
switch to <literal>wicked</literal>, first stop what is running and then | |
enable <literal>wicked</literal>: | |
</para> | |
<screen>systemctl is-active network && \ | |
systemctl stop network | |
systemctl enable --force wicked</screen> | |
<para> | |
This enables the wicked services, creates the | |
<filename>network.service</filename> to <filename>wicked.service</filename> | |
alias link, and starts the network at the next boot. | |
</para> | |
<para> | |
Starting the server process: | |
</para> | |
<screen>systemctl start wickedd</screen> | |
<para> | |
This starts <command>wickedd</command> (the main server) and associated | |
supplicants: | |
</para> | |
<screen>/usr/lib/wicked/bin/wickedd-auto4 --systemd --foreground | |
/usr/lib/wicked/bin/wickedd-dhcp4 --systemd --foreground | |
/usr/lib/wicked/bin/wickedd-dhcp6 --systemd --foreground | |
/usr/sbin/wickedd --systemd --foreground | |
/usr/sbin/wickedd-nanny --systemd --foreground</screen> | |
<para> | |
Then bringing up the network: | |
</para> | |
<screen>systemctl start wicked</screen> | |
<para> | |
Alternatively use the <filename>network.service</filename> alias: | |
</para> | |
<screen>systemctl start network</screen> | |
<para> | |
These commands are using the default or system configuration sources as | |
defined in <filename>/etc/wicked/client.xml</filename>. | |
</para> | |
<para> | |
To enable debugging, set <literal>WICKED_DEBUG</literal> in | |
<filename>/etc/sysconfig/network/config</filename>, for example: | |
</para> | |
<screen>WICKED_DEBUG="all"</screen> | |
<para> | |
Or, to omit some: | |
</para> | |
<screen>WICKED_DEBUG="all,-dbus,-objectmodel,-xpath,-xml"</screen> | |
<para> | |
Use the client utility to display interface information for all interfaces | |
or the interface specified with <replaceable>IFNAME</replaceable>: | |
</para> | |
<screen>wicked show all | |
wicked show <replaceable>IFNAME</replaceable></screen> | |
<para> | |
In XML output: | |
</para> | |
<screen>wicked show-xml all | |
wicked show-xml <replaceable>IFNAME</replaceable></screen> | |
<para> | |
Bringing up one interface: | |
</para> | |
<screen>wicked ifup eth0 | |
wicked ifup wlan0 | |
...</screen> | |
<para> | |
Because there is no configuration source specified, the wicked client | |
checks its default sources of configuration defined in | |
<filename>/etc/wicked/client.xml</filename>: | |
</para> | |
<orderedlist> | |
<listitem> | |
<para> | |
<literal>firmware:</literal> iSCSI Boot Firmware Table (iBFT) | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
<literal>compat:</literal> <literal>ifcfg</literal> | |
files—implemented for compatibility | |
</para> | |
</listitem> | |
</orderedlist> | |
<para> | |
Whatever <literal>wicked</literal> gets from those sources for a given | |
interface is applied. The intended order of importance is | |
<literal>firmware</literal>, then <literal>compat</literal>—this may | |
be changed in the future. | |
</para> | |
<para> | |
For more information, see the <command>wicked</command> man page. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-using-nanny"> | |
<title>Nanny</title> | |
<para> | |
Nanny is an event and policy driven daemon that is responsible for | |
asynchronous or unsolicited scenarios such as hotplugging devices. Thus the | |
nanny daemon helps with starting or restarting delayed or temporarily gone | |
devices. Nanny monitors device and link changes, and integrates new devices | |
defined by the current policy set. Nanny continues to set up even if | |
<command>ifup</command> already exited because of specified timeout | |
constraints. | |
</para> | |
<para> | |
By default, the nanny daemon is active on the system. It is enabled in the | |
<filename>/etc/wicked/common.xml</filename> configuration file: | |
</para> | |
<screen><config> | |
... | |
<use-nanny>true</use-nanny> | |
</config></screen> | |
<para> | |
This setting causes ifup and ifreload to apply a policy with the effective | |
configuration to the nanny daemon; then, nanny configures | |
<systemitem class="daemon">wickedd</systemitem> and thus ensures | |
hotplug support. It waits in the background for events or changes (such as | |
new devices or carrier on). | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-multiple"> | |
<title>Bringing up multiple interfaces</title> | |
<para> | |
For bonds and bridges, it may make sense to define the entire device | |
topology in one file (ifcfg-bondX), and bring it up in one go. wicked then | |
can bring up the whole configuration if you specify the top level interface | |
names (of the bridge or bond): | |
</para> | |
<screen>wicked ifup br0</screen> | |
<para> | |
This command automatically sets up the bridge and its dependencies in the | |
appropriate order without the need to list the dependencies (ports, etc.) | |
separately. | |
</para> | |
<para> | |
To bring up multiple interfaces in one command: | |
</para> | |
<screen>wicked ifup bond0 br0 br1 br2</screen> | |
<para> | |
Or also all interfaces: | |
</para> | |
<screen>wicked ifup all</screen> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-tunnel"> | |
<title>Using tunnels with wicked</title> | |
<para> | |
When you need to use tunnels with Wicked, the <envar>TUNNEL_DEVICE</envar> | |
is used for this. It permits to specify an optional device name to bind | |
the tunnel to the device. The tunneled packets will only be routed via this | |
device. | |
</para> | |
<para> | |
For more information, refer to <command>man 5 ifcfg-tunnel</command>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-incremental"> | |
<title>Handling incremental changes</title> | |
<para> | |
With <command>wicked</command>, there is no need to actually take down an | |
interface to reconfigure it (unless it is required by the kernel). For | |
example, to add another IP address or route to a statically configured | |
network interface, add the IP address to the interface definition, and do | |
another <quote>ifup</quote> operation. The server will try hard to update | |
only those settings that have changed. This applies to link-level options | |
such as the device MTU or the MAC address, and network-level settings, such | |
as addresses, routes, or even the address configuration mode (for example, | |
when moving from a static configuration to DHCP). | |
</para> | |
<para> | |
Things get tricky of course with virtual interfaces combining several real | |
devices such as bridges or bonds. For bonded devices, it is not possible to | |
change certain parameters while the device is up. Doing that will result in | |
an error. | |
</para> | |
<para> | |
However, what should still work, is the act of adding or removing the child | |
devices of a bond or bridge, or choosing a bond's primary interface. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-address-config"> | |
<title>Wicked extensions: address configuration</title> | |
<para> | |
<command>wicked</command> is designed to be extensible with shell scripts. | |
These extensions can be defined in the <filename>config.xml</filename> | |
file. | |
</para> | |
<para> | |
Currently, several classes of extensions are supported: | |
</para> | |
<itemizedlist> | |
<listitem> | |
<para> | |
link configuration: these are scripts responsible for setting up a | |
device's link layer according to the configuration provided by the | |
client, and for tearing it down again. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
address configuration: these are scripts responsible for managing a | |
device's address configuration. Usually address configuration and DHCP | |
are managed by <command>wicked</command> itself, but can be implemented | |
by means of extensions. | |
</para> | |
</listitem> | |
<listitem> | |
<para> | |
firewall extension: these scripts can apply firewall rules. | |
</para> | |
</listitem> | |
</itemizedlist> | |
<para> | |
Typically, extensions have a start and a stop command, an optional | |
<quote>pid file</quote>, and a set of environment variables that get passed | |
to the script. | |
</para> | |
<para> | |
To illustrate how this is supposed to work, look at a firewall extension | |
defined in <filename>etc/server.xml</filename>: | |
</para> | |
<screen><dbus-service interface="org.opensuse.Network.Firewall"> | |
<action name="firewallUp" command="/etc/wicked/extensions/firewall up"/> | |
<action name="firewallDown" command="/etc/wicked/extensions/firewall down"/> | |
<!-- default environment for all calls to this extension script --> | |
<putenv name="WICKED_OBJECT_PATH" value="$object-path"/> | |
<putenv name="WICKED_INTERFACE_NAME" value="$property:name"/> | |
<putenv name="WICKED_INTERFACE_INDEX" value="$property:index"/> | |
</dbus-service></screen> | |
<para> | |
The extension is attached to the | |
<tag class="starttag">dbus-service</tag> | |
tag and defines commands to execute for the actions of this interface. | |
Further, the declaration can define and initialize environment variables | |
passed to the actions. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-configuration-files"> | |
<title>Wicked extensions: configuration files</title> | |
<para> | |
You can extend the handling of configuration files with scripts as well. | |
For example, DNS updates from leases are ultimately handled by the | |
<filename>extensions/resolver</filename> script, with behavior configured | |
in <filename>server.xml</filename>: | |
</para> | |
<screen><system-updater name="resolver"> | |
<action name="backup" command="/etc/wicked/extensions/resolver backup"/> | |
<action name="restore" command="/etc/wicked/extensions/resolver restore"/> | |
<action name="install" command="/etc/wicked/extensions/resolver install"/> | |
<action name="remove" command="/etc/wicked/extensions/resolver remove"/> | |
</system-updater></screen> | |
<para> | |
When an update arrives in <systemitem>wickedd</systemitem>, the system | |
updater routines parse the lease and call the appropriate commands | |
(<literal>backup</literal>, <literal>install</literal>, etc.) in the | |
resolver script. This in turn configures the DNS settings using | |
<command>/sbin/netconfig</command>, or by manually writing | |
<filename>/run/netconfig/resolv.conf</filename> as a fallback. | |
</para> | |
</sect3> | |
</sect2> | |
<sect2 version="5.0" xml:id="sec-network-manconf-files"> | |
<title>Configuration files</title> | |
<info> | |
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager"> | |
<dm:bugtracker/> | |
<dm:translation>yes</dm:translation> | |
</dm:docmanager> | |
</info> | |
<para> | |
This section provides an overview of the network configuration files and | |
explains their purpose and the format used. | |
</para> | |
<sect3 xml:id="wicked-configuration-common-xml"> | |
<title><filename>/etc/wicked/common.xml</filename></title> | |
<para> | |
The <filename>/etc/wicked/common.xml</filename> file contains common | |
definitions that should be used by all applications. It is sourced/included | |
by the other configuration files in this directory. Although you can use | |
this file to enable debugging across all | |
<literal>wicked</literal> components, we recommend to use the file | |
<filename>/etc/wicked/local.xml</filename> for this purpose. After applying | |
maintenance updates you might lose your changes as the | |
<filename>/etc/wicked/common.xml</filename> might be overwritten. The | |
<filename>/etc/wicked/common.xml</filename> file includes the | |
<filename>/etc/wicked/local.xml</filename> in the default installation, thus | |
you typically do not need to modify the | |
<filename>/etc/wicked/common.xml</filename>. | |
</para> | |
<para> | |
In case you want to disable <literal>nanny</literal> by setting the | |
<literal><use-nanny></literal> to <literal>false</literal>, restart | |
the <literal>wickedd.service</literal> and then run the following command to | |
apply all configurations and policies: | |
</para> | |
<screen><prompt>> </prompt><command>sudo</command> wicked ifup all</screen> | |
<note> | |
<title>Configuration files</title> | |
<para> | |
The <literal>wickedd</literal>, <literal>wicked</literal>, or | |
<literal>nanny</literal> programs try to read | |
<filename>/etc/wicked/common.xml</filename> if their own configuration | |
files do not exist. | |
</para> | |
</note> | |
</sect3> | |
<sect3 xml:id="wicked-configuration-server-xml"> | |
<title><filename>/etc/wicked/server.xml</filename></title> | |
<para> | |
The file <filename>/etc/wicked/server.xml</filename> is read by the | |
<literal>wickedd</literal> server process at start-up. The file stores | |
extensions to the <filename>/etc/wicked/common.xml</filename>. On top of | |
that this file configures handling of a resolver and receiving information | |
from <literal>addrconf</literal> supplicants, for example DHCP. | |
</para> | |
<para> | |
We recommend to add changes required to this file into a separate file | |
<filename>/etc/wicked/server-local.xml</filename>, that gets included by | |
<filename>/etc/wicked/server.xml</filename>. By using a separate file | |
you avoid overwriting of your changes during maintenance updates. | |
</para> | |
</sect3> | |
<sect3 xml:id="wicked-configuration-client-xml"> | |
<title><filename>/etc/wicked/client.xml</filename></title> | |
<para> | |
The <filename>/etc/wicked/client.xml</filename> is used by the | |
<command>wicked</command> command. The file specifies the location of a | |
script used when discovering devices managed by ibft and configures | |
locations of network interface configurations. | |
</para> | |
<para> | |
We recommend to add changes required to this file into a separate file | |
<filename>/etc/wicked/client-local.xml</filename>, that gets included by | |
<filename>/etc/wicked/server.xml</filename>. By using a separate file | |
you avoid overwriting of your changes during maintenance updates. | |
</para> | |
</sect3> | |
<sect3 xml:id="wicked-configuration-nanny-xml"> | |
<title><filename>/etc/wicked/nanny.xml</filename></title> | |
<para> | |
The <filename>/etc/wicked/nanny.xml</filename> configures types of link | |
layers. We recommend to add specific configuration into a separate file: | |
<filename>/etc/wicked/nanny-local.xml</filename> to avoid losing the changes | |
during maintenance updates. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-files-ifcfg"> | |
<title><filename>/etc/sysconfig/network/ifcfg-*</filename></title> | |
<para> | |
These files contain the traditional configurations for network interfaces. | |
</para> | |
<note> | |
<title><command>wicked</command> and the <filename>ifcfg-*</filename> files</title> | |
<para> | |
<command>wicked</command> reads these files if you specify the | |
<literal>compat:</literal> prefix. According to the <phrase role="productname"><phrase os="sles">SUSE Linux Enterprise Server</phrase></phrase> default | |
configuration in <filename>/etc/wicked/client.xml</filename>, | |
<command>wicked</command> tries these files before the XML configuration | |
files in <filename>/etc/wicked/ifconfig</filename>. | |
</para> | |
<para> | |
The <option>--ifconfig</option> switch is provided mostly for testing only. | |
If specified, default configuration sources defined in | |
<filename>/etc/wicked/ifconfig</filename> are not applied. | |
</para> | |
</note> | |
<para> | |
The <filename>ifcfg-*</filename> files include information such as the start | |
mode and the IP address. Possible parameters are described in the manual | |
page of <systemitem>ifup</systemitem>. Additionally, most variables from the | |
<filename>dhcp</filename> and <filename>wireless</filename> files can be | |
used in the <filename>ifcfg-*</filename> files if a general setting should | |
be used for only one interface. However, most of the | |
<filename>/etc/sysconfig/network/config</filename> variables are global and | |
cannot be overridden in <literal>ifcfg</literal> files. For example, | |
<systemitem>NETCONFIG_*</systemitem> variables are global. | |
</para> | |
<para> | |
For configuring <systemitem>macvlan</systemitem> and | |
<systemitem>macvtab</systemitem> interfaces, see the | |
<systemitem>ifcfg-macvlan</systemitem> and | |
<systemitem>ifcfg-macvtap</systemitem> man pages. For example, for a macvlan | |
interface provide a <filename>ifcfg-macvlan0</filename> with settings as | |
follows: | |
</para> | |
<screen>STARTMODE='auto' | |
MACVLAN_DEVICE='eth0' | |
#MACVLAN_MODE='vepa' | |
#LLADDR=02:03:04:05:06:aa</screen> | |
<para> | |
For <filename>ifcfg.template</filename>, see | |
<xref linkend="sec-network-manconf-files-config-etc" role="internalbook"/>. | |
</para> | |
<para arch="zseries" os="sles"> | |
IBM Z does not support USB. The names of the interface files and | |
network aliases contain IBM Z-specific elements like | |
<literal>qeth</literal>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-files-config-etc"> | |
<title><filename>/etc/sysconfig/network/config</filename>, <filename>/etc/sysconfig/network/dhcp</filename>, and <filename>/etc/sysconfig/network/wireless</filename></title> | |
<para> | |
The file <filename>config</filename> contains general settings for the | |
behavior of <command>ifup</command>, <command>ifdown</command> and | |
<command>ifstatus</command>. <filename>dhcp</filename> contains settings for | |
DHCP and <filename>wireless</filename> for wireless LAN cards. The variables | |
in all three configuration files are commented. Some variables from | |
<filename>/etc/sysconfig/network/config</filename> can also be used in | |
<filename>ifcfg-*</filename> files, where they are given a higher priority. | |
The <filename>/etc/sysconfig/network/ifcfg.template</filename> file lists | |
variables that can be specified in a per interface scope. However, most of | |
the <filename>/etc/sysconfig/network/config</filename> variables are global | |
and cannot be overridden in ifcfg-files. For example, | |
<systemitem>NETWORKMANAGER</systemitem> or | |
<systemitem>NETCONFIG_*</systemitem> variables are global. | |
</para> | |
<note> | |
<title>Using DHCPv6</title> | |
<para> | |
<phrase os="sles;sled">In SUSE Linux Enterprise 11, DHCPv6 used to work even on networks | |
where IPv6 Router Advertisements (RAs) were not configured | |
properly. Starting with SUSE Linux Enterprise 12,</phrase> DHCPv6 requires that at least | |
one of the routers on the network sends out RAs that indicate that this | |
network is managed by DHCPv6. | |
</para> | |
<para> | |
For networks where the router cannot be configured correctly, the <literal>ifcfg</literal> option allows the user to override this | |
behavior by specifying <literal>DHCLIENT6_MODE='managed'</literal> in the | |
<literal>ifcfg</literal> file. | |
You can also activate this workaround with a boot parameter in the | |
installation system: | |
</para> | |
<screen>ifcfg=eth0=dhcp6,DHCLIENT6_MODE=managed</screen> | |
</note> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-files-routes"> | |
<title><filename>/etc/sysconfig/network/routes</filename> and <filename>/etc/sysconfig/network/ifroute-*</filename></title> | |
<para> | |
The static routing of TCP/IP packets is determined by the | |
<filename>/etc/sysconfig/network/routes</filename> and | |
<filename>/etc/sysconfig/network/ifroute-*</filename> files. All the static | |
routes required by the various system tasks can be specified in | |
<filename>/etc/sysconfig/network/routes</filename>: routes to a host, routes | |
to a host via a gateway and routes to a network. For each interface that | |
needs individual routing, define an additional configuration file: | |
<filename>/etc/sysconfig/network/ifroute-*</filename>. Replace the wild card | |
(<literal>*</literal>) with the name of the interface. The entries in the | |
routing configuration files look like this: | |
</para> | |
<screen># Destination Gateway Netmask Interface Options</screen> | |
<para> | |
The route's destination is in the first column. This column may contain the | |
IP address of a network or host or, in the case of | |
<emphasis>reachable</emphasis> name servers, the fully qualified network or | |
host name. The network should be written in CIDR notation (address with the | |
associated routing prefix-length) such as 10.10.0.0/16 for IPv4 or fc00::/7 | |
for IPv6 routes. The keyword <literal>default</literal> indicates that the | |
route is the default gateway in the same address family as the gateway. For | |
devices without a gateway use explicit 0.0.0.0/0 or ::/0 destinations. | |
</para> | |
<para> | |
The second column contains the default gateway or a gateway through which a | |
host or network can be accessed. | |
</para> | |
<para> | |
The third column is deprecated; it used to contain the IPv4 netmask of the | |
destination. For IPv6 routes, the default route, or when using a | |
prefix-length (CIDR notation) in the first column, enter a dash | |
(<literal>-</literal>) here. | |
</para> | |
<para> | |
The fourth column contains the name of the interface. If you leave it empty | |
using a dash (<literal>-</literal>), it can cause unintended behavior in | |
<filename>/etc/sysconfig/network/routes</filename>. For more information, | |
see the <systemitem>routes</systemitem> man page. | |
</para> | |
<para> | |
An (optional) fifth column can be used to specify special options. For | |
details, see the <systemitem>routes</systemitem> man page. | |
</para> | |
<example> | |
<title>Common network interfaces and some static routes</title> | |
<screen># --- IPv4 routes in CIDR prefix notation: | |
# Destination [Gateway] - Interface | |
127.0.0.0/8 - - lo | |
204.127.235.0/24 - - eth0 | |
default 204.127.235.41 - eth0 | |
207.68.156.51/32 207.68.145.45 - eth1 | |
192.168.0.0/16 207.68.156.51 - eth1 | |
# --- IPv4 routes in deprecated netmask notation" | |
# Destination [Dummy/Gateway] Netmask Interface | |
# | |
127.0.0.0 0.0.0.0 255.255.255.0 lo | |
204.127.235.0 0.0.0.0 255.255.255.0 eth0 | |
default 204.127.235.41 0.0.0.0 eth0 | |
207.68.156.51 207.68.145.45 255.255.255.255 eth1 | |
192.168.0.0 207.68.156.51 255.255.0.0 eth1 | |
# --- IPv6 routes are always using CIDR notation: | |
# Destination [Gateway] - Interface | |
2001:DB8:100::/64 - - eth0 | |
2001:DB8:100::/32 fe80::216:3eff:fe6d:c042 - eth0</screen> | |
</example> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-files-resolv"> | |
<title><filename>/var/run/netconfig/resolv.conf</filename></title> | |
<para> | |
The domain to which the host belongs is specified in | |
<filename>/var/run/netconfig/resolv.conf</filename> (keyword | |
<systemitem>search</systemitem>). Up to six domains with a total of 256 | |
characters can be specified with the <systemitem>search</systemitem> option. | |
When resolving a name that is not fully qualified, an attempt is made to | |
generate one by attaching the individual <systemitem>search</systemitem> | |
entries. Up to three name servers can be specified with the | |
<systemitem>nameserver</systemitem> option, each on a line of its own. | |
Comments are preceded by hash mark or semicolon signs (<literal>#</literal> | |
or <literal>;</literal>). As an example, see | |
<xref linkend="dat-net-etc-resolv-conf" role="internalbook"/>. | |
</para> | |
<para> | |
However, <filename>/etc/resolv.conf</filename> should not be edited by | |
hand. It is generated by the <command>netconfig</command> script and is a | |
symbolic link to <filename>/run/netconfig/resolv.conf</filename>. | |
To define static DNS configuration without using YaST, edit the | |
appropriate variables manually in the | |
<filename>/etc/sysconfig/network/config</filename> file: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><systemitem>NETCONFIG_DNS_STATIC_SEARCHLIST</systemitem> | |
</term> | |
<listitem> | |
<para> | |
list of DNS domain names used for host name lookup | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>NETCONFIG_DNS_STATIC_SERVERS</systemitem> | |
</term> | |
<listitem> | |
<para> | |
list of name server IP addresses to use for host name lookup | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>NETCONFIG_DNS_FORWARDER</systemitem> | |
</term> | |
<listitem> | |
<para> | |
the name of the DNS forwarder that needs to be configured, for example | |
<literal>bind</literal> or <literal>resolver</literal> | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>NETCONFIG_DNS_RESOLVER_OPTIONS</systemitem> | |
</term> | |
<listitem> | |
<para> | |
arbitrary options that will be written to | |
<filename>/var/run/netconfig/resolv.conf</filename>, for example: | |
</para> | |
<screen>debug attempts:1 timeout:10</screen> | |
<para> | |
For more information, see the <literal>resolv.conf</literal> man page. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><systemitem>NETCONFIG_DNS_RESOLVER_SORTLIST</systemitem> | |
</term> | |
<listitem> | |
<para> | |
list of up to 10 items, for example: | |
</para> | |
<screen>130.155.160.0/255.255.240.0 130.155.0.0</screen> | |
<para> | |
For more information, see the <systemitem>resolv.conf</systemitem> man | |
page. | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
To disable DNS configuration using netconfig, set | |
<literal>NETCONFIG_DNS_POLICY=''</literal>. For more information about | |
<command>netconfig</command>, see the <systemitem>netconfig(8)</systemitem> | |
man page (<command>man 8 netconfig</command>). | |
</para> | |
<example xml:id="dat-net-etc-resolv-conf"> | |
<title><filename>/var/run/netconfig/resolv.conf</filename></title> | |
<screen># Our domain | |
search example.com | |
# | |
# We use dns.example.com (192.168.1.116) as nameserver | |
nameserver 192.168.1.116</screen> | |
</example> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-netconfig"> | |
<title><filename>/sbin/netconfig</filename></title> | |
<para> | |
<command>netconfig</command> is a modular tool to manage additional network | |
configuration settings. It merges statically defined settings with settings | |
provided by autoconfiguration mechanisms as DHCP or PPP according to a | |
predefined policy. The required changes are applied to the system by calling | |
the netconfig modules that are responsible for modifying a configuration | |
file and restarting a service or a similar action. | |
</para> | |
<para> | |
<command>netconfig</command> recognizes three main actions. The | |
<command>netconfig modify</command> and <command>netconfig remove</command> | |
commands are used by daemons such as DHCP or PPP to provide or remove | |
settings to netconfig. Only the <command>netconfig update</command> command | |
is available for the user: | |
</para> | |
<variablelist> | |
<varlistentry> | |
<term><command>modify</command> | |
</term> | |
<listitem> | |
<para> | |
The <command>netconfig modify</command> command modifies the current | |
interface and service specific dynamic settings and updates the network | |
configuration. Netconfig reads settings from standard input or from a | |
file specified with the <option>--lease-file | |
<replaceable>FILENAME</replaceable></option> option and internally stores | |
them until a system reboot (or the next modify or remove action). Already | |
existing settings for the same interface and service combination are | |
overwritten. The interface is specified by the <option>-i | |
<replaceable>INTERFACE_NAME</replaceable></option> parameter. The service | |
is specified by the <option>-s | |
<replaceable>SERVICE_NAME</replaceable></option> parameter. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>remove</command> | |
</term> | |
<listitem> | |
<para> | |
The <command>netconfig remove</command> command removes the dynamic | |
settings provided by an editing action for the specified interface | |
and service combination and updates the network configuration. The | |
interface is specified by the <option>-i | |
<replaceable>INTERFACE_NAME</replaceable></option> parameter. The service | |
is specified by the <option>-s | |
<replaceable>SERVICE_NAME</replaceable></option> parameter. | |
</para> | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
<term><command>update</command> | |
</term> | |
<listitem> | |
<para> | |
The <command>netconfig update</command> command updates the network | |
configuration using current settings. This is useful when the policy or | |
the static configuration has changed. Use the <option>-m | |
<replaceable>MODULE_TYPE</replaceable></option> parameter to | |
update a specified service only (<systemitem>dns</systemitem>, | |
<systemitem>nis</systemitem>, or <systemitem>ntp</systemitem>). | |
</para> | |
</listitem> | |
</varlistentry> | |
</variablelist> | |
<para> | |
The netconfig policy and the static configuration settings are defined | |
either manually or using YaST in the | |
<filename>/etc/sysconfig/network/config</filename> file. The dynamic | |
configuration settings provided by autoconfiguration tools such as DHCP or | |
PPP are delivered directly by these tools with the <command>netconfig | |
modify</command> and <command>netconfig remove</command> actions. | |
When NetworkManager is enabled, netconfig (in policy mode <literal>auto</literal>) | |
uses only NetworkManager settings, ignoring settings from any other interfaces | |
configured using the traditional ifup method. If NetworkManager does not provide any | |
setting, static settings are used as a fallback. A mixed usage of NetworkManager and | |
the <command>wicked</command> method is not supported. | |
</para> | |
<para> | |
For more information about <command>netconfig</command>, see <command>man 8 | |
netconfig</command>. | |
</para> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-hosts"> | |
<title><filename>/etc/hosts</filename></title> | |
<para> | |
In this file, shown in <xref linkend="dat-net-etc-hosts" role="internalbook"/>, IP addresses | |
are assigned to host names. If no name server is implemented, all hosts to | |
which an IP connection will be set up must be listed here. For each host, | |
enter a line consisting of the IP address, the fully qualified host name, | |
and the host name into the file. The IP address must be at the beginning of | |
the line and the entries separated by blanks and tabs. Comments are always | |
preceded by the <literal>#</literal> sign. | |
</para> | |
<example xml:id="dat-net-etc-hosts"> | |
<title><filename>/etc/hosts</filename></title> | |
<screen>127.0.0.1 localhost | |
192.168.2.100 jupiter.example.com jupiter | |
192.168.2.101 venus.example.com venus</screen> | |
</example> | |
</sect3> | |
<sect3 xml:id="sec-network-manconf-files-networks"> | |
<title><filename>/etc/networks</filename></title> | |
<para> | |
Here, network names are converted to network addresses. The format is | |
similar to that of the <filename>hosts</filename> file, except the network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment