SDB:Zypper usage
This page contains complementary information to Zypper's manual page (with man zypper). What you can't find here, you should find in the man page and vice versa.
Version: 13.2 This article is about zypper 1.11.23 as it appeared in openSUSE 13.2. For other versions see Zypper versions.
Quick reference
This is what you will probably use most frequently.
zypper # to print the list of available global options and commands zypper help search # to print help for the search command zypper lp # to see what patch updates are needed zypper patch # to apply the needed patches zypper se sqlite # to search for sqlite zypper rm sqlite2 # to remove sqlite2 zypper in sqlite3 # to install sqlite3 zypper in yast* # to install all packages matching 'yast*' zypper up # to update all installed packages with newer versions, where possible
If you are familiar with package managers such as apt, yum, emerge etc. from other Linux distribution, see this link for comparison/differences between them and zypper.
Cheat sheet
Here you can find the information displayed on this page, but compressed in the format of a cheat sheet. It also includes a few references taken from the man pages. It is recommended for use after you have analyzed the info displayed here.
First page A4. |
Second page A4. |
First page letter. |
Second page letter. |
General usage
The general syntax of zypper is:
zypper [global-options] command [command-options] [arguments] ...
The components enclosed in brackets are not required, thus the simplest way to execute zypper is to type its name followed by a command. See zypper help for a list of general options and all commands. To get help for a specific command, type zypper help command. For example, to apply needed patches to the system type:
sudo zypper patch
To get help for the patch command:
sudo zypper help patch
Additionally, you can choose from one or more global options by typing them just before the command: (run the command, but don't ask me anything, decide on your own)
sudo zypper --non-interactive patch
To use the options specific to particular command, type them right after the command: (apply needed patches to the system but don't ask me to confirm any licenses, i've read them all before)
sudo zypper patch --auto-agree-with-licenses
Some of the commands require one or more arguments: (install or update mplayer package)
sudo zypper install mplayer
Some of the options also require an argument: (search for patterns)
sudo zypper search -t pattern
All of the above combined: (install mplayer and amarok by using the factory repository only, be verbose)
sudo zypper -v install --repo factory mplayer amarok
User prompts
Whenever zypper needs some input from you, it lists possible answers in brackets next to the prompt text. To choose the default answer, just press <enter> (the default answer is printed in capitals (with the exception of non-ascii characters)). Some prompts also have help available, in which case there is a question mark '?' listed as a possible answer. To make zypper use the default answers without user interaction, use the --non-interactive global option.
Vocabulary
- repository - local or remote directory containing packages and various package information (package metadata). Repositories were formerly known as installation sources , services or catalogs).
- alias - repository alias is a short version of repository name for use in repository handling commands and options as removerepo or --repo.
- package - software package (RPM package, source package). Patches, patterns, and products are also commonly referred to as different types of packages.
- patch - represents a package or a group of packages needed to install an update (a bug fix mostly).
- pattern - represents a group of packages. For example an Http Server pattern would have the dependencies defined so that all packages needed to run and manage an http server would have been triggered for installation when upon installing the pattern.
- product - represents the whole product (e.g. 'openSUSE 12.2').
Commands
zypper provides a number of commands which can be grouped into the following categories:
- repository management
refresh, repos, addrepo, removerepo, modifyrepo, namerepo
refresh-services, services, addservice, removeservice, modifyservice - package management
install, remove, source-install - update management
patch, list-patches, patch-check, patches, update, list-updates, dist-upgrade - querying
search, info, what-provides, list-updates, patch-check, patches, packages, patterns, products - locking
locks, addlock, removelock, cleanlocks - utilities
verify, install-new-recommends - other
help, licenses, versioncmp, targetos
Printing help
First, it is good to know how to get help. To print general help (list of commands and global options), just type zypper without any option or arguments. To print help for specific command, use:
zypper help [command]
To obtain specific help for a command, use:
zypper [command] --help
Note that using -h instead of --help is also possible for convenience.
Repository management
You can specify existing repositories by their number in the list produced by zypper lr, alias, or URI. When using the numbers, make sure you always check zypper lr first, as the numbers may change after you made some changes to the repositories.
Listing defined repositories
repos or lr
Example output:
zypper lr
# | Alias | Name | Enabled | Refresh ---+----------------------------------+------------------------------------+---------+-------- 1 | Mewtwo:KDE:Extra | KDE:Extra | Yes | Yes 2 | Mewtwo:repo-ati | repo-ati | Yes | Yes 3 | Mewtwo:repo-debug | openSUSE-12.2-Debug | No | Yes 4 | Mewtwo:repo-debug-update | openSUSE-12.2-Update-Debug | No | Yes 5 | Mewtwo:repo-debug-update-non-oss | openSUSE-12.2-Update-Debug-Non-Oss | No | Yes 6 | Mewtwo:repo-libdvdcss | repo-libdvdcss | Yes | Yes 7 | Mewtwo:repo-non-oss | openSUSE 12.2 Oss | No | Yes 8 | Mewtwo:repo-oss | openSUSE-12.2-Oss | Yes | Yes 9 | Mewtwo:repo-packman | packman | Yes | Yes 10 | Mewtwo:repo-source | openSUSE-12.2-Source | Yes | Yes 11 | Mewtwo:repo-update | openSUSE-12.2-Update | Yes | Yes 12 | Mewtwo:repo-update-non-oss | openSUSE-12.2-Update-Non-Oss | Yes | Yes 13 | Mewtwo:security | security | Yes | Yes
zypper lr 5 4
Alias : Mewtwo:repo-debug-update-non-oss Name : openSUSE-12.2-Update-Debug-Non-Oss URI : http://download.opensuse.org/debug/update/12.2-non-oss/ Enabled : No Priority : 99 Auto-refresh : On Keep Packages : Off Type : rpm-md GPG Check : On GPG Key URI : Path Prefix : Parent Service : Mewtwo MD Cache Path : /var/cache/zypp/raw/Mewtwo:repo-debug-update-non-oss Alias : Mewtwo:repo-debug-update Name : openSUSE-12.2-Update-Debug URI : http://download.opensuse.org/debug/update/12.2/ Enabled : No Priority : 99 Auto-refresh : On Keep Packages : Off Type : rpm-md GPG Check : On GPG Key URI : Path Prefix : Parent Service : Mewtwo MD Cache Path : /var/cache/zypp/raw/Mewtwo:repo-debug-update
Other examples:
zypper lr -u # to include also repo URI in the table zypper lr -d # to include several other repo properties in the table zypper lr -P # to include also repo priority and sort the list by it zypper lr -e my # export all repository definitions into file named 'my.repo'
Adding repositories
addrepo or ar
Before any packages can be installed at least one repository must be defined. To add a repository, use the addrepo command:
Example output:
zypper ar http://download.videolan.org/pub/vlc/SuSE/11.1 vlc
Adding repository 'vlc' [done] Repository 'vlc' successfully added Enabled: Yes Autorefresh: No URI: http://download.videolan.org/pub/vlc/SuSE/11.1
Other examples:
zypper ar http://download.opensuse.org/repositories/X11:/XGL/openSUSE_11.1/X11:XGL.repo # via .repo file zypper ar -c ftp://some.download.site myalias # probe the repository upon adding zypper ar my/dir/with/rpms local # add your local directory with rpm files as repository
See also Libzypp for the list of supported media types and URIs.
Refreshing repositories
refresh or ref
After adding of a repository or when a repository becomes out of date, it needs to be refreshed. This mean downloading package metadata from it and preprocessing the data into .solv cache for quick reading.
zypper refresh
Downloading repository 'Packman 11.1' metadata [done] Building repository 'Packman 11.1' cache [done] Downloading repository 'Updates for 11.1' metadata [done] Building repository 'Updates for 11.1' cache [done] Repository 'openSUSE-11.1-Oss' is up to date. All repositories have been refreshed.
If autorefresh is enabled for a repository, you don't need to worry about refreshing, it happens automatically when needed. However, some people prefer to be in control when the refresh takes place (e.g. to avoid waiting for the refresh to complete when you only wanted to see 'zypper info krusader'), so they disable autorefresh. See man zypper for more details.
Other examples:
zypper ref packman main # you can also specify which repositories to refresh zypper ref -f upd # force refresh of the 'upd' repository
Removing repositories
removerepo or rr
zypper rr vlc 1 23 foo
Repository 23 not found by alias, number or URI. Repository foo not found by alias, number or URI. Removing repository 'repo-debug' [done] Repository 'repo-debug' has been removed. Removing repository 'vlc' [done] Repository 'vlc' has been removed.
Modifying repositories
modifyrepo or mr
Disable repository #6:
zypper mr -d 6
Repository 'repo-non-oss' has been sucessfully disabled.
Enable autorefresh and rpm files caching for 'packman' repository and set its priority to 70:
zypper mr -rk -p 70 packman
Autorefresh has been enabled for repository 'packman'. RPM files caching has been enabled for repository 'packman'. Repository 'packman' priority has been set to 70.
Disable RPM files caching for all repositories:
zypper mr -Ka
Nothing to change for repository 'local'. RPM files caching has been disabled for repository 'packman'. Nothing to change for repository 'fate'. Nothing to change for repository 'upd'. Nothing to change for repository 'repo-oss'. Nothing to change for repository 'repo-non-oss'.
Enable RPM files caching for all repositories:
zypper mr -ka
RPM files caching has been enabled for repository 'repo-non-oss'. RPM files caching has been enabled for repository 'Main Repository (OSS)'. RPM files caching has been enabled for repository 'Main Repository (NON-OSS)'. RPM files caching has been enabled for repository 'openSUSE-11.1-Updates'.
Renaming repositories
renamerepo or nr
# zypper nr 3 upd Repository 'openSUSE-11.1-Updates' renamed to 'upd'.
This command is currently only able to change the alias of the repository. If you wish to change the displayed name of the repository, take a look at the mr command.
Keep the aliases short and simple for an easy use as arguments of commands and --repo options. Using an alias is safer than using repo number (since that may change and you can easily make a mistake) and easier than using URI (since they are long, leaving you with copy-and-paste).
Export/Import repositories
repos --export or lr -e
You can export your complete repository list to a file and import it later or on another machine.
# zypper lr --export backups/repos/foo.repo # zypper ar backups/repos/foo.repo
Service management
Services are one level above repositories and serves to manage repositories. Libzypp actually support only one type of services, the Repository index service also known as RIS.
Add a service
addservice or as
To add a service type addservice
Example:
celebi:~ # zypper as -t RIS http://mewtwo.domain/ Mewtwo
El servicio 'Mewtwo' se agregó correctamente.
Refresh a service
refresh-services or refs
Next to add a service it must be refreshed to setup the repositories it provides:
celebi:~ # zypper refs
Actualizando servicio 'Mewtwo'. Añadiendo el repositorio 'KDE:Extra' .......................................................[hecho] Añadiendo el repositorio 'repo-ati' ........................................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Debug' .............................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Update-Debug' ......................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Update-Debug-Non-Oss' ..............................[hecho] Añadiendo el repositorio 'repo-libdvdcss' ..................................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Oss' ...............................................[hecho] Añadiendo el repositorio 'packman' .........................................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Source' ............................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Update' ............................................[hecho] Añadiendo el repositorio 'openSUSE-12.2-Update-Non-Oss' ....................................[hecho] Añadiendo el repositorio 'security' ........................................................[hecho] Todos los servicios fueron actualizados.
The first time a service is refreshed, the repositories must be enabled by the command zypper mr -e -a
Remove a service
removeservice or rs
A service can be removed using the command rs.
Example:
celebi:~ # zypper rs Mewtwo
Eliminado servicio 'Mewtwo': Eliminado el repositorio 'KDE:Extra' .......................................................[hecho] Eliminado el repositorio 'repo-ati' ........................................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Debug' .............................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Update-Debug' ......................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Update-Debug-Non-Oss' ..............................[hecho] Eliminado el repositorio 'repo-libdvdcss' ..................................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Oss' ...............................................[hecho] Eliminado el repositorio 'packman' .........................................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Source' ............................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Update' ............................................[hecho] Eliminado el repositorio 'openSUSE-12.2-Update-Non-Oss' ....................................[hecho] Eliminado el repositorio 'security' ........................................................[hecho] Se eliminó el servicio 'Mewtwo'.
Package management
Selecting packages
There are several ways in which you can choose packages for installation or removal.
- by capability name
zypper in eclipse zypper in qt
- by capability name and/or architecture and/or version
zypper in 'zypper<0.12.10' zypper in zypper.i586=0.12.11
- by exact package name (--name)
zypper in -n ftp
- by exact package name and repository (implies --name)
zypper in factory:zypper
- by package name using wildcards
zypper in yast*ftp*
- by specifying an .rpm package file to install. The path can be relative or absolute
zypper in foo.rpm #Relative path. zypper in /path/to/somewhere/foo.rpm #Absolute path
Installing packages
install or in
You can install packages by name...
# zypper install git
Reading installed packages... The following NEW packages are going to be installed: subversion-perl sqlite3 perl-DBD-SQLite git-svn git-cvs git Overall download size: 1.1 M. After the operation, additional 4.6 M will be used. Continue? [YES/no]: Downloading package subversion-perl-1.5.0-96.1.x86_64 (1/6), 950.0 K (4.1 M unpacked) Downloading: subversion-perl-1.5.0-96.1.x86_64.rpm [done] Installing: subversion-perl-1.5.0-96.1 [done] Downloading package sqlite3-3.5.7-17.1.x86_64 (2/6), 30.0 K (40.0 K unpacked) Downloading: sqlite3-3.5.7-17.1.x86_64.rpm [done] Installing: sqlite3-3.5.7-17.1 [done] Downloading package perl-DBD-SQLite-1.14-41.1.x86_64 (3/6), 44.0 K (103.0 K unpacked) Downloading: perl-DBD-SQLite-1.14-41.1.x86_64.rpm [done] Installing: perl-DBD-SQLite-1.14-41.1 [done] Downloading package git-svn-1.5.4.5-26.1.x86_64 (4/6), 66.0 K (195.0 K unpacked) Downloading: git-svn-1.5.4.5-26.1.x86_64.rpm [done] Installing: git-svn-1.5.4.5-26.1 [done] Downloading package git-cvs-1.5.4.5-26.1.x86_64 (5/6), 63.0 K (205.0 K unpacked) Downloading: git-cvs-1.5.4.5-26.1.x86_64.rpm [done] Installing: git-cvs-1.5.4.5-26.1 [done] Downloading package git-1.5.4.5-26.1.x86_64 (6/6), 10.0 K (3.0 K unpacked) Downloading: git-1.5.4.5-26.1.x86_64.rpm [done] Installing: git-1.5.4.5-26.1 [done]
...or by capability they provide:
# zypper in MozillaFirefox \< 3
Reading installed packages... 'MozillaFirefox' providing 'MozillaFirefox<3' is already installed. Nothing to do.
# zypper in MozillaFirefox \>= 3
Reading installed packages... The following packages are going to be upgraded: mozilla-xulrunner190-translations MozillaFirefox mozilla-xulrunner190-gnomevfs mozilla-xulrunner190 MozillaFirefox-translations The following package is going to be REMOVED: mozilla-xulrunner190-lang Overall download size: 11.0 M. After the operation, 12.9 M will be freed. Continue? [Y/n/p/?]:
# zypper in 'libqtiff.so()(64bit)'
Reading installed packages... 'libqt4-x11' providing 'libqtiff.so()(64bit)' is already installed. Nothing to do.
Other examples:
zypper in yast* # install all yast modules zypper in -t pattern lamp_server # install lamp_server pattern (packages needed for a LAMP server) zypper in emacs pattern:lamp_server # install the emacs package and lamp_server pattern zypper in vim -emacs # install vim and remove emacs in one go zypper in amarok packman:libxine1 # install libxine1 from packman and amarok from any repo zypper in bitchx-1.1-81.x86_64.rpm # install bitchx rpm from local directory zypper in -f subversion # force reinstallation of subversion
Removing packages
remove or rm
The remove command is very much like the install command, except that the effect is the opposite :O)
zypper remove sqlite
Reading installed packages... The following packages are going to be REMOVED: sqlite3 perl-DBD-SQLite git-cvs git After the operation, 351.0 K will be freed. Continue? [YES/no]: n
Automatically Removing unneeded packages
The above command may only remove the target package. To ensure the removal of the packages installed as dependencies of sqlite and that are not needed by any other package in the system, use the option --clean-deps, or -u for short.
zypper rm solaar
Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: solaar 1 package to remove. After the operation, 2.0 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): n
zypper rm -u solaar
Reading installed packages... Resolving package dependencies... The following 7 packages are going to be REMOVED: python311-evdev python311-hid-parser python311-python-xlib python311-PyYAML python311-typing_extensions solaar solaar-udev 7 packages to remove. After the operation, 5.0 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): y (1/7) Removing solaar-1.1.10-2.1.noarch ............................................................[done] (2/7) Removing solaar-udev-1.1.10-2.1.noarch .......................................................[done] (3/7) Removing python311-typing_extensions-4.8.0-1.1.noarch ........................................[done] (4/7) Removing python311-python-xlib-0.33-2.1.noarch ...............................................[done] (5/7) Removing python311-hid-parser-0.0.3-1.6.noarch ...............................................[done] (6/7) Removing python311-evdev-1.6.1-2.3.x86_64 ....................................................[done] (7/7) Removing python311-PyYAML-6.0.1-2.1.x86_64 ...................................................[done] Running post-transaction scripts ...................................................................[done]
If you have already removed the package, you will need to first check the packages installed that are not needed anymore:
zypper pa --unneeded
As a one-liner, you can use the following to remove them, similarly to Debian-based `apt-get autoremove`:
sudo zypper rm (zypper pa --unneeded | awk '/i / {print $3}' FS='|' | uniq | tr '\n')
Source packages and build dependencies
source-install or si
# zypper si zypper
Reading installed packages... The following NEW packages are going to be installed: libzypp-devel libsatsolver-devel The following source package is going to be installed: zypper Overall download size: 1.5 M. After the operation, additional 6.7 M will be used. Continue? [YES/no]:
You can also install only the build deps or only the source package:
zypper si -D zypper # only the source packages (no build deps) zypper si -d zypper # only the build deps (no source package)
Updating packages
update or up
The following commands update packages with their newer available versions. See also Update Management for more information.
zypper up # update all installed packages with newer version as far as possible zypper up libzypp zypper # update libzypp and zypper zypper in sqlite3 # update sqlite3 or install it if not yet installed
Querying
Searching packages
search or se
By default, the search command looks for packages of any type, status or repository, having names containing specified string (compares case-insensitively):
celebi:~ # zypper se sqlite
Loading repository data... Reading installed packages... S | Name | Summary | Type --+-----------------------------+----------------------------------------------------------------+----------- | dovecot21-backend-sqlite | SQLite support for Dovecot | package | go-gosqlite | Trivial SQLite binding for Go | package | go-gosqlite | Trivial SQLite binding for Go | srcpackage | go-gosqlite-doc | API documenation | package | libapr-util1-dbd-sqlite3 | DBD driver for SQLite 3 | package | libdbi-drivers-dbd-sqlite3 | SQLite3 driver for libdbi | package | libgda-3_0-sqlite | Sqlite Provider for GNU Data Access (GDA) | package | libgda-5_0-sqlite | Sqlite Provider for GNU Data Access (GDA) | package i | libqt4-sql-sqlite | Qt 4 sqlite plugin | package i | libqt4-sql-sqlite-32bit | Qt 4 sqlite plugin | package i | libsqlite3-0 | Shared libraries for the Embeddable SQL Database Engine | package i | libsqlite3-0-32bit | Shared libraries for the Embeddable SQL Database Engine | package | mono-data-sqlite | Database connectivity for Mono | package | pdns-backend-sqlite2 | SQLite 2 backend for pdns | package i | perl-DBD-SQLite | Self-contained RDBMS in a DBI Driver | package | perl-DBD-SQLite | Self-contained RDBMS in a DBI Driver | srcpackage | perl-DBD-SQLite-devel | Development files for perl-DBD-SQLite | package i | php5-sqlite | PHP5 Extension Module | package | proftpd-sqlite | SQLite Module for ProFTPD | package | python-pysqlite | DB-API 2.0 interface for SQLite 3.x | package | python-pysqlite | DB-API 2.0 interface for SQLite 3.x | srcpackage | python-pysqlite-debuginfo | Debug information for package python-pysqlite | package | python-pysqlite-debugsource | Debug sources for package python-pysqlite | package | qt3-sqlite | SQLite Database Plug-In for Qt | package | rubygem-sqlite3 | A Ruby interface for the SQLite3 database engine | package | rubygem-sqlite3 | A Ruby interface for the SQLite3 database engine | srcpackage | rubygem-sqlite3-doc | RDoc documentation for sqlite3 | package | rubygem-sqlite3-testsuite | Test suite for sqlite3 | package i | sqlite2 | Embeddable SQL Database Engine | package | sqlite2 | Embeddable SQL Database Engine | srcpackage | sqlite2-32bit | Embeddable SQL Database Engine | package | sqlite2-devel | Embeddable SQL Database Engine | package | sqlite3 | Embeddable SQL Database Engine | package | sqlite3 | Embeddable SQL Database Engine | srcpackage i | sqlite3-devel | Embeddable SQL Database Engine | package | sqlite3-tcl | Tcl binding for SQLite | package | strongswan-sqlite | OpenSource IPsec-based VPN Solution | package | tntdb3-sqlite | Tntdb is a c++-class-library for easy database-access - sqlite | package | tntdb3-sqlite-debuginfo | Debug information for package tntdb3-sqlite | package | ulogd2-sqlite3 | SQLite3 output target for ulogd2 | package
The letter "i" in column one (1); states that the package is already installed on the local machine. To see all available versions of matching packages, use "--details/-s" option:
celebi:~ # zypper search -s --match-exact VirtualBox
Loading repository data... Reading installed packages... S | Name | Type | Version | Arch | Repository --+------------+------------+--------------+--------+--------------------- | virtualbox | package | 4.1.18-1.3.1 | x86_64 | openSUSE-12.2-Oss | virtualbox | package | 4.1.18-1.3.1 | i586 | openSUSE-12.2-Oss | virtualbox | srcpackage | 4.1.18-1.3.1 | noarch | openSUSE-12.2-Source
The letter "i" in column one (1); states that the software selected is already installed on the local machine, while the letter "v" in column one (1); states that there are other versions of the product installed on the local machine.
Other examples:
zypper se -dC --match-words RSI # look for RSI acronym (case-sensitively), also in summaries and descriptions zypper se 'yast*' # show all packages starting with 'yast' (beware of shell expansion, quote the strings if unsure!) zypper se -r packman # list all packages from 'packman' repository zypper se -i sqlite # show all installed packages containing 'sqlite' in their name zypper se -t pattern -r repo-oss # list all patterns available in the 'repo-oss' repository zypper se -t product # list all available products
Obtaining information about packages
info or if
celebi:~ # zypper info amarok
Loading repository data... Reading installed packages... Information for package amarok: Repository: packman Name: amarok Version: 2.6.0-7.3 Arch: x86_64 Vendor: http://packman.links2linux.de Installed: Yes Status: out-of-date (version 2.6.0-6.9 installed) Installed Size: 31.0 MiB Summary: Media Player for KDE Description: Amarok is a media player for all kinds of media. This includes MP3, Ogg Vorbis, audio CDs, podcasts and streams. Play lists can be stored in .m3u or .pls files.
This command displays detailed information about package named 'amarok'.
Other examples:
zypper info -t patch MozillaFirefox # show information about 'MozillaFirefox' patch zypper patch-info MozillaFirefox # the same as above zypper info -t pattern lamp_server # show info about 'lamp_server' pattern zypper info -t product openSUSE-FTP # show info about specified product
Dependencies
what-provides or wp
To list all providers of specified capability, do:
celebi:~ # zypper wp firefox
Loading repository data... Reading installed packages... S | Name | Type | Version | Arch | Repository --+----------------+---------+---------------+--------+--------------------- i | MozillaFirefox | package | 15.0.1-2.11.1 | x86_64 | openSUSE-12.2-Update v | MozillaFirefox | package | 15.0-2.7.1 | x86_64 | openSUSE-12.2-Update v | MozillaFirefox | package | 14.0.1-2.4.1 | x86_64 | openSUSE-12.2-Oss v | MozillaFirefox | package | 15.0.1-2.11.1 | i586 | openSUSE-12.2-Update v | MozillaFirefox | package | 15.0-2.7.1 | i586 | openSUSE-12.2-Update v | MozillaFirefox | package | 14.0.1-2.4.1 | i586 | openSUSE-12.2-Oss
This command is similar to rpm -q --whatprovides firefox, but rpm is only able to query the RPM database (database of the installed packages). Zypper, on the other hand, will tell you about providers of the capability from any repository, not only the installed ones.
Other queries
Commands patches, packages, patterns, and products are similar to search -s -t [patch,package,pattern,product], except that they display some additional information specific to the corresponding package type. For example patches shows also the status of patches (Needed/Security/Not Applicable).
Commands list-updates and patch-check are discussed in Update Management.
Package locks
locks or ll addlock or al removelock or rl cleanlocks or cl
Package locks serve the purpose of preventing changes to the packages on the system. Packages matching an active lock can't change their installed status; installed packages can't be removed or upgraded, packages not yet installed can't be installed.
To lock all packages starting with 'yast2', do:
celebi:~ # zypper al nano
Specified lock has been successfully added.
Again beware of shell expansion, use quotes if there is a possibility that yast* will match some files or directories in the working directory.
To list currently active locks:
celebi:~ # zypper ll
# | Name | Type | Repository ---+-------------------------------+---------+----------- 1 | PackageKit-gstreamer-plugin | package | (any) 2 | PackageKit-backend-zypp | package | (any) 3 | PackageKit-branding-openSUSE | package | (any) 4 | apper | package | (any) 5 | PackageKit-browser-plugin | package | (any) 6 | libpackagekit-glib2-14 | package | (any) 7 | PackageKit-gtk3-module | package | (any) 8 | libpackagekit-qt2-2 | package | (any) 9 | pk-update-icon | package | (any) 10 | libpackagekit-qt2-2-32bit | package | (any) 11 | libpackagekit-qt2-devel-32bit | package | (any) 12 | gnome-packagekit | package | (any) 13 | libpackagekit-qt2-devel | package | (any) 14 | PackageKit | package | (any)
To remove a lock, do:
# zypper rl nano
1 lock has been successfully removed.
Other examples:
zypper al zypper # lock package 'zypper' (exact match) zypper al -r repo-oss virtualbox* # restrict the lock to 'repo-oss' repository (allowing installation from others) zypper rl 3 # remove lock by number
You can manipulate the locks also by directly editing the locks file.
Utilities
Verify dependencies
verify or ve
You may occasionally end up with a broken system when it comes to package dependencies. If some of your applications fails to start with a message indicating that it misses something, this is something for zypper to check:
$ firefox
Could not find compatible GRE between version 1.9.0 and 1.9.0.
# zypper ve
Reading installed packages... Some of the dependencies of installed packages are broken. In order to fix these dependencies, the following actions need to be taken: The following NEW package is going to be installed: mozilla-xulrunner190 Overall download size: 6.5 M. After the operation, additional 23.5 M will be used. Continue? [YES/no]: y
Install new recommended packages
install-new-recommends or inr
This command finds and installs newly added recommended packages for packages you have already installed. This provides an easy way to get new language bundles for your software or drivers for newly added hardware.
# zypper inr
Reading installed packages... The following NEW packages are going to be installed: kdebase4-openSUSE-lang bundle-lang-common-cs Overall download size: 534.0 K. After the operation, additional 1.9 M will be used. Continue? [YES/no]:
Check processes
ps
This command shows processes that use files deleted by recent package upgrades or removal
There are some running programs that use files deleted by recent upgrade. You may wish to restart some of them. Run 'zypper ps' to list these programs.
celebi:~ # zypper ps
The following running processes use deleted files: PID | PPID | UID | Login | Command | Service | Files ------+------+------+---------+-------------------------------+---------+----------------------------- 1 | 0 | 0 | root | systemd | | /lib64/libudev.so.0.13.1 759 | 1 | 0 | root | systemd-logind | | /lib64/libudev.so.0.13.1 1827 | 1696 | 0 | root | Xorg | | /lib64/libudev.so.0.13.1 You may wish to restart these processes. See 'man zypper' for information about the meaning of values in the above table.
Update management
There are two approaches to keeping your system up to date. One is patch-wise, the second is package-wise.
The patch-wise approach is particularly useful for people using stable releases and want update their systems with patches released through online update repositories. Update repositories are added by default during installation or upgrade of the system, or they can be added via Online Update Configuration from the Software tab in YaST Control Center, or manually using zypper. Here is the list of available openSUSE update repositories.
YaST equivalent of this feature is the Online Update module.
The second, package-wise update is described in section Package Updates and servers for general updating of packages from any repository with their newer versions.
Listing needed patches
list-patches or lp
To list all needed patch updates, do:
celebi:~ # zypper lp
Loading repository data... Reading installed packages... Repository | Name | Version | Category | Status | Summary ---------------------+-------------------+---------+-------------+--------+--------------------------------------------------------------------- openSUSE-12.2-Update | openSUSE-2012-651 | 1 | recommended | needed | udev: create /dev/root symlink with dynamic rule for systemd openSUSE-12.2-Update | openSUSE-2012-655 | 1 | recommended | needed | clamav: update to version 0.97.6 openSUSE-12.2-Update | openSUSE-2012-657 | 1 | recommended | needed | NetworkManager: Several Bug fixes openSUSE-12.2-Update | openSUSE-2012-659 | 1 | recommended | needed | timezone: update to 2012f openSUSE-12.2-Update | openSUSE-2012-660 | 1 | security | needed | security update for tor openSUSE-12.2-Update | openSUSE-2012-662 | 1 | recommended | needed | coreutils: re-enable multithreaded sort(1) if OMP_NUM_THREADS is set openSUSE-12.2-Update | openSUSE-2012-663 | 1 | recommended | needed | suspend: Fixed double suspend issue openSUSE-12.2-Update | openSUSE-2012-665 | 1 | recommended | needed | mdadm update for openSUSE 12.2 openSUSE-12.2-Update | openSUSE-2012-666 | 1 | recommended | needed | module-init-tools: Fix modprobe when /usr/local is managed by AutoFS
Sometimes only updates affecting the package management are listed, since these should be applied first. Once applied, the rest of available updates will be listed by this command.
This command is equivalent to zypper up -t patch known from older zypper versions. To list all available package updates, use:
celebi:~ # zypper lu
Applying patches
patch
To apply the needed patches, do:
celebi:~ # zypper patch
Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW patches are going to be installed: openSUSE-2012-651 openSUSE-2012-655 openSUSE-2012-657 openSUSE-2012-659 openSUSE-2012-660 openSUSE-2012-662 openSUSE-2012-663 openSUSE-2012-665 openSUSE-2012-666 The following packages are going to be upgraded: NetworkManager NetworkManager-devel clamav coreutils libgudev-1_0-0 libnm-glib-vpn1 libnm-glib4 libnm-util2 libudev-devel libudev0 mdadm module-init-tools suspend timezone timezone-java tor typelib-1_0-NMClient-1_0 typelib-1_0-NetworkManager-1_0 udev 19 packages to upgrade. Overall download size: 9.2 MiB. After the operation, additional 4.3 KiB will be used. Continue? [y/n/?] (y):
Listing all patches
patches
The list-updates command only lists needed patches. To list all available patches, use:
# zypper patches
Reading installed packages... Catalog | Name | Version | Category | Status -----------------+--------------------+---------+-------------+--------------- Updates for 11.1 | KDE4-fixes | 38 | recommended | Installed Updates for 11.1 | MozillaFirefox | 50 | recommended | Installed Updates for 11.1 | NetworkManager-kde | 49 | recommended | Installed Updates for 11.1 | autoyast2 | 37 | recommended | Installed Updates for 11.1 | courier-authlib | 42 | security | Not Applicable Updates for 11.1 | insserv | 47 | recommended | Installed Updates for 11.1 | opera | 43 | security | Installed
Checking patches
patch-check
This command will tell you whether there are any important patches available for your system and the number of such patches:
celebi:~ # zypper pchk
Loading repository data... Reading installed packages... 9 patches needed (1 security patch)
Getting information about patches
patch-info
info -t patch
celebi:~ # zypper info -t patch openSUSE-2012-651
Loading repository data... Reading installed packages... Information for patch openSUSE-2012-651: Name: openSUSE-2012-651 Version: 1 Arch: noarch Vendor: maint-coord@suse.de Status: Installed Category: recommended Created On: Wed Sep 19 14:03:20 2012 Reboot Required: No Package Manager Restart Required: No Interactive: No Summary: udev: create /dev/root symlink with dynamic rule for systemd Description: This update fixes the following issue for udev: - bnc#776882: create /dev/root symlink with dynamic rule for systemd Provides: patch:openSUSE-2012-651 == 1 Conflicts: libgudev-1_0-0.i586 < 182-4.17.1 libgudev-1_0-0-32bit.x86_64 < 182-4.17.1 libgudev-1_0-0-debuginfo.i586 < 182-4.17.1 libgudev-1_0-0-debuginfo-32bit.x86_64 < 182-4.17.1 libgudev-1_0-devel.i586 < 182-4.17.1 libudev-devel.i586 < 182-4.17.1 libudev0.i586 < 182-4.17.1 libudev0-32bit.x86_64 < 182-4.17.1 libudev0-debuginfo.i586 < 182-4.17.1 libudev0-debuginfo-32bit.x86_64 < 182-4.17.1 typelib-1_0-GUdev-1_0.i586 < 182-4.17.1 udev.i586 < 182-4.17.1 srcpackage:udev < 182-4.17.1 udev-debuginfo.i586 < 182-4.17.1 udev-debugsource.i586 < 182-4.17.1 libgudev-1_0-0.x86_64 < 182-4.17.1 libgudev-1_0-0-debuginfo.x86_64 < 182-4.17.1 libgudev-1_0-devel.x86_64 < 182-4.17.1 libudev-devel.x86_64 < 182-4.17.1 libudev0.x86_64 < 182-4.17.1 libudev0-debuginfo.x86_64 < 182-4.17.1 typelib-1_0-GUdev-1_0.x86_64 < 182-4.17.1 udev.x86_64 < 182-4.17.1 udev-debuginfo.x86_64 < 182-4.17.1 udev-debugsource.x86_64 < 182-4.17.1
Package updates
list-updates or lu
update or up
To simply update installed packages with their newer available versions, do:
# zypper up
You can get a list of available updates with:
# zypper lu
The above commands will list or update only such packages whose update has
no dependency problems. To get raw list of packages with newer versions than those
installed, do:
# zypper lu -a
This will list all update candidates, regardless whether they are installable
or not, or whether they need user's interaction to resolve some problems.
Distribution upgrade
dist-upgrade or dup
This command uses the distribution upgrade algorithm, which handles package splits, unmaintaned packages, and similar. Use it to switch to another distribution release.
# zypper dup
It is recommended to enable only the main repository of the distribution you want to install plus a few important repositories you were using (even better - their version corresponding to the current main repository) during a dist-upgrade. You can achieve this by disabling the old repositories using zypper mr -da, adding the new repositories via zypper ar and issuing zypper dup. You can also specify repositories to be used using --repo option: zypper dup -r repo1 -r repo2 ....
Q: Is it true that "zypper up" only upgrades packages when a newer version is in the same repo as the outdated package and "zypper dup" upgrades everything, no matter in which repo the new package is located?
A: "zypper up" updates the packages if a newer version is available but will not change the vendor (Note: The whole build service currently has the same vendor). "zypper dup" will try to sync your currently installed packages with the ones available from (all) the repos you have enabled. This means it will also downgrade packages if your installed version is newer than the one available in the repo.
Using zypper in scripts and applications
Zypper supports several global options which make it suitable for use within automated processes like scripts. Also, several different exit codes listed in zypper's manual page can be checked for when using zypper in an automated process.
Non interactive mode
--non-interactive
In this mode zypper does not prompt the user for any answers and uses default answers instead. When using this option it is guaranteed that zypper will not hang prompting for an answer on stdin, or in an endless loop.
For example, to update your system automatically without confirmation, you can type
# zypper --non-interactive update
This command does not require confirmation from the user to proceed with update, skips all interactive patches which would need additional confirmation and also automatically answers any other prompts.
No GPG checks mode
--no-gpg-checks
If this option is used, zypper will always choose to continue if some of the gpg checks fails, e.g. a repository file is not signed and should be, a file is signed and the gpg check fails, etc.
Auto-agree with licenses
--auto-agree-with-licenses
This is special option for the install, remove and update commands. By using this, the user declares he/she agrees with the terms of licenses the command will install, and zypper will automatically say 'yes' to the license confirmation prompt. This is useful for people installing the same set of packages on multiple machines (by an automated process) and have read all the licenses before.
Quiet output
--quiet
Avoids displaying too much texts like progress information and only displays result of the operation and error messages.
XML output
--xmlout
This option makes zypper to talk in XML. This allows scripts, graphical front-ends or other types of applications which would like to use zypper, to parse zypper's output in a well-defined, standard way. The RNC schema of zypper's XML output is available here and at /usr/share/zypper/xml/xmlout.rnc.
Not all (but most of) the output is currently in XML; the goal is to have all possible output in XML.
Prompts
The following should be a complete list of cases where zypper needs user interaction together with the replies used in non-interactive mode. All the additional options mentioned here have higher priority over --non-interactive, so if used, the answer they imply are automatically used even if --non-interactive isn't used.
Where --no-gpg-checks is applied, a message is displayed or a warning is written to stderr and logged.
prompt | default answer | with --no-gpgp-checks | note |
---|---|---|---|
accept unsigned file? | N | Y | |
accept new key (reject the key, trust temporarily, or trust always? [r/t/a]) | R | R | a new key can be trusted or imported in the interactive mode only |
accept unknown key? | N | Y | |
verification of signed file failed, continue? | N | Y | |
no digest for a file, continue? | N | Y | |
accept unknown digest? | N | Y |
Other prompts
prompt | default answer | other answer | note |
---|---|---|---|
proceed with installation/removal/update? | Y | in addition, the --no-confirm option can be used with the install/remove/update commands even without the global --non-interactive | |
confirm 3rd party license | N | Y if --auto-agree-with-licenses is used | in addition, for zypper update, --skip-interactive option can be used to exclude interactive patches from to-be-installed list (a heritage of rug) |
confirm a patch message | Y | ||
problem while installing/removing a resolvable, Abort/Retry/Ignore? | ABORT | this is ugly and can be improved in future | |
problem while downloading a package, Abort/Retry/Ignore? | ABORT | this is also ugly, can be enhanced somehow in the future | |
dependency conflict, #/s/r/c (solution number, skip, retry, or cancel) | c | always cancel, user interaction is needed to resolve dependencies | |
media change request | ABORT | ||
remove problematic lock? | Y |
In XML output, prompts are indicated by <prompt> tag, containing id attribute. Enumeration of all known ids is available in prompt.h include file packaged with zypper (/usr/include/zypper/prompt.h).
Compatibility with Rug
Zypper's syntax is similar to that of Rug but its command and option set has started to diversify from rug as well as its output and behavior.