SDB:Zypper usage 11.3

(Ανακατεύθυνση από SDB:Zypper usage)
Μετάβαση σε: πλοήγηση, αναζήτηση
This article is about how to use Zypper, the command line package manager using the Libzypp library. It contains complementary information to Zypper's manual page (man zypper). What you can't find here, you should find in the man page and vice versa.
Version: 11.3This article is about zypper 1.4.5 as it appeared in openSUSE 11.3. For other versions see Zypper versions.

Γρήγορη Αναφορά

Οι εντολές που πιθανόν θα χρησιμοποιείτε ποιο συχνά.

zypper                 # για να εμφανιστεί η λίστα με τις διαθέσιμες γενικες επιλογές και εντολές
zypper help search     # για να εμφανιστεί βοήθεια για την εντολή search
zypper lp              # για να δείτε ποιες διορθώσεις αναβαθμίσεων είναι διαθέσιμες
zypper patch           # για να αιτηθείτε τις απαραίτητες διορθώσεις
zypper se sqlite       # για να ψάξετε για το sqlite
zypper rm sqlite2      # για να αφαιρέσετε το sqlite2
zypper in sqlite3      # για να εγκαταστήσετε το sqlite3
zypper in yast*        # για να εγκαταστήσετε όλα τα πακέτα που ταιριάζουν με το 'yast*'
zypper up              # για να αναβαθμίσετε όλα τα εγκατεστημένα πακέτα με τις νεότερες εκδόσεις, όπου είναι εφικτό

Φυλλάδιο γρήγορων εντολών

Εδώ μπορείτε να δείτε τις πληροφορίες που εμφανίζονται σε αυτή την σελίδα, αλλά συγκεντρωμένες σε μορφή φυλλαδίου γρήγορων εντολών. Επίσης συμπεριλαμβάνει μερικές αναφορές από τις σελίδες του εγχειριδίου. Συστήνεται αφού αναλύσετε τις πληροφορίες που εμφανίζονται εδώ.

Πρώτη Σελίδα A4.
Δεύτερη Σελίδα A4.
Πρώτη Σελίδα Επιστολή.
Δεύτερη σελίδα επιστολή.

Γενική Χρήση

Η γενική σύνταξη του zypper είναι:

# zypper [Γενικές επιλογές] command [Επιλογές εντολής] [Παράμετροι] ...

Τα στοιχεία που εσωκλείονται στις αγκύλες δεν απαιτούνται, έτσι ο απλούστερος τρόπος για να εκτελεστεί το zypper είναι να πληκτρολογήσετε το όνομα του ακολουθούμενο από μια εντολή. Για παράδειγμα, για να αιτηθείς τις απαραίτητες διορθώσεις στο σύστημα πληκτρολογίστε:

# zypper patch

Εναλακτικά, μπορείτε να διαλέξετε από μια η περισσότερες γενικές επιλογές by typing them just before the command: (run the command, but don't ask me anything, decide on your own)

# 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)

# zypper patch --auto-agree-with-licenses

Some of the commands require one or more arguments: (install or update mplayer package)

# zypper install mplayer

Some of the options also require an argument: (search for patterns)

# zypper search -t pattern

All of the above combined: (install mplayer and amarok by using the factory repository only, be verbose)

# 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 11.1').

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 | packman               | Packman 11.1          | Yes     | No
2 | fate                  | fate                  | No      | No
3 | openSUSE-11.1-Updates | Updates for 11.1      | Yes     | Yes
4 | repo-oss              | openSUSE-11.1-Oss     | Yes     | No
5 | repo-non-oss          | openSUSE-11.1-Non-Oss | Yes     | No
6 | repo-debug            | openSUSE-11.1-Debug   | No      | No
# zypper lr 5 4
Alias          : openSUSE-11.3-Non-Oss
Name           : openSUSE-11.3-Non-Oss
URI            : http://download.opensuse.org/distribution/11.3/repo/non-oss/
Enabled        : Yes
Priority       : 99
Auto-refresh   : Off
Keep Packages  : Off
Type           : yast2                                                       
GPG Check      : On
GPG Key URI    : 
Path Prefix    : /
Parent Service : 
MD Cache Path  : /var/cache/zypp/raw/openSUSE-11.3-Non-Oss

Alias          : openSUSE-11.3-Oss
Name           : openSUSE-11.3-Oss
URI            : http://download.opensuse.org/distribution/11.3/repo/oss/
Enabled        : Yes
Priority       : 99
Auto-refresh   : Off
Keep Packages  : Off 
Type           : yast2
GPG Check      : On
GPG Key URI    :   
Path Prefix    : /
Parent Service :
MD Cache Path  : /var/cache/zypp/raw/openSUSE-11.3-Oss

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:

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

<to be added>


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

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 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


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):

# zypper se sqlite
Reading installed packages...

S | Name                     | Summary                                                        | Type
--+--------------------------+----------------------------------------------------------------+--------
  | libapr-util1-dbd-sqlite3 | DBD driver for SQLite 3                                        | package
i | libgda-3_0-sqlite        | Sqlite Provider for GNU Data Access (GDA)                      | package
  | libqt4-sql-sqlite        | Qt 4 sqlite plugin                                             | package
i | libsqlite3-0             | Shared libraries for the Embeddable SQL Database Engine        | package
  | libsqlite3-0-32bit       | Shared libraries for the Embeddable SQL Database Engine        | package
  | mediatomb-sqlite         | UPnP AV MediaServer                                            | package
i | mono-data-sqlite         | Database connectivity for Mono                                 | package
  | pdns-backend-sqlite2     | SQLite 2 backend for pdns                                      | package
  | pdns-backend-sqlite3     | SQLite 3 backend for pdns                                      | package
i | perl-DBD-SQLite          | The DBD::SQLite is a self contained RDBMS in a DBI driver      | package
i | php5-sqlite              | PHP5 Extension Module                                          | package
  | python-sqlite2           | Python bindings for sqlite 2                                   | package
  | qt3-sqlite               | SQLite Database Plug-In for Qt                                 | package
  | rekall-sqlite            | Rekall sqlite Database Backend                                 | package
  | rubygem-sqlite3          | A Ruby interface for the SQLite3 database engine               | package
i | sqlite2                  | Embeddable SQL Database Engine                                 | package
  | sqlite2-32bit            | Embeddable SQL Database Engine                                 | package
  | sqlite2-devel            | Embeddable SQL Database Engine                                 | package
i | sqlite3                  | Embeddable SQL Database Engine                                 | package
  | sqlite3-devel            | Embeddable SQL Database Engine                                 | package
  | sqlite3-tcl              | Tcl binding for SQLite                                         | package
  | tntdb1-sqlite            | Tntdb is a c++-class-library for easy database-access - sqlite | package
  | ulogd-sqlite             | SQLite output plugin for ulogd                                 | 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:

# zypper search -s --match-exact virtualbox-ose
Reading installed packages...

S | Name           | Type    | Version    | Arch   | Repository
--+----------------+---------+------------+--------+------------------------------------
v | virtualbox-ose | package | 1.6.2-2.1  | x86_64 | VirtualBox OSE
i | virtualbox-ose | package | 1.5.6-33.1 | x86_64 | openSUSE-11.1-Oss
v | virtualbox-ose | package | 1.5.6-20.5 | x86_64 | VirtualBox OSE (
v | virtualbox-ose | package | 1.6.2-2.1  | i586   | VirtualBox OSE
v | virtualbox-ose | package | 1.5.6-33.1 | i586   | openSUSE-11.1-Oss
v | virtualbox-ose | package | 1.5.6-20.3 | i586   | VirtualBox OSE

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

# zypper info amarok
Reading installed packages...


Information for package amarok:

Repository: Packman 11.1
Name: amarok
Version: 1.4.9.1-103.pm.1
Arch: x86_64
Vendor: packman.links2linux.de
Installed: Yes
Status: up-to-date
Installed Size: 12.1 M
Summary: Media Player for KDE
Description:
Amarok is a media player for all kinds of media, supported by aRts, GStreamer
or Xine (depending on the packages you install). This includes MP3, Ogg
Vorbis, audio CDs and streams.
It also supports audio effects of all kinds that are provided by aRts.
Playlists can be stored in .m3u or .pls files.

Amarok also provides audio file collection management, by using either an
embedded sqlite3, a MySQL or a PostgreSQL database.

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:

# zypper wp firefox
Reading installed packages...
S | Name           | Type    | Version     | Arch   | Repository
--+----------------+---------+-------------+--------+------------------
i | MozillaFirefox | package | 3.0-0.1     | x86_64 | Updates for 11.1
v | MozillaFirefox | package | 2.9.95-25.1 | x86_64 | openSUSE-11.1-Oss
v | MozillaFirefox | package | 3.0-0.1     | i586   | Updates for 11.1
v | MozillaFirefox | package | 2.9.95-25.1 | i586   | openSUSE-11.1-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:

# zypper al 'yast2*'
Reading installed packages...
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:

# zypper ll
# | Name             | Type    | Repository
--+------------------+---------+-----------
1 | libpoppler3      | package | (any)
2 | libpoppler-glib3 | package | (any)
3 | yast*            | package | (any)

To remove a lock, do:

# zypper rl yast2-packager
Reading installed packages...
The following query locks some of the objects you want to unlock:

type: package
match_type: glob
case_sensitive: on
solvable_name: yast2*

Do you want remove this lock? [YES/no]: y
Lock count has been succesfully decreased by: 1

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:

$ rpm -e --nodeps mozilla-xulrunner190 $ 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.
# zypper ps
The following running processes use deleted files:

PID   | PPID  | UID  | Login | Command       | Service | Files
------+-------+------+-------+---------------+---------+--------------------------------
10604 | 10603 | 1000 | geeko | chrome        |         | /usr/share/mime/mime.cache
      |       |      |       |               |         | /usr/share/mime/mime.cache
15304 | 3195  | 1000 | geeko | kio_thumbnail |         | /var/tmp/kdecache-geeko/ksycoca4
      |       |      |       |               |         | /var/tmp/kdecache-geeko/ksycoca4

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:

# zypper lp
Reading installed packages...
Patches

Repository       | Name               | Version | Category    | Status
-----------------+--------------------+---------+-------------+-------
Updates for 11.1 | KDE4-fixes         | 38      | recommended | Needed
Updates for 11.1 | MozillaFirefox     | 50      | recommended | Needed
Updates for 11.1 | NetworkManager-kde | 49      | recommended | Needed

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:

# zypper lu

Applying patches

patch

To apply the needed patches, do:

# zypper patch
Reading installed packages...

The following packages are going to be upgraded:
  NetworkManager-kde mozilla-nss mozilla-nspr kde4-korganizer


The following NEW patches are going to be installed:
  NetworkManager-kde MozillaFirefox KDE4-fixes


Overall download size: 2.9 M. After the operation, additional 283.0 K will be used.
Continue? [YES/no]:


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:

# zypper pchk
Reading installed packages...
0 patches needed (0 security patches)


Getting information about patches

patch-info
info -t patch

# zypper info -t patch MozillaFirefox
Reading installed packages...


Information for patch MozillaFirefox:

Name: MozillaFirefox
Version: 50
Arch: noarch
Vendor: maint-coord@suse.de
Status: Installed
Category: recommended
Created On: Thu 01 Jan 1970 01:00:00 AM CET
Reboot Required: No
Package Manager Restart Required: No
Interactive: No
Summary: Mozilla Firefox 3.0
Description:
This patch updates Mozilla Firefox to the final 3.0 version.

The dependend libraries mozilla-xulrunner190, mozilla-nspr
and mozilla-nss were also brought to their release version.

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.


GPG-related prompts

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. However, zypper is able to work also in rug-compatible mode and supports most of the rug commands. For more details see man zypper, section COMPATIBILITY WITH RUG.


See also