This guide covers system administration tasks like maintaining, monitoring and customizing an initially installed system.
- Preface
- I Common tasks
- 1 Bash and Bash scripts
- 2
sudo
basics - 3 Using YaST
- 4 YaST in text mode
- 5 Changing language and country settings with YaST
- 6 Managing users with YaST
- 7 YaST online update
- 8 Installing or removing software
- 9 Managing software with command line tools
- 10 System recovery and snapshot management with Snapper
- 10.1 Default setup
- 10.2 Using Snapper to undo changes
- 10.3 System rollback by booting from snapshots
- 10.4 Enabling Snapper in user home directories
- 10.5 Creating and modifying Snapper configurations
- 10.6 Manually creating and managing snapshots
- 10.7 Automatic snapshot clean-up
- 10.8 Showing exclusive disk space used by snapshots
- 10.9 Frequently asked questions
- 11 Live kernel patching with KLP
- 12 User space live patching
- 13 Transactional updates
- 14 Remote graphical sessions with VNC
- 15 File copying with RSync
- II Booting a Linux system
- III System
- 20 32-bit and 64-bit applications in a 64-bit system environment
- 21
journalctl
: query thesystemd
journal - 22
update-alternatives
: managing multiple versions of commands and files - 23 Basic networking
- 24 Printer operation
- 25 Graphical user interface
- 26 Accessing file systems with FUSE
- 27 Installing multiple kernel versions
- 28 Managing kernel modules
- 29 Dynamic kernel device management with
udev
- 29.1 The
/dev
directory - 29.2 Kernel
uevents
andudev
- 29.3 Drivers, kernel modules and devices
- 29.4 Booting and initial device setup
- 29.5 Monitoring the running
udev
daemon - 29.6 Influencing kernel device event handling with
udev
rules - 29.7 Persistent device naming
- 29.8 Files used by
udev
- 29.9 More information
- 29.1 The
- 30 Special system features
- 31 Using NetworkManager
- IV Hardware configuration
- V Services
- VI Troubleshooting
- A An example network
- B GNU licenses
- 4.1 Main window of YaST in text mode
- 4.2 The software installation module
- 6.1 YaST user and group administration
- 7.1 YaST online update
- 7.2 Viewing retracted patches and history
- 7.3 YaST online update configuration
- 8.1 Conflict management of the software manager
- 8.2 Adding a software repository
- 8.3 Update notification on GNOME desktop
- 8.4 — view
- 10.1 Boot loader: snapshots
- 14.1 vncviewer
- 14.2 Remmina's main window
- 14.3 Remote desktop preference
- 14.4 Quick-starting
- 14.5 Remmina viewing remote session
- 14.6 Reading path to the profile file
- 14.7 Remote administration
- 14.8 VNC session settings
- 14.9 Joining a persistent VNC session
- 17.1 Secure boot support
- 17.2 UEFI: secure boot process
- 18.1 GRUB 2 boot editor
- 18.2 Boot code options
- 18.3 Boot loader options
- 18.4 Kernel parameters
- 19.1 Services Manager
- 21.1 YaST systemd journal
- 23.1 Simplified layer model for TCP/IP
- 23.2 TCP/IP Ethernet packet
- 23.3 Configuring network settings
- 23.4
wicked
architecture - 25.1 Warning about a missing GNOME Shell extension
- 25.2 GNOME gTile extension activated
- 25.3 gTile tray icon
- 27.1 The YaST software manager: multiversion view
- 31.1 GNOME Network Connections dialog
- 31.2
firewalld
zones in NetworkManager - 38.1 YaST service manager
- 39.1 NTP configuration window
- 39.2 Adding a time server
- 41.1 HTML report generated by SCA tool
- 41.2 HTML report generated by SCA appliance
- 1.1 Bash configuration files for login shells
- 1.2 Bash configuration files for non-login shells
- 1.3 Special files for Bash
- 1.4 Overview of a standard directory tree
- 1.5 Useful environment variables
- 9.1 Essential RPM query options
- 9.2 RPM verify options
- 19.1 Service management commands
- 19.2 Commands for enabling and disabling services
- 19.3 System V runlevels and
systemd
target units - 23.1 Private IP address domains
- 23.2 Parameters for /etc/host.conf
- 23.3 Databases available via /etc/nsswitch.conf
- 23.4 Configuration options for NSS “databases”
- 23.5 Feature comparison between bonding and team
- 25.1 Generating PFL from fontconfig rules
- 25.2 Results from generating PFL from fontconfig rules with changed order
- 25.3 Results from generating PFL from fontconfig rules
- 30.1
ulimit
: Setting resources for the user - 40.1 Man pages—categories and descriptions
- 41.1 Comparison of features and file names in the TAR archive
- 42.1 Log files
- 42.2 System information with the
/proc
file system - 42.3 System information with the
/sys
file system
- 1.1 A shell script printing a text
- 2.1 Create a user-specific configuration file
- 2.2 Create custom configurations by grouping items
- 2.3 Simplify configurations by applying aliases
- 9.1 Zypper—list of known repositories
- 9.2
rpm -q -i wget
- 9.3 Script to search for packages
- 10.1 Example timeline configuration
- 18.1 Usage of grub2-mkconfig
- 18.2 Usage of grub2-mkrescue
- 18.3 Usage of grub2-script-check
- 18.4 Usage of grub2-once
- 19.1 List active services
- 19.2 List failed services
- 19.3 List all processes belonging to a service
- 22.1 Alternatives System of the
java
command - 23.1 Writing IP addresses
- 23.2 Linking IP addresses to the netmask
- 23.3 Sample IPv6 address
- 23.4 IPv6 address specifying the prefix length
- 23.5 Common network interfaces and some static routes
- 23.6
/var/run/netconfig/resolv.conf
- 23.7
/etc/hosts
- 23.8
/etc/networks
- 23.9
/etc/host.conf
- 23.10
/etc/nsswitch.conf
- 23.11 Output of the command ping
- 23.12 Configuration for load balancing with Network Teaming
- 23.13 Configuration for DHCP Network Teaming device
- 24.1 Error message from
lpd
- 24.2 Broadcast from the CUPS network server
- 25.1 Specifying rendering algorithms
- 25.2 Aliases and family name substitutions
- 25.3 Aliases and family name substitutions
- 25.4 Aliases and family names substitutions
- 29.1 Example
udev
rules - 30.1 Entry in /etc/crontab
- 30.2 /etc/crontab: remove time stamp files
- 30.3
ulimit
: Settings in~/.bashrc
- 41.1 Output of
hostinfo
when logging in asroot
Copyright © 2006–2024 SUSE LLC and contributors. All rights reserved.
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 “GNU Free Documentation License”.
For SUSE trademarks, see https://www.suse.com/company/legal/. All 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.
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.
Preface #
1 Available documentation #
- Online documentation
Our documentation is available online at https://documentation.suse.com. Browse or download the documentation in various formats.
Note: Latest updatesThe latest updates are usually available in the English-language version of this documentation.
- SUSE Knowledgebase
If you run into an issue, check out the Technical Information Documents (TIDs) that are available online at https://www.suse.com/support/kb/. Search the SUSE Knowledgebase for known solutions driven by customer need.
- Release notes
For release notes, see https://www.suse.com/releasenotes/.
- In your system
For offline use, the release notes are also available under
/usr/share/doc/release-notes
on your system. The documentation for individual packages is available at/usr/share/doc/packages
.Many commands are also described in their manual pages. To view them, run
man
, followed by a specific command name. If theman
command is not installed on your system, install it withsudo zypper install man
.
2 Improving the documentation #
Your feedback and contributions to this documentation are welcome. The following channels for giving feedback are available:
- Service requests and support
For services and support options available for your product, see https://www.suse.com/support/.
To open a service request, you need a SUSE subscription registered at SUSE Customer Center. Go to https://scc.suse.com/support/requests, log in, and click .
- Bug reports
Report issues with the documentation at https://bugzilla.suse.com/.
To simplify this process, click the
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.A Bugzilla account is required.
- Contributions
To contribute to this documentation, click the
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.A GitHub account is required.
Note:only available for EnglishThe
icons are only available for the English version of each document. For all other languages, use the icons instead.For more information about the documentation environment used for this documentation, see the repository's README.
You can also report errors and send feedback concerning the documentation to <doc-team@suse.com>. 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.
3 Documentation conventions #
The following notices and typographic conventions are used in this document:
/etc/passwd
: Directory names and file namesPLACEHOLDER: Replace PLACEHOLDER with the actual value
PATH
: An environment variablels
,--help
: Commands, options, and parametersuser
: The name of a user or grouppackage_name: The name of a software package
Alt, Alt–F1: A key to press or a key combination. Keys are shown in uppercase as on a keyboard.
Chapter 1, “Example chapter”: A cross-reference to another chapter in this guide.
Commands that must be run with
root
privileges. You can also prefix these commands with thesudo
command to run them as a non-privileged user:#
command
>
sudo
command
Commands that can be run by non-privileged users:
>
command
Commands can be split into two or multiple lines by a backslash character (
\
) at the end of a line. The backslash informs the shell that the command invocation will continue after the end of the line:>
echo
a b \ c dA code block that shows both the command (preceded by a prompt) and the respective output returned by the shell:
>
command
outputNotices
Warning: Warning noticeVital information you must be aware of before proceeding. Warns you about security issues, potential loss of data, damage to hardware, or physical hazards.
Important: Important noticeImportant information you should be aware of before proceeding.
Note: Note noticeAdditional information, for example about differences in software versions.
Tip: Tip noticeHelpful information, like a guideline or a piece of practical advice.
Compact Notices
Additional information, for example about differences in software versions.
Helpful information, like a guideline or a piece of practical advice.
4 Support #
Find the support statement for SUSE Linux Enterprise Desktop and general information about technology previews below. For details about the product lifecycle, see https://www.suse.com/lifecycle.
If you are entitled to support, find details on how to collect information for a support ticket at https://documentation.suse.com/sles-15/html/SLES-all/cha-adm-support.html.
4.1 Support statement for SUSE Linux Enterprise Desktop #
To receive support, you need an appropriate subscription with SUSE. To view the specific support offers available to you, go to https://www.suse.com/support/ and select your product.
The support levels are defined as follows:
- L1
Problem determination, which means technical support designed to provide compatibility information, usage support, ongoing maintenance, information gathering and basic troubleshooting using available documentation.
- L2
Problem isolation, which means technical support designed to analyze data, reproduce customer problems, isolate a problem area and provide a resolution for problems not resolved by Level 1 or prepare for Level 3.
- L3
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.
For contracted customers and partners, SUSE Linux Enterprise Desktop is delivered with L3 support for all packages, except for the following:
Technology previews.
Sound, graphics, fonts, and artwork.
Packages that require an additional customer contract.
Packages with names ending in -devel (containing header files and similar developer resources) will only be supported together with their main packages.
SUSE will only support the usage of original packages. That is, packages that are unchanged and not recompiled.
4.2 Technology previews #
Technology previews are packages, stacks, or features delivered by SUSE to provide glimpses into upcoming innovations. Technology previews are included for your convenience to give you a chance to test new technologies within your environment. We would appreciate your feedback. If you test a technology preview, please contact your SUSE representative and let them know about your experience and use cases. Your input is helpful for future development.
Technology previews have the following limitations:
Technology previews are still in development. Therefore, they may be functionally incomplete, unstable, or otherwise not suitable for production use.
Technology previews are not supported.
Technology previews may only be available for specific hardware architectures.
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.
SUSE may discover that a preview does not meet customer or market needs, or does not comply with enterprise standards. Technology previews can be removed from a product at any time. SUSE does not commit to providing a supported version of such technologies in the future.
For an overview of technology previews shipped with your product, see the release notes at https://www.suse.com/releasenotes.
Part I Common tasks #
- 1 Bash and Bash scripts
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 several aspects of shells, in this case the Bash shell.
- 2
sudo
basics Running certain commands requires root privileges. However, for security reasons and to avoid mistakes, it is not recommended to log in as
root
. A safer approach is to log in as a regular user, and then usesudo
to run commands with elevated privileges.- 3 Using YaST
YaST is a SUSE Linux Enterprise Desktop 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.…
- 4 YaST in text mode
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 sho…
- 5 Changing language and country settings with YaST
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.
- 6 Managing users with YaST
During installation, you may have created a local user for your system. With the YaST module
you can add users or edit existing ones. It also lets you configure your system to authenticate users with a network server.- 7 YaST online update
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 Section 8.5, “The GNOME package updater” for further information on the update applet. This chapter covers the alternative tool for updating s…
- 8 Installing or removing software
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.
- 9 Managing software with command line tools
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,
repository
,patch
, orupdate
) refer to Section 8.1, “Definition of terms”.- 10 System recovery and snapshot management with Snapper
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.
- 11 Live kernel patching with KLP
This document describes the basic principles of the Kernel Live Patching (KLP) technology, and provides usage guidelines for the SLE Live Patching service.
- 12 User space live patching
This chapter describes the basic principles and usage of user space live patching.
- 13 Transactional updates
Transactional updates are available in SUSE Linux Enterprise Desktop 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 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 administrator must decide if a reboot is more expensive than disturbing running services. If reboots are too expensive then do not use transactional updates.
Transactional updates are run daily by the
transactional-update
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 updated, it is marked as active and will be the new default root file system after the next reboot of the system. Whentransactional-update
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.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.
RPMs that require a license to be accepted cannot be updated.
- 14 Remote graphical sessions with VNC
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.
SUSE Linux Enterprise Desktop supports two different kinds of VNC sessions: one-time sessions that “live” While the VNC connection from the client is kept up, and persistent sessions that “live” until they are explicitly terminated.
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.
- 15 File copying with RSync
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.
1 Bash and Bash scripts #
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 several aspects of shells, in this case the Bash shell.
1.1 What is “the shell”? #
Traditionally, the Linux shell is Bash (Bourne again Shell). When this chapter speaks about “the shell” it means Bash. There are more shells available (ash, csh, ksh, zsh, …), each employing different features and characteristics.
1.1.1 Bash configuration files #
A shell can be invoked as an:
Interactive login shell. This is used when logging in to a machine, invoking Bash with the
--login
option or when logging in to a remote machine with SSH.Interactive non-login shell. This is normally the case when starting xterm, konsole, gnome-terminal, or similar command line interface (CLI) tools.
Non-interactive non-login shell. This is invoked when invoking a shell script at the command line.
Each shell reads different configuration files. The following tables show the login and non-login shell configuration files.
Bash looks for its configuration files in a specific order depending on
the type of shell where it is run. Find more details on the Bash man
page (man 1 bash
). Search for the headline
INVOCATION
.
File |
Description |
---|---|
|
Do not modify this file, otherwise your modifications may be destroyed during your next update. |
|
Use this file if you extend |
|
Contains system-wide configuration files for specific programs |
|
Insert user specific configuration for login shells here |
The login shell also sources the configuration files listed under Table 1.2, “Bash configuration files for non-login shells”.
|
Do not modify this file, otherwise your modifications may be destroyed during your next update. |
|
Use this file to insert your system-wide modifications for Bash only |
|
Insert user specific configuration here |
Additionally, Bash uses multiple files:
File |
Description |
---|---|
|
Contains a list of all commands you have typed |
|
Executed when logging out |
|
User defined aliases of frequently used commands. See
|
No-Login Shells#
There are special shells that block users from logging into
the system: /bin/false
and
/sbin/nologin
. 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.
The default on SUSE Linux Enterprise Desktop is to assign /bin/bash
to human users, and /bin/false
or
/sbin/nologin
to system users.
The nobody
user has /bin/bash
for historical reasons, as it is
a user with minimum privileges that used to be the default for system users.
However, whatever little bit of security gained by using
nobody
is lost when
multiple system users use it. It should be possible to change it to
/sbin/nologin
; the fastest way to test it is change
it and see if it breaks any services or applications.
Use the following command to list which shells are assigned to all users,
system and human users, in /etc/passwd
. The output
varies according to the services and users on your system:
>
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
1.1.2 The directory structure #
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.
Directory |
Contents |
---|---|
|
Root directory—the starting point of the directory tree. |
|
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. |
|
Static files of the boot loader. |
|
Files needed to access host-specific devices. |
|
Host-specific system configuration files. |
|
Holds the home directories of all users who have accounts on the system.
However, |
|
Essential shared libraries and kernel modules. |
|
Mount points for removable media. |
|
Mount point for temporarily mounting a file system. |
|
Add-on application software packages. |
|
Home directory for the superuser |
|
Essential system binaries. |
|
Data for services provided by the system. |
|
Temporary files. |
|
Secondary hierarchy with read-only data. |
|
Variable data such as log files. |
|
Only available if you have both Microsoft Windows* and Linux installed on your system. Contains the Windows data. |
The following list provides more detailed information and gives some examples of which files and subdirectories can be found in the directories:
/bin
Contains the basic shell commands that may be used both by
root
and by other users. These commands includels
,mkdir
,cp
,mv
,rm
andrmdir
./bin
also contains Bash, the default shell in SUSE Linux Enterprise Desktop./boot
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.
/dev
Holds device files that represent hardware components.
/etc
Contains local configuration files that control the operation of programs like the X Window System. The
/etc/init.d
subdirectory contains LSB init scripts that can be executed during the boot process./home/USERNAME
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
.gconf/
and.config
.Note: Home directory in a network environmentIf you are working in a network environment, your home directory may be mapped to a directory in the file system other than
/home
./lib
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.
/media
Contains mount points for removable media, such as CD-ROMs, flash disks, and digital cameras (if they use USB).
/media
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./mnt
This directory provides a mount point for a temporarily mounted file system.
root
may mount file systems here./opt
Reserved for the installation of third-party software. Optional software and larger add-on program packages can be found here.
/root
Home directory for the
root
user. The personal data ofroot
is located here./run
A tmpfs directory used by
systemd
and various components./var/run
is a symbolic link to/run
./sbin
As the
s
indicates, this directory holds utilities for the superuser./sbin
contains the binaries essential for booting, restoring and recovering the system in addition to the binaries in/bin
./srv
Holds data for services provided by the system, such as FTP and HTTP.
/tmp
This directory is used by programs that require temporary storage of files.
Important: Cleaning up/tmp
at boot timeData stored in
/tmp
is not guaranteed to survive a system reboot. It depends, for example, on settings made in/etc/tmpfiles.d/tmp.conf
./usr
/usr
has nothing to do with users, but is the acronym for Unix system resources. The data in/usr
is static, read-only data that can be shared among various hosts compliant with theFilesystem Hierarchy Standard
(FHS). This directory contains all application programs including the graphical desktops such as GNOME and establishes a secondary hierarchy in the file system./usr
holds several subdirectories, such as/usr/bin
,/usr/sbin
,/usr/local
, and/usr/share/doc
./usr/bin
Contains generally accessible programs.
/usr/sbin
Contains programs reserved for the system administrator, such as repair functions.
/usr/local
In this directory the system administrator can install local, distribution-independent extensions.
/usr/share/doc
Holds various documentation files and the release notes for your system. In the
manual
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.Under
packages
find the documentation included in the software packages installed on your system. For every package, a subdirectory/usr/share/doc/packages/PACKAGENAME
is created that often holds README files for the package and sometimes examples, configuration files or additional scripts.If HOWTOs are installed on your system
/usr/share/doc
also holds thehowto
subdirectory in which to find additional documentation on many tasks related to the setup and operation of Linux software./var
Whereas
/usr
holds static, read-only data,/var
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/var/log/
, refer to Table 42.1, “Log files”./windows
Only available if you have both Microsoft Windows and Linux installed on your system. Contains the Windows data available on the Windows partition of your system. Whether you can edit the data in this directory depends on the file system your Windows partition uses. If it is FAT32, you can open and edit the files in this directory. For NTFS, SUSE Linux Enterprise Desktop also includes write access support. However, the driver for the NTFS-3g file system has limited functionality.
1.2 Writing shell scripts #
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:
#!/bin/sh 1 # Output the following line: 2 echo "Hello World" 3
The first line begins with the Shebang
characters ( | |
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 can better understand your script. Commenting is considered good practice in the development community. | |
The third line uses the built-in command |
Before you can run this script, there are a few prerequisites:
Every script should contain a Shebang line (as in the example above). If the line is missing, you need to call the interpreter manually.
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
PATH
. A normal user does not have write access to/usr/bin
. Therefore it is recommended to save your scripts in the users' directory~/bin/
. The above example gets the namehello.sh
.The script needs executable permissions. Set the permissions with the following command:
>
chmod +x ~/bin/hello.sh
If you have fulfilled all the above prerequisites, you can execute the script in the following ways:
As absolute path. The script can be executed with an absolute path. In our case, it is
~/bin/hello.sh
.Everywhere. If the
PATH
environment variable contains the directory where the script is located, you can execute the script withhello.sh
.
1.3 Redirecting command events #
Each command can use three channels, either for input or output:
Standard output. This is the default output channel. Whenever a command prints something, it uses the standard output channel.
Standard input. If a command needs input from users or other commands, it uses this channel.
Standard error. Commands use this channel for error reporting.
To redirect these channels, there are the following possibilities:
Command > File
Saves the output of the command into a file, the existing file is deleted. For example, the
ls
command writes its output into the filelisting.txt
:>
ls > listing.txtCommand >> File
Appends the output of the command to a file. For example, the
ls
command appends its output to the filelisting.txt
:>
ls >> listing.txtCommand < File
Reads the file as input for the given command. For example, the
read
command reads in the content of the file into the variable:>
read a < fooCommand1 | Command2
Redirects the output of the left command as input for the right command. For example, the
cat
command outputs the content of the/proc/cpuinfo
file. This output is used bygrep
to filter only those lines which containcpu
:>
cat /proc/cpuinfo | grep cpu
Every channel has a file descriptor: 0 (zero) for
standard input, 1 for standard output and 2 for standard error. It is
allowed to insert this file descriptor before a <
or
>
character. For example, the following line searches
for a file starting with foo
, but suppresses its errors
by redirecting it to /dev/null
:
>
find / -name "foo*" 2>/dev/null
1.4 Using aliases #
An alias is a shortcut definition of one or more commands. The syntax for an alias is:
alias NAME=DEFINITION
For example, the following line defines an alias lt
that
outputs a long listing (option -l
), sorts it by
modification time (-t
), and prints it in reverse sorted order (-r
):
>
alias lt='ls -ltr'
To view all alias definitions, use alias
. Remove your
alias with unalias
and the corresponding alias name.
1.5 Using variables in Bash #
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.
To view all environment variables, use the printenv
command. If you need to know the value of a variable, insert the name of
your variable as an argument:
>
printenv PATH
A variable, be it global or local, can also be viewed with
echo
:
>
echo $PATH
To set a local variable, use a variable name followed by the equal sign, followed by the value:
>
PROJECT="SLED"
Do not insert spaces around the equal sign, otherwise you get an error. To
set an environment variable, use export
:
>
export NAME="tux"
To remove a variable, use unset
:
>
unset NAME
The following table contains common environment variables that you can use in you shell scripts:
|
the home directory of the current user |
|
the current host name |
|
when a tool is localized, it uses the language from this environment
variable. English can also be set to |
|
the search path of the shell, a list of directories separated by colon |
|
specifies the normal prompt printed before each command |
|
specifies the secondary prompt printed when you execute a multi-line command |
|
current working directory |
|
the current user |
1.5.1 Using argument variables #
For example, if you have the script foo.sh
you can
execute it like this:
>
foo.sh "Tux Penguin" 2000
To access all the arguments which are passed to your script, you need
positional parameters. These are $1
for the first argument,
$2
for the second, and so on. You can have up to nine
parameters. To get the script name, use $0
.
The following script foo.sh
prints all arguments from 1
to 4:
#!/bin/sh echo \"$1\" \"$2\" \"$3\" \"$4\"
If you execute this script with the above arguments, you get:
"Tux Penguin" "2000" "" ""
1.5.2 Using variable substitution #
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:
${VAR#pattern}
removes the shortest possible match from the left:
>
file=/home/tux/book/book.tar.bz2>
echo ${file#*/} home/tux/book/book.tar.bz2${VAR##pattern}
removes the longest possible match from the left:
>
file=/home/tux/book/book.tar.bz2>
echo ${file##*/} book.tar.bz2${VAR%pattern}
removes the shortest possible match from the right:
>
file=/home/tux/book/book.tar.bz2>
echo ${file%.*} /home/tux/book/book.tar${VAR%%pattern}
removes the longest possible match from the right:
>
file=/home/tux/book/book.tar.bz2>
echo ${file%%.*} /home/tux/book/book${VAR/pattern_1/pattern_2}
substitutes the content of VAR from the PATTERN_1 with PATTERN_2:
>
file=/home/tux/book/book.tar.bz2>
echo ${file/tux/wilber} /home/wilber/book/book.tar.bz2
1.6 Grouping and combining commands #
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.
The following list shows, how commands can be grouped:
Command1 ; Command2
executes the commands in sequential order. The exit code is not checked. The following line displays the content of the file with
cat
and then prints its file properties withls
regardless of their exit codes:>
cat filelist.txt ; ls -l filelist.txtCommand1 && Command2
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):
>
cat filelist.txt && ls -l filelist.txtCommand1 || Command2
runs the right command, when the left command has failed (logical OR). The following line creates only a directory in
/home/wilber/bar
when the creation of the directory in/home/tux/foo
has failed:>
mkdir /home/tux/foo || mkdir /home/wilber/barfuncname(){ ... }
creates a shell function. You can use the positional parameters to access its arguments. The following line defines the function
hello
to print a short message:>
hello() { echo "Hello $1"; }You can call this function like this:
>
hello Tuxwhich prints:
Hello Tux
1.7 Working with common flow constructs #
To control the flow of your script, a shell has while
,
if
, for
and case
constructs.
1.7.1 The if control command #
The if
command is used to check expressions. For
example, the following code tests whether the current user is Tux:
if test $USER = "tux"; then echo "Hello Tux." else echo "You are not Tux." fi
The test expression can be as complex or simple as possible. The following
expression checks if the file foo.txt
exists:
if test -e /tmp/foo.txt ; then echo "Found foo.txt" fi
The test expression can also be abbreviated in square brackets:
if [ -e /tmp/foo.txt ] ; then echo "Found foo.txt" fi
Find more useful expressions at https://bash.cyberciti.biz/guide/If..else..fi.
1.7.2 Creating loops with the for
command #
The for
loop allows you to execute commands to a list of
entries. For example, the following code prints certain information about PNG
files in the current directory:
for i in *.png; do ls -l $i done
1.8 More information #
Important information about Bash is provided in the man pages man
bash
. More about this topic can be found in the following list:
https://tldp.org/LDP/Bash-Beginners-Guide/html/index.html—Bash Guide for Beginners
https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html—BASH Programming - Introduction HOW-TO
https://tldp.org/LDP/abs/html/index.html—Advanced Bash-Scripting Guide
https://www.grymoire.com/Unix/Sh.html—Sh - the Bourne Shell
2 sudo
basics #
Running certain commands requires root privileges. However, for security
reasons and to avoid mistakes, it is not recommended to log in as
root
. A safer approach is to log in as a regular user, and then use
sudo
to run commands with elevated privileges.
On SUSE Linux Enterprise Desktop, sudo
is configured to work similarly to
su
. However, sudo
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 users
to
run a command with the privileges of user wilber
. Access to the
command can be further restricted by disallowing any command options. While
su always requires the root
password for authentication with PAM,
sudo
can be configured to authenticate with your own credentials. This
means that the users do not need to share the root
password, which
improves security.
2.1 Basic sudo
usage #
The following chapter provides an introduction to basic usage of sudo
.
2.1.1 Running a single command #
As a regular user, you can run any command as root
by adding
sudo
before it. This prompts you to provide the root password. If
authenticated successfully, this runs the command as root
:
>
id -un
1 tux>
sudo
id -un
root's password:2 root>
id -un
tux3>
sudo
id -un
4 root
The | |
The password is not shown during input, neither as clear text nor as masking characters. | |
Only commands that start with | |
The elevated privileges persist for a certain period of time, so
you do not need to provide the |
When using sudo
, I/O redirection does not work:
>
sudo
echo s > /proc/sysrq-trigger bash: /proc/sysrq-trigger: Permission denied>
sudo
cat < /proc/1/maps bash: /proc/1/maps: Permission denied
In the example above, only the echo
and
cat
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 Section 2.1.2, “Starting a shell” or use the
dd
utility:
echo s | sudo dd of=/proc/sysrq-trigger sudo dd if=/proc/1/maps | cat
2.1.2 Starting a shell #
Using sudo
every time to run a command with elevated privileges is
not always practical. While you can use the sudo
bash
command, it is recommended to use one of the built-in
mechanisms to start a shell:
sudo -s (<command>)
Starts a shell specified by the
SHELL
environment variable or the target user's default shell. If a command is specified, it is passed to the shell (with the-c
option). Otherwise the shell runs in interactive mode.tux:~ >
sudo -s root's password:root:/home/tux #
exittux:~ >
sudo -i (<command>)
Similar to
-s
, but starts the shell as a login shell. This means that the shell's start-up files (.profile
etc.) are processed, and the current working directory is set to the target user's home directory.tux:~ >
sudo -i root's password:root:~ #
exittux:~ >
By default, sudo
does not propagate environment variables. This
behavior can be changed using the env_reset
option
(see Useful flags and options).
2.2 Configuring sudo
#
sudo
provides a wide range on configurable options.
If you accidentally locked yourself out of sudo
, use su
-
and the root
password to start a root shell. To fix
the error, run visudo
.
The example rules outlined below are purely for demonstration purposes.
Use them to understand the general syntax of sudo
configuration files.
Do not use them in real-world setups, because they
do not reflect the complexity of these environments.
2.2.1 sudo
configuration best practices #
Before you start, here are a few ground rules for maintaining sudo
configurations:
- Always use
visudo
to editsudo
configuration files Any changes to the
sudo
configuration should be done using thevisudo
command.visudo
is a tailor-made tool that allows you to edit thesudo
configuration files and runs basic syntax checks, making sure that the configuration remains intact and functional. A faultysudo
configuration can result in a user being locked out of their own system.- Always create custom configurations under
/etc/sudoers.d/
Custom configurations must reside under
/etc/sudoers.d/
to be pulled in bysudo
. Settings in the custom configuration files take precedence over the ones in the default configuration in/etc/sudoers
.- Always mind the order in which configurations are read
To make sure the custom configurations are read in the correct order, prefix them with numbers. Use leading zeroes to establish the order in which the files are read. For example,
01_myfirstconfig
is parsed before10_myotherconfig
. If a directive has been set in a file that is read before another file that contains conflicting information, the last-read directive is applied.- Always use descriptive file names
Use file names that hint at what the configuration file does. This helps you keep track of what your
sudo
setup is supposed to do.
2.2.2 Create a user-specific configuration file #
Create a sudo
configuration file that allows a normal user (tux
)
to use the useradd
command with their own password
instead of the root
password.
As system administrator (
root
), create a custom configuration file that holds the new user-specific directives by startingvisudo
. Use both numbering and a descriptive name:#
visudo -f /etc/sudoers.d/02_usermanagement
Create a rule that allows
tux
to execute the/usr/sbin/useradd
binary in the entire environment that thissudo
configuration is applied to:tux1 ALL2 = /usr/sbin/useradd3
Specify the user or group. List users by name or
#UID
, and groups by%GROUPNAME
. Separate multiple items with commas. To negate entries, use!
.Specify one or several (separated by commas) hosts. Use (fully qualified) host names or IP addresses. Add
ALL
to enforce this setting globally across all hosts. Use!
for negations.Specify one or several executables (separated by commas). When specifying them, make sure to mind the following rules:
/usr/sbin/useradd
Without any additional options added, this allows the execution of every possible
useradd
command./usr/sbin/useradd -c
If you explicitly specify an option, then that option is the only one that is allowed. Nothing else would be available to the user you specified above.
/usr/sbin/useradd ""
This would just let the user invoke a mere
useradd
without any option at all.
In the example above, you would want to either allow all options and subcommands or limit them to a few for security reasons, but forbidding a user from specifying any option at all would be pointless in this context.
To let the user use their own password instead of the
root
password, add the following line:Defaults:tux !targetpw
When active, this flag requires the user to enter the password of the target user, that is,
root
. This flag is enabled by default on any SUSE Linux Enterprise Desktop system. Negate it using!
to require the user to just enter their own password instead of theroot
password.Save the configuration, leave the editor and open a second shell to test whether
sudo
honors your new configuration.
2.2.3 Create custom configurations by grouping items #
Modify the configuration from Example 2.1, “Create a user-specific configuration file”
so that a group of named users can run the useradd
command without the need for the root
password. Also, add the
usermod
and userdel
to the list of
commands available to this group.
To modify the example configuration, open it as system administrator with
visudo
:#
visudo /etc/sudoers.d/02_usermanagement
Add more users to the rule in a comma-separated list:
tux, wilber ALL = /usr/sbin/useradd
To allow the listed users to execute a list of commands, specify the commands as a comma-separated list:
tux, wilber ALL = /usr/sbin/useradd, /usr/sbin/usermod, /usr/sbin/userdel
To let the listed users use their own password instead of the
root
password, add the following line:Defaults:tux, wilber !targetpw
When active, this flag requires the listed users to enter the password of the target user, that is,
root
. This flag is enabled by default on any SUSE Linux Enterprise Desktop system. Negate it using!
to require the listed users to just enter their own password instead of theroot
password.Save the configuration, leave the editor and open a second shell to test whether
sudo
honors your new configuration.
2.2.4 Simplify configurations by applying aliases #
Use aliases to simplify your custom configuration from
Example 2.2, “Create custom configurations by grouping items” even further. Grouping items
helps to a certain extent, but using global aliases for users,
commands and hosts is the most efficient way to keep a clean and
lean sudo
configuration.
Using aliases and groups instead of lists is a much better way to address
changes in your setup. Should a user leave, just remove them from the
global User_Alias
declaration in your alias declaration
file instead of scouring all the separate custom configuration files.
The same procedure applies for any other type of alias
(Host_Alias
, Cmnd_Alias
and Runas_Alias
).
Create a new file to hold your global alias definitions:
#
visudo /etc/sudoers.d/01_aliases
Add the following line to create the
TEAMLEADERS
alias:User_Alias TEAMLEADERS = tux, wilber
Add the following line to create the
USERMANAGEMENT
alias:Cmnd_Alias USERMANAGEMENT = /usr/sbin/useradd, /usr/sbin/usermod, /usr/sbin/userdel
Save your changes and exit
visudo
.As system administrator, start
visudo
to edit the example configuration file:#
visudo -f /etc/sudoers.d/02_usermanagement
Delete the previous rule and replace it with the following rule that uses the aliases you have just defined above:
TEAMLEADERS ALL = USERMANAGEMENT
To let all the users defined by
User_Alias
use their own password instead of theroot
password, add the following line:Defaults:TEAMLEADERS !targetpw
Save the configuration, leave the editor and open a second shell to test whether
sudo
honors your new configuration.
2.2.5 Basic sudoers configuration syntax #
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:
# Everything on a line after # is ignored 1 Defaults !insults # Disable the insults flag 2 Defaults env_keep += "DISPLAY HOME" # Add DISPLAY and HOME to env_keep tux ALL = NOPASSWD: /usr/bin/frobnicate, PASSWD: /usr/bin/journalctl 3
There are two exceptions: | |
Remove the | |
targetpw
This flag controls whether the invoking user is required to enter the password of the target user (ON) (for example
root
) or the invoking user (OFF).Defaults targetpw # Turn targetpw flag ON
rootpw
If set,
sudo
prompts for theroot
password. The default is OFF.Defaults !rootpw # Turn rootpw flag OFF
env_reset
If set,
sudo
constructs a minimal environment withTERM
,PATH
,HOME
,MAIL
,SHELL
,LOGNAME
,USER
,USERNAME
, andSUDO_*
. Additionally, variables listed inenv_keep
are imported from the calling environment. The default is ON.Defaults env_reset # Turn env_reset flag ON
env_keep
List of environment variables to keep when the
env_reset
flag is ON.# 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
env_delete
List of environment variables to remove when the
env_reset
flag is OFF.# 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
The Defaults
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.
For detailed information about the sudoers configuration files, consult man 5
sudoers
.
2.2.6 Basic sudoers rules #
Each rule follows the following scheme ([]
marks
optional parts):
#Who Where As whom Tag What User_List Host_List = [(User_List)] [NOPASSWD:|PASSWD:] Cmnd_List
User_List
One or several (separated by comma) identifiers: either a user name, a group in the format
%GROUPNAME
, or a user ID in the format#UID
. Negation can be specified with the!
prefix.Host_List
One or several (separated by comma) identifiers: either a (fully qualified) host name or an IP address. Negation can be specified with the
!
prefix.ALL
is a common choice forHost_List
.NOPASSWD:|PASSWD:
The user is not prompted for a password when running commands matching
Cmd_List
afterNOPASSWD:
.PASSWD
is the default. It only needs to be specified when bothPASSWD
andNOPASSWD
are on the same line:tux ALL = PASSWD: /usr/bin/foo, NOPASSWD: /usr/bin/bar
Cmnd_List
One or several (separated by comma) specifiers: a path to an executable, followed by an optional allowed argument.
/usr/bin/foo # Anything allowed /usr/bin/foo bar # Only "/usr/bin/foo bar" allowed /usr/bin/foo "" # No arguments allowed
ALL
can be used as User_List
,
Host_List
, and Cmnd_List
.
A rule that allows tux
to run all commands as root without
entering a password:
tux ALL = NOPASSWD: ALL
A rule that allows tux
to run systemctl restart
apache2
:
tux ALL = /usr/bin/systemctl restart apache2
A rule that allows tux
to run wall
as
admin
with no arguments:
tux ALL = (admin) /usr/bin/wall ""
Do not use rules like ALL ALL =
ALL
without Defaults targetpw
. Otherwise
anyone can run commands as root
.
When specifying the group name in the sudoers
file, make sure that you use the NetBIOS domain name instead of the
realm, for example:
%DOMAIN\\GROUP_NAME ALL = (ALL) ALL
Keep in mind that when using winbindd, the format also depends on the
winbind separator
option in the
smb.conf
file. By default, it is
\
. If it is changed, for example, to
+
, then the account format in the
sudoers
file must be
DOMAIN+GROUP_NAME
.
2.3 Using sudo
with X.Org applications #
Starting graphical applications with sudo
normally results in the
following error:
>
sudo
xterm xterm: Xt error: Can't open display: %s xterm: DISPLAY is not set
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:
xhost si:localuser:root
The command below removes the granted access:
xhost -si:localuser:root
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.
2.4 More information #
The sudo --help
command offers a brief overview of the
available command line options, while the man sudoers
command provides detailed information about sudoers
and its configuration.
3 Using YaST #
YaST is a SUSE Linux Enterprise Desktop 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.
Additional information about YaST is available on the project's official Web site at https://yast.opensuse.org/.
3.1 YaST interface overview #
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 Chapter 4, YaST in text mode).
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.
The list of installed modules for the ncurses-based and GUI version of YaST may differ. Before starting any YaST module, verify that it is installed for the version of YaST that you are using.
3.2 Useful key combinations #
The graphical version of YaST supports keyboard shortcuts
- Print Screen
Take and save a screenshot. It may not work on certain desktop environments.
- Shift–F4
Enable and disable the color palette optimized for visually impaired users.
- Shift–F7
Enable/disable logging of debug messages.
- Shift–F8
Open a file dialog to save log files to a user-defined location.
- Ctrl–Shift–Alt–D
Send a DebugEvent. YaST modules can react to this by executing special debugging actions. The result depends on the specific YaST module.
- Ctrl–Shift–Alt–M
Start and stop macro recorder.
- Ctrl–Shift–Alt–P
Replay macro.
- Ctrl–Shift–Alt–S
Show stylesheet editor.
- Ctrl–Shift–Alt–T
Dump widget tree to the log file.
- Ctrl–Shift–Alt–X
Open a terminal window (xterm). Useful for installation process via VNC.
- Ctrl–Shift–Alt–Y
Show widget tree browser.
4 YaST in text mode #
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.
To launch the ncurses-based version of YaST, open the terminal and run the
sudo yast2
command. Use the →| 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
F9, while the F10 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
Q
is highlighted in the
button. This means that you can activate the button by pressing
Alt–Alt+Q.
If a YaST dialog gets corrupted or distorted, for example, while resizing the window, press Ctrl–L to refresh and restore its contents.
4.2 Advanced key combinations #
The ncurses-based version of YaST offers several advanced key combinations.
- Shift–F1
List advanced hotkeys.
- Shift–F4
Change color schema.
- Ctrl–Q
Quit the application.
- Ctrl–L
Refresh screen.
- Ctrl–DF1
List advanced hotkeys.
- Ctrl–DShift–D
Dump dialog to the log file as a screenshot.
- Ctrl–DShift–Y
Open YDialogSpy to see the widget hierarchy.
4.3 Restriction of key combinations #
If your window manager uses global Alt combinations, the Alt combinations in YaST may not work. Keys like Alt or Shift can also be occupied by the settings of the terminal.
- Using Alt instead of Esc
Alt shortcuts can be executed with Esc instead of Alt. For example, Esc–H replaces Alt–H. (Press Esc, then press H.)
- Backward and forward navigation with Ctrl–F and Ctrl–B
If the Alt and Shift combinations are taken over by the window manager or the terminal, use the combinations Ctrl–F (forward) and Ctrl–B (backward) instead.
- Restriction of function keys
The function keys (F1 ... F12) are also used for functions. Certain function keys may be taken over by the terminal and may not be available for YaST. However, the Alt key combinations and function keys should always be fully available on a text-only console.
4.4 YaST command line options #
Besides the text mode interface, YaST provides a command line interface. To get a list of YaST command line options, use the following command:
>
sudo
yast -h
4.4.1 Installing packages from the command line #
If you know the package name, and the package is provided by an active
installation repository, you can use the command line option
-i
to install the package:
>
sudo
yast -i package_name
or
>
sudo
yast --install -i package_name
package_name can be a single short package name, for example, gvim, installed with dependency checking, or the full path to an RPM package, which is installed without dependency checking.
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 Section 9.1, “Using Zypper”.
4.4.2 Working with individual modules #
To save time, you can start individual YaST modules using the following command:
>
sudo
yast module_name
View a list of all modules available on your system with yast
-l
or yast --list
.
4.4.3 Command line parameters of YaST modules #
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:
>
sudo
yast module_name help
If a module does not provide command line support, it is started in a text mode with the following message:
This YaST module does not support the command line interface.
The following sections describe all YaST modules with command line support, along with a brief explanation of all their commands and available options.
4.4.3.1 Common YaST module commands #
All YaST modules support the following commands:
- help
Lists all the module's supported commands with their description:
>
sudo
yast lan help- longhelp
Same as
help
, but adds a detailed list of all command's options and their descriptions:>
sudo
yast lan longhelp- xmlhelp
Same as
longhelp
, but the output is structured as an XML document and redirected to a file:>
sudo
yast lan xmlhelp xmlfile=/tmp/yast_lan.xml- interactive
Enters the interactive mode. This lets you run the module's commands without prefixing them with
sudo yast
. Useexit
to leave the interactive mode.
4.4.3.2 yast add-on #
Adds a new add-on product from the specified path:
>
sudo
yast add-on http://server.name/directory/Lang-AddOn-CD1/
You can use the following protocols to specify the source path: http:// ftp:// nfs:// disk:// cd:// or dvd://.
4.4.3.3 yast audit-laf #
Displays and configures the Linux Audit Framework. Refer to the Book “Security and Hardening Guide” for more details. yast audit-laf
accepts the following commands:
- set
Sets an option:
>
sudo
yast audit-laf set log_file=/tmp/audit.logFor a complete list of options, run
yast audit-laf set help
.- show
Displays settings of an option:
>
sudo
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: SUSPENDFor a complete list of options, run
yast audit-laf show help
.
4.4.3.4 yast dhcp-server #
Manages the DHCP server and configures its settings. yast
dhcp-server
accepts the following commands:
- disable
Disables the DHCP server service.
- enable
Enables the DHCP server service.
- host
Configures settings for individual hosts.
- interface
Specifies to which network interface to listen to:
>
sudo
yast dhcp-server interface current Selected Interfaces: eth0 Other Interfaces: bond0, pbu, eth1For a complete list of options, run
yast dhcp-server interface help
.- options
Manages global DHCP options. For a complete list of options, run
yast dhcp-server options help
.- status
Prints the status of the DHCP service.
- subnet
Manages the DHCP subnet options. For a complete list of options, run
yast dhcp-server subnet help
.
4.4.3.5 yast dns-server #
Manages the DNS server configuration. yast dns-server
accepts the following commands:
- acls
Displays access control list settings:
>
sudo
yast dns-server acls show ACLs: ----- Name Type Value ---------------------------- any Predefined localips Predefined localnets Predefined none Predefined- dnsrecord
Configures zone resource records:
>
sudo
yast dnsrecord add zone=example.org query=office.example.org type=NS value=ns3For a complete list of options, run
yast dns-server dnsrecord help
.- forwarders
Configures DNS forwarders:
>
sudo
yast dns-server forwarders add ip=10.0.0.100>
sudo
yast dns-server forwarders show [...] Forwarder IP ------------ 10.0.0.100For a complete list of options, run
yast dns-server forwarders help
.- host
Handles “A” and its related “PTR” record at once:
>
sudo
yast dns-server host show zone=example.orgFor a complete list of options, run
yast dns-server host help
.- logging
Configures logging settings:
>
sudo
yast dns-server logging set updates=no transfers=yesFor a complete list of options, run
yast dns-server logging help
.- mailserver
Configures zone mail servers:
>
sudo
yast dns-server mailserver add zone=example.org mx=mx1 priority=100For a complete list of options, run
yast dns-server mailserver help
.- nameserver
Configures zone name servers:
>
sudo
yast dns-server nameserver add zone=example.com ns=ns1For a complete list of options, run
yast dns-server nameserver help
.- soa
Configures the start of authority (SOA) record:
>
sudo
yast dns-server soa set zone=example.org serial=2006081623 ttl=2D3H20SFor a complete list of options, run
yast dns-server soa help
.- startup
Manages the DNS server service:
>
sudo
yast dns-server startup atbootFor a complete list of options, run
yast dns-server startup help
.- transport
Configures zone transport rules. For a complete list of options, run
yast dns-server transport help
.- zones
Manages DNS zones:
>
sudo
yast dns-server zones add name=example.org zonetype=masterFor a complete list of options, run
yast dns-server zones help
.
4.4.3.6 yast disk #
Prints information about all disks or partitions. The only supported
command is list
followed by either of the following
options:
- disks
Lists all configured disks in the system:
>
sudo
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- partitions
Lists all partitions in the system:
>
sudo
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 | / | | [...]
4.4.3.7 yast ftp-server #
Configures FTP server settings. yast ftp-server
accepts
the following options:
- SSL, TLS
Controls secure connections via SSL and TLS. SSL options are valid for the
vsftpd
only.>
sudo
yast ftp-server SSL enable>
sudo
yast ftp-server TLS disable- access
Configures access permissions:
>
sudo
yast ftp-server access authen_onlyFor a complete list of options, run
yast ftp-server access help
.- anon_access
Configures access permissions for anonymous users:
>
sudo
yast ftp-server anon_access can_uploadFor a complete list of options, run
yast ftp-server anon_access help
.- anon_dir
Specifies the directory for anonymous users. The directory must already exist on the server:
>
sudo
yast ftp-server anon_dir set_anon_dir=/srv/ftpFor a complete list of options, run
yast ftp-server anon_dir help
.- chroot
Controls change root environment (chroot):
>
sudo
yast ftp-server chroot enable>
sudo
yast ftp-server chroot disable- idle-time
Sets the maximum idle time in minutes before FTP server terminates the current connection:
>
sudo
yast ftp-server idle-time set_idle_time=15- logging
Determines whether to save the log messages into a log file:
>
sudo
yast ftp-server logging enable>
sudo
yast ftp-server logging disable- max_clients
Specifies the maximum number of concurrently connected clients:
>
sudo
yast ftp-server max_clients set_max_clients=1500- max_clients_ip
Specifies the maximum number of concurrently connected clients via IP:
>
sudo
yast ftp-server max_clients_ip set_max_clients=20- max_rate_anon
Specifies the maximum data transfer rate permitted for anonymous clients (KB/s):
>
sudo
yast ftp-server max_rate_anon set_max_rate=10000- max_rate_authen
Specifies the maximum data transfer rate permitted for locally authenticated users (KB/s):
>
sudo
yast ftp-server max_rate_authen set_max_rate=10000- port_range
Specifies the port range for passive connection replies:
>
sudo
yast ftp-server port_range set_min_port=20000 set_max_port=30000For a complete list of options, run
yast ftp-server port_range help
.- show
Displays FTP server settings.
- startup
Controls the FTP start-up method:
>
sudo
yast ftp-server startup atbootFor a complete list of options, run
yast ftp-server startup help
.- umask
Specifies the file umask for
authenticated:anonymous
users:>
sudo
yast ftp-server umask set_umask=177:077- welcome_message
Specifies the text to display when someone connects to the FTP server:
>
sudo
yast ftp-server welcome_message set_message="hello everybody"
4.4.3.8 yast http-server #
Configures the HTTP server (Apache2). yast http-server
accepts the following commands:
- configure
Configures the HTTP server host settings:
>
sudo
yast http-server configure host=main servername=www.example.com \ serveradmin=admin@example.comFor a complete list of options, run
yast http-server configure help
.
- hosts
Configures virtual hosts:
>
sudo
yast http-server hosts create servername=www.example.com \ serveradmin=admin@example.com documentroot=/var/wwwFor a complete list of options, run
yast http-server hosts help
.
- listen
Specifies the ports and network addresses where the HTTP server should listen:
>
sudo
yast http-server listen add=81>
sudo
yast http-server listen list Listen Statements: ================== :80 :81>
sudo
yast http-server delete=80For a complete list of options, run
yast http-server listen help
.
- mode
Enables or disables the wizard mode:
>
sudo
yast http-server mode wizard=on
- modules
Controls the Apache2 server modules:
>
sudo
yast http-server modules enable=php5,rewrite>
sudo
yast http-server modules disable=ssl>
sudo
http-server modules list [...] Enabled rewrite Disabled ssl Enabled php5 [...]
4.4.3.9 yast kdump #
Configures kdump
settings. For more information
on kdump
, refer to the
Book “System Analysis and Tuning Guide”, Chapter 18 “Kexec and Kdump”, Section 18.7 “Basic Kdump configuration”. yast kdump
accepts the following commands:
- copykernel
Copies the kernel into the dump directory.
- customkernel
Specifies the kernel_string part of the name of the custom kernel. The naming scheme is
/boot/vmlinu[zx]-kernel_string[.gz]
.>
sudo
yast kdump customkernel kernel=kdumpFor a complete list of options, run
yast kdump customkernel help
.- dumpformat
Specifies the (compression) format of the dump kernel image. Available formats are “none”, “ELF”, “compressed” or “lzo”:
>
sudo
yast kdump dumpformat dump_format=ELF- dumplevel
Specifies the dump level number in the range from 0 to 31:
>
sudo
yast kdump dumplevel dump_level=24- dumptarget
Specifies the destination for saving dump images:
>
sudo
kdump dumptarget target=ssh server=name_server port=22 \ dir=/var/log/dump user=user_nameFor a complete list of options, run
yast kdump dumptarget help
.- immediatereboot
Controls whether the system should reboot immediately after saving the core in the Kdump kernel:
>
sudo
yast kdump immediatereboot enable>
sudo
yast kdump immediatereboot disable- keepolddumps
Specifies how many old dump images are kept. Specify zero to keep them all:
>
sudo
yast kdump keepolddumps no=5- kernelcommandline
Specifies the command line that needs to be passed off to the Kdump kernel:
>
sudo
yast kdump kernelcommandline command="ro root=LABEL=/"- kernelcommandlineappend
Specifies the command line that you need to append to the default command line string:
>
sudo
yast kdump kernelcommandlineappend command="ro root=LABEL=/"- notificationcc
Specifies an e-mail address for sending copies of notification messages:
>
sudo
yast kdump notificationcc email="user1@example.com user2@example.com"- notificationto
Specifies an e-mail address for sending notification messages:
>
sudo
yast kdump notificationto email="user1@example.com user2@example.com"- show
Displays
kdump
settings:>
sudo
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- smtppass
Specifies the file with the plain text SMTP password used for sending notification messages:
>
sudo
yast kdump smtppass pass=/path/to/file- smtpserver
Specifies the SMTP server host name used for sending notification messages:
>
sudo
yast kdump smtpserver server=smtp.server.com- smtpuser
Specifies the SMTP user name used for sending notification messages:
>
sudo
yast kdump smtpuser user=smtp_user- startup
Enables or disables start-up options:
>
sudo
yast kdump startup enable alloc_mem=128,256>
sudo
yast kdump startup disable
4.4.3.10 yast keyboard #
Configures the system keyboard for virtual consoles. It does not affect
the keyboard settings in graphical desktop environments, such as GNOME
or KDE. yast keyboard
accepts the following commands:
- list
Lists all available keyboard layouts.
- set
Activates new keyboard layout setting:
>
sudo
yast keyboard set layout=czech- summary
Displays the current keyboard configuration.
4.4.3.11 yast lan #
Configures network cards. yast lan
accepts the
following commands:
- add
Configures a new network card:
>
sudo
yast lan add name=vlan50 ethdevice=eth0 bootproto=dhcpFor a complete list of options, run
yast lan add help
.- delete
Deletes an existing network card:
>
sudo
yast lan delete id=0- edit
Changes the configuration of an existing network card:
>
sudo
yast lan edit id=0 bootproto=dhcp- list
Displays a summary of network card configuration:
>
sudo
yast lan list id name, bootproto 0 Ethernet Card 0, NONE 1 Network Bridge, DHCP
4.4.3.12 yast language #
Configures system languages. yast language
accepts the
following commands:
- list
Lists all available languages.
- set
Specifies the main system languages and secondary languages:
>
sudo
yast language set lang=cs_CZ languages=en_US,es_ES no_packages
4.4.3.13 yast mail #
Displays the configuration of the mail system:
>
sudo
yast mail summary
4.4.3.14 yast nfs #
Controls the NFS client. yast nfs
accepts the following
commands:
- add
Adds a new NFS mount:
>
sudo
yast nfs add spec=remote_host:/path/to/nfs/share file=/local/mount/pointFor a complete list of options, run
yast nfs add help
.- delete
Deletes an existing NFS mount:
>
sudo
yast nfs delete spec=remote_host:/path/to/nfs/share file=/local/mount/pointFor a complete list of options, run
yast nfs delete help
.- edit
Changes an existing NFS mount:
>
sudo
yast nfs edit spec=remote_host:/path/to/nfs/share \ file=/local/mount/point type=nfs4For a complete list of options, run
yast nfs edit help
.- list
Lists existing NFS mounts:
>
sudo
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
4.4.3.15 yast nfs-server #
Configures the NFS server. yast nfs-server
accepts the
following commands:
- add
Adds a directory to export:
>
sudo
yast nfs-server add mountpoint=/nfs/export hosts=*.allowed_hosts.comFor a complete list of options, run
yast nfs-server add help
.- delete
Deletes a directory from the NFS export:
>
sudo
yast nfs-server delete mountpoint=/nfs/export- set
Specifies additional parameters for the NFS server:
>
sudo
yast nfs-server set enablev4=yes security=yesFor a complete list of options, run
yast nfs-server set help
.- start
Starts the NFS server service:
>
sudo
yast nfs-server start- stop
Stops the NFS server service:
>
sudo
yast nfs-server stop- summary
Displays a summary of the NFS server configuration:
>
sudo
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.
4.4.3.16 yast nis #
Configures the NIS client. yast nis
accepts the
following commands:
- configure
Changes global settings of a NIS client:
>
sudo
yast nis configure server=nis.example.com broadcast=yesFor a complete list of options, run
yast nis configure help
.- disable
Disables the NIS client:
>
sudo
yast nis disable- enable
Enables your machine as NIS client:
>
sudo
yast nis enable server=nis.example.com broadcast=yes automounter=yesFor a complete list of options, run
yast nis enable help
.- find
Shows available NIS servers for a given domain:
>
sudo
yast nis find domain=nisdomain.com- summary
Displays a configuration summary of a NIS client.
4.4.3.17 yast nis-server #
Configures a NIS server. yast nis-server
accepts the
following commands:
- master
Configures a NIS master server:
>
sudo
yast nis-server master domain=nisdomain.com yppasswd=yesFor a complete list of options, run
yast nis-server master help
.- slave
Configures a NIS worker server:
>
sudo
yast nis-server slave domain=nisdomain.com master_ip=10.100.51.65For a complete list of options, run
yast nis-server slave help
.- stop
Stops a NIS server:
>
sudo
yast nis-server stop- summary
Displays a configuration summary of a NIS server:
>
sudo
yast nis-server summary
4.4.3.18 yast proxy #
Configures proxy settings. yast proxy
accepts the
following commands:
- authentication
Specifies the authentication options for proxy:
>
sudo
yast proxy authentication username=tux password=secretFor a complete list of options, run
yast proxy authentication help
.- enable, disable
Enables or disables proxy settings.
- set
Changes the current proxy settings:
>
sudo
yast proxy set https=proxy.example.comFor a complete list of options, run
yast proxy set help
.- summary
Displays proxy settings.
4.4.3.19 yast rdp #
Controls remote desktop settings. yast rdp
accepts the
following commands:
- allow
Allows remote access to the server's desktop:
>
sudo
yast rdp allow set=yes- list
Displays the remote desktop configuration summary.
4.4.3.20 yast samba-client #
Configures the Samba client settings. yast samba-client
accepts the following commands:
- configure
Changes global settings of Samba:
>
sudo
yast samba-client configure workgroup=FAMILY- isdomainmember
Checks whether the machine is a member of a domain:
>
sudo
yast samba-client isdomainmember domain=SMB_DOMAIN- joindomain
Makes the machine a member of a domain:
>
sudo
yast samba-client joindomain domain=SMB_DOMAIN user=username password=pwd- winbind
Enables or disables Winbind services (the
winbindd
daemon):>
sudo
yast samba-client winbind enable>
sudo
yast samba-client winbind disable
4.4.3.21 yast samba-server #
Configures Samba server settings. yast samba-server
accepts the following commands:
- backend
Specifies the back-end for storing user information:
>
sudo
yast samba-server backend smbpasswdFor a complete list of options, run
yast samba-server backend help
.- configure
Configures global settings of the Samba server:
>
sudo
yast samba-server configure workgroup=FAMILY description='Home server'For a complete list of options, run
yast samba-server configure help
.- list
Displays a list of available shares:
>
sudo
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- role
Specifies the role of the Samba server:
>
sudo
yast samba-server role standaloneFor a complete list of options, run
yast samba-server role help
.- service
Enables or disables the Samba services (
smb
andnmb
):>
sudo
yast samba-server service enable>
sudo
yast samba-server service disable- share
Manipulates a single Samba share:
>
sudo
yast samba-server share name=movies browseable=yes guest_ok=yesFor a complete list of options, run
yast samba-server share help
.
4.4.3.22 yast security #
Controls the security level of the host. yast security
accepts the following commands:
- level
Specifies the security level of the host:
>
sudo
yast security level serverFor a complete list of options, run
yast security level help
.- set
Sets the value of a specific option:
>
sudo
yast security set passwd=sha512 crack=yesFor a complete list of options, run
yast security set help
.- summary
Displays a summary of the current security configuration:
sudo
yast security summary
4.4.3.23 yast sound #
Configures sound card settings. yast sound
accepts the
following commands:
- add
Configures a new sound card. Without any parameters, the command adds the first detected card.
>
sudo
yast sound add card=0 volume=75For a complete list of options, run
yast sound add help
.- channels
Lists available volume channels of a sound card:
>
sudo
yast sound channels card=0 Master 75 PCM 100- modules
Lists all available sound kernel modules:
>
sudo
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) [...]- playtest
Plays a test sound on a sound card:
>
sudo
yast sound playtest card=0- remove
Removes a configured sound card:
>
sudo
yast sound remove card=0>
sudo
yast sound remove all- set
Specifies new values for a sound card:
>
sudo
yast sound set card=0 volume=80- show
Displays detailed information about a sound card:
>
sudo
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) [...]- summary
Prints a configuration summary for all sound cards on the system:
>
sudo
yast sound summary- volume
Specifies the volume level of a sound card:
sudo
yast sound volume card=0 play
4.4.3.24 yast sysconfig #
Controls the variables in files under /etc/sysconfig
.
yast sysconfig
accepts the following commands:
- clear
Sets empty value to a variable:
>
sudo
yast sysconfig clear=POSTFIX_LISTENTip: Variable in multiple filesIf the variable is available in several files, use the VARIABLE_NAME$FILE_NAME syntax:
>
sudo
yast sysconfig clear=CONFIG_TYPE$/etc/sysconfig/mail- details
Displays detailed information about a variable:
>
sudo
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- list
Displays summary of modified variables. Use
all
to list all variables and their values:>
sudo
yast sysconfig list all AOU_AUTO_AGREE_WITH_LICENSES="false" AOU_ENABLE_CRONJOB="true" AOU_INCLUDE_RECOMMENDS="false" [...]- set
Sets a value for a variable:
>
sudo
yast sysconfig set DISPLAYMANAGER=gdmTip: Variable in multiple filesIf the variable is available in several files, use the VARIABLE_NAME$FILE_NAME syntax:
>
sudo
yast sysconfig set CONFIG_TYPE$/etc/sysconfig/mail=advanced
4.4.3.25 yast tftp-server #
Configures a TFTP server. yast tftp-server
accepts the
following commands:
- directory
Specifies the directory of the TFTP server:
>
sudo
yast tftp-server directory path=/srv/tftp>
sudo
yast tftp-server directory list Directory Path: /srv/tftp- status
Controls the status of the TFTP server service:
>
sudo
yast tftp-server status disable>
sudo
yast tftp-server status show Service Status: false>
sudo
yast tftp-server status enable
4.4.3.26 yast timezone #
Configures the time zone. yast timezone
accepts the
following commands:
- list
Lists all available time zones grouped by region:
>
sudo
yast timezone list Region: Africa Africa/Abidjan (Abidjan) Africa/Accra (Accra) Africa/Addis_Ababa (Addis Ababa) [...]- set
Specifies new values for the time zone configuration:
>
sudo
yast timezone set timezone=Europe/Prague hwclock=local- summary
Displays the time zone configuration summary:
>
sudo
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
4.4.3.27 yast users #
Manages user accounts. yast users
accepts the following
commands:
- add
Adds a new user:
>
sudo
yast users add username=user1 password=secret home=/home/user1For a complete list of options, run
yast users add help
.- delete
Deletes an existing user account:
>
sudo
yast users delete username=user1 delete_homeFor a complete list of options, run
yast users delete help
.- edit
Changes an existing user account:
>
sudo
yast users edit username=user1 password=new_secretFor a complete list of options, run
yast users edit help
.- list
Lists existing users filtered by user type:
>
sudo
yast users list systemFor a complete list of options, run
yast users list help
.- show
Displays details about a user:
>
sudo
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: 456For a complete list of options, run
yast users show help
.
5 Changing language and country settings with YaST #
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.
If you work in different countries or in a multilingual environment, you
should configure your system accordingly. SUSE® Linux Enterprise Desktop can handle
different locales
in parallel. A locale is a set of
parameters that defines the language and country settings reflected in the
user interface.
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.
For those tasks, use the YaST language module as described in Section 5.1, “Changing the system language”. Install secondary languages to get optional localization if you need to start applications or desktops in languages other than the primary one.
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 Section 5.2, “Changing the country and time settings”.
5.1 Changing the system language #
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:
- Changing the system language globally
Proceed as described in Section 5.1.1, “Modifying system languages with YaST” and Section 5.1.2, “Switching the default system language” 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.
- Changing the language for the desktop only
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. Refer to Book “GNOME User Guide”, Chapter 3 “Customizing your settings”, Section 3.2 “Configuring language settings” for details. 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.
- Temporarily switching languages for one application only
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 Section 5.1.3, “Switching languages for standard X and GNOME applications”.
5.1.1 Modifying system languages with YaST #
YaST supports two different language categories:
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.
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.
Before installing additional languages, determine which of them should be the default system language (primary language).
To access the YaST language module, start YaST and click sudo yast2 language &
from a command line.
When installing additional languages, YaST allows you to
set different locale settings for the user root
, see Step 4. The option
determines how
the locale variables (LC_*
) in the file
/etc/sysconfig/language
are set for
root
. 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 RC_LC_CTYPE
to
the same values as for the regular users. The
RC_LC_CTYPE
variable sets the localization for
language-specific function calls.
To add languages in the YaST language module, select the
you want to install.To make a language the default language, set it as
.Additionally, adapt the keyboard to the new primary language and adjust the time zone, if appropriate.
Tip: Advanced settingsFor advanced keyboard or time zone settings, select Chapter 32, Setting up your system keyboard layout and Section 5.2, “Changing the country and time settings”.
› or › in YaST. For more information, refer toTo change language settings specific to the user
root
, click .Set
to the desired value. For more information, click .Decide whether to use
forroot
or not.
If your locale was not included in the list of primary languages available, try specifying it with
. However, this may result in certain locales being incomplete.Confirm the changes in the dialogs with
. If you have selected secondary languages, YaST installs the localized software packages for the additional languages.
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 Section 5.1.3, “Switching languages for standard X and GNOME applications”.
5.1.2 Switching the default system language #
To globally change the default language of a system, use the following procedure:
Start the YaST language module.
Select the desired new system language as
.Important: Deleting former system languagesIf you switch to a different primary language, the localized software packages for the former primary language gets removed from the system. To switch the default system language but keep the former primary language as an additional language, add it as
by selecting the respective check box.Adjust the keyboard and time zone options as desired.
Confirm your changes with
.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.
5.1.3 Switching languages for standard X and GNOME applications #
After you have installed the respective language with YaST, you can run a single application in another language.
Start the application from the command line by using the following command:
LANG=LANGUAGE application
For example, to start f-spot in German, run
LANG=de_DE f-spot
. For other languages, use the
appropriate language code. Get a list of all language codes available with
the locale
-av
command.
5.2 Changing the country and time settings #
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 sudo yast2 timezone &
from a command line.
First, select a general region, such as
. Choose an appropriate country that matches the one you are working in, for example, .Depending on which operating systems run on your workstation, adjust the hardware clock settings accordingly:
If you run another operating system on your machine, such as Microsoft Windows*, your system may not use UTC, but local time. In this case, deactivate
.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.
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 is only performed if the time difference between the hardware and system clock is less than 15 minutes.
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 always set the hardware clock to UTC.
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.
In the YaST timezone module, click
to set date and time.Select
and enter date and time values.Confirm your changes.
Click
to set date and time.Select
.Enter the address of an NTP server, if not already populated.
With the Section 39.1, “Configuring an NTP client with YaST”.
button, you can open the advanced NTP configuration. For details, seeConfirm your changes.
6 Managing users with YaST #
During installation, you may have created a local user for your system. With the YaST module
you can add users or edit existing ones. It also lets you configure your system to authenticate users with a network server.6.1 User and group administration dialog #
To administer users or groups, start YaST and click sudo
yast2 users &
from a command line.
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 system users for internal use only. Each user is assigned to one or more groups. Similar to system users, there are also system groups for internal use.
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:
- Managing user accounts
From the Section 6.2, “Managing user accounts”. Learn about advanced options like enforcing password policies, using encrypted home directories, or managing disk quotas in Section 6.3, “Additional options for user accounts”.
tab create, modify, delete or temporarily disable user accounts as described in- Changing default settings
Local user accounts are created according to the settings defined on the Section 6.4, “Changing default settings for local users”.
tab. Learn how to change the default group assignment, or the default path and access permissions for home directories in- Assigning users to groups
Learn how to change the group assignment for individual users in Section 6.5, “Assigning users to groups”.
- Managing groups
From the Section 6.6, “Managing groups” for information on how to do this.
tab, you can add, modify or delete existing groups. Refer to- Changing user authentication method
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 Section 6.7, “Changing the user authentication method”.
tab. For more information, refer to
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.
Filter options allow you to define the set of users or groups you want to modify: on the
or tab, click to view and edit users or groups. They are listed according to certain categories, such as or , if applicable. With › you can also set up and use a custom filter.Depending on the filter you choose, not all the following options and functions may be available from the dialog.
6.2 Managing user accounts #
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.
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 is manually modified.
The following instructions demonstrate how to set up default user accounts. For further options, refer to Section 6.3, “Additional options for user accounts”.
Open the YaST
dialog and click the tab.With
define the set of users you want to manage. The dialog lists users in the system and the groups the users belong to.To modify options for an existing user, select an entry and click
.To create a new user account, click
.Enter the appropriate user data on the first tab, such as
(which is used for login) and . This data is sufficient to create a new user. If you click now, the system automatically assigns a user ID and sets all other values as default.Activate
if you want system notifications to be delivered to this user's mailbox. This creates a mail alias forroot
and the user can read the system mail without having to first log in asroot
.The mails sent by system services are stored in the local mailbox
/var/spool/mail/
USERNAME, where USERNAME is the login name of the selected user. To read e-mails, you can use themail
command.To adjust further details such as the user ID or the path to the user's home directory, do so on the
tab.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
. Otherwise, a new home directory is created without any of the existing data.To force users to regularly change their password or set other password options, switch to Section 6.3.2, “Enforcing password policies”.
and adjust the options. For more details, refer toIf all options are set according to your wishes, click
.Click
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.Alternatively, to save all changes without exiting the
dialog, click › .
root
account
While it is technically possible to rename the root
account, certain
applications, scripts or third-party products may rely on the existence of
a user called root
. While such a configuration always targets
individual environments, necessary adjustments could be overwritten by
vendor updates, so this becomes an ongoing task rather than a one-time
setting. This is especially true in complex setups involving third-party
applications, where it needs to be verified with every vendor involved
whether a rename of the root
account is supported.
As the implications for renaming the root
account cannot be foreseen, SUSE does not
support renaming the root
account.
Usually, the idea behind renaming the root
account is to hide it or make it unpredictable.
However, /etc/passwd
requires 644
permissions for
regular users, so any user of the system can retrieve the login name for the
user ID 0.
For better ways to secure the root
account, refer to
Book “Security and Hardening Guide”, Chapter 14 “User management”, Section 14.5 “Restricting root
logins” and
Book “Security and Hardening Guide”, Chapter 14 “User management”, Section 14.5.3 “Restricting SSH logins”.
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 “offline” is the same as if they had created them directly on the network.
Open the YaST
dialog and click the tab.To temporarily disable a user account without deleting it, select the user from the list and click
. Activate . The user cannot log in to your machine until you enable the account again.To delete a user account, select the user from the list and click
. Choose if you also want to delete the user's home directory or to retain the data.
6.3 Additional options for user accounts #
Besides the settings for a default user account, SUSE® Linux Enterprise Desktop offers further options. For example, options to enforce password policies, use encrypted home directories or define disk quotas for users and groups.
6.3.1 Automatic login and passwordless login #
If you use the GNOME desktop environment you can configure Auto Login for a certain user and Passwordless Login 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.
Enabling Auto Login or Passwordless Login 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.
To activate auto login or login without password, access these functions in the YaST
with › .6.3.2 Enforcing password policies #
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:
Open the YaST
dialog and select the tab.Select user and click
.Switch to the
tab. The user's last password change is displayed on the tab.To make the user change their password at next login, activate
.To enforce password rotation, set a
and a .To remind the user to change their password before it expires, set the number of
.To restrict the period of time the user can log in after their password has expired, change the value in
.You can also specify a certain expiration date for the complete account. Enter the
in YYYY-MM-DD format. This setting is not password-related but rather applies to the account itself.For more information about options and default values, click
.Apply your changes with
.
6.3.3 Managing quotas #
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.
SUSE Linux Enterprise Desktop allows usage of soft
and
hard
quotas. Additionally, grace intervals can be
defined that allow users or groups to temporarily exceed their quotas by
certain amounts.
- Soft quota
Defines a warning level at which users are informed that they are nearing their limit. Administrators may urge the users to clean up and reduce their data on the partition. The soft quota limit is normally lower than the hard quota limit.
- Hard quota
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.
- Grace period
Defines the time between the overflow of the soft quota and a warning being issued. Normally set to a rather low value of one or several hours.
To configure quotas for certain users and groups, you need to enable quota support for the respective partition in the YaST Expert Partitioner first.
In YaST, select
› and click to proceed.In the
, select the partition for which to enable quotas and click .Click
and activate . If thequota
package is not already installed, it will be installed when you confirm the respective message with .Confirm your changes and leave the
.Make sure the service
quotaon
is running by entering the following command:>
sudo
systemctl status quotaon.serviceIt should be marked as being
active
. If this is not the case, start it with the commandsystemctl start quotaon.service
.
Now you can define soft or hard quotas for specific users or groups and set time periods as grace intervals.
In the YaST
, select the user or the group you want to set the quotas for and click .On the
tab, select the entry and click to open the dialog.From
, select the partition to which the quota should apply.Below
, restrict the amount of disk space. Enter the number of 1 KB blocks the user or group may have on this partition. Specify a and a value.Additionally, you can restrict the number of inodes the user or group may have on the partition. Below
, enter a and .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.
Confirm your settings with
.Click
to close the administration dialog and save the changes.Alternatively, to save all changes without exiting the
dialog, click › .
SUSE Linux Enterprise Desktop also ships command line tools like
repquota
or warnquota
. System
administrators can use these tools to control the disk usage or send e-mail
notifications to users exceeding their quota. Using
quota_nld
, administrators can also forward kernel
messages about exceeded quotas to D-BUS. For more information, refer to the
repquota
, the warnquota
and the quota_nld
man page.
6.4 Changing default settings for local users #
When creating new local users, several default settings are used by YaST. These include, for example, the group the user belongs to, or the access permissions of the user's home directory. You can change these default settings to meet your requirements:
Open the YaST
dialog and select the tab.To change the group the new users should automatically belong to, select another group from
.If you do not want to use
/home/USERNAME
as the default path for new users' home directories, modify the .To change the default permission modes for newly created home directories, adjust the umask value in Book “Security and Hardening Guide”, Chapter 19 “Access control lists in Linux” and to the
. For more information about umask, refer toumask
man page.For information about the individual options, click
.Apply your changes with
.
6.5 Assigning users to groups #
Local users are assigned to several groups according to the default settings, which you can access from the Section 6.4, “Changing default settings for local users”.
dialog on the 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 toOpen the YaST
dialog and click the tab. It lists users and the groups the users belong to.Click
and switch to the tab.To change the group the user belongs to, click
and select the group from the list.To assign the user additional secondary groups, activate the corresponding check boxes in the
list.Click
to apply your changes.Click
to close the administration dialog and save the changes.Alternatively, to save all changes without exiting the
dialog, click › .
6.6 Managing groups #
With YaST you can also easily add, modify or delete groups.
Open the YaST
dialog and click the tab.With
define the set of groups you want to manage. The dialog lists groups in the system.To create a new group, click
.To modify an existing group, select the group and click
.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.
To add existing users to a new group select them from the list of possible
by checking the corresponding box. To remove them from the group deactivate the box.Click
to apply your changes.Click
to close the administration dialog and save the changes.Alternatively, to save all changes without exiting the
dialog, click › .
To delete a group, it must not contain any group members. To delete a group, select it from the list and click
. Click to close the administration dialog and save the changes. Alternatively, to save all changes without exiting the dialog, click › .6.7 Changing the user authentication method #
When your machine is connected to a network, you can change the authentication method. The following options are available:
- NIS
Users are administered centrally on a NIS server for all systems in the network. For details, see Book “Security and Hardening Guide”, Chapter 3 “Using NIS”.
- SSSD
The System Security Services Daemon (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 Book “Security and Hardening Guide”, Chapter 4 “Setting up authentication clients using YaST”, Section 4.2 “SSSD”.
- Samba
SMB authentication is often used in mixed Linux and Windows networks. For details, see Book “Security and Hardening Guide”, Chapter 7 “Active Directory support”.
To change the authentication method, proceed as follows:
Open the
dialog in YaST.Click the
tab to show an overview of the available authentication methods and the current settings.To change the authentication method, click
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:NIS: Book “Security and Hardening Guide”, Chapter 3 “Using NIS”, Section 3.2 “Configuring NIS clients”
LDAP: Book “Security and Hardening Guide”, Chapter 4 “Setting up authentication clients using YaST”, Section 4.1 “Configuring an authentication client with YaST”
SSSD: Book “Security and Hardening Guide”, Chapter 4 “Setting up authentication clients using YaST”, Section 4.2 “SSSD”
After accepting the configuration, return to the
overview.Click
to close the administration dialog.
6.8 Default system users #
By default, SUSE Linux Enterprise Desktop creates user names, which cannot be deleted. These users are typically defined in the Linux Standard Base (see https://refspecs.linuxfoundation.org/lsb.shtml). The following list provides the common user names and their purpose:
bin
,daemon
Legacy user, included for compatibility with legacy applications. New applications should no longer use this user name.
gdm
Used by GNOME Display Manager (GDM) to provide graphical logins and manage local and remote displays.
lp
Used by the Printer daemon for Common Unix Printing System (CUPS).
mail
User reserved for mailer programs like
sendmail
orpostfix
.man
Used by man to access man pages.
messagebus
Used to access D-Bus (desktop bus), a software bus for inter-process communication. Daemon is
dbus-daemon
.nobody
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.
nscd
Used by the Name Service Caching Daemon. This daemon is a lookup service to improve performance with NIS and LDAP. Daemon is
nscd
.polkitd
Used by the PolicyKit Authorization Framework, which defines and handles authorization requests for unprivileged processes. Daemon is
polkitd
.postfix
Used by the Postfix mailer.
pulse
Used by the Pulseaudio sound server.
root
Used by the system administrator, providing all appropriate privileges.
rpc
Used by the
rpcbind
command, an RPC port mapper.rtkit
Used by the rtkit package providing a D-Bus system service for real time scheduling mode.
salt
User for parallel remote execution provided by Salt. Daemon is named
salt-master
.scard
User for communication with smart cards and readers. Daemon is named
pcscd
.srvGeoClue
Used by the GeoClue D-Bus service to provide location information.
sshd
Used by the Secure Shell daemon (SSH) to ensure secured and encrypted communication over an insecure network.
statd
Used by the Network Status Monitor protocol (NSM), implemented in the
rpc.statd
daemon, to listen for reboot notifications.systemd-coredump
Used by the
/usr/lib/systemd/systemd-coredump
command to acquire, save and process core dumps.systemd-timesync
Used by the
/usr/lib/systemd/systemd-timesyncd
command to synchronize the local system clock with a remote Network Time Protocol (NTP) server.
6.9 Default system groups #
By default, SLE creates multiple user groups that are used by system services. The following list describes examples of required and common optional groups.
root
Administrative group with all privileges.
bin
Included for compatibility with legacy applications. New applications should not use this group.
daemon
Previously used to limit daemons' access to the system. Daemons should run under their own UID/GID now to separate daemons from one another.
audio
Privileges for audio devices.
gdm
Privileges for the GNOME Display Manager.
chrony
Privileges for the time synchronization service.
kvm
Privileges for the QEMU machine emulator toolkit.
libvirt
Privileges for virtualization stack.
lp
Privileges for printer operation.
mail
Privileges for mail services.
man
Privileges specific to manual pages and the
man
command.sshd
Privileges for SSH communication protocol daemon.
7 YaST online update #
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 Section 8.5, “The GNOME package updater” for further information on the update applet. This chapter covers the alternative tool for updating software packages: YaST Online Update.
The current patches for SUSE® Linux Enterprise Desktop are available from an update software repository. If you have registered your product during the installation, an update repository is already configured. If you have not registered SUSE Linux Enterprise Desktop, you can do so by starting the in YaST. Alternatively, you can manually add an update repository from a source you trust. To add or remove repositories, start the Repository Manager with › in YaST. Learn more about the Repository Manager in Section 8.4, “Managing software repositories and services”.
If you are not able to access the update catalog, this may happen because of an expired subscription. Normally, SUSE Linux Enterprise Desktop 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.
If an access to the update catalog is denied, you can see a warning message prompting you to visit the SUSE Customer Center and check your subscription. The SUSE Customer Center is available at https://scc.suse.com//.
By default, the firewall on SUSE Linux Enterprise Desktop only blocks incoming connections.
If your system is behind another firewall that blocks outgoing traffic,
make sure to allow connections to https://scc.suse.com/
and
https://updates.suse.com
on ports 80 and 443 in order
to receive updates.
SUSE provides updates with different relevance levels:
- Security updates
Fix severe security hazards and should always be installed.
- Recommended updates
Fix issues that could compromise your computer.
- Optional updates
Fix non-security relevant issues or provide enhancements.
7.1 The online update dialog #
To open the YaST yast2 online_update
.
The
window consists of four sections.
The SUSE Linux Enterprise Desktop. The patches are sorted by security relevance:
security
, recommended
, and
optional
. You can change the view of the
section by selecting one of the following options
from :
- (default view)
Non-installed patches that apply to packages installed on your system.
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).
All patches available for SUSE Linux Enterprise Desktop.
Each list entry in the Shift–F1. Actions required by Security
and
Recommended
patches are automatically preset. These
actions are ,
and .
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 is visible in the list until you mark it for installation. This does not install the patch (because the package already is up to date), but mark the patch as having been installed.
Select an entry in the
section to view a short 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.7.2 Installing patches #
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.
By default, all new patches (except optional
ones) that
are currently available for your system are already marked for installation.
They will be applied automatically once you click
or .
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.
Start YaST and select
› .To automatically apply all new patches (except
optional
ones) that are currently available for your system, click or .First modify the selection of patches that you want to apply:
Use the respective filters and views that the interface provides. For details, refer to Section 7.1, “The online update dialog”.
Select or deselect patches according to your needs and wishes by right-clicking the patch and choosing the respective action from the context menu.
Important: Always apply security updatesDo not deselect any
security
-related patches without a good reason. These patches fix severe security hazards and prevent your system from being exploited.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.
To confirm your selection and apply the selected patches, proceed with
or .
After the installation is complete, click
to leave the YaST . Your system is now up to date.
7.3 Viewing retracted patches #
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
tab.7.4 Automatic online update #
You may configure automatic updates with a daily, weekly or
monthly schedule with YaST. Install the
yast2-online-update-configuration
package.
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 may require you to disable the use of delta RPMs for the sake of performance.
Certain 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.
Use the
tab in the YaST module to review available and installed patches, including references to bug reports and CVE bulletins.After installation, start YaST and select yast2-online-update-configuration is not installed, you will be prompted to do that.
› . Choose › . If theFigure 7.3: YaST online update configuration #Alternatively, start the module with
yast2 online_update_configuration
from the command line.Choose the update interval:
, , or .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 “Interactive Patches”.
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
. 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.To automatically accept any license agreements, activate
.To automatically install all packages recommended by updated packages, activate
.To disable the use of delta RPMs (for performance reasons), un-check
.To filter the patches by category (such as security or recommended), check
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 updates, and to manually review all others. Patching is normally reliable, but you may wish to test non-security patches, and roll them back if you encounter any problems.supply patches for package management and YaST features and modules.
patches provide crucial updates and bugfixes.
patches are optional bugfixes and enhancements.
are new packages.
is equivalent to miscellaneous.
is unused.
Confirm your configuration by clicking
.
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.
8 Installing or removing software #
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.
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 Chapter 4, YaST in text mode.
When installing, updating or removing packages, any changes in the Software Manager are only applied after clicking
or . YaST maintains a list with all actions, allowing you to review and modify your changes before applying them to the system.8.1 Definition of terms #
The following terms are important for understanding installing and removing software in SUSE Linux Enterprise Desktop.
- Repository
A local or remote directory containing packages, plus additional information about these packages (package metadata).
- (Repository) alias/repository name
A short name for a repository (called
Alias
within Zypper and within YaST). It can be chosen by the user when adding a repository and must be unique.- Repository description files
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.
- Product
Represents a whole product, for example, SUSE® Linux Enterprise Desktop.
- Pattern
A pattern is an installable group of packages dedicated to a certain purpose. For example, the
Laptop
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.- Package
A package is a compressed file in
rpm
format that contains the files for a particular program.- Patch
A fix or compilation of fixes released by SUSE to correct operation defects (program bugs) in SUSE products. A patch can contain one or multiple files to replace or enhance existing executables, programs, applications or documents.
A patch consists of one or more packages and may be applied by delta RPMs. It may also introduce dependencies to packages that are not installed yet.
- Resolvable
A generic term for product, pattern, package or patch. The most commonly used type of resolvable is a package or a patch.
- Delta RPM
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.
- Package dependencies
Certain packages are dependent on other packages, such as shared libraries. In other terms, a package may
require
other packages—if the required packages are not available, the package cannot be installed. Besides dependencies (package requirements) that must be fulfilled, certain packagesrecommend
other packages. These recommended packages are only installed if they are available, otherwise they are ignored and the package recommending them is installed nevertheless.
8.2 Registering an installed system #
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
Product Registration or the command line tool
SUSEConnect
.
8.2.1 Registering with YaST #
To register the system, start YaST and switch to
, then .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.
8.2.2 Registering with SUSEConnect #
To register from the command line, use the command
>
sudo
SUSEConnect -r REGISTRATION_CODE -e EMAIL_ADDRESS
Replace REGISTRATION_CODE with the registration code you received with your copy of SUSE Linux Enterprise Desktop. Replace EMAIL_ADDRESS with the e-mail address associated with the SUSE account you or your organization uses to manage subscriptions.
To register with a local registration server, also provide the URL to the server:
>
sudo
SUSEConnect -r REGISTRATION_CODE -e EMAIL_ADDRESS --url "URL"
8.3 Using the YaST software manager #
Start the software manager from the
by choosing › .8.3.1 Searching software #
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
view is the default view of the window. To change view, click and select one of the following entries from the drop-down box. The selected view opens in a new tab.Lists all patterns available for installation on your system.
Lists all packages sorted by groups such as
, , or .A filter to list all packages needed to add a new system language.
A filter to list packages by repository. To select more than one repository, hold the Ctrl key while clicking repository names. The “pseudo repository” lists all packages currently installed.
Shows which packages belong to a certain module or extension. Select an entry (for example,
Basesystem
orHigh Availability
) to display a list of packages that belong to this module or extension.Lets you search for a package according to certain criteria. Enter a search term and press Enter. Refine your search by specifying where to and by changing the . 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 in the search process.
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 Shift–F1 for details on the status flags.
. To filter for packages with a certain status in this view, activate or deactivate the respective check boxes. Press
To list all packages that do not belong to an active repository, choose
› › and then choose › . This is useful, for example, if you have deleted a repository and want to make sure no packages from that repository remain installed.The online search feature allows searching for packages across all registered and unregistered modules and extensions.
To search for software packages online, perform the following steps:
Open the online search window with
› .Enter a Enter or click . 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.
and pressSelect one or more packages for installation by clicking the corresponding table row and
. Alternatively, you can double-click a row. If the package belongs to an unregistered module or extension, YaST asks for confirmation to register it.Click
, review the changes, and install the packages.
8.3.2 Installing and removing packages or patterns #
Certain packages are dependent on other packages, such as shared libraries. Several 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 Section 8.3.4, “Package dependencies”.
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
› from the main menu.Search for packages as described in Section 8.3.1, “Searching software”.
The packages found are listed in the right pane. To install a package or remove it, right-click it and choose Shift–F1 for help.
or . If the relevant option is not available, check the package status indicated by the symbol in front of the package name—pressTip: Applying an action to all packages listedTo apply an action to all packages listed in the right pane, go to the main menu and choose an action from
› .To install a pattern, right-click the pattern name and choose
.It is not possible to remove a pattern. Instead, select the packages for the pattern you want to remove and mark them for removal.
To select more packages, repeat the steps mentioned above.
Before applying your changes, you can review or modify them by clicking
› . By default, all packages that will change status are listed.To revert the status for a package, right-click the package and select one of the following entries:
if the package was scheduled to be deleted or updated, or if it was scheduled for installation. To abandon all changes and quit the Software Manager, click and .When you are finished, click
to apply your changes.If YaST finds additional dependencies, it shows a list of related packages to install, update or remove. Click
to accept them.After all selected packages are installed, updated or removed, the YaST Software Manager automatically closes.
Installing source packages with YaST Software Manager is not possible at
the moment. Use the command line tool zypper
for this
purpose. For more information, see
Section 9.1.3.5, “Installing or downloading source packages”.
8.3.3 Updating packages #
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:
priorities of the repositories that provide the package,
architecture of the package (for example, AMD64/Intel 64),
version number of the package,
package vendor.
Which of the aspects has the highest importance for choosing the update candidates depends on the respective update option you choose.
To update all installed packages to the latest version, choose
› › from the main menu.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 “best” 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 “best” update candidate is selected according to the following criteria:
Repository priority: prefer the package from the repository with the highest priority.
If more than one package results from this selection, choose the one with the “best” architecture (best choice: matching the architecture of the installed one).
If the resulting package has a higher version number than the installed one, the installed package is updated and replaced with the selected update candidate.
This option tries to avoid changes in architecture and vendor for the installed packages, but under certain circumstances, they are tolerated.
Note: Update unconditionallyIf you choose
› › instead, the same criteria apply but any candidate package found is installed unconditionally. Thus, choosing this option may lead to downgrading certain packages.To make sure that the packages for a mass update derive from a certain repository:
Choose the repository from which to update as described in Section 8.3.1, “Searching software” .
On the right hand side of the window, click
. This explicitly allows YaST to change the package vendor when replacing the packages.When you proceed with
, all installed packages are replaced by packages deriving from this repository, if available. This may lead to changes in vendor and architecture and even to downgrading certain packages.To refrain from this, click
. You can only cancel this until you click the button.
Before applying your changes, you can review or modify them by clicking
› . By default, all packages that will change status, are listed.If all options are set according to your wishes, confirm your changes with
to start the mass update.
8.3.4 Package dependencies #
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. Certain 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.
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
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.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
› . Manually perform a dependency check with › . A consistency check is always performed when you confirm your selection with .To review a package's dependencies, right-click it and choose
. A map showing the dependencies opens. Packages that are already installed are displayed in a green frame.Unless you are 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,
the Software Manager, all your changes and start again.8.3.5 Handling package recommendations #
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.
When installing a new package, recommended packages are still
installed by default. When updating an existing package, missing
recommendations are not be installed automatically. To change this, set
PKGMGR_RECOMMENDED="yes"
in
/etc/sysconfig/yast2
. To install all missing
recommendations for already installed packages, start › and choose › .
To disable the installation of recommended packages when installing new
packages, deactivate --no-recommends.
8.4 Managing software repositories and services #
To install third-party software, add software repositories to your system. By default, product repositories such as SUSE Linux Enterprise Desktop-DVD 15 SP6 and a matching update repository are automatically configured when you register your system. For more information about registration, see Book “Deployment Guide”, Chapter 5 “Installation steps”, Section 5.6 “Registration” or Book “Upgrade Guide”, Chapter 4 “Upgrading offline”, Section 4.7 “Registering your system”. Depending on the initially selected product, an additional repository containing translations, dictionaries, etc. might also be configured.
To manage repositories, start YaST and select
› . The dialog opens. Here, you can also manage subscriptions to by changing the at the right corner of the dialog to . A Service in this context is a (RIS) that can offer one or more software repositories. Such a Service can be changed dynamically by its administrator or vendor.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.
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.
8.4.1 Adding software repositories #
You can either add repositories from DVD/CD, a USB flash drive, a local directory, an ISO image, or a network source.
To add repositories from the
dialog in YaST proceed as follows:Click
.Select one of the options listed in the dialog:
Figure 8.2: Adding a software repository #To scan your network for installation servers announcing their services via SLP, select
and click .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
to start the installation.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
. Specifying a is optional. If none is specified, YaST will use the product name or the URL as repository name.
The option
is activated by default. If you deactivate the option, YaST will automatically download the files later, if needed.Depending on the repository you add, you may be prompted to import the repository's GPG key or asked to agree to a license.
After confirming, YaST will download and parse the metadata. It will add the repository to the list of
.If needed, adjust the repository Section 8.4.2, “Managing repository properties”.
as described inConfirm your changes with
to close the configuration dialog.After having successfully added the repository, the software manager starts and you can install packages from this repository. For details, refer to Chapter 8, Installing or removing software.
8.4.2 Managing repository properties #
The
overview of the lets you change the following repository properties:- Status
The repository status can either be
or . You can only install packages from repositories that are enabled. To turn a repository off temporarily, select it and deactivate . You can also double-click a repository name to toggle its status. To remove a repository completely, click .- Refresh
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
. To do a manual refresh click and select one of the options.Packages from remote repositories are downloaded before being installed. By default, they are deleted upon successful installation. Activating
prevents the deletion of downloaded packages. The download location is configured in/etc/zypp/zypp.conf
, by default it is/var/cache/zypp/packages
.The
of a repository is a value between1
and200
, with1
being the highest priority and200
the lowest priority. Any new repositories that are added with YaST get a priority of99
by default. If you do not care about a priority value for a certain repository, you can also set the value to0
to apply the default priority to that repository (99
). 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.Important: Priority compared to versionThe 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.
- Name and URL
To change a repository name or its URL, select it from the list with a single-click and then click
.
8.4.3 Managing repository keys #
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.
To manage all imported keys, click
in the dialog. Select an entry with the mouse to show the key properties at the bottom of the window. , , or keys with a click on the respective buttons.8.5 The GNOME package updater #
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 YaST online update module. This section describes how to update the system from the GNOME desktop using the .
Contrary to the YaST Online Update module, the GNOME
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 add functionality or introduce major changes.)Whenever new patches or package updates are available, GNOME shows a notification in the notification area or on the lock screen.
To configure the notification settings for the
, start GNOME and choose › .To install the patches and updates, click the notification message. This opens the GNOME
. Alternatively, open the updater from by typingpackage U
and choosing .Updates are sorted into four categories:
- Security updates (patches)
Fix severe security hazards and should always be installed.
- Recommended updates (patches)
Fix issues that could compromise your computer. Installing them is strongly recommended.
- Optional updates (patches)
Fix non-security relevant issues or provide enhancements.
- Other updates
New versions of packages that are installed.
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.
To get detailed information on an update, click its title and then
. The information is displayed in a box beneath the package list.Click
to start the installation.Some updates may require to restart the machine or to log out. Check the message displayed after installation for instructions.
8.6 Updating packages with #
In addition to the GNOME
, GNOME provides which has the following functionality:Install, update, and remove software delivered as an RPM via PackageKit
Install, update, and remove software delivered as a Flatpak
Install, update, and remove GNOME shell extensions (https://extensions.gnome.org)
Update firmware for hardware devices using Linux Vendor Firmware Service (LVFS, https://fwupd.org)
also provides screenshots, ratings, and reviews for software.
SUSE Linux Enterprise Desktop:
has the following differences to other tools provided onUnlike YaST or Zypper, for installing software packaged as an RPM,
is restricted to software that provides AppStream metadata. This includes most desktop applications.While the GNOME
updates packages within the running system (forcing you to restart the respective applications), downloads the updates and applies them after reboot.
9 Managing software with command line tools #
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, repository
, patch
, or
update
) refer to
Section 8.1, “Definition of terms”.
9.1 Using Zypper #
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.
9.1.1 General usage #
The general syntax of Zypper is:
zypper[--global-options]
COMMAND[--command-options]
[arguments]
The components enclosed in brackets are not required. See zypper
help
for a list of general options and all commands. To get help
for a specific command, type zypper help
COMMAND.
- Zypper commands
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:
>
sudo
zypper patch- Global options
Additionally, you can choose from one or more global options by typing them immediately before the command:
>
sudo
zypper --non-interactive patchIn the above example, the option
--non-interactive
means that the command is run without asking anything (automatically applying the default answers).- Command-specific options
To use options that are specific to a particular command, type them immediately after the command:
>
sudo
zypper patch --auto-agree-with-licensesIn the above example,
--auto-agree-with-licenses
is used to apply all needed patches to a system without you being asked to confirm any licenses. Instead, licenses will be accepted automatically.- Arguments
Some commands require one or more arguments. For example, when using the command
install
, you need to specify which package or which packages you want to install:>
sudo
zypper install mplayerSome options also require a single argument. The following command will list all known patterns:
>
zypper search -t pattern
You can combine all of the above. For example, the following command will
install the mc and vim packages from
the factory
repository while being verbose:
>
sudo
zypper -v install --from factory mc vim
The --from
option keeps all repositories
enabled (for solving any dependencies) while requesting the package from the
specified repository. --repo
is an alias for --from
, and you may use either one.
Most Zypper commands have a dry-run
option that does a
simulation of the given command. It can be used for test purposes.
>
sudo
zypper remove --dry-run MozillaFirefox
Zypper supports the global --userdata
STRING
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.
>
sudo
zypper --userdata STRING patch
9.1.2 Using Zypper subcommands #
Zypper subcommands are executables that are stored in the directory
specified by the zypper_execdir
configuration option. It is
/usr/lib/zypper/commands
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.
Executing subcommands in the Zypper shell, and using global Zypper options are not supported.
List your available subcommands:
>
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)
View the help screen for a subcommand:
>
zypper help appstream-cache
9.1.3 Installing and removing software with Zypper #
To install or remove packages, use the following commands:
>
sudo
zypper install PACKAGE_NAME>
sudo
zypper remove PACKAGE_NAME
Do not remove mandatory system packages like glibc , zypper , kernel . If they are removed, the system can become unstable or stop working altogether.
9.1.3.1 Selecting which packages to install or remove #
There are various ways to address packages with the commands
zypper install
and zypper remove
.
- By exact package name
>
sudo
zypper install MozillaFirefox- By exact package name and version number
>
sudo
zypper install MozillaFirefox-52.2- By repository alias and package name
>
sudo
zypper install mozilla:MozillaFirefoxWhere
mozilla
is the alias of the repository from which to install.- By package name using wild cards
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 “Moz”:
>
sudo
zypper install 'Moz*'Tip: Removing all-debuginfo
packagesWhen debugging a problem, you sometimes need to temporarily install a lot of
-debuginfo
packages which give you more information about running processes. After your debugging session finishes and you need to clean the environment, run the following:>
sudo
zypper remove '*-debuginfo'- By capability
For example, to install a package without knowing its name, capabilities come in handy. The following command will install the package MozillaFirefox:
>
sudo
zypper install firefox- By capability, hardware architecture, or version
Together with a capability, you can specify a hardware architecture and a version:
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
x86_64
), use:>
sudo
zypper install 'firefox.x86_64'Versions must be appended to the end of the string and must be preceded by an operator:
<
(lesser than),<=
(lesser than or equal),=
(equal),>=
(greater than or equal),>
(greater than).>
sudo
zypper install 'firefox>=74.2'You can also combine a hardware architecture and version requirement:
>
sudo
zypper install 'firefox.x86_64>=74.2'
- By path to the RPM file
You can also specify a local or remote path to a package:
>
sudo
zypper install /tmp/install/MozillaFirefox.rpm>
sudo
zypper install http://download.example.com/MozillaFirefox.rpm
9.1.3.2 Combining installation and removal of packages #
To install and remove packages simultaneously, use the
+/-
modifiers. To install emacs and
simultaneously remove vim , use:
>
sudo
zypper install emacs -vim
To remove emacs and simultaneously install vim , use:
>
sudo
zypper remove emacs +vim
To prevent the package name starting with the -
being
interpreted as a command option, always use it as the second argument. If
this is not possible, precede it with --
:
>
sudo
zypper install -emacs +vim # Wrong>
sudo
zypper install vim -emacs # Correct>
sudo
zypper install -- -emacs +vim # Correct>
sudo
zypper remove emacs +vim # Correct
9.1.3.3 Cleaning up dependencies of removed packages #
If (together with a certain package), you automatically want to remove any
packages that become unneeded after removing the specified package, use the
--clean-deps
option:
>
sudo
zypper rm --clean-deps PACKAGE_NAME
9.1.3.4 Using Zypper in scripts #
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 --non-interactive
option. This option must be
given before the actual command (install
,
remove
, and patch
), as can be seen in
the following:
>
sudo
zypper--non-interactive
install PACKAGE_NAME
This option allows the use of Zypper in scripts and cron jobs.
9.1.3.5 Installing or downloading source packages #
To install the corresponding source package of a package, use:
>
zypper source-install PACKAGE_NAME
When executed as root
, the default location to install source
packages is /usr/src/packages/
and
~/rpmbuild
when run as user. These values can be
changed in your local rpm
configuration.
This command will also install the build dependencies of the specified
package. If you do not want this, add the switch -D
:
>
sudo
zypper source-install -D PACKAGE_NAME
To install only the build dependencies use -d
.
>
sudo
zypper source-install -d PACKAGE_NAME
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 Section 9.1.6, “Managing repositories with Zypper” for details on repository management.
A list of all source packages available in your repositories can be obtained with:
>
zypper search -t srcpackage
You can also download source packages for all installed packages to a local directory. To download source packages, use:
>
zypper source-download
The default download directory is
/var/cache/zypper/source-download
. You can change it
using the --directory
option. To only show missing or
extraneous packages without downloading or deleting anything, use the
--status
option. To delete extraneous source packages, use
the --delete
option. To disable deleting, use the
--no-delete
option.
9.1.3.6 Installing packages from disabled repositories #
Normally you can only install or refresh packages from enabled
repositories. The --plus-content
TAG
option helps you specify
repositories to be refreshed, temporarily enabled during the current Zypper
session, and disabled after it completes.
For example, to enable repositories that may provide additional
-debuginfo
or -debugsource
packages, use --plus-content debug
. You can specify this
option multiple times.
To temporarily enable such 'debug' repositories to install a specific
-debuginfo
package, use the option as follows:
>
sudo
zypper --plus-content debug \ install "debuginfo(build-id)=eb844a5c20c70a59fc693cd1061f851fb7d046f4"
The build-id
string is reported by
gdb
for missing debuginfo packages.
Repositories from the SUSE Linux Enterprise Desktop installation media are still
configured but disabled after successful installation. You can use the
--plus-content
option to install packages from the
installation media instead of the online repositories. Before calling
zypper
, ensure the media is available, for example by
inserting the DVD into the computer's drive.
9.1.3.7 Utilities #
To verify whether all dependencies are still fulfilled and to repair missing dependencies, use:
>
zypper verify
In addition to dependencies that must be fulfilled, some packages “recommend” 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:
>
sudo
zypper install-new-recommends
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.
9.1.4 Updating software with Zypper #
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 zypper
dist-upgrade
. Upgrading SUSE Linux Enterprise Desktop is discussed in
Book “Upgrade Guide”, Chapter 2 “Upgrade paths and methods”.
9.1.4.1 Installing all needed patches #
Patching SUSE Linux Enterprise Desktop 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 conflicting are omitted.
To install all officially released patches that apply to your system, run:
>
sudo
zypper patch
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 optional
or
feature
), they are installed immediately.
If zypper patch
succeeds, it is guaranteed that no
vulnerable version package is installed unless you confirm the exception.
Note that the official update repository is only
available after registering your SUSE Linux Enterprise Desktop installation.
If a patch that is about to be installed includes changes that require a system reboot, you will be warned before.
The plain zypper patch
command does not apply patches
from third party repositories. To update also the third party repositories,
use the with-update
command option as follows:
>
sudo
zypper patch --with-update
To install also optional patches, use:
>
sudo
zypper patch --with-optional
To install all patches relating to a specific Bugzilla issue, use:
>
sudo
zypper patch --bugzilla=NUMBER
To install all patches relating to a specific CVE database entry, use:
>
sudo
zypper patch --cve=NUMBER
For example, to install a security patch with the CVE number
CVE-2010-2713
, execute:
>
sudo
zypper patch --cve=CVE-2010-2713
To install only patches which affect Zypper and the package management itself, use:
>
sudo
zypper patch --updatestack-only
Bear in mind that other command options that would also update other
repositories will be dropped if you use the
updatestack-only
command option.
9.1.4.2 Listing patches #
To find out whether patches are available, Zypper allows viewing the following information:
- Number of needed patches
To list the number of needed patches (patches that apply to your system but are not yet installed), use
patch-check
:>
zypper patch-check Loading repository data... Reading installed packages... 5 patches needed (1 security patch)This command can be combined with the
--updatestack-only
option to list only the patches which affect Zypper and the package management itself.- List of needed patches
To list all needed patches (patches that apply to your system but are not yet installed), use
zypper list-patches
.- List of all patches
To list all patches available for SUSE Linux Enterprise Desktop, regardless of whether they are already installed or apply to your installation, use
zypper patches
.
It is also possible to list and install patches relevant to specific
issues. To list specific patches, use the zypper
list-patches
command with the following options:
- By Bugzilla issues
To list all needed patches that relate to Bugzilla issues, use the option
--bugzilla
.To list patches for a specific bug, you can also specify a bug number:
--bugzilla=NUMBER
. To search for patches relating to multiple Bugzilla issues, add commas between the bug numbers, for example:>
zypper list-patches --bugzilla=972197,956917- By CVE number
To list all needed patches that relate to an entry in the CVE database (Common Vulnerabilities and Exposures), use the option
--cve
.To list patches for a specific CVE database entry, you can also specify a CVE number:
--cve=NUMBER
. To search for patches relating to multiple CVE database entries, add commas between the CVE numbers, for example:>
zypper list-patches --cve=CVE-2016-2315,CVE-2016-2324- List retracted patches
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
zypper
:>
zypper lp --all |grep retracted
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 KernelSee complete information on a retracted (or any) patch:
>
zypper patch-info SUSE-SLE-Product-SLES-15-2021-2689
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 : maint-coord@suse.de 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. [...]- Patch with conflicting packages
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 : maint-coord@suse.de 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 [...]
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 needed.
zypper patch
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.
To list all patches regardless of whether they are needed, use the option
--all
additionally. For example, to list all patches with
a CVE number assigned, use:
>
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
[...]
9.1.4.3 Installing new package versions #
If a repository contains only new packages, but does not provide patches,
zypper patch
does not show any effect. To update
all installed packages with newer available versions, use the following command:
>
sudo
zypper update
zypper update
ignores problematic packages.
For example, if a package is locked, zypper update
omits the package, even if a higher version of it is available. Conversely,
zypper patch
reports a conflict if the package is
considered vulnerable.
To update individual packages, specify the package with either the update or install command:
>
sudo
zypper update PACKAGE_NAME>
sudo
zypper install PACKAGE_NAME
A list of all new installable packages can be obtained with the command:
>
zypper list-updates
Note that this command only lists packages that match the following criteria:
has the same vendor like the already installed package,
is provided by repositories with at least the same priority than the already installed package,
is installable (all dependencies are satisfied).
A list of all new available packages (regardless whether installable or not) can be obtained with:
>
sudo
zypper list-updates --all
To find out why a new package cannot be installed, use the zypper
install
or zypper update
command as described
above.
9.1.4.4 Identifying orphaned packages #
Whenever you remove a repository from Zypper or upgrade your system, some packages can get in an “orphaned” state. These orphaned packages belong to no active repository anymore. The following command gives you a list of these:
>
sudo
zypper packages --orphaned
With this list, you can decide if a package is still needed or can be removed safely.
9.1.5 Identifying processes and services using deleted files #
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 zypper ps
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 zypper
ps
shows a table:
>
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->
[...]
PID: ID of the process |
PPID: ID of the parent process |
UID: ID of the user running the process |
Login: Login name of the user running the process |
Command: Command used to execute the process |
Service: Service name (only if command is associated with a system service) |
Files: The list of the deleted files |
The output format of zypper ps
can be controlled as
follows:
zypper ps
-s
Create a short table not showing the deleted files.
>
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 |zypper ps
-ss
Show only processes associated with a system service.
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
zypper ps
-sss
Only show system services using deleted files.
avahi-daemon irqbalance postfix sshd
zypper ps
--print "systemctl status %s"
Show the commands to retrieve status information for services which might need a restart.
systemctl status avahi-daemon systemctl status irqbalance systemctl status postfix systemctl status sshd
For more information about service handling refer to
Chapter 19, The systemd
daemon.
9.1.6 Managing repositories with Zypper #
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:
>
zypper repos
The result will look similar to the following output:
>
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
When specifying repositories in various commands, an alias, URI or
repository number from the zypper repos
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.
By default, details such as the URI or the priority of the repository are not displayed. Use the following command to list all details:
>
zypper repos -d
9.1.6.1 Adding repositories #
To add a repository, run
>
sudo
zypper addrepo URI ALIAS
URI can either be an Internet repository, a network resource, a directory or a CD or DVD (see https://en.opensuse.org/openSUSE:Libzypp_URIs for details). The ALIAS 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.
9.1.6.2 Refreshing repositories #
zypper
enables you to fetch changes in packages from
configured repositories. To fetch the changes, run:
>
sudo
zypper refresh
zypper
By default, some commands perform refresh
automatically, so you do not need to run the command explicitly.
The refresh
command enables you to view changes also in
disabled repositories, by using the --plus-content
option:
>
sudo
zypper --plus-content refresh
This option fetches changes in repositories, but keeps the disabled repositories in the same state—disabled.
9.1.6.3 Removing repositories #
To remove a repository from the list, use the command zypper
removerepo
together with the alias or number of the repository
you want to delete. For example, to remove the repository
SLEHA-12-GEO
from Example 9.1, “Zypper—list of known repositories”, use one of the following commands:
>
sudo
zypper removerepo 1>
sudo
zypper removerepo "SLEHA-12-GEO"
9.1.6.4 Modifying repositories #
Enable or disable repositories with zypper modifyrepo
.
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 updates
, turn on
auto-refresh and set its priority to 20:
>
sudo
zypper modifyrepo -er -p 20 'updates'
Modifying repositories is not limited to a single repository—you can also operate on groups:
-a : all repositories |
-l : local repositories |
-t : remote repositories |
-m TYPE : repositories
of a certain type (where TYPE can be one of the
following: http , https , ftp ,
cd , dvd , dir , file ,
cifs , smb , nfs , hd ,
iso ) |
To rename a repository alias, use the renamerepo
command. The following example changes the alias from Mozilla
Firefox
to firefox
:
>
sudo
zypper renamerepo 'Mozilla Firefox' firefox
9.1.7 Querying repositories and packages with Zypper #
Zypper offers various methods to query repositories or packages. To get lists of all products, patterns, packages or patches available, use the following commands:
>
zypper products>
zypper patterns>
zypper packages>
zypper patches
To query all repositories for certain packages, use
search
. To get information regarding particular packages,
use the info
command.
9.1.7.1 Searching for software #
The zypper search
command works on package names, or,
optionally, on package summaries and descriptions. Strings wrapped in
/
are interpreted as regular expressions. By default,
the search is not case-sensitive.
- Simple search for a package name containing
fire
>
zypper search "fire"- Simple search for the exact package
MozillaFirefox
>
zypper search --match-exact "MozillaFirefox"- Also search in package descriptions and summaries
>
zypper search -d fire- Only display packages not already installed
>
zypper search -u fire- Display packages containing the string
fir
not followed bee
>
zypper se "/fir[^e]/"
9.1.7.2 Searching for packages across all SLE modules #
To search for packages both within and outside of currently enabled SLE
modules, use the search-packages
subcommand. This
command contacts the SUSE Customer Center and searches all modules for matching packages,
for example:
>
zypper search-packages package1 package2
zypper search-packages
provides the following options:
Search for an exact match of your search string:
-x
,--match-exact
Group the results by module (default: group by package):
-g,
--group-by-module
Display more detailed information about packages:
-d
,--details
Output search results in XML:
--xmlout
9.1.7.3 Searching for specific capability #
To search for packages which provide a special capability, use the command
what-provides
. For example, if you want to know which
package provides the Perl module SVN::Core
, use the
following command:
>
zypper what-provides 'perl(SVN::Core)'
The what-provides
PACKAGE_NAME
is similar to
rpm -q --whatprovides
PACKAGE_NAME, 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.
9.1.7.4 Showing package information #
To query single packages, use info
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 -t
option) and the
type does not exist, the command outputs other available matches but
without detailed information.
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.
To also show what is required/recommended by the package, use the options
--requires
and --recommends
:
>
zypper info --requires MozillaFirefox
9.1.8 Showing lifecycle information #
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 https://www.suse.com/lifecycle.
To check the lifecycle of your product and the supported package, use the
zypper lifecycle
command as shown below:
#
zypper lifecycle
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
9.1.9 Configuring Zypper #
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 /etc/zypp/zypper.conf
. For
user-specific changes, edit ~/.zypper.conf
. If
~/.zypper.conf
does not yet exist, you can use
/etc/zypp/zypper.conf
as a template: copy it to
~/.zypper.conf
and adjust it to your liking. Refer to
the comments in the file for help about the available options.
9.1.10 Troubleshooting #
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:
>
sudo
zypper refresh
If that does not help, try
>
sudo
zypper refresh -fdb
This forces a complete refresh and rebuild of the database, including a forced download of raw metadata.
9.1.11 Zypper rollback feature on Btrfs file system #
If the Btrfs file system is used on the root partition and
snapper
is installed, Zypper automatically calls
snapper
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 Chapter 10, System recovery and snapshot management with Snapper for
more information.
9.1.12 More information #
For more information on managing software from the command line, enter
zypper help
, zypper help
COMMAND or refer to the
zypper(8)
man page. For a complete and detailed command
reference, cheat sheets
with the most important commands,
and information on how to use Zypper in scripts and applications, refer to
https://en.opensuse.org/SDB:Zypper_usage. A list of
software changes for the latest SUSE Linux Enterprise Desktop version can be found at
https://en.opensuse.org/openSUSE:Zypper_versions.
9.2 RPM—the package manager #
RPM (RPM Package Manager) is used for managing software packages. Its main
commands are rpm
and rpmbuild
. The
powerful RPM database can be queried by the users, system administrators and
package builders for detailed information about the installed software.
rpm
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. rpmbuild
can be used to build installable
packages from pristine sources.
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 rpm
to configure the
software package or stored in the RPM database for documentation purposes.
RPM archives normally have the extension .rpm
.
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 -devel
, such as the
packages alsa-devel
and
gimp-devel
.
9.2.1 Verifying package authenticity #
RPM packages have a GPG signature. To verify the signature of an RPM
package, use the command rpm --checksig
PACKAGE-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.
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:
>
sudo
rpm --import \ /usr/share/doc/packages/suse-build-key/suse_ptf_key.asc
After importing the key, you can install PTF packages on your system.
9.2.2 Managing packages: install, update, and uninstall #
Normally, the installation of an RPM archive is quite simple: rpm
-i
PACKAGE.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,
rpm
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 rpm
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.
The options -U
or --upgrade
and
-F
or --freshen
can be used to update a
package (for example, rpm -F
PACKAGE.rpm). This command removes the files of
the old version and immediately installs the new files. The difference
between the two versions is that -U
installs packages that
previously did not exist in the system, while -F
merely
updates previously installed packages. When updating, rpm
updates configuration files carefully using the following strategy:
If a configuration file was not changed by the system administrator,
rpm
installs the new version of the appropriate file. No action by the system administrator is required.If a configuration file was changed by the system administrator before the update,
rpm
saves the changed file with the extension.rpmorig
or.rpmsave
(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 (.rpmorig
or.rpmsave
) with the newly installed file and make your changes again in the new file. Afterward, delete all.rpmorig
and.rpmsave
files to avoid problems with future updates..rpmnew
files appear if the configuration file already exists and if thenoreplace
label was specified in the.spec
file.
Following an update, .rpmsave
and
.rpmnew
files should be removed after comparing them,
so they do not obstruct future updates. The .rpmorig
extension is assigned if the file has not previously been recognized by the
RPM database.
Otherwise, .rpmsave
is used. In other words,
.rpmorig
results from updating from a foreign format to
RPM. .rpmsave
results from updating from an older RPM
to a newer RPM. .rpmnew
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
/var/adm/rpmconfigcheck
. Some configuration files (like
/etc/httpd/httpd.conf
) are not overwritten to allow
continued operation.
The -U
switch is not only an
equivalent to uninstalling with the -e
option and
installing with the -i
option. Use -U
whenever possible.
To remove a package, enter rpm -e
PACKAGE. 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 no
additional dependencies exist), it may be helpful to rebuild the RPM
database using the option --rebuilddb
.
9.2.3 Delta RPM packages #
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.
The makedeltarpm
and applydelta
binaries are part of the delta RPM suite (package
deltarpm
) and help you create and apply delta RPM
packages. With the following commands, you can create a delta RPM called
new.delta.rpm
. The following command assumes that
old.rpm
and new.rpm
are present:
>
sudo
makedeltarpm old.rpm new.rpm new.delta.rpm
Using applydeltarpm
, you can reconstruct the new RPM from
the file system if the old package is already installed:
>
sudo
applydeltarpm new.delta.rpm new.rpm
To derive it from the old RPM without accessing the file system, use the
-r
option:
>
sudo
applydeltarpm -r old.rpm new.delta.rpm new.rpm
See /usr/share/doc/packages/deltarpm/README
for
technical details.
9.2.4 RPM queries #
With the -q
option rpm
initiates
queries, making it possible to inspect an RPM archive (by adding the option
-p
) and to query the RPM database of installed packages.
Several switches are available to specify the type of information required.
See Table 9.1, “Essential RPM query options”.
|
Package information |
|
File list |
|
Query the package that contains the file FILE (the full path must be specified with FILE) |
|
File list with status information (implies |
|
List only documentation files (implies |
|
List only configuration files (implies |
|
File list with complete details (to be used with |
|
List features of the package that another package can request with
|
|
Capabilities the package requires |
|
Installation scripts (preinstall, postinstall, uninstall) |
For example, the command rpm -q -i wget
displays the
information shown in Example 9.2, “rpm -q -i wget
”.
rpm -q -i wget
#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
The option -f
only works if you specify the complete file
name with its full path. Provide as many file names as desired. For example:
>
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
If only part of the file name is known, use a shell script as shown in Example 9.3, “Script to search for packages”. Pass the partial file name to the script shown as a parameter when running it.
#! /bin/sh for i in $(rpm -q -a -l | grep $1); do echo "\"$i\" is in package:" rpm -q -f $i echo "" done
The command rpm -q --changelog
PACKAGE displays a detailed list of change
information about a specific package, sorted by date.
With the installed RPM database, verification checks can be made. Initiate
these with -V
, or --verify
. With this
option, rpm
shows all files in a package that have been
changed since installation. rpm
uses eight character
symbols to give some hints about the following changes:
|
MD5 check sum |
|
File size |
|
Symbolic link |
|
Modification time |
|
Major and minor device numbers |
|
Owner |
|
Group |
|
Mode (permissions and file type) |
In the case of configuration files, the letter c
is
printed. For example, for changes to /etc/wgetrc
(wget
package):
>
rpm -V wget
S.5....T c /etc/wgetrc
The files of the RPM database are placed in
/var/lib/rpm
. If the partition
/usr
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 --rebuilddb
. Before doing this, make a backup of the
old database. The cron
script
cron.daily
makes daily copies of the database (packed
with gzip) and stores them in /var/adm/backup/rpmdb
.
The number of copies is controlled by the variable
MAX_RPMDB_BACKUPS
(default: 5
) in
/etc/sysconfig/backup
. The size of a single backup is
approximately 1 MB for 1 GB in /usr
.
9.2.5 Installing and compiling source packages #
All source packages carry a .src.rpm
extension (source
RPM).
Source packages can be copied from the installation medium to the hard disk
and unpacked with YaST. They are not, however, marked as installed
([i]
) in the package manager. This is because the source
packages are not entered in the RPM database. Only
installed operating system software is listed in the
RPM database. When you “install” a source package, only the
source code is added to the system.
The following directories must be available for rpm
and
rpmbuild
in /usr/src/packages
(unless you specified custom settings in a file like
/etc/rpmrc
):
SOURCES
for the original sources (
.tar.bz2
or.tar.gz
files, etc.) and for distribution-specific adjustments (mostly.diff
or.patch
files)SPECS
for the
.spec
files, similar to a meta Makefile, which control the build processBUILD
all the sources are unpacked, patched and compiled in this directory
RPMS
where the completed binary packages are stored
SRPMS
here are the source RPMs
When you install a source package with YaST, all the necessary components
are installed in /usr/src/packages
: the sources and the
adjustments in SOURCES
and the relevant
.spec
file in SPECS
.
Do not experiment with system components
(glibc
,
rpm
, etc.), because this
endangers the stability of your system.
The following example uses the wget.src.rpm
package.
After installing the source package, you should have files similar to those
in the following list:
/usr/src/packages/SOURCES/wget-1.19.5.tar.bz2 /usr/src/packages/SOURCES/wgetrc.patch /usr/src/packages/SPECS/wget.spec
rpmbuild
-bX
/usr/src/packages/SPECS/wget.spec
starts the
compilation. X is a wild card for various stages
of the build process (see the output of --help
or the RPM
documentation for details). The following is merely a brief explanation:
-bp
Prepare sources in
/usr/src/packages/BUILD
: unpack and patch.-bc
Do the same as
-bp
, but with additional compilation.-bi
Do the same as
-bp
, but with additional installation of the built software. Caution: if the package does not support the BuildRoot feature, you might overwrite configuration files.-bb
Do the same as
-bi
, but with the additional creation of the binary package. If the compile was successful, the binary should be in/usr/src/packages/RPMS
.-ba
Do the same as
-bb
, but with the additional creation of the source RPM. If the compilation was successful, the binary should be in/usr/src/packages/SRPMS
.--short-circuit
Skip some steps.
The binary RPM created can now be installed with rpm
-i
or, preferably, with rpm
-U
. Installation with rpm
makes it
appear in the RPM database.
Keep in mind that the BuildRoot
directive in the spec
file is deprecated. If you still need this feature, use the
--buildroot
option as a workaround.
9.2.6 Compiling RPM packages with build #
The danger with many packages is that unwanted files are added to the
running system during the build process. To prevent this use
build
, which creates a defined environment in which
the package is built. To establish this chroot environment, the
build
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 build --rpms
DIRECTORY. Unlike rpm
, the
build
command looks for the .spec
file in the source directory. To build wget
(like in
the above example) with the DVD mounted in the system under
/media/dvd
, use the following commands as
root
:
#
cd /usr/src/packages/SOURCES/#
mv ../SPECS/wget.spec .#
build --rpms /media/dvd/suse/ wget.spec
Subsequently, a minimum environment is established at
/var/tmp/build-root
. The package is built in this
environment. Upon completion, the resulting packages are located in
/var/tmp/build-root/usr/src/packages/RPMS
.
The build
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 rpm
command to one
of the above-mentioned stages. Access additional information with
build
--help
and by reading the
build
man page.
9.2.7 Tools for RPM archives and the RPM database #
Midnight Commander (mc
) 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
HEADER
with F3. View the archive
structure with the cursor keys and Enter. Copy archive
components with F5.
A full-featured package manager is available as a YaST module. For details, see Chapter 8, Installing or removing software.
10 System recovery and snapshot management with Snapper #
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.
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:
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.)
You can also boot from
Btrfs
snapshots. For more information, see Section 10.3, “System rollback by booting from snapshots”.Thinly provisioned LVM volumes formatted with XFS or Ext4.
Using Snapper, you can perform the following tasks:
Undo system changes made by
zypper
and YaST. See Section 10.2, “Using Snapper to undo changes” for details.Restore files from previous snapshots. See Section 10.2.2, “Using Snapper to restore files” for details.
Do a system rollback by booting from a snapshot. See Section 10.3, “System rollback by booting from snapshots” for details.
Manually create and manage snapshots, within the running system. See Section 10.6, “Manually creating and managing snapshots” for details.
10.1 Default setup #
Snapper on SUSE Linux Enterprise Desktop is set up as an undo and recovery
tool for system changes. By default, the root partition
(/
) of SUSE Linux Enterprise Desktop is formatted with
Btrfs
. Taking snapshots is automatically enabled if the
root partition (/
) is big enough (more
than approximately 16 GB). By default, snapshots are disabled on partitions
other than /
.
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:
>
sudo
snapper -c root create-config /
Afterward enable the different snapshot types as described in Section 10.1.4.1, “Disabling/enabling snapshots”.
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.
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
Btrfs
file system containing snapshots may
not free disk space.
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.
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 Section 10.1.4.4, “Controlling snapshot archiving” for details.
10.1.1 Default settings #
- Disks larger than 16 GB
Configuration file:
/etc/snapper/configs/root
USE_SNAPPER=yes
TIMELINE_CREATE=no
- Disks smaller than 16 GB
Configuration file: not created
USE_SNAPPER=no
TIMELINE_CREATE=yes
10.1.2 Types of snapshots #
Although snapshots themselves do not differ in a technical sense, we distinguish between three types of snapshots, based on the events that trigger them:
- Timeline snapshots
A single snapshot is created every hour. Using the YaST OS installation method (default), timeline snapshots are enabled, except for the root file system. You can configure timeline snapshots to be taken at different intervals: hourly, daily, weekly, monthly and yearly. Old snapshots are automatically deleted. By default, the first snapshot of the last ten days, months and years is kept.
- Installation snapshots
Whenever one or more packages are installed with Zypper or YaST, three installation snapshots are created. In case an important system component such as the kernel has been installed, the snapshot pair is marked as important. Old snapshots are automatically deleted. Installation snapshots are enabled by default.
- Administration snapshots
Whenever you make changes to the system using Zypper or YaST, a pair of snapshots is created: one prior to the system change (“pre”) and the other one after the system change (“post”). Old snapshots are automatically deleted. Administration snapshots are enabled by default.
10.1.3 Directories that are excluded from snapshots #
Certain directories need to be excluded from snapshots for different reasons. The following list shows all directories that are excluded:
/boot/grub2/i386-pc
,/boot/grub2/x86_64-efi
,/boot/grub2/powerpc-ieee1275
,/boot/grub2/s390x-emu
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.
/home
If
/home
does not reside on a separate partition, it is excluded to avoid data loss on rollbacks./opt
Third-party products usually get installed to
/opt
. It is excluded to avoid uninstalling these applications on rollbacks./srv
Contains data for Web and FTP servers. It is excluded to avoid data loss on rollbacks.
/tmp
All directories containing temporary files and caches are excluded from snapshots.
/usr/local
This directory is used when manually installing software. It is excluded to avoid uninstalling these installations on rollbacks.
/var
This directory contains many variable files, including logs, temporary caches, third party products in
/var/opt
, 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.
10.1.4 Customizing the setup #
SUSE Linux Enterprise Desktop 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.
10.1.4.1 Disabling/enabling snapshots #
Each of the three snapshot types (timeline, installation, administration) can be enabled or disabled independently.
- Disabling/enabling timeline snapshots
Enabling.
snapper -c root set-config "TIMELINE_CREATE=yes"
Disabling.
snapper -c root set-config "TIMELINE_CREATE=no"
Using the YaST OS installation method (default), timeline snapshots are enabled, except for the root file system.
- Disabling/enabling installation snapshots
Enabling: Install the package
snapper-zypp-plugin
Disabling: Uninstall the package
snapper-zypp-plugin
Installation snapshots are enabled by default.
- Disabling/enabling administration snapshots
Enabling: Set
USE_SNAPPER
toyes
in/etc/sysconfig/yast2
.Disabling: Set
USE_SNAPPER
tono
in/etc/sysconfig/yast2
.Administration snapshots are enabled by default.
10.1.4.2 Controlling installation snapshots #
Taking snapshot pairs upon installing packages with YaST or Zypper is
handled by the
snapper-zypp-plugin
. An XML
configuration file, /etc/snapper/zypp-plugin.conf
defines, when to make snapshots. By default the file looks like the
following:
1 <?xml version="1.0" encoding="utf-8"?> 2 <snapper-zypp-plugin-conf> 3 <solvables> 4 <solvable match="w"1 important="true"2>kernel-*3</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>4 10 </solvables> 11 </snapper-zypp-plugin-conf>
The match attribute defines whether the pattern is a Unix shell-style
wild card ( | |
If the given pattern matches and the corresponding package is marked as important (for example, kernel packages), the snapshot is also marked as important. | |
Pattern to match a package name. Based on the setting of the
| |
This line unconditionally matches all packages. |
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 is also marked as important (lines 4 to 8). All rules are evaluated.
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:
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>
10.1.4.3 Creating and mounting new subvolumes #
Creating a new subvolume underneath the /
hierarchy
and permanently mounting it is supported. Such a subvolume is 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.
SUSE Linux Enterprise Desktop is configured with the /@/
subvolume
which serves as an independent root for permanent subvolumes such as
/opt
, /srv
,
/home
and others. Any new subvolumes you create and
permanently mount need to be created in this initial root file system.
To do so, run the following commands. In this example, a new subvolume
/usr/important
is created from
/dev/sda2
.
>
sudo
mount /dev/sda2 -o subvol=@ /mnt>
sudo
btrfs subvolume create /mnt/usr/important>
sudo
umount /mnt
The corresponding entry in /etc/fstab
needs to look
like the following:
/dev/sda2 /usr/important btrfs subvol=@/usr/important 0 0
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 nodatacow
mount option in
/etc/fstab
to do so:
/dev/sda2 /usr/important btrfs nodatacow,subvol=@/usr/important 0 0
To alternatively disable copy-on-write for single files or directories,
use the command chattr +C
PATH
.
10.1.4.4 Controlling snapshot archiving #
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 are deleted. A minimum of four important and two regular snapshots are always kept.
Refer to Section 10.5.1, “Managing existing configurations” for instructions on how to change these values.
10.1.4.5 Using Snapper on thinly provisioned LVM volumes #
Apart from snapshots on Btrfs
file systems, Snapper
also supports taking snapshots on thinly provisioned LVM volumes (snapshots
on regular LVM volumes are not supported) formatted
with XFS, Ext4 or Ext3. For more information and setup instructions on LVM
volumes, refer to Book “Deployment Guide”, Chapter 7 “.
”, Section 7.3 “LVM configuration”
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
--fstype=lvm(FILESYSTEM)
.
ext3
, etx4
or xfs
are valid values for FILESYSTEM. Example:
>
sudo
snapper -c lvm create-config --fstype="lvm(xfs)" /thin_lvm
You can adjust this configuration according to your needs as described in Section 10.5.1, “Managing existing configurations”.
10.2 Using Snapper to undo changes #
Snapper on SUSE Linux Enterprise Desktop is preconfigured to serve as a tool that lets you
undo changes made by zypper
and YaST. For this purpose,
Snapper is configured to create a pair of snapshots before and after each
run of zypper
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
Section 10.1.4.1, “Disabling/enabling snapshots” for details.
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 /home
for example, you can create
custom configurations.
When working with snapshots to restore data, it is important to know that there are two fundamentally different scenarios Snapper can handle:
- Undoing changes
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.
- Rollback
When doing rollbacks as described in Section 10.3, “System rollback by booting from snapshots”, the system is reset to the state at which the snapshot was taken.
When undoing changes, it is also possible to compare a snapshot against the current system. When restoring all files from such a comparison, this will have the same result as doing a rollback. However, using the method described in Section 10.3, “System rollback by booting from snapshots” for rollbacks should be preferred, since it is faster and allows you to review the system before doing the rollback.
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, certain system
files such as /etc/mtab
must never be restored.
Therefore it is strongly recommended to always closely
review the list of changed files and their diffs. Only restore files that
really belong to the action you want to revert.
10.2.1 Undoing YaST and Zypper changes #
If you set up the root partition with Btrfs
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
“pre-snapshot” capturing the state of the file system before
the start of the module and a “post-snapshot” after the module
has been finished.
Using the YaST Snapper module or the snapper
command
line tool, you can undo the changes made by YaST/Zypper by restoring
files from the “pre-snapshot”. 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).
Start the
module from the section in YaST or by enteringyast2 snapper
.Make sure
is set to . This is always the case unless you have manually added own Snapper configurations.Choose a pair of pre- and post-snapshots from the list. Both, YaST and Zypper snapshot pairs are of the type
. YaST snapshots are labeled aszypp(y2base)
in the ; Zypper snapshots are labeledzypp(zypper)
.Click
to open the list of files that differ between the two snapshots.Review the list of files. To display a “diff” between the pre- and post-version of a file, select it from the list.
To restore one or more files, select the relevant files or directories by activating the respective check box. Click
and confirm the action by clicking .To restore a single file, activate its diff view by clicking its name. Click
and confirm your choice with .
snapper
command #Get a list of YaST and Zypper snapshots by running
snapper list -t pre-post
. YaST snapshots are labeled asyast MODULE_NAME
in the ; Zypper snapshots are labeledzypp(zypper)
.>
sudo
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)Get a list of changed files for a snapshot pair with
snapper status
PRE..POST. Files with content changes are marked with , files that have been added are marked with and deleted files are marked with .>
sudo
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/Sigmd5To display the diff for a certain file, run
snapper diff
PRE..POST FILENAME. If you do not specify FILENAME, a diff for all files will be displayed.>
sudo
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 [...]To restore one or more files run
snapper -v undochange
PRE..POST FILENAMES. If you do not specify a FILENAMES, all changed files will be restored.>
sudo
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
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
tool to remove users.10.2.2 Using Snapper to restore files #
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.
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 /home
doing automatic timeline snapshots. See
Section 10.5, “Creating and modifying Snapper configurations” for instructions.
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 Section 10.3, “System rollback by booting from snapshots” for details.
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 /etc
directory, but not the
complete list of files from the snapshot.
This restriction only affects snapshots taken from the root file system.
Start the
module from the section in YaST or by enteringyast2 snapper
.Choose the
from which to choose a snapshot.Select a timeline snapshot from which to restore a file and choose
. Timeline snapshots are of the type with a description value of .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.
Click
and confirm the action by clicking .
snapper
command #Get a list of timeline snapshots for a specific configuration by running the following command:
>
sudo
snapper -c CONFIG list -t single | grep timelineCONFIG needs to be replaced by an existing Snapper configuration. Use
snapper list-configs
to display a list.Get a list of changed files for a given snapshot by running the following command:
>
sudo
snapper -c CONFIG status SNAPSHOT_ID..0Replace SNAPSHOT_ID by the ID for the snapshot from which you want to restore the files.
Optionally list the differences between the current file version and the one from the snapshot by running
>
sudo
snapper -c CONFIG diff SNAPSHOT_ID..0 FILE NAMEIf you do not specify <FILE NAME>, the difference for all files are shown.
To restore one or more files, run
>
sudo
snapper -c CONFIG -v undochange SNAPSHOT_ID..0 FILENAME1 FILENAME2If you do not specify file names, all changed files will be restored.
10.3 System rollback by booting from snapshots #
The GRUB 2 version included on SUSE Linux Enterprise Desktop 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 (root
) are bootable.
As of SUSE Linux Enterprise Desktop 15 SP6 system rollbacks are only supported if the default subvolume configuration of the root partition has not been changed.
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.
When working with snapshots to restore data, it is important to know that there are two fundamentally different scenarios Snapper can handle:
- Undoing changes
When undoing changes as described in Section 10.2, “Using Snapper to undo changes”, 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.
- Rollback
When doing rollbacks as described in the following, the system is reset to the state at which the snapshot was taken.
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.
The root file system needs to be Btrfs. Booting from LVM volume snapshots is not supported.
The root file system needs to be on a single device. To check, run
sudo /sbin/btrfs filesystem show
. It needs to reportTotal devices 1
. If more than1
device is listed, your setup is not supported.Note: Directories excluded from snapshotsDirectories that are excluded from snapshots such as
/srv
(see Section 10.1.3, “Directories that are excluded from snapshots” for a full list) may reside on separate devices.The system needs to be bootable via the installed boot loader.
Only contents of the subvolume
/
will be rolled back. It is not possible to include other subvolumes.
To perform a rollback from a bootable snapshot, do as follows:
Boot the system. In the boot menu choose
and select the snapshot you want to boot. The list of snapshots is listed by date—the most recent snapshot is listed first.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 not get lost, regardless of what you do next.
Depending on whether you want to perform the rollback or not, choose your next step:
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.
To perform the rollback, run
>
sudo
snapper rollbackand 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 Section 10.3.1, “Snapshots after rollback”.
It is useful to add a description for the snapshot with the
-d
option. For example:New file system root since rollback on DATE TIME
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 after installation
.
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).
10.3.1 Snapshots after rollback #
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.
Snapshots created by rollbacks receive the value number
for the Cleanup
attribute. The rollback snapshots are
therefore automatically deleted when the set number of snapshots is reached.
Refer to Section 10.7, “Automatic snapshot clean-up” for details.
If the snapshot contains important data, extract the data from the snapshot
before it is removed.
10.3.1.1 Example of rollback snapshot #
For example, after a fresh installation the following snapshots are available on the system:
#
snapper
--iso list Type | # | | Cleanup | Description | Userdata -------+---+ ... +---------+-----------------------+-------------- single | 0 | | | current | single | 1 | | | first root filesystem | single | 2 | | number | after installation | important=yes
After running sudo snapper rollback
snapshot
3
is created and contains the state of the system
before the rollback was executed. Snapshot 4
is
the new default Btrfs subvolume and thus the system after a reboot.
#
snapper
--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 | | | |
10.3.2 Accessing and identifying snapshot boot entries #
To boot from a snapshot, reboot your machine and choose ↓ and ↑ to navigate and press 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.
. A screen listing all bootable snapshots opens. The most recent snapshot is listed first, the oldest last. Use the keysRefer to https://www.suse.com/support/kb/doc/?id=000020602 for more details.
Each snapshot entry in the boot loader follows a naming scheme which makes it possible to identify it easily:
[*]1OS2 (KERNEL3,DATE4TTIME5,DESCRIPTION6)
If the snapshot was marked | |
Operating system label. | |
Date in the format | |
Time in the format | |
This field contains a description of the snapshot. In case of a manually
created snapshot this is the string created with the option
|
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 STRING for snapshot NUMBER, use the following command:
>
sudo
snapper modify --userdata "bootloader=STRING" NUMBER
The description should be no longer than 25 characters—everything that exceeds this size will not be readable on the boot screen.
10.3.3 Limitations #
A complete system rollback, restoring the complete system to the identical state as it was in when a snapshot was taken, is not possible.
10.3.3.1 Directories excluded from snapshots #
Root file system snapshots do not contain all directories. See Section 10.1.3, “Directories that are excluded from snapshots” for details and reasons. As a general consequence, data from these directories is not restored, resulting in the following limitations.
- Add-ons and third-party software may be unusable after a rollback
Applications and add-ons installing data in subvolumes excluded from the snapshot, such as
/opt
, may not work after a rollback if other 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.- File access problems
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.
- Incompatible data formats
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.
- Subvolumes with a mixture of code and data
Subvolumes like
/srv
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.- User data
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
find
to locate and remove orphaned files.
10.3.3.2 No rollback of boot loader data #
A rollback of the boot loader is not possible, since all
“stages” of the boot loader must fit together. This cannot be
guaranteed when doing rollbacks of /boot
.
10.4 Enabling Snapper in user home directories #
You may enable snapshots for users' /home
directories, which supports several use cases:
Individual users may manage their own snapshots and rollbacks.
System users, for example, database, system, and network admins who want to track copies of configuration files, documentation, and so on.
Samba shares with home directories and Btrfs back-end.
Each user's directory is a Btrfs subvolume of /home
.
It is possible to set this up manually
(see Section 10.4.3, “Manually enabling snapshots in home directories”). However, a
more convenient way is to use pam_snapper
.
The pam_snapper
package installs the
pam_snapper.so
module and helper scripts, which
automate user creation and Snapper configuration.
pam_snapper
provides integration with the
useradd
command, pluggable authentication modules
(PAM), and Snapper. By default it creates snapshots at user login and
logout, and also creates time-based snapshots as certain users remain
logged in for extended periods of time. You may change the defaults
using the normal Snapper commands and configuration files.
10.4.1 Installing pam_snapper and creating users #
The easiest way is to start with a new /home
directory formatted with Btrfs, and no existing users. Install
pam_snapper
:
#
zypper in pam_snapper
Add this line to /etc/pam.d/common-session
:
session optional pam_snapper.so
Use the /usr/lib/pam_snapper/pam_snapper_useradd.sh
script to create a new user and home directory. By default the script
performs a dry run. Edit the script to change
DRYRUN=1
to DRYRUN=0
. Now you
can create a new user:
#
/usr/lib/pam_snapper/pam_snapper_useradd.sh \
username group passwd=password
Create subvolume '/home/username'
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
The files from /etc/skel
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:
#
snapper list --all
Config: home_username, subvolume: /home/username
Type | # | Pre # | Date | User | Cleanup | Description | Userdata
-------+---+-------+------+------+---------+-------------+---------
single | 0 | | | root | | current |
Over time, this output will become populated with a list of snapshots, which the user can manage with the standard Snapper commands.
10.4.2 Removing users #
Remove users with the
/usr/lib/pam_snapper/pam_snapper_userdel.sh
script. By default it performs a dry run, so edit it to change
DRYRUN=1
to DRYRUN=0
. This
removes the user, the user's home subvolume, Snapper configuration,
and deletes all snapshots.
#
/usr/lib/pam_snapper/pam_snapper_userdel.sh username
10.4.3 Manually enabling snapshots in home directories #
These are the steps for manually setting up users' home directories
with Snapper. /home
must be formatted with Btrfs,
and the users not yet created.
#
btrfs subvol create /home/username#
snapper -c home_username create-config /home/username#
sed -i -e "s/ALLOW_USERS=\"\"/ALLOW_USERS=\"username\"/g" \ /etc/snapper/configs/home_username#
yast users add username=username home=/home/username password=password#
chown username.group /home/username#
chmod 755 /home/username/.snapshots
10.5 Creating and modifying Snapper configurations #
The way Snapper behaves is defined in a configuration file that is specific
for each partition or Btrfs
subvolume. These
configuration files reside under /etc/snapper/configs/
.
In case the root file system is big enough (approximately 12 GB), snapshots
are automatically enabled for the root file system /
upon installation. The corresponding default configuration is named
root
. It creates and manages the YaST and Zypper
snapshot. See Section 10.5.1.1, “Configuration data” for a list
of the default values.
As explained in Section 10.1, “Default setup”, 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.
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 /control.xml
from the
installation media:
<root_base_size> <btrfs_increase_percentage>
It is calculated with the following formula: ROOT_BASE_SIZE * (1 + BTRFS_INCREASE_PERCENTAGE/100)
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.
You may create your own configurations for other partitions formatted with
Btrfs
or existing subvolumes on a
Btrfs
partition. In the following example we will set up
a Snapper configuration for backing up the Web server data residing on a
separate, Btrfs
-formatted partition mounted at
/srv/www
.
After a configuration has been created, you can either use
snapper
itself or the YaST
module to restore files from these snapshots. In YaST you need to select
your , while you need to specify
your configuration for snapper
with the global switch
-c
(for example, snapper -c myconfig
list
).
To create a new Snapper configuration, run snapper
create-config
:
>
sudo
snapper -c www-data1 create-config /srv/www2
Name of configuration file. | |
Mount point of the partition or |
This command will create a new configuration file
/etc/snapper/configs/www-data
with reasonable default
values (taken from
/etc/snapper/config-templates/default
). Refer to
Section 10.5.1, “Managing existing configurations” for instructions on how to
adjust these defaults.
Default values for a new configuration are taken from
/etc/snapper/config-templates/default
. 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 -t
option
with the create-config command:
>
sudo
snapper -c www-data create-config -t MY_DEFAULTS /srv/www
10.5.1 Managing existing configurations #
The snapper
command offers several subcommands for managing
existing configurations. You can list, show, delete and modify them:
- Listing configurations
Use the subcommand
snapper list-configs
to get all existing configurations:>
sudo
snapper list-configs Config | Subvolume -------+---------- root | / usr | /usr local | /local- Showing a configuration
Use the subcommand
snapper -c CONFIG get-config
to display the specified configuration. Replace CONFIG with one of the configuration names shown bysnapper list-configs
. For more information about the configuration options, see Section 10.5.1.1, “Configuration data”.To display the default configuration, run:
>
sudo
snapper -c root get-config- Modifying a configuration
Use the subcommand
snapper -c CONFIG set-config OPTION=VALUE
to modify an option in the specified configuration. Replace CONFIG with one of the configuration names shown bysnapper list-configs
. Possible values for OPTION and VALUE are listed in Section 10.5.1.1, “Configuration data”.- Deleting a configuration
Use the subcommand
snapper -c CONFIG delete-config
to delete a configuration. Replace CONFIG with one of the configuration names shown bysnapper list-configs
.
10.5.1.1 Configuration data #
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 snapper -c CONFIG
set-config
"KEY=VALUE"
.
ALLOW_GROUPS
,ALLOW_USERS
Granting permissions to use snapshots to regular users. See Section 10.5.1.2, “Using Snapper as regular user” for more information.
The default value is
""
.BACKGROUND_COMPARISON
Defines whether pre and post snapshots should be compared in the background after creation.
The default value is
"yes"
.EMPTY_*
Defines the clean-up algorithm for snapshots pairs with identical pre and post snapshots. See Section 10.7.3, “Cleaning up snapshot pairs that do not differ” for details.
FSTYPE
File system type of the partition. Do not change.
The default value is
"btrfs"
.NUMBER_*
Defines the clean-up algorithm for installation and administration snapshots. See Section 10.7.1, “Cleaning up numbered snapshots” for details.
QGROUP
/SPACE_LIMIT
Adds quota support to the clean-up algorithms. See Section 10.7.5, “Adding disk quota support” for details.
SUBVOLUME
Mount point of the partition or subvolume to snapshot. Do not change.
The default value is
"/"
.SYNC_ACL
If Snapper is used by regular users (see Section 10.5.1.2, “Using Snapper as regular user”), the users must be able to access the
.snapshot
directories and to read files within them. If SYNC_ACL is set toyes
, Snapper automatically makes them accessible using ACLs for users and groups from the ALLOW_USERS or ALLOW_GROUPS entries.The default value is
"no"
.TIMELINE_CREATE
If set to
yes
, hourly snapshots are created. Valid values:yes
,no
.The default value is
"no"
.TIMELINE_CLEANUP
/TIMELINE_LIMIT_*
Defines the clean-up algorithm for timeline snapshots. See Section 10.7.2, “Cleaning up timeline snapshots” for details.
10.5.1.2 Using Snapper as regular user #
By default Snapper can only be used by root
. 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:
Web site administrators who want to take snapshots of
/srv/www
Users who want to take a snapshot of their home directory
For these purposes, you can create Snapper configurations that grant
permissions to users or/and groups. The corresponding
.snapshots
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 yes
.
All steps in this procedure need to be run by root
.
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 Section 10.5, “Creating and modifying Snapper configurations” for instructions. Example:
>
sudo
snapper --config web_data create /srv/wwwThe configuration file is created under
/etc/snapper/configs/CONFIG
, where CONFIG is the value you specified with-c/--config
in the previous step (for example/etc/snapper/configs/web_data
). Adjust it according to your needs. For more information, see Section 10.5.1, “Managing existing configurations”.Set values for
ALLOW_USERS
and/orALLOW_GROUPS
to grant permissions to users and/or groups, respectively. Multiple entries need to be separated by Space. To grant permissions to the userwww_admin
for example, run:>
sudo
snapper -c web_data set-config "ALLOW_USERS=www_admin" SYNC_ACL="yes"The given Snapper configuration can now be used by the specified users and/or groups. You can test it with the
list
command, for example:www_admin:~ >
snapper -c web_data list
10.6 Manually creating and managing snapshots #
Snapper is not restricted to creating and managing snapshots automatically by configuration; you can also create snapshot pairs (“before and after”) or single snapshots manually using either the command-line tool or the YaST module.
All Snapper operations are carried out for an existing configuration (see
Section 10.5, “Creating and modifying Snapper configurations” for details). You can only take
snapshots of partitions or volumes for which a configuration exists. By
default the system configuration (root
) is used.
To create or manage snapshots for your own configuration you need to
explicitly choose it. Use the
drop-down box in YaST or specify the -c
on the command
line (snapper -c MYCONFIG
COMMAND
).
10.6.1 Snapshot metadata #
Each snapshot consists of the snapshot itself and certain 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 snapper list
to show existing snapshots and their
metadata:
snapper --config home list
Lists snapshots for the configuration
home
. To list snapshots for the default configuration (root), usesnapper -c root list
orsnapper list
.snapper list -a
Lists snapshots for all existing configurations.
snapper list -t pre-post
Lists all pre and post snapshot pairs for the default (
root
) configuration.snapper list -t single
Lists all snapshots of the type
single
for the default (root
) configuration.
The following metadata is available for each snapshot:
Type: snapshot type, see Section 10.6.1.1, “Snapshot types” for details. This data cannot be changed.
Number: unique number of the snapshot. This data cannot be changed.
Pre Number: specifies the number of the corresponding pre snapshot. For snapshots of type post only. This data cannot be changed.
Description: a description of the snapshot.
Userdata: an extended description where you can specify custom data in the form of a comma-separated key=value list:
reason=testing, project=foo
. This field is also used to mark a snapshot as important (important=yes
) and to list the user that created the snapshot (user=tux).Cleanup-Algorithm: cleanup-algorithm for the snapshot, see Section 10.7, “Automatic snapshot clean-up” for details.
10.6.1.1 Snapshot types #
Snapper knows three different types of snapshots: pre, post and single. Physically they do not differ, but Snapper handles them differently.
pre
Snapshot of a file system before a modification. Each
pre
snapshot corresponds to apost
snapshot. For example, this is used for the automatic YaST/Zypper snapshots.post
Snapshot of a file system after a modification. Each
post
snapshot corresponds to apre
snapshot. For example, this is used for the automatic YaST/Zypper snapshots.single
Stand-alone snapshot. For example, this is used for the automatic hourly snapshots. This is the default type when creating snapshots.
10.6.1.2 Cleanup algorithms #
Snapper provides three algorithms to clean up old snapshots. The
algorithms are executed in a daily
cron
job.
It is possible to define the
number of different types of snapshots to keep in the Snapper
configuration (see Section 10.5.1, “Managing existing configurations” for
details).
- number
Deletes old snapshots when a certain snapshot count is reached.
- timeline
Deletes old snapshots having passed a certain age but keeps several hourly, daily, monthly and yearly snapshots.
- empty-pre-post
Deletes pre/post snapshot pairs with empty diffs.
10.6.2 Creating snapshots #
To create a snapshot, run snapper create
or
click in the YaST module
. 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.
Always specify a meaningful description to later be able to
identify its purpose. You can also specify additional information via
the option --userdata
.
snapper create --from 17 --description "with package2"
Creates a stand-alone snapshot (type single) from an existing snapshot, which is specified by the snapshot's number from
snapper list
. (This applies to Snapper version 0.8.4 and newer.)snapper create --description "Snapshot for week 2 2014"
Creates a stand-alone snapshot (type single) for the default (
root
) configuration with a description. Because no cleanup-algorithm is specified, the snapshot will never be deleted automatically.snapper --config home create --description "Cleanup in ~tux"
Creates a stand-alone snapshot (type single) for a custom configuration named
home
with a description. Because no cleanup-algorithm is specified, the snapshot will never be deleted automatically.snapper --config home create --description "Daily data backup" --cleanup-algorithm timeline
>Creates a stand-alone snapshot (type single) for a custom configuration named
home
with a description. The snapshot will automatically be deleted when it meets the criteria specified for the timeline cleanup-algorithm in the configuration.snapper create --type pre --print-number --description "Before the Apache config cleanup" --userdata "important=yes"
Creates a snapshot of the type
pre
and prints the snapshot number. First command needed to create a pair of snapshots used to save a “before” and “after” state. The snapshot is marked as important.snapper create --type post --pre-number 30 --description "After the Apache config cleanup" --userdata "important=yes"
Creates a snapshot of the type
post
paired with thepre
snapshot number30
. Second command needed to create a pair of snapshots used to save a “before” and “after” state. The snapshot is marked as important.snapper create --command COMMAND --description "Before and after COMMAND"
Automatically creates a snapshot pair before and after running COMMAND. This option is only available when using snapper on the command line.
10.6.3 Modifying snapshot metadata #
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.
To modify a snapshot on the command line, you need to know its number. Use
snapper list
to display all snapshots
and their numbers.
The YaST
module already lists all snapshots. Choose one from the list and click .snapper modify --cleanup-algorithm "timeline"
10Modifies the metadata of snapshot 10 for the default (
root
) configuration. The cleanup algorithm is set totimeline
.snapper --config home modify --description "daily backup" -cleanup-algorithm "timeline" 120
Modifies the metadata of snapshot 120 for a custom configuration named
home
. A new description is set and the cleanup algorithm is unset.
10.6.4 Deleting snapshots #
To delete a snapshot with the YaST
module, choose a snapshot from the list and click .
To delete a snapshot with the command-line tool, you need to know its
number. Get it by running snapper list
. To delete a
snapshot, run snapper delete
NUMBER.
Deleting the current default subvolume snapshot is not allowed.
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
--sync
with the delete command.
When deleting a pre
snapshot, you should always delete
its corresponding post
snapshot (and vice versa).
snapper delete 65
Deletes snapshot 65 for the default (
root
) configuration.snapper -c home delete 89 90
Deletes snapshots 89 and 90 for a custom configuration named
home
.snapper delete --sync 23
Deletes snapshot 23 for the default (
root
) configuration and makes the freed space available immediately.
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:
btrfs subvolume delete /.snapshots/SNAPSHOTNUMBER/snapshot rm -rf /.snapshots/SNAPSHOTNUMBER
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.
Snapshots are also automatically deleted by a daily cron job. Refer to Section 10.6.1.2, “Cleanup algorithms” for details.
10.7 Automatic snapshot clean-up #
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.
Additionally, 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.
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 Can a snapshot be protected from deletion? .
The default setup (root
) 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.
10.7.1 Cleaning up numbered snapshots #
Cleaning up numbered snapshots—administration plus installation snapshot pairs—is controlled by the following parameters of a Snapper configuration.
NUMBER_CLEANUP
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
NUMBER_LIMIT
and/orNUMBER_LIMIT_IMPORTANT
and an age specified withNUMBER_MIN_AGE
. Valid values:yes
(enable),no
(disable).The default value is
"yes"
.Example command to change or set:
>
sudo
snapper -c CONFIG set-config "NUMBER_CLEANUP=no"NUMBER_LIMIT
/NUMBER_LIMIT_IMPORTANT
Defines how many regular and/or important installation and administration snapshot pairs to keep. Ignored if
NUMBER_CLEANUP
is set to"no"
.The default value is
"2-10"
forNUMBER_LIMIT
and"4-10"
forNUMBER_LIMIT_IMPORTANT
. 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.Example command to change or set:
>
sudo
snapper -c CONFIG set-config "NUMBER_LIMIT=10"Important: Ranged compared to constant valuesIf quota support is enabled (see Section 10.7.5, “Adding disk quota support”), the limit needs to be specified as a minimum-maximum range, for example,
2-10
. If quota support is disabled, a constant value, for example,10
, needs to be provided, otherwise cleaning up fails with an error.NUMBER_MIN_AGE
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.
The default value is
"1800"
.Example command to change or set:
>
sudo
snapper -c CONFIG set-config "NUMBER_MIN_AGE=864000"
NUMBER_LIMIT
, NUMBER_LIMIT_IMPORTANT
and NUMBER_MIN_AGE
are always evaluated. Snapshots are
only deleted when all conditions are met.
If you always want to keep the number of snapshots defined with
NUMBER_LIMIT*
regardless of their age, set
NUMBER_MIN_AGE
to 0
.
The following example shows a configuration to keep the last 10 important and regular snapshots regardless of age:
NUMBER_CLEANUP=yes NUMBER_LIMIT_IMPORTANT=10 NUMBER_LIMIT=10 NUMBER_MIN_AGE=0
If you do not want to keep snapshots beyond a certain
age, set NUMBER_LIMIT*
to 0
and
provide the age with NUMBER_MIN_AGE
.
The following example shows a configuration to only keep snapshots younger than ten days:
NUMBER_CLEANUP=yes NUMBER_LIMIT_IMPORTANT=0 NUMBER_LIMIT=0 NUMBER_MIN_AGE=864000
10.7.2 Cleaning up timeline snapshots #
Cleaning up timeline snapshots is controlled by the following parameters of a Snapper configuration.
TIMELINE_CLEANUP
Enables or disables clean-up of timeline snapshots. If enabled, snapshots are deleted when the total snapshot count exceeds a number specified with
TIMELINE_LIMIT_*
and an age specified withTIMELINE_MIN_AGE
. Valid values:yes
,no
.The default value is
"yes"
.Example command to change or set:
>
sudo
snapper -c CONFIG set-config "TIMELINE_CLEANUP=yes"TIMELINE_LIMIT_DAILY
,TIMELINE_LIMIT_HOURLY
,TIMELINE_LIMIT_MONTHLY
,TIMELINE_LIMIT_WEEKLY
,TIMELINE_LIMIT_YEARLY
Number of snapshots to keep for hour, day, month, week and year.
The default value for each entry is
"10"
, except forTIMELINE_LIMIT_WEEKLY
, which is set to"0"
by default.TIMELINE_MIN_AGE
Defines the minimum age in seconds a snapshot must have before it can automatically be deleted.
The default value is
"1800"
.
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"
This example configuration enables hourly snapshots which are
automatically cleaned up. TIMELINE_MIN_AGE
and
TIMELINE_LIMIT_*
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
TIMELINE_LIMIT_DAILY
is set to not zero, this means
that the first snapshot of the day is kept, too.
Hourly: the last 24 snapshots that have been made.
Daily: the first daily snapshot that has been made is kept from the last seven days.
Monthly: the first snapshot made on the last day of the month is kept for the last twelve months.
Weekly: the first snapshot made on the last day of the week is kept from the last four weeks.
Yearly: the first snapshot made on the last day of the year is kept for the last two years.
10.7.3 Cleaning up snapshot pairs that do not differ #
As explained in Section 10.1.2, “Types of snapshots”, 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 “empty” snapshot pairs can be automatically be deleted by setting the following parameters in a Snapper configuration:
EMPTY_PRE_POST_CLEANUP
If set to
yes
, pre and post snapshot pairs that do not differ will be deleted.The default value is
"yes"
.EMPTY_PRE_POST_MIN_AGE
Defines the minimum age in seconds a pre and post snapshot pair that does not differ must have before it can automatically be deleted.
The default value is
"1800"
.
10.7.4 Cleaning up manually created snapshots #
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 “clean-up queue” for the algorithm you specified. You can specify a clean-up algorithm when creating a snapshot, or by modifying an existing snapshot:
snapper create --description "Test" --cleanup-algorithm number
Creates a stand-alone snapshot (type single) for the default (root) configuration and assigns the
number
clean-up algorithm.snapper modify --cleanup-algorithm "timeline" 25
Modifies the snapshot with the number 25 and assigns the clean-up algorithm
timeline
.
10.7.5 Adding disk quota support #
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.
Btrfs quotas are applied to subvolumes, not to users. You may apply
disk space quotas to users and groups (for example, with the
quota
command) in addition to using Btrfs quotas.
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 snapper
setup-quota
. This requires a valid configuration (see
Section 10.5, “Creating and modifying Snapper configurations” for more information).
Quota support is controlled by the following parameters of a Snapper configuration.
QGROUP
The Btrfs quota group used by Snapper. If not set, run
snapper setup-quota
. If already set, only change if you are familiar withman 8 btrfs-qgroup
. This value is set withsnapper setup-quota
and should not be changed.SPACE_LIMIT
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%, ...).
The following limitations and guidelines apply:
Quotas are only activated in addition to an existing number and/or timeline clean-up algorithm. If no clean-up algorithm is active, quota restrictions are not applied.
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.
Even if quota support is enabled, Snapper will always keep the number of snapshots specified with the
NUMBER_LIMIT*
andTIMELINE_LIMIT*
values, even if the quota will be exceeded. It is therefore recommended to specify ranged values (MIN-MAX
) forNUMBER_LIMIT*
andTIMELINE_LIMIT*
to ensure the quota can be applied.If, for example,
NUMBER_LIMIT=5-20
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.
10.8 Showing exclusive disk space used by snapshots #
Snapshots share data, for efficient use of storage space, so using ordinary
commands like du
and df
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
Used Space
column:
#
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 | |
The btrfs
command provides another view of space used by
snapshots:
#
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 ---
The qgroupid
column displays the identification number for
each subvolume, assigning a qgroup level/ID combination.
The rfer
column displays the total amount of data
referred to in the subvolume.
The excl
column displays the exclusive data in each
subvolume.
The parent
column shows the parent qgroup of the subvolumes.
The final item, 1/0
, 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:
#
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
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 Section 10.6.4, “Deleting snapshots” for details.
10.9 Frequently asked questions #
- Q:
Why does Snapper never show changes in
/var/log
,/tmp
and other directories? For certain directories, we decided to exclude them from snapshots. See Section 10.1.3, “Directories that are excluded from snapshots” for a list and reasons. To exclude a path from snapshots we create a subvolume for that path.
- Q: Can I boot a snapshot from the boot loader?
Yes—refer to Section 10.3, “System rollback by booting from snapshots” for details.
- Q: Can a snapshot be protected from deletion?
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 Section 10.6.2, “Creating snapshots”) have no clean-up algorithm assigned unless you specify one with
--cleanup-algorithm
. Automatically created snapshots always either have thenumber
ortimeline
algorithm assigned. To remove such an assignment from one or more snapshots, proceed as follows:List all available snapshots:
>
sudo
snapper list -aMemorize the number of the snapshots you want to prevent from being deleted.
Run the following command and replace the number placeholders with the numbers you memorized:
>
sudo
snapper modify --cleanup-algorithm "" #1 #2 #nCheck the result by running
snapper list -a
again. The entry in the columnCleanup
should now be empty for the snapshots you modified.
- Q: Where can I get more information on Snapper?
See the Snapper home page at http://snapper.io/.
11 Live kernel patching with KLP #
This document describes the basic principles of the Kernel Live Patching (KLP) technology, and provides usage guidelines for the SLE Live Patching service.
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.
The information provided in this document relates to the AMD64/Intel 64, POWER, and IBM Z architectures.
11.1 Advantages of Kernel Live Patching #
KLP offers several benefits.
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.
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.
Since KLP is part of the standard system update mechanism, there is no need for specialized training or introduction of complicated maintenance routines.
11.2 Kernel Live Patching overview #
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.
To determine the kernel patching status, use the klp -v
patches
command. The uname
command's output
does not change for patched kernels.
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.
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 klp -v
patches
command.
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 Section 11.5.1, “Checking expiration date of the live patch”).
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 initial patches
.
11.2.1 Kernel Live Patching scope #
The scope of SLE Live Patching includes fixes for SUSE Common Vulnerability Scoring System (CVSS; SUSE CVSS is based on the CVSS v3.1 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 Common Vulnerability Scoring System SIG.
11.2.2 Kernel Live Patching limitations #
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, certain fixes cannot be converted to live patches. In this situation, a system restart is the only way to apply the fixes.
11.3 Activating Kernel Live Patching using YaST #
To activate KLP on your system, you need to have active SLES and SLE Live Patching subscriptions. Visit SUSE Customer Center to check the status of your subscriptions and obtain a registration code for the SLE Live Patching subscription.
To activate Kernel Live Patching on your system, follow these steps:
Run the
yast2 registration
command and click .Select
in the list of available extensions and click .Confirm the license terms and click
.Enter your SLE Live Patching registration code and click
.Check the
and selected . The patternsLive Patching
andSLE Live Patching Lifecycle Data
should be automatically selected for installation along with additional packages to satisfy dependencies.Click
to complete the installation. This installs the base Kernel Live Patching components on your system, the initial live patch, and the required dependencies.
11.4 Activating Kernel Live Patching from the command line #
To activate Kernel Live Patching, you need to have active SLES and SLES Live Patching subscriptions. Visit SUSE Customer Center to check the status of your subscriptions and obtain a registration code for the SLES Live Patching subscription.
Run
sudo SUSEConnect --list-extensions
. Note the exact activation command for SLES Live Patching. Example command output (abbreviated):$ SUSEConnect --list-extensions ... SUSE Linux Enterprise Live Patching 15 SP6 x86_64 Activate with: SUSEConnect -p sle-module-live-patching/15.6/x86_64 \ -r ADDITIONAL REGCODE
Activate SLES Live Patching using the obtained command followed by
-r LIVE_PATCHING_REGISTRATION_CODE
, for example:SUSEConnect -p sle-module-live-patching/15.6/x86_64 \ -r LIVE_PATCHING_REGISTRATION_CODE
Install the required packages and dependencies using the command
zypper install -t pattern lp_sles
At this point, the system has already been live-patched.
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 as part of the package installation. The kernel gets live-patched even before the product installation is complete.
11.5 Performing Kernel Live Patching #
Kernel live patches are installed as part of regular system updates. However, there are several things you should be aware of.
The kernel is live-patched if a kernel-livepatch-* package has been installed for the running kernel. You can use the command
zypper se --details kernel-livepatch-*
to check what kernel live patch packages are installed on your system.When the kernel-default 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 Live Patching with SUSE Manager).
You can check patching status using the
klp status
command. To examine installed patches, run theklp -v patches
command.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.
The active live patch is included in the
initrd
. 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.
11.5.1 Checking expiration date of the live patch #
Make sure that the
lifecycle-data-sle-module-live-patching is installed,
then run the zypper lifecycle
command. You should see
expiration dates for live patches in the Package end of support if
different from product
section of the output.
Every live patch receives updates for one year from the release of the underlying kernel package. The Maintained kernels, patch updates and lifecycle page allows you to check expiration dates based on the running kernel version without installing the product extension.
11.6 Troubleshooting Kernel Live Patching issues #
11.6.1 Manual patch downgrade #
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.
Identify the running live patch using the
klp -v patches
command. You can see the currently running patch on the line starting withRPM:
. For example:RPM: kernel-livepatch-6_4_0-150600_9-default-1-150600.2.36.x86_64
The
6_4_0-150600_9-default
in the example above denotes the exact running kernel version.Use the command
zypper search -s kernel-livepatch-RUNNING_KERNEL_VERSION-default
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.Install the desired version with the command
zypper in --oldpackage kernel-livepatch-RUNNING_KERNEL_VERSION-default=DESIRED_VERSION
.
12 User space live patching #
This chapter describes the basic principles and usage of user space live patching.
12.1 About user space live patching #
User space live patching (ULP) refers to the process of applying patches to the libraries used by a running process without interrupting them. Every time a security fix is available as a live patch, customer services will be secured after applying the live patch without restarting the processes.
Live patching operations are performed using the
ulp
tool that is part of
libpulp
. libpulp
is a
framework that consists of the libpulp.so
library and the ulp
binary that makes libraries live
patchable and applies live patches.
You can run the ulp
command either as a normal user
or a privileged user via the sudo
mechanism. The difference is that
running ulp
via sudo
lets you view information of
processes or patch processes that are running by root
.
12.1.1 Prerequisites #
For ULP to work, two requirements must be met.
Install the ULP on your system by running:
>
sudo
zypper in libpulp0 libpulp-toolsApplications with desired live patch support must be launched preloading the
libpulp.so.0
library. See Section 12.1.3, “Usinglibpulp
” for more details.
12.1.2 Supported libraries #
Currently, only glibc
and
openssl
(openssl1_1
and openssl-3
)
are supported. Additional packages will be available after they are
prepared for live patching. To receive glibc
and openssl
live patches, install both
glibc-livepatches and
openssl-livepatches packages:
>
zypper install glibc-livepatches openssl-livepatches
12.1.3 Using libpulp
#
To enable live patching on an application, you need to preload the
libpulp.so.0
library when starting the
application:
>
LD_PRELOAD=/usr/lib64/libpulp.so.0 APPLICATION_CMD
12.1.3.1 Checking if a library is live patchable #
To check whether a library is live patchable, use the following command:
>
ulp livepatchable PATH_TO_LIBRARY
12.1.3.2 Checking if a .so
file is a live patch container #
A shared object (.so
) is a live patch container
if it contains the ULP patch description embedded into it. You can
verify it with the following command:
>
readelf -S SHARED_OBJECT | grep .ulp
If the output shows that there are both .ulp
and
.ulp.rev
sections in the shared object, then it is
a live patch container.
12.1.3.3 Applying live patches #
Live patches are applied using the ulp trigger
command, for example:
>
ulp trigger -p PID LIVEPATCH.so
Replace PID
with the process ID of the running
process that uses the library to be patched and
LIVEPATCH.so
with the actual live patch file. The
command returns one of the following status messages:
- SUCCESS
The live patching operation was successful.
- SKIPPED
The patch was skipped because it was not designed for any library that is loaded in the process.
- ERROR
An error occurred, and you can retrieve more information by inspecting the
libpulp
internal message buffer. See Section 12.1.3.6, “View internal message queue” for more information.
It is also possible to apply multiple live patches by using wildcards, for example:
>
ulp trigger '*.so'
The command tries to apply every patch in the current folder to every
process that have the libpulp
library
loaded. If the patch is not suitable for the process, it is
automatically skipped. In the end, the tool shows how many patches it
successfully applied to how many processes.
12.1.3.4 Reverting live patches #
You can use the ulp trigger
command to revert live
patches. There are two ways to revert live patches. You can revert a
live patch by using the --revert
switch and passing
the live patch container:
>
ulp trigger -p PID --revert LIVEPATCH.so
Alternatively, it is possible to remove all patches associated with a particular library, for example:
>
ulp trigger -p PID --revert-all=LIBRARY
In the example, LIBRARY refers to the
actual library, such as libcrypto.so.1.1
.
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 while the target application is still running a secure code, for example:
>
ulp trigger -p PID --revert-all=libcrypto.so.1.1 new_livepatch2.so
12.1.3.5 View applied patches #
It is possible to verify which applications have live patches applied by running:
>
ulp patches
The output shows which libraries are live patchable and patches loaded in programs, as well which bugs the patch addresses:
PID: 10636, name: test Livepatchable libraries: in /lib64/libc.so.6: livepatch: libc_livepatch1.so bug labels: jsc#SLE-0000 in /usr/lib64/libpulp.so.0:
It is also possible to see which functions are patched by the live patch:
>
ulp dump LIVEPATCH.so
12.1.3.6 View internal message queue #
Log messages from libpulp.so
are stored in a
buffer inside the library and are not displayed unless requested by
the user. To show these messages, run:
>
ulp messages -p PID
12.2 More information #
Further information about libpulp
is available
in the project's Git
repository.
13 Transactional updates #
Transactional updates are available in SUSE Linux Enterprise Desktop 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 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 administrator must decide if a reboot is more expensive than disturbing running services. If reboots are too expensive then do not use transactional updates.
Transactional updates are run daily by the
transactional-update
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 updated, it is
marked as active and will be the new default root file system after the next
reboot of the system. When transactional-update
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.
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.
RPMs that require a license to be accepted cannot be updated.
13.1 Limitations #
Currently, there are certain limitations in the functionality of
transactional updates. The following packages do not work with the
transactional-update
command:
The nginx default
index.html
page may not be availabletomcat-webapps and tomcat-admin-webapps
phpMyAdmin
sca-appliance-*
mpi-selector
emacs works except for Emacs games
bind and bind-chrootenv
docbook*
sblim-sfcb*
texlive*
iso_ent
openjade
opensp
pcp
plymouth
postgresql-server-10
pulseaudio-gdm-hooks
smartmontools
The updater component of the system installer does not work with a read-only file system as it has no support for transactional updates.
Further considerations:
It is a good idea to minimize the time between updating the system and rebooting the machine.
Only one update can be applied at a time. Be sure to reboot after an update, and before the next update is applied.
update-alternatives
should not be run after a transactional update until the machine has been rebooted.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).
YaST is not yet aware of transactional updates. If a YaST module needs to install additional packages, this does not work. Normal system operations that modify configuration files in
/etc
work.For php7-fastcgi, you must manually create a symbolic link,
/srv/www/cgi-bin/php
, that points to/usr/bin/php-cgi
.ntpis part of the Legacy Module for migration from older SLES versions. It is not supported on a new SUSE Linux Enterprise Desktop installation, and has been replaced by chrony. If you continue to use ntp, a fresh installation is required to work correctly with transactional updates.
sblim-sfcb: the whole sblim ecosystem is incompatible with transactional update.
btrfs-defrag
from the btrfsmaintenance package does not work with a read-only root file system.For
btrfs-balance
, the variableBTRFS_BALANCE_MOUNTPOINTS
in/etc/sysconfig/btrfsmaintenance
must be changed from/
to/.snapshots
.For
btrfs-scrub
, the variableBTRFS_SCRUB_MOUNTPOINTS
in/etc/sysconfig/btrfsmaintenance
must be changed from/
to/.snapshots
.
13.2 Enabling transactional-update #
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.
Changing the subvolume layout of the root partition, or putting
subdirectories or subvolumes of the root partition on their own partitions
(except /home
, /var
,
/srv
, and /opt
) is not supported,
and may break the system.
13.3 Managing automatic updates #
Automatic updates are controlled by a systemd.timer
that runs once per day. This applies all updates, and informs
rebootmgrd
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 rebootmgrd
reboots the
system, see rebootmgrd(8).
You can disable automatic transactional updates with this command:
#
systemctl --now disable transactional-update.timer
13.4 The transactional-update
command #
The transactional-update
command enables atomic
installation or removal of updates. Updates are applied only if they all can
be successfully installed.
transactional-update
creates a snapshot of your system
before the update is applied, and you can restore this snapshot. All changes become
active only after reboot.
--continue
The
--continue
option is for making multiple changes to an existing snapshot without rebooting.The default
transactional-update
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, runtransactional-update
again to install the forgotten package, and reboot again. You cannot run thetransactional-update
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.Use the
--continue
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.Another useful feature of the
--continue
option is you may select any existing snapshot as the base for your new snapshot. The following example demonstrates runningtransactional-update
to install a new package in a snapshot based on snapshot 13, and then running it again to install another package:#
transactional-update pkg install package_1
#
transactional-update --continue 13 pkg install package_2
The
--continue [num]
option callssnapper create --from
, see Section 10.6.2, “Creating snapshots”.cleanup
If the current root file system is identical to the active root file system (after a reboot, before
transactional-update
creates a new snapshot with updates), all old snapshots without a cleanup algorithm get a cleanup algorithm set. This ensures that old snapshots are deleted by Snapper. (See the section about cleanup algorithms in snapper(8).) This also removes all unreferenced (and thus unused)/etc
overlay directories in/var/lib/overlay
:#
transactional-update cleanup
pkg in/install
Installs individual packages from the available channels using the
zypper install
command. This command can also be used to install Program Temporary Fix (PTF) RPM files.#
transactional-update pkg install package_name
or
#
transactional-update pkg install rpm1 rpm2
pkg rm/remove
Removes individual packages from the active snapshot using the
zypper remove
command. This command can also be used to remove PTF RPM files.#
transactional-update pkg remove package_name
pkg up/update
Updates individual packages from the active snapshot using the
zypper update
command. Only packages that are part of the snapshot of the base file system can be updated.#
transactional-update pkg update package_name
up/update
If there are new updates available, a new snapshot is created and
zypper up/update
updates the snapshot.#
transactional-update up
dup
If there are new updates available, a new snapshot is created and
zypper dup –no-allow-vendor-change
updates the snapshot. The snapshot is activated afterwards and becomes the new root file system after reboot.#
transactional-update dup
patch
If there are new updates available, a new snapshot is created and
zypper patch
updates the snapshot.#
transactional-update patch
rollback
This sets the default subvolume. On systems with a read-write file system
snapper rollback
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.#
transactional-update rollback snapshot_number
grub.cfg
This creates a new GRUB2 configuration. Sometimes it is necessary to adjust the boot configuration, for example, adding additional kernel parameters. Edit /etc/default/grub, run
transactional-update grub.cfg
, and then reboot to activate the change. You must immediately reboot, or the new GRUB2 configuration gets overwritten with the default by the nexttransactional-update
run.#
transactional-update grub.cfg
reboot
This parameter triggers a reboot after the action is completed.
#
transactional-update dup reboot
--help
This prints a help screen with options and subcommands.
#
transactional-update --help
13.5 Troubleshooting #
If the upgrade fails, run supportconfig
to collect log
data. Provide the resulting files, including
/var/log/transactional-update.log
to SUSE Support.
14 Remote graphical sessions with VNC #
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.
SUSE Linux Enterprise Desktop supports two different kinds of VNC sessions: one-time sessions that “live” While the VNC connection from the client is kept up, and persistent sessions that “live” until they are explicitly terminated.
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.
14.1 The vncviewer
client #
To connect to a VNC service provided by a server, a client is needed. The
default in SUSE Linux Enterprise Desktop is vncviewer
, provided by the
tigervnc
package.
14.1.1 Connecting using the vncviewer CLI #
To start your VNC viewer and initiate a session with the server, use the command:
>
vncviewer jupiter.example.com:1
Instead of the VNC display number you can also specify the port number with two colons:
>
vncviewer jupiter.example.com::5901
The actual display or port number you specify in the VNC client must be the same as the display or port number selected when configuring a VNC server on the target machine. See Section 14.4, “Configuring persistent VNC server sessions” for further info.
14.1.2 Connecting using the vncviewer GUI #
When running vncviewer
without specifying
--listen
or a host to connect to, it shows a window
asking for connection details. Enter the host into the field like in Section 14.1.1, “Connecting using the vncviewer CLI”
and click .
14.1.3 Notification of unencrypted connections #
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 “(Connection not encrypted!)” can be seen in the window title of the VNC viewer.
14.2 Remmina: the remote desktop client #
Remmina is a modern and feature-rich remote desktop client. It supports several access methods, for example, VNC, SSH, RDP and Spice.
14.2.1 Installation #
To use Remmina, verify whether the remmina package is installed on your system, and install it if not. Remember to install the VNC plug-in for Remmina as well:
#
zypper in remmina remmina-plugin-vnc
14.2.2 Main window #
Run Remmina by entering the remmina
command.
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.
14.2.3 Adding remote sessions #
To add and save a new remote session, click in the top left of the main window. The window opens.
Complete the fields that specify your newly added remote session profile. The most important are:
- Name
Name of the profile. It will be listed in the main window.
- Protocol
The protocol to use when connecting to the remote session, for example, VNC.
- Server
The IP or DNS address and display number of the remote server.
- User name, password
Credentials to use for remote authentication. Leave empty for no authentication.
- Color depth, quality
Select the best options according to your connection speed and quality.
Select the
tab to enter more specific settings.If the communication between the client and the remote server is not encrypted, activate
, otherwise the connection fails.Select the
tab for advanced SSH tunneling and authentication options.Confirm with
. Your new profile is now listed in the main window.14.2.4 Starting remote sessions #
You can either start a previously saved session, or quick-start a remote session without saving the connection details.
14.2.4.1 Quick-starting remote sessions #
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.
Select the communication protocol from the drop-down list, for example, “VNC”, then enter the VNC server DNS or IP address followed by a colon and a display number, and confirm with Enter.
14.2.4.2 Opening saved remote sessions #
To open a specific remote session, double-click it from the list of sessions.
14.2.4.3 Remote sessions window #
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. For example, toggle full-screen 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.
14.2.5 Editing, copying, and deleting saved sessions #
To edit a saved remote session, right-click its name in Remmina's main window and select . Refer to Section 14.2.3, “Adding remote sessions” for the description of the relevant fields.
To copy a saved remote session, right-click its name in Remmina's main window and select . In the window, change the name of the profile, optionally adjust relevant options, and confirm with .
To Delete a saved remote session, right-click its name in Remmina's main window and select . Confirm with in the next dialog.
14.2.6 Running remote sessions from the command line #
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:
>
remmina -c profile_name.remmina
Remmina's profile files are stored in the
.local/share/remmina/
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.
While Remmina is not running, you can rename the profile file to a more
reasonable file name, such as sle15.remmina
. You can
even copy the profile file to your custom directory and run it using the
remmina -c
command from there.
14.3 Configuring one-time sessions on the VNC server #
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 cancel the client connection to such a VNC session, all applications started within that session are 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.
Start
› › .Check
.Activate
if you plan to access the VNC session in a Web browser window.If necessary, also check
(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 .Confirm your settings with
.In case not all needed packages are available yet, you need to approve the installation of missing packages.
Tip: Restart the display managerYaST 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.
14.3.1 Available configurations #
The default configuration on SUSE Linux Enterprise Desktop serves sessions with a
resolution of 1024x768 pixels at a color depth of 16-bit. The sessions are
available on ports 5901
for
“regular” VNC viewers (equivalent to VNC display
1
) and on port
5801
for Web browsers.
Other configurations can be made available on different ports. Ask your system administrator for details if you need to modify the configuration.
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.
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.
Certain 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 x509
, or generate a properly signed
certificate for the VNC server and import it to the client's system trust
store.
14.3.2 Initiating a one-time VNC session #
To connect to a one-time VNC session, a VNC viewer must be installed, see
also Section 14.1, “The vncviewer
client”. Alternatively use a
JavaScript-capable Web browser to view the VNC session by entering the
following URL: http://jupiter.example.com:5801
14.3.3 Configuring one-time VNC sessions #
You can skip this section, if you do not need or want to modify the default configuration.
One-time VNC sessions are started via the systemd
socket
xvnc.socket
. By default it offers six
configuration blocks: three for VNC viewers (vnc1
to
vnc3
), and three serving a JavaScript client
(vnchttpd1
to vnchttpd3
). By default
only vnc1
and vnchttpd1
are active.
To activate the VNC server socket at boot time, run the following command:
>
sudo
systemctl enable xvnc.socket
To start the socket immediately, run:
>
sudo
systemctl start xvnc.socket
The Xvnc
server can be configured via the
server_args
option. For a list of options, see
Xvnc --help
.
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.
Activate configuration changes by entering the following command:
>
sudo
systemctl reload xvnc.socket
When activating Remote Administration as described in
Procedure 14.1, “Enabling one-time VNC sessions”, the ports
5801
and
5901
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
Book “Security and Hardening Guide”, Chapter 23 “Masquerading and firewalls” for instructions.
14.4 Configuring persistent VNC server sessions #
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 may need access to the trainee's desktop.
To connect to a persistent VNC session, a VNC viewer must be installed.
Refer to Section 14.1, “The vncviewer
client” for more details. Alternatively,
use a JavaScript-capable Web browser to view the VNC session by entering the
following URL: http://jupiter.example.com:5801
.
14.4.1 VNC session initiated using vncmanager
#
Start
› › .Activate
.Activate
if you plan to access the VNC session in a Web browser window.If necessary, also check
(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 .Confirm your settings with
.In case not all needed packages are available yet, you need to approve the installation of missing packages.
Tip: Restart the display managerYaST 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.
14.4.1.1 Configuring persistent VNC sessions #
After you enable the VNC session management as described in Procedure 14.2, “Enabling persistent VNC sessions”, you can normally connect to
the remote session with your favorite VNC viewer, such as
vncviewer
or Remmina. After you log in, the
“VNC” icon appears in the system tray of your desktop
environment. Click the icon to open the
window. If your desktop environment does not support icons in the system
tray, run vncmanager-controller
manually.
There are several settings that influence the VNC session's behavior:
This is equivalent to a one-time session. It is not visible to others and is terminated after you disconnect from it. Refer to Section 14.3, “Configuring one-time sessions on the VNC server” for more information.
The session is visible to other users and keeps running even after you disconnect from it.
Specify the name of the persistent session so that it is easily identified when reconnecting.
The session is freely accessible without having to log in under user credentials.
You need to log in with a valid user name and password to access the session. Lists the valid user names in the
text box.Prevents multiple users from joining the session at the same time.
Allows multiple users to join the persistent session at the same time. Useful for remote presentations or training sessions.
Confirm with
.14.4.1.2 Joining persistent VNC sessions #
After you set up a persistent VNC session as described in Section 14.4.1.1, “Configuring persistent VNC sessions”, you can join it with your VNC viewer. After your VNC client connects to the server, you are prompted to choose whether you want to create a new session or join the existing one:
After you click the name of the existing session, you may be asked for login credentials, depending on the persistent session settings.
14.5 Configuring encryption on the VNC server #
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.
Whether for a one-time or a persistent VNC session, security options are
configured via the -securitytypes
parameter of the
/usr/bin/Xvnc
command located on the
server_args
line. The -securitytypes
parameter selects both authentication method and encryption. It has the
following options:
- None, TLSNone, x509None
No authentication.
- VncAuth, TLSVnc, x509Vnc
Authentication using custom password.
- Plain, TLSPlain, x509Plain
Authentication using PAM to verify user's password.
- None, vncAuth, plain
No encryption.
- TLSNone, TLSVnc, TLSPlain
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.
- X509None, x509Vnc, x509Plain
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).
TipCertain 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
x509
, or generate a properly signed certificate for the VNC server and import it to the client's system trust store.Tip: Path to certificate and keyWith X509 based encryption, you need to specify the path to the X509 certificate and the key with
-X509Cert
and-X509Key
options.
If you select multiple security types separated by comma, the first one supported and allowed by both client and server is 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.
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 warns you with the
Connection not encrypted!
message in that case).
14.6 Compatibility with Wayland #
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 gdm, edit /etc/gdm/custom.conf
.
In the [daemon]
section, add
WaylandEnable=false
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 gnome-session-wayland package.
15 File copying with RSync #
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.
Before you start using a synchronization tool, you should familiarize yourself with its features and functionality. Make sure to back up your important files.
15.1 Conceptual overview #
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.
Detecting changes requires certain computing power. So make sure that machines on both ends have enough resources, including RAM.
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.
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.
15.2 Basic syntax #
Rsync is a command-line tool that has the following basic syntax:
rsync [OPTION] SOURCE [SOURCE]... DEST
You can use Rsync on any local or remote machine, provided you have access and write permissions. It is possible to have multiple SOURCE entries. The SOURCE and DEST placeholders can be paths, URLs or both.
Below are the most common Rsync options:
-v
Outputs more verbose text
-a
Archive mode; copies files recursively and preserves time stamps, user/group ownership, file permissions, and symbolic links
-z
Compresses the transmitted data
When working with Rsync, you should pay particular attention to trailing slashes. A trailing slash after the directory denotes the content of the directory. No trailing slash denotes the directory itself.
15.3 Copying files and directories locally #
The following description assumes that the current user has write
permissions to the directory /var/backup
. To copy a
single file from one directory on your machine to another path, use the
following command:
>
rsync
-avz backup.tar.xz /var/backup/
The file backup.tar.xz
is copied to
/var/backup/
; the absolute path is
/var/backup/backup.tar.xz
.
Do not forget to add the trailing slash after the
/var/backup/
directory. If you do not insert the slash,
the file backup.tar.xz
is copied to
/var/backup
(file) not inside the
directory /var/backup/
!
Copying a directory is similar to copying a single file. The following
example copies the directory tux/
and
its content into the directory /var/backup/
:
>
rsync
-avz tux /var/backup/
Find the copy in the absolute path
/var/backup/tux/
.
15.4 Copying files and directories remotely #
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.
To copy the file file.tar.xz
from your local host to
the remote host
192.168.1.1
with
same users (being local and remote), use the following command:
>
rsync
-avz file.tar.xz tux@192.168.1.1:
Depending on what you prefer, these commands are also possible and equivalent:
>
rsync
-avz file.tar.xz 192.168.1.1:~>
rsync
-avz file.tar.xz 192.168.1.1:/home/tux
In all cases with standard configuration, you are prompted to enter your
passphrase of the remote user. This command copies
file.tar.xz
to the home directory of user tux
(normally /home/tux
).
Copying a directory remotely is similar to copying a directory locally. The
following example copies the directory
tux/
and its content into the remote
directory /var/backup/
on the
192.168.1.1
host:
>
rsync
-avz tux 192.168.1.1:/var/backup/
Assuming you have write permissions on the host
192.168.1.1
, you can
find the copy in the absolute path
/var/backup/tux
.
15.5 Configuring and using an rsync server #
Rsync can run as a daemon
(rsyncd
) listening on default
port 873 for incoming connections. This daemon can receive “copying
targets”.
The following description explains how to create an Rsync server on a
jupiter
host with a backup
target. This target can be used to store your backups. To create an Rsync
server, do the following:
On jupiter, create a directory to store all your backup files. In this example, we use
/var/backup
:#
mkdir
/var/backupSpecify ownership. In this case, the directory is owned by user
tux
in groupusers
:#
chown
tux.users /var/backupConfigure the rsyncd daemon.
We separate the configuration file into a main file and certain “modules” which hold your backup target. This makes it easier to add additional targets later. Global values can be stored in
/etc/rsyncd.d/*.inc
files, whereas your modules are placed in/etc/rsyncd.d/*.conf
files:Create a directory
/etc/rsyncd.d/
:#
mkdir
/etc/rsyncd.d/In the main configuration file
/etc/rsyncd.conf
, add the following lines:# rsyncd.conf main configuration file log file = /var/log/rsync.log pid file = /var/lock/rsync.lock &merge /etc/rsyncd.d 1 &include /etc/rsyncd.d 2
Create your module (your backup target) in the file
/etc/rsyncd.d/backup.conf
with the following lines:# backup.conf: backup module [backup] 1 uid = tux 2 gid = users 2 path = /var/backup 3 auth users = tux 4 secrets file = /etc/rsyncd.secrets 5 comment = Our backup target
The backup 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
*.conf
file.Specifies the user name or group name that is used when the file transfer takes place.
Defines the path to store your backups (from Step 1).
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
tux
is allowed.Specifies the path of a file that contains lines with user names and plain passwords.
Create the
/etc/rsyncd.secrets
file with the following content and replace PASSPHRASE:# user:passwd tux:PASSPHRASE
Make sure the file is only readable by
root
:#
chmod
0600 /etc/rsyncd.secrets
Start and enable the rsyncd daemon with:
#
systemctl
enable rsyncd#
systemctl
start rsyncdTest the access to your Rsync server:
>
rsync
jupiter::You should see a response that looks like this:
backup Our backup target
Otherwise, check your configuration file, firewall and network settings.
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 /var/log/rsyncd.log
. This is useful to debug
your transfers.
To list the content of your backup target, use the following command:
>
rsync -avz jupiter::backup
This command lists all files present in the directory
/var/backup
on the server. This request is also logged
in the log file /var/log/rsyncd.log
. To start an actual
transfer, provide a source directory. Use .
for the
current directory. For example, the following command copies the current
directory to your Rsync backup server:
>
rsync -avz . jupiter::backup
By default, Rsync does not delete files and directories when it runs. To
enable deletion, the additional option --delete
must be
stated. To ensure that no newer files are deleted, the option
--update
can be used instead. Any conflicts that arise must
be resolved manually.
15.6 More information #
- Csync
Bidirectional file synchronization tool, see https://csync.org/.
- RSnapshot
Creates incremental backups, see https://rsnapshot.org.
- Unison
A file synchronization tool similar to CSync but with a graphical interface, see https://github.com/bcpierce00/unison.
- Rear
A disaster recovery framework, see the Administration Guide of the SUSE Linux Enterprise High Availability, chapter Disaster Recovery with Rear (Relax-and-Recover).
Part II Booting a Linux system #
- 16 Introduction to the boot process
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 the boot loader GRUB 2. After this point, the boot process is controlled by the operating system and handled by
systemd
.systemd
provides a set of “targets” that boot configurations for everyday usage, maintenance or emergencies.- 17 UEFI (Unified Extensible Firmware Interface)
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.
- 18 The boot loader GRUB 2
This chapter describes how to configure GRUB 2, the boot loader used in SUSE® Linux Enterprise Desktop. It is the successor to the traditional GRUB boot loader—now called “GRUB Legacy”. GRUB 2 has been the default boot loader in SUSE® Linux Enterprise Desktop since version 12. A YaST module is available for configuring the most important settings. The boot procedure as a whole is outlined in Chapter 16, Introduction to the boot process. For details on Secure Boot support for UEFI machines, see Chapter 17, UEFI (Unified Extensible Firmware Interface).
- 19 The
systemd
daemon systemd initializes the system. It has the process ID 1. systemd is started directly by the kernel and resists signal 9, which normally terminates processes. All other programs are started directly by systemd or by one of its child processes. systemd is a replacement for the System V init daemon and…
16 Introduction to the boot process #
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 the boot loader
GRUB 2. After this point, the boot process is controlled by the
operating system and handled by systemd
. systemd
provides a set of
“targets” that boot configurations for everyday usage,
maintenance or emergencies.
16.1 Terminology #
This chapter uses terms that can be interpreted ambiguously. To understand how they are used here, read the definitions below:
init
Two different processes are commonly named “init”:
The
initramfs
process mounting the root file systemThe operating system process that starts all other processes that is executed from the real root file system
In both cases, the
systemd
program is taking care of this task. It is first executed from theinitramfs
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 twosystemd
processes, we refer to the first process as init on initramfs and to the second one as systemd.-
initrd
/initramfs
An
initrd
(initial RAM disk) is an image file containing a root file system image which is loaded by the kernel and mounted from/dev/ram
as the temporary root file system. Mounting this file system requires a file system driver.Beginning with kernel 2.6.13, the initrd has been replaced by the
initramfs
(initial RAM file system), which does not require a file system driver to be mounted. SUSE Linux Enterprise Desktop exclusively uses aninitramfs
. However, since theinitramfs
is stored as/boot/initrd
, it is often called “initrd”. In this chapter we exclusively use the nameinitramfs
.
16.2 The Linux boot process #
The Linux boot process consists of several stages, each represented by a different component:
16.2.1 The initialization and boot loader phase #
During the initialization phase, the machine's hardware is set up, and the devices are prepared. This process differs across hardware architectures.
SUSE Linux Enterprise Desktop 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 Chapter 18, The boot loader GRUB 2.
16.2.1.1 Initialization and boot loader phase on AArch64 and AMD64/Intel 64 #
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.
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
/boot
located on the root file
system. /boot
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.
When booting a BIOS system from an encrypted file system that includes an
encrypted /boot
partition, you need to enter the
password for decryption twice. It is first needed by GRUB 2 to decrypt
/boot
and then for systemd
to mount the encrypted
volumes.
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
/boot/efi
) holds enough space to host a fully fledged
GRUB 2 which is directly loaded and executed by the firmware.
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, independent of local hard disks.
16.2.1.2 Initialization and boot loader phase on IBM Z #
On IBM Z the boot process must be initialized by a boot loader
called zipl
(z initial program load). Although
zipl
supports reading from multiple file systems, it
does not support the SLE default file system (Btrfs) or booting from
snapshots. SUSE Linux Enterprise Desktop therefore uses a two-stage boot process that
ensures full Btrfs support at boot-time:
zipl
boots from the partition/boot/zipl
, 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 parameterinitgrub
, which tells it to start GRUB 2.The kernel mounts the root file system, so
/boot
becomes accessible. Now GRUB 2 is started from the initramfs. It reads its configuration from/boot/grub2/grub.cfg
and loads the final kernel and initramfs from/boot
. The new kernel now gets loaded via Kexec.
16.2.2 The kernel phase #
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 (initramfs
) into
memory and the kernel takes over.
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
initramfs
.
16.2.2.1 The initramfs
file #
initramfs
(initial RAM file system) is a small
cpio archive that the kernel can load into a RAM disk. It is located at
/boot/initrd
. It can be created with a tool called
dracut
—refer to man 8 dracut
for details.
The initramfs
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
initramfs
archive must always provide an
executable named init
that executes the systemd
daemon on the root file system for the boot process to proceed.
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 init
on
initramfs
. After the modules are loaded,
udev
provides the
initramfs
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 systemd
unit
systemd-udev-trigger.service
.
16.2.2.1.1 Regenerating the initramfs #
Because the initramfs
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 informs you about this by showing the
output of the command that generates the
initramfs
. However, there are specific occasions
when you need to regenerate an initramfs
manually:
- Adding drivers because of hardware changes
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
initramfs
file.Open or create
/etc/dracut.conf.d/10-DRIVER.conf
and add the following line (mind the leading blank space):force_drivers+=" DRIVER1 "
Replace DRIVER1 with the module name of the driver. If you need to add more than one driver, list them space-separated:
force_drivers+=" DRIVER1 DRIVER2 "
Proceed with Procedure 16.1, “Generate an initramfs”.
- Moving system directories to a RAID or LVM
Whenever you move swap files, or system directories like
/usr
in a running system to a RAID or logical volume, you need to create aninitramfs
that contains support for software RAID or LVM drivers.To do so, create the respective entries in
/etc/fstab
and mount the new entries (for example withmount -a
and/orswapon -a
).Proceed with Procedure 16.1, “Generate an initramfs”.
- Adding disks to an LVM group or Btrfs RAID containing the root file system
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
initramfs
that contains support for the enlarged volume. Follow the instructions at Procedure 16.1, “Generate an initramfs”.Proceed with Procedure 16.1, “Generate an initramfs”.
- Changing kernel variables
If you change the values of kernel variables via the
sysctl
interface by editing related files (/etc/sysctl.conf
or/etc/sysctl.d/*.conf
), the change will be lost on the next system reboot. Even if you load the values withsysctl --system
at runtime, the changes are not saved into theinitramfs
file. You need to update it by proceeding as outlined in Procedure 16.1, “Generate an initramfs”.- Adding or removing swap devices, re-creating swap area
Whenever you add or remove a swap device, or re-create a swap area with a different UUID, update the initramfs as outlined in Procedure 16.1, “Generate an initramfs”. You may also need to update
GRUB_CMDLINE_*
variables that include theresume=
option in/etc/default/grub
, and then regenerate/boot/grub2/grub.cfg
as outlined in Section 18.2.1, “The file/boot/grub2/grub.cfg
”.
All commands in the following procedure need to be executed as the
root
user.
Enter your
/boot
directory:#
cd /bootGenerate a new
initramfs
file withdracut
, replacing MY_INITRAMFS with a file name of your choice:#
dracut MY_INITRAMFSAlternatively, run
dracut -f
FILENAME to replace an existing init file.(Skip this step if you ran
dracut -f
in the previous step.) Create a symbolic link from theinitramfs
file you created in the previous step toinitrd
:#
ln -sf MY_INITRAMFSinitrd
On the IBM Z architecture, additionally run
grub2-install
.
16.2.3 The init on initramfs phase #
The temporary root file system mounted by the kernel from the
initramfs
contains the executable systemd
(which
is called init
on
initramfs
in the following, also see Section 16.1, “Terminology”. 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
udev
.
The main purpose of init
on
initramfs
is to prepare the mounting of and access
to the real root file system. Depending on your system configuration,
init
on initramfs
is
responsible for the following tasks.
- Loading kernel modules
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.
- Providing block special files
The kernel generates device events depending on loaded modules.
udev
handles these events and generates the required special block files on a RAM file system in/dev
. Without those special files, the file system and other devices would not be accessible.- Managing RAID and LVM setups
If you configured your system to hold the root file system under RAID or LVM,
init
oninitramfs
sets up LVM or RAID to enable access to the root file system later.- Managing the network configuration
If you configured your system to use a network-mounted root file system (mounted via NFS),
init
must make sure that the proper network drivers are loaded and that they are set up to allow access to the root file system.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
init
oninitramfs
. SUSE Linux Enterprise Desktop supports booting from a secondary iSCSI target if the primary target is not available. .
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.
16.2.3.1 The init on initramfs phase in the installation process #
When init
on initramfs
is called during the initial boot as part of the installation process, its
tasks differ from those mentioned above. The installation system also does
not start systemd
from
initramfs
—these tasks are performed by
linuxrc
.
- Finding the installation medium
When starting the installation process, your machine loads an installation kernel and a special
init
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.- Initiating hardware recognition and loading appropriate kernel modules
As mentioned in Section 16.2.2.1, “The
initramfs
file”, 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,linuxrc
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.These drivers are used to generate a custom
initramfs
that is needed to boot the system. If the modules are not needed for boot but for coldplug, the modules can be loaded withsystemd
; for more information, see Section 19.6.4, “Loading kernel modules”.- Loading the installation system
When the hardware is properly recognized, the appropriate drivers are loaded. The
udev
program creates the special device files andlinuxrc
starts the installation system with the YaST installer.- Starting YaST
Finally,
linuxrc
starts YaST, which starts the package installation and the system configuration.
16.2.4 The systemd phase #
After the “real” root file system has been found, it is
checked for errors and mounted. If this is successful, the
initramfs
is cleaned and the systemd
daemon on
the root file system is executed. systemd
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 Chapter 19, The systemd
daemon for details.
17 UEFI (Unified Extensible Firmware Interface) #
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.
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 (“Secure Boot”, 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.
UEFI additionally offers the following advantages:
Booting from large disks (over 2 TiB) with a GUID Partition Table (GPT).
CPU-independent architecture and drivers.
Flexible pre-OS environment with network capabilities.
CSM (Compatibility Support Module) to support booting legacy operating systems via a PC-BIOS-like emulation.
For more information, see https://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 certain features are implemented in SUSE Linux Enterprise Desktop.
17.1 Secure boot #
In the world of UEFI, securing the bootstrapping process means establishing a chain of trust. The “platform” is the root of this chain of trust; in the context of SUSE Linux Enterprise Desktop, the mainboard and the on-board firmware could be considered the “platform”. 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.
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.
Finally, security is established by requiring that no code will be executed by the firmware unless it has been signed by one of these “trusted” keys—be it an OS boot loader, a driver located in the flash memory of certain PCI Express card or on disk, or be it an update of the firmware itself.
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.
Key Exchange Keys (KEK) can be added to the UEFI key database. This way, you can use other certificates, if they are signed with the private part of the PK.
17.1.1 Implementation on SUSE Linux Enterprise Desktop #
Microsoft’s Key Exchange Key (KEK) is installed by default.
The Secure Boot feature is enabled by default on UEFI/x86_64 installations. You can find the
option in the tab of the dialog. It supports booting when the secure boot is activated in the firmware, while making it possible to boot when it is deactivated.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).
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.
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).
At the implementation layer, SUSE uses the shim
loader which is installed by default. It is a smart solution that avoids
legal issues, and simplifies the certification and signing step
considerably. The shim
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.
There are two types of trusted users:
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.
Second, anyone with physical access to the machine. A user with physical access can reboot the machine, and configure UEFI.
UEFI offers two types of variables to fulfill the needs of those users:
The first is the so-called “Authenticated Variables”, 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.
The second is the so-called “Boot Services Only Variables”. 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
ExitBootServices
call. After that, these variables are no longer accessible, and the OS cannot touch them.
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 “Boot Services Only Variable”, that helps to implement Secure Boot in a secure and open source-friendly manner, and thus compatible with GPLv3.
SUSE starts with shim
—a small and simple EFI
boot loader signed by SUSE and Microsoft.
This allows shim
to load and execute.
shim
then goes on to verify that the boot loader
it wants to load is trusted.
In a default situation shim
will use an
independent SUSE certificate embedded in its body. In addition,
shim
will allow to “enroll”
additional keys, overriding the default SUSE key. In the following, we call
them “Machine Owner Keys” or MOKs for short.
Next the boot loader will verify and then boot the kernel, and the kernel will do the same on the modules.
17.1.2 MOK (Machine Owner Key) #
To replace specific kernels, drivers or other components that are part of
the boot process, you need to use Machine Owner Keys (MOKs). The
mokutil
tool can help you to manage MOKs.
You can create a MOK enrollment request with
mokutil
. The request is stored in a UEFI runtime
(RT) variable called MokNew
. During the next boot,
the shim
boot loader detects
MokNew
and loads
MokManager
, which presents you with several options.
You can use the and
options to add the key to the
MokList. Use the option to copy the key from
the MokNew
variable.
Enrolling a key from disk is normally done when the shim fails to
load grub2
and falls back to loading
MokManager. As MokNew
does not exist yet,
you have the option of locating the key on the UEFI partition.
17.1.3 Booting a custom kernel #
The following is based on https://en.opensuse.org/openSUSE:UEFI#Booting_a_custom_kernel.
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.
Create a custom X.509 key and certificate used for signing:
openssl req -new -x509 -newkey rsa:2048 -keyout key.asc \ -out cert.pem -nodes -days 666 -subj "/CN=$USER/"
For more information about creating certificates, see https://en.opensuse.org/openSUSE:UEFI_Image_File_Sign_Tools#Create_Your_Own_Certificate.
Package the key and the certificate as a PKCS#12 structure:
>
openssl pkcs12 -export -inkey key.asc -in cert.pem \ -name kernel_cert -out cert.p12Generate an NSS database for use with
pesign
:>
certutil -d . -NImport the key and the certificate contained in PKCS#12 into the NSS database:
>
pk12util -d . -i cert.p12“Bless” the kernel with the new signature using
pesign
:>
pesign -n . -c kernel_cert -i arch/x86/boot/bzImage \ -o vmlinuz.signed -sList the signatures on the kernel image:
>
pesign -n . -S -i vmlinuz.signedAt that point, you can install the kernel in
/boot
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.Convert the certificate to the DER format for import into the firmware or MOK:
>
openssl x509 -in cert.pem -outform der -out cert.derCopy the certificate to the ESP for easier access:
>
sudo
cp cert.der /boot/efi/Use
mokutil
to launch the MOK list automatically.Import the certificate to MOK:
>
mokutil --root-pw --import cert.derThe
--root-pw
option enables usage of theroot
user directly.Check the list of certificates that are prepared to be enrolled:
>
mokutil --list-newReboot the system;
shim
should launch MokManager. You need to enter theroot
password to confirm the import of the certificate to the MOK list.Check if the newly imported key was enrolled:
>
mokutil --list-enrolled
Alternatively, this is the procedure to launch MOK manually:
Reboot
In the GRUB 2 menu press the '
c
' key.Type:
chainloader $efibootdir/MokManager.efi boot
Select
.Navigate to the
cert.der
file and press Enter.Follow the instructions to enroll the key. Normally this should be pressing “0” and then “y” to confirm.
Alternatively, the firmware menu may provide ways to add a new key to the Signature Database.
17.1.4 Using non-inbox drivers #
There is no support for adding non-inbox drivers (that is, drivers that do not come with SUSE Linux Enterprise Desktop) during installation with Secure Boot enabled. The signing key used for SolidDriver/PLDP is not trusted by default.
It is possible to install third party drivers during installation with Secure Boot enabled in two different ways. In both cases:
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.
Use a bootable driver ISO from https://drivers.suse.com/ or your hardware vendor to enroll the needed keys in the MOK list at first boot.
To use the bootable driver ISO to enroll the driver keys to the MOK list, follow these steps:
Burn the ISO image above to an empty CD/DVD medium.
Start the installation using the new CD/DVD medium, having the standard installation media at hand or a URL to a network installation server.
If doing a network installation, enter the URL of the network installation source on the boot command line using the
install=
option.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.
An initrd containing updated drivers will be used for installation.
For more information, see https://drivers.suse.com/doc/Usage/Secure_Boot_Certificate.html.
17.1.5 Features and limitations #
When booting in Secure Boot mode, the following features apply:
Installation to UEFI default boot loader location, a mechanism to keep or restore the EFI boot entry.
Reboot via UEFI.
Xen hypervisor will boot with UEFI when there is no legacy BIOS to fall back to.
UEFI IPv6 PXE boot support.
UEFI video mode support, the kernel can retrieve video mode from UEFI to configure KMS mode with the same parameters.
UEFI booting from USB devices is supported.
Since SUSE Linux Enterprise Server 15 SP3, Kexec and Kdump are supported in Secure Boot mode.
When booting in Secure Boot mode, the following limitations apply:
To ensure that Secure Boot cannot be easily circumvented, certain kernel features are disabled when running under Secure Boot.
Boot loader, kernel, and kernel modules must be signed.
Hibernation (suspend on disk) is disabled.
Access to
/dev/kmem
and/dev/mem
is not possible, not even as root user.Access to the I/O port is not possible, not even as root user. All X11 graphical drivers must use a kernel driver.
PCI BAR access through sysfs is not possible.
custom_method
in ACPI is not available.debugfs for asus-wmi module is not available.
the
acpi_rsdp
parameter does not have any effect on the kernel.
17.2 More information #
https://uefi.org — UEFI home page where you can find the current UEFI specifications.
Blog posts by Olaf Kirch and Vojtěch Pavlík (the chapter above is heavily based on these posts):
https://en.opensuse.org/openSUSE:UEFI —UEFI with openSUSE.
18 The boot loader GRUB 2 #
This chapter describes how to configure GRUB 2, the boot loader used in SUSE® Linux Enterprise Desktop. It is the successor to the traditional GRUB boot loader—now called “GRUB Legacy”. GRUB 2 has been the default boot loader in SUSE® Linux Enterprise Desktop since version 12. A YaST module is available for configuring the most important settings. The boot procedure as a whole is outlined in Chapter 16, Introduction to the boot process. For details on Secure Boot support for UEFI machines, see Chapter 17, UEFI (Unified Extensible Firmware Interface).
18.1 Main differences between GRUB legacy and GRUB 2 #
The configuration is stored in different files.
More file systems are supported (for example, Btrfs).
Can directly read files stored on LVM or RAID devices.
The user interface can be translated and altered with themes.
Includes a mechanism for loading modules to support additional features, such as file systems, etc.
Automatically searches for and generates boot entries for other kernels and operating systems, such as Windows.
Includes a minimal Bash-like console.
18.2 Configuration file structure #
The configuration of GRUB 2 is based on the following files:
/boot/grub2/grub.cfg
This file contains the configuration of the GRUB 2 menu items. It replaces
menu.lst
used in GRUB Legacy.grub.cfg
should not be edited—it is automatically generated by the commandgrub2-mkconfig -o /boot/grub2/grub.cfg
./boot/grub2/custom.cfg
This optional file is directly sourced by
grub.cfg
at boot time and can be used to add custom items to the boot menu. Starting with SUSE Linux Enterprise Desktop 12 SP2 these entries are also parsed when usinggrub-once
./etc/default/grub
This file controls the user settings of GRUB 2 and normally includes additional environmental settings such as backgrounds and themes.
- Scripts under
/etc/grub.d/
The scripts in this directory are read during execution of the command
grub2-mkconfig -o /boot/grub2/grub.cfg
. Their instructions are integrated into the main configuration file/boot/grub/grub.cfg
./etc/sysconfig/bootloader
This configuration file holds certain basic settings like the boot loader type and whether to enable UEFI Secure Boot support.
/boot/grub2/x86_64-efi
,/boot/grub2/power-ieee1275
These configuration files contain architecture-specific options.
GRUB 2 can be controlled in multiple ways. Boot entries from an existing
configuration can be selected from the graphical menu (splash screen).
The configuration is loaded from the file
/boot/grub2/grub.cfg
which is compiled from other
configuration files (see below). All GRUB 2 configuration files are
considered system files, and you need root
privileges to edit them.
After having manually edited GRUB 2 configuration files, you need to
run grub2-mkconfig -o /boot/grub2/grub.cfg
to
activate the changes. However, this is not necessary when changing the
configuration with YaST, because YaST automatically runs this
command.
18.2.1 The file /boot/grub2/grub.cfg
#
The graphical splash screen with the boot menu is based on the GRUB 2
configuration file /boot/grub2/grub.cfg
, which
contains information about all partitions or operating systems that can
be booted by the menu.
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.
grub.cfg
is automatically rebuilt with kernel
installations or removals.
grub.cfg
is compiled from the file
/etc/default/grub
and scripts found in the
/etc/grub.d/
directory when running the command
grub2-mkconfig -o /boot/grub2/grub.cfg
. Therefore
you should never edit the file manually. Instead, edit the related
source files or use the YaST module to
modify the configuration as described in
Section 18.3, “Configuring the boot loader with YaST”.
18.2.2 The file /etc/default/grub
#
More general options of GRUB 2 belong in this file, 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:
>
grep "export GRUB_DEFAULT" -A50 /usr/sbin/grub2-mkconfig | grep GRUB_
You can introduce custom variables and use them later in the scripts
found in the /etc/grub.d
directory.
After having edited /etc/default/grub
, update the
main configuration file with grub2-mkconfig -o
/boot/grub2/grub.cfg
.
All options specified in this file are general options that affect all
boot entries. Options specific to a Xen hypervisor include the
_XEN_
substring.
More complex options with spaces require quoting so that they are processed as one option. Such inner quotes need to be correctly escaped, for example:
GRUB_CMDLINE_LINUX_XEN="debug loglevel=9 log_buf_len=5M \"ddebug_query=file drivers/xen/xen-acpi-processor.c +p\""
GRUB_DEFAULT
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 “saved”.
GRUB_DEFAULT=2
boots the third (counted from zero) boot menu entry.GRUB_DEFAULT="2>0"
boots the first submenu entry of the third top-level menu entry.GRUB_DEFAULT="Example boot menu entry"
boots the menu entry with the title “Example boot menu entry”.GRUB_DEFAULT=saved
boots the entry specified by thegrub2-once
orgrub2-set-default
commands. Whilegrub2-reboot
sets the default boot entry for the next reboot only,grub2-set-default
sets the default boot entry until changed.grub2-editenv list
lists the next boot entry.GRUB_HIDDEN_TIMEOUT
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
GRUB_TIMEOUT
.GRUB_HIDDEN_TIMEOUT=0
first checks whether 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.GRUB_HIDDEN_TIMEOUT_QUIET
If
false
is specified, a countdown timer is displayed on a blank screen when theGRUB_HIDDEN_TIMEOUT
feature is active.GRUB_TIMEOUT
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.
GRUB_TIMEOUT=-1
causes the menu to be displayed until you select the boot entry manually.GRUB_CMDLINE_LINUX
Entries on this line are added at the end of the boot entries for normal and recovery modes. Use it to add kernel parameters to the boot entry.
GRUB_CMDLINE_LINUX_DEFAULT
Same as
GRUB_CMDLINE_LINUX
but the entries are appended in the normal mode only.GRUB_CMDLINE_LINUX_RECOVERY
Same as
GRUB_CMDLINE_LINUX
but the entries are appended in the recovery mode only.GRUB_CMDLINE_LINUX_XEN_REPLACE
This entry replaces the
GRUB_CMDLINE_LINUX
parameters for all Xen boot entries.GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
Same as
GRUB_CMDLINE_LINUX_XEN_REPLACE
but it only replaces parameters ofGRUB_CMDLINE_LINUX_DEFAULT
.GRUB_CMDLINE_XEN
These entries are passed to the Xen hypervisor Xen menu entries for normal and recovery modes. For example:
GRUB_CMDLINE_XEN="loglvl=all guest_loglvl=all"
Tip: Xen hypervisor optionsFind a complete list of Xen hypervisor options in https://xenbits.xen.org/docs/unstable/misc/xen-command-line.html
GRUB_CMDLINE_XEN_DEFAULT
Same as
GRUB_CMDLINE_XEN
but the entries are appended in the normal mode only.GRUB_TERMINAL
Enables and specifies an input/output terminal device. Can be
console
(PC BIOS and EFI consoles),serial
(serial terminal),ofconsole
(Open Firmware console), or the defaultgfxterm
(graphics-mode output). It is also possible to enable more than one device by quoting the required options, for example,GRUB_TERMINAL="console serial"
.GRUB_GFXMODE
The resolution used for the
gfxterm
graphical terminal. 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 typingvideoinfo
in the GRUB 2 command line. The command line is accessed by typing C when the GRUB 2 boot menu screen is displayed.You can also specify a color depth by appending it to the resolution setting, for example,
GRUB_GFXMODE=1280x1024x24
.GRUB_BACKGROUND
Set a background image for the
gfxterm
graphical terminal. The image must be a file readable by GRUB 2 at boot time, and it must end with the.png
,.tga
,.jpg
, or.jpeg
suffix. If necessary, the image is scaled to fit the screen.GRUB_DISABLE_OS_PROBER
If this option is set to
true
, automatic searching for other operating systems is disabled. Only the kernel images in/boot/
and the options from your own scripts in/etc/grub.d/
are detected.SUSE_BTRFS_SNAPSHOT_BOOTING
If this option is set to
true
, GRUB 2 can boot directly into Snapper snapshots. For more information, see Section 10.3, “System rollback by booting from snapshots”.
For a complete list of options, see the GNU GRUB manual.
18.2.3 Scripts in /etc/grub.d
#
The scripts in this directory are read during execution of the command
grub2-mkconfig -o /boot/grub2/grub.cfg
. Their
instructions are incorporated into
/boot/grub2/grub.cfg
. The order of menu items in
grub.cfg
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.
00_header
is run before
10_linux
, which would run before
40_custom
. If files with alphabetic names are
present, they are executed after the numerically named files. Only
executable files generate output to grub.cfg
during execution of grub2-mkconfig
. By default all
files in the /etc/grub.d
directory are executable.
grub.cfg
Because /boot/grub2/grub.cfg
is recompiled each
time grub2-mkconfig
is run, any custom content is
lost. To insert your lines directly into
/boot/grub2/grub.cfg
without losing them after
grub2-mkconfig
is run, insert them between
### BEGIN /etc/grub.d/90_persistent ###
and
### END /etc/grub.d/90_persistent ###
The 90_persistent
script ensures that such
content is preserved.
A list of the most important scripts follows:
00_header
Sets environmental variables such as system file locations, display settings, themes and previously saved entries. It also imports preferences stored in the
/etc/default/grub
. Normally you do not need to make changes to this file.10_linux
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.
30_os-prober
This script uses
os-prober
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.40_custom
This file provides a simple way to include custom boot entries into
grub.cfg
. Make sure that you do not change theexec tail -n +3 $0
part at the beginning.
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.
/boot/grub2/custom.cfg
If you create /boot/grub2/custom.cfg
and fill it
with content, it is automatically included into
/boot/grub2/grub.cfg
right after
40_custom
at boot time.
18.2.4 Mapping between BIOS drives and Linux devices #
In GRUB Legacy, the device.map
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.
GRUB 2 avoids this problem by using device ID strings (UUIDs) or file
system labels when generating grub.cfg
. GRUB 2
utilities create a temporary device map on the fly, which is normally
sufficient, particularly for single-disk systems.
However, if you need to override the GRUB 2's automatic device mapping
mechanism, create your custom mapping file
/boot/grub2/device.map
. The following example
changes the mapping to make DISK 3
the boot disk.
GRUB 2 partition numbers start with 1
and
not with 0
as in GRUB 2 Legacy.
(hd1) /dev/disk-by-id/DISK3 ID (hd2) /dev/disk-by-id/DISK1 ID (hd3) /dev/disk-by-id/DISK2 ID
18.2.6 Setting a boot password #
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.
If set, the boot password is required on every boot, which means the system does not boot automatically.
Proceed as follows to set a boot password. Alternatively use YaST ().
Encrypt the password using
grub2-mkpasswd-pbkdf2:
>
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...Paste the resulting string into the file
/etc/grub.d/40_custom
together with theset superusers
command.set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
To import the changes into the main configuration file, run:
>
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
After you reboot, GRUB 2 prompts you for a user name and a password
when trying to boot a menu entry. Enter root
and the
password you typed during the grub2-mkpasswd-pbkdf2
command. If the credentials are correct, the system boots the
selected boot entry.
For more information, see https://www.gnu.org/software/grub/manual/grub/grub.html#Security.
18.2.7 Authorized access to boot menu entries #
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:
Create and encrypt one password for each user account you want to use in GRUB 2. Use the
grub2-mkpasswd-pbkdf2
command as described in Section 18.2.6, “Setting a boot password”.Delete the file
/etc/grub.d/10_linux
. This prevents outputting the default GRUB 2 menu entries.Edit the
/boot/grub2/custom.cfg
file and add custom menu entries manually. The following template is an example, adjust it to better match your use case:set superusers=admin password admin ADMIN_PASSWORD password maintainer MAINTAINER_PASSWORD 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 }
Import the changes into the main configuration file:
>
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
In the above example:
The GRUB 2 menu has two entries,
and .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.
admin
user can access GRUB 2 command line and edit existing menu entries.maintenance
user can select the recovery menu item.
18.3 Configuring the boot loader with YaST #
The easiest way to configure general options of the boot loader in your SUSE Linux Enterprise Desktop system is to use the YaST module. In the , select › . The module shows the current boot loader configuration of your system and allows you to make changes.
Use the
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.If you have an EFI system you can only install GRUB2-EFI, otherwise your system is no longer bootable.
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
first and then immediately switch back to .Otherwise, the boot loader may only be partially reinstalled.
To use a boot loader other than the ones listed, select
. Read the documentation of your boot loader carefully before choosing this option.18.3.1 Boot loader location and boot code options #
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
/
partition. To modify the location of the boot loader,
follow these steps:
Select the
tab and then choose one of the following options for :This installs the boot loader in the MBR of the disk containing the directory
/boot
. Usually this will be the disk mounted to/
, but if/boot
is mounted to a separate partition on a different disk, the MBR of that disk will be used.This installs the boot loader in the boot sector of the
/
partition.Use this option to specify the location of the boot loader manually.
Click
to apply the changes.
The
tab includes the following additional options:Activates the partition that contains the
/boot
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.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.
Starts TrustedGRUB2, which supports trusted computing functionality (Trusted Platform Module (TPM)). For more information refer to https://github.com/Sirrix-AG/TrustedGRUB2.
The
section includes the following options:This is appropriate for traditional legacy BIOS booting.
This is appropriate for UEFI booting.
This is usually the best choice if you have an already working system.
In most cases YaST defaults to the appropriate choice.
18.3.2 Adjusting the disk order #
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 SUSE Linux Enterprise Desktop is installed by default. The rest of the list is a hint for GRUB 2's device mapper (see Section 18.2.4, “Mapping between BIOS drives and Linux devices”).
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.
Open the
tab.Click
.If more than one disk is listed, select a disk and click
or to reorder the displayed disks.Click
two times to save the changes.
18.3.3 Configuring advanced options #
Advanced boot parameters can be configured via the
tab.18.3.3.1 tab #
Change the value of
by typing in a new value and clicking the appropriate arrow key with your mouse.When selected, the boot loader searches for other systems like Windows or other Linux installations.
Hides the boot menu and boots the default entry.
Select the desired entry from the “Default Boot Section” list. Note that the “>” sign in the boot entry name delimits the boot section and its subsection.
Protects the boot loader and the system with an additional password. For details on manual configuration, see Section 18.2.6, “Setting a boot password”. 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 . With this setting, anybody is allowed to select a boot entry and boot the system, whereas the password for the GRUB 2
root
user is only required for modifying boot entries.
18.3.3.2 tab #
Specify optional kernel parameters here to enable/disable system features, add drivers, etc.
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:
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. .
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. .
Disables all mitigations. Side-channel attacks against your CPU are possible, depending on the CPU model. This setting has no impact on performance. .
Does not set any mitigation level. Specify your CPU mitigations manually by using the kernel command line options. .
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
. The graphical theme definition file can be specified with the file chooser. Only change this if you want to apply your own, custom-made theme.If your machine is controlled via a serial console, activate this option and specify which COM port to use at which speed. See
info grub
or https://www.gnu.org/software/grub/manual/grub.html#Serial-terminal
18.4 Helpful GRUB 2 commands #
grub2-mkconfig
Generates a new
/boot/grub2/grub.cfg
based on/etc/default/grub
and the scripts from/etc/grub.d/
.Example 18.1: Usage of grub2-mkconfig #grub2-mkconfig -o /boot/grub2/grub.cfg
Tip: Syntax checkRunning
grub2-mkconfig
without any parameters prints the configuration to STDOUT where it can be reviewed. Usegrub2-script-check
after/boot/grub2/grub.cfg
has been written to check its syntax.Important:grub2-mkconfig
cannot repair UEFI Secure Boot tablesIf 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:
#
shim-install --config-file=/boot/grub2/grub.cfggrub2-mkrescue
Creates a bootable rescue image of your installed GRUB 2 configuration.
Example 18.2: Usage of grub2-mkrescue #grub2-mkrescue -o save_path/name.iso iso
grub2-script-check
Checks the given file for syntax errors.
Example 18.3: Usage of grub2-script-check #grub2-script-check /boot/grub2/grub.cfg
grub2-once
Set the default boot entry for the next boot only. To get the list of available boot entries use the
--list
option.Example 18.4: Usage of grub2-once #grub2-once number_of_the_boot_entry
Tip:grub2-once
helpCall the program without any option to get a full list of all possible options.
18.5 Rescue mode #
Rescue mode is a specific root
user session
for troubleshooting and repairing systems where the booting process
fails. It offers a single-user environment with local file systems and
core system services active. Network interfaces are not activated. To
enter the rescue mode, follow these steps.
Reboot the system. The boot screen appears, offering the GRUB 2 boot menu.
Select the menu entry to boot and press e to edit the boot line.
Append the following parameter to the line containing the kernel parameters:
systemd.unit=rescue.target
Press Ctrl+X to boot with these settings.
Enter the password for
root
.Make all the necessary changes.
Enter normal operating target again by entering
systemctl isolate multi-user.target
orsystemctl isolate graphical.target
at the command line.
18.6 More information #
Extensive information about GRUB 2 is available at
https://www.gnu.org/software/grub/. Also refer to the
grub
info page. You can also
search for the keyword “GRUB 2” in the Technical Information
Search at https://www.suse.com/support to get
information about special issues.
19 The systemd
daemon #
systemd
initializes the system. It has the process ID 1. systemd
is
started directly by the kernel and resists signal 9, which normally
terminates processes. All other programs are started directly by
systemd
or by one of its child processes. systemd
is a replacement for
the System V init daemon and is fully compatible with System V init (by
supporting init scripts).
The main advantage of systemd
is that it considerably speeds up boot time
by parallelizing service starts. Furthermore, systemd
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. systemd
also
supports Kernel Control Groups (cgroups), creating snapshots, and restoring
the system state. For more details see
https://www.freedesktop.org/wiki/Software/systemd/.
systemd
inside WSL
Windows Subsystem for Linux (WSL) enables running Linux applications and distributions under
the Microsoft Windows operating system. WSL uses its init process instead of systemd
. To enable
systemd
in SLED running in WSL, install the wsl_systemd
pattern that automates the process:
>
sudo
zypper in -t pattern wsl_systemd
Alternatively, you can edit /etc/wsl.conf
and add the following lines
manually:
[boot] systemd=true
Keep in mind that the support for systemd
in WSL is partial—systemd
unit files must
have reasonable process management behavior.
19.1 The systemd
concept #
The following section explains the concept behind systemd
.
systemd
is a system and session manager for Linux, compatible with
System V and LSB init scripts. The main features of systemd
include:
parallelization capabilities
socket and D-Bus activation for starting services
on-demand starting of daemons
tracking of processes using Linux cgroups
creating snapshots and restoring of the system state
maintains mount and automount points
implements an elaborate transactional dependency-based service control logic
19.1.1 Unit file #
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 systemd
, a temporary system state
snapshot, a resource management slice or a group of externally created
processes.
“Unit file” is a generic term used by systemd
for the
following:
Service. Information about a process (for example, running a daemon); file ends with .service
Targets. Used for grouping units and as synchronization points during start-up; file ends with .target
Sockets. Information about an IPC or network socket or a file system FIFO, for socket-based activation (like
inetd
); file ends with .socketPath. Used to trigger other units (for example, running a service when files change); file ends with .path
Timer. Information about a timer controlled, for timer-based activation; file ends with .timer
Mount point. Normally auto-generated by the fstab generator; file ends with .mount
Automount point. Information about a file system automount point; file ends with .automount
Swap. Information about a swap device or file for memory paging; file ends with .swap
Device. Information about a device unit as exposed in the sysfs/udev(7) device tree; file ends with .device
Scope / slice. A concept for hierarchically managing resources of a group of processes; file ends with .scope/.slice
For more information about systemd
unit files, see
https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html
19.2 Basic usage #
The System V init system uses several commands to handle
services—the init scripts, insserv
,
telinit
and others. systemd
makes it easier to
manage services, because there is only one command to handle most service
related tasks: systemctl
. It uses the “command
plus subcommand” notation like git
or
zypper
:
systemctl GENERAL OPTIONS SUBCOMMAND SUBCOMMAND OPTIONS
See man 1 systemctl
for a complete manual.
If the output goes to a terminal (and not to a pipe or a file, for
example), systemd
commands send long output to a pager by default.
Use the --no-pager
option to turn off paging mode.
systemd
also supports bash-completion, allowing you to enter the
first letters of a subcommand and then press →|.
This feature is only available in the bash
shell and requires the installation of the package
bash-completion
.
19.2.1 Managing services in a running system #
Subcommands for managing services are the same as for managing a
service with System V init (start
,
stop
, ...). The general syntax for service
management commands is as follows:
systemd
systemctl reload|restart|start|status|stop|... MY_SERVICE(S)
- System V init
rcMY_SERVICE(S) reload|restart|start|status|stop|...
systemd
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:
>
sudo
systemctl start MY_1ST_SERVICE MY_2ND_SERVICE
To list all services available on the system:
>
sudo
systemctl list-unit-files --type=service
The following table lists the most important service management
commands for systemd
and System V init:
Task |
|
System V init Command |
---|---|---|
Starting. |
start |
start |
Stopping. |
stop |
stop |
Restarting. Shuts down services and starts them afterward. If a service is not yet running, it is started. |
restart |
restart |
Restarting conditionally. Restarts services if they are currently running. Does nothing for services that are not running. |
try-restart |
try-restart |
Reloading.
Tells services to reload their configuration files without
interrupting operation. Use case: tell Apache to reload a
modified |
reload |
reload |
Reloading or restarting. Reloads services if reloading is supported, otherwise restarts them. If a service is not yet running, it is started. |
reload-or-restart |
n/a |
Reloading or restarting conditionally. Reloads services if reloading is supported, otherwise restarts them if currently running. Does nothing for services that are not running. |
reload-or-try-restart |
n/a |
Getting detailed status information.
Lists information about the status of services. The
|
status |
status |
Getting short status information. Shows whether services are active or not. |
is-active |
status |
19.2.2 Permanently enabling/disabling services #
The service management commands mentioned in the previous section let
you manipulate services for the current session. systemd
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.
19.2.2.1 Enabling/disabling services on the command line #
The following table lists enabling and disabling commands for
systemd
and System V init:
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 systemctl start
MY_SERVICE
or rc
MY_SERVICE start
.
Task |
|
System V init Command |
---|---|---|
Enabling. |