Archive:Zypper usage 11.1

Aller à : navigation, rechercher
Icon-obsolete.png Cet article fait référence à la version '11.1' et il est maintenant obsolète !
Référez-vous à la page de discussion pour plus de renseignements.
Cet article concerne l'utilisation de Zypper, l'interface du gestionnaire de paquet reposant sur la librairie Libzypp. Il contient des informations complémentaires aux pages man de Zypper (man zypper). Ce que vous trouverez pas ici, vous le trouverez dans les pages man et vice versa.

Version : 11.1 Cet article concerne zypper 1.0.2, inclut dans openSUSE 11.1. Pour d'autres versions, veuillez consulter Zypper/Versions.


Référence rapide


Ceci est ce que vous utiliserez probablement le plus fréquemment.

zypper                 # liste les options et commandes globales disponibles
zypper help search     # affiche l'aide pour la commande search
zypper lu              # affiche les correctifs de sécurité requis
zypper up -t patch     # applique les correctifs de sécurité
zypper se sqlite       # recherche sqlite
zypper rm sqlite2      # désinstalle sqlite2
zypper in sqlite3      # installe sqlite3
zypper in yast*        # installe tous les paquets contenant 'yast*'
zypper up              # met à jour tous les paquets installés avec des versions plus récentes lorsque c'est possible


Usage général


La syntaxe générale de zypper est la suivante :

zypper [global-options] command [command-options] [arguments] ...

Les composants entre crochets ne sont pas requis, ainsi, la manière la plus simple d'utiliser zypper est d'entrer son nom suivi d'une commande. Par exemple, pour appliquer les correctifs nécessaires au système, tapez:

zypper update -t patch

Par ailleurs, vous pouvez chosir une ou plusieurs options globales en les appelant juste avant la commande: (effectue la commande, mais ne me demande rien, décide par toi même)

zypper --non-interactive update

Pour utiliser les options spécifiques à une commande particulière, rentrez les juste après la commande: (applique les correctifs nécessaires au système mais ne demande pas de confirmer les licences, je les ai toute lues précédemment)

zypper update --auto-agree-with-licenses

Certaines commandes nécessitent un ou plusieurs arguments : (installe ou met à jour le paquet mplayer)

zypper install mplayer

Certaines de ces options nécessitent également un argument: (met à jour le système avec des paquets plus récents)

zypper update

On peut combiner toutes ces situations: (installe mplayer et amarok en utilisant le dépôt 'factory', soit verbeux)

zypper -v install --repo factory mplayer amarok 


Vocabulaire


  • dépôt (repository) - dépôt local ou distant, contenant divers paquets et informations à propos de ceux-ci (méta-données de paquets). Les dépôts étaient également appelés sources d'installation, services ou catalogues.
  • alias (alias) - l'alias d'un dépôt est une version courte du nom du dépôt, destiné à être utilisé dans les commandes et options de manipulation des dépôts, tels que removerepo ou –repo.
  • paquet (package) - paquet logiciel (paquet RPM, paquet source). Les correctifs, patterns, et produits sont communément connus comme des différents types de paquets.
  • correctif (patch) - représente un paquet ou un groupe de paquets nécessaire d'être installé comme une mise à jour critique (résolution de bogue).
  • pattern (pattern) - représente un groupe de paquets. Par exemple un pattern Http Server définirait toutes les dépendances de sorte que tous les paquets nécessaires à l'utilisation et la gestion d'un serveur http seraient installés lors de l'installation du pattern.
  • produit (product) - représente le produit complet (par ex.'openSUSE 11.1').

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.


Commandes


zypper fournit un certain nombre de commandes, qui peuvent être groupées dans les catégories suivantes :

  • gestion des dépôts
    refresh, repos, addrepo, removerepo, modifyrepo, namerepo
  • gestion des paquets
    install, remove, update, dist-upgrade, source-install
  • requêtes
    search, info, what-provides, list-updates, patch-check, patches, packages, patterns, products
  • verrouillage
    locks, addlock, removelock
  • utilitaires
    verify, install-new-recommends
  • autres
    help

A noter que les commandes update, list-updates, patch-check, et patches peuvent se référer à des commandes de Gestion des mises à jour.


Afficher l'aide

'help ou -h

Il est utile de savoir comment obtenir de l'aide. Pour afficher l'aide générale (liste des commandes et options globales), entrez juste zypper sans aucune option ni argument. pour afficher l'aide d'une commande spécifique, utilisez :

# zypper help [command]

Les commandes zypper -h [command] et zypper [command] -h sont équivalentes.


Gestion des dépôts

Vous pouvez spécifier un dépot existant par le nombre qui lui est associé par la commande zypper lr, alia ou URI. Quand vous utilisez les nombres, soyez sûr de toujours vérifier la correspondance avec zypper lr, puisque ces nombres peuvent changer après manipulation des dépots.


Lister les dépôts définis

repos ou lr

Exemple de sortie:

$ 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

Autres exemples:

zypper lr -u       # inclus également l'URI dans la table
zypper lr -d       # inclus de nombreuses autres propriétés dans la table
zypper lr -P       # inclus également la priorité des dépots et trie la liste selon cette propriété
zypper lr -e my    # exporte tous les dépôts définis dans un fichier nommé 'my.repo'


Ajout de dépôts

addrepo ou ar

Avant qu'un paquet puisse être installé, il est nécessaire de définir au moins un dépot. Pour ajouter un dépôt, utilisez la commande addrepo:

Exemple de sortie:

$ zypper ar http://download.videolan.org/pub/vlc/SuSE/11.0 vlc
Adding repository 'vlc' [done]
Repository 'vlc' successfully added
Enabled: Yes
Autorefresh: No
URI: http://download.videolan.org/pub/vlc/SuSE/11.0

Autres exemples:

zypper ar http://download.opensuse.org/repositories/X11:/XGL/openSUSE_11.0/X11:XGL.repo  # via fichier .repo
zypper ar -c ftp://some.download.site myalias   # sonde le dépôt lors de l'ajout
zypper ar my/dir/with/rpms local                # ajoute votre répertoire local contenant des RPMs comme un dépôt

Voir également en:Libzypp/URI pour une liste des types de media et URI supportés.


Rafraichir les dépôts

refresh ou ref

Après l'ajout d'un dépôt ou lors que l'un des dépôts devient trop vieux, son état doit être vérifié : il a besoin d'être rafraichi afin de mettre à jour la liste des paquets qu'il contient. Cela signifie qu'on télécharge les méta-données et on place ces données en cache (fichier .solv) pour une lecture rapide.

Exemple de sortie:

$ zypper refresh
Downloading repository 'Packman 11.0' metadata [done]
Building repository 'Packman 11.0' cache [done]
Downloading repository 'Updates for 11.0' metadata [done]
Building repository 'Updates for 11.0' cache [done]
Repository 'openSUSE-11.0-Oss' is up to date.
All repositories have been refreshed.

Si autorefresh est activée pour un dépôt, il n'est pas nécessaire de s'inquiéter du rafraichissement, il sera exécuté automatiquement lorsqu'il est requis. Cependant, certaines personnes préfèrent contrôler manuellement le rafraichissement (par ex. pour éviter d'attendre que le rafraichissement se termine lorsque l'on a seulement besoin de voir 'zypper info krusader'), le rafraichissement automatique peur donc être desactivé. Voir man zypper pour plus de détails.

Autres exemples:

zypper ref packman main  # specifie quel sont les dépôts à rafraichir
zypper ref -f upd        # force le rafraichissement du dépôt 'upd'


Suppression de dépôts

removerepo ou rr

Exemple de sortie:

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


Modification de dépôts

modifyrepo ou mr

Exemple de sortie:

Désactiver le dépôt spécifique n°6:

$ zypper mr -d 6
Repository 'repo-non-oss' has been sucessfully disabled.

Autoriser l’auto-refresh et le cache des fichiers RPMs pour le dépot 'packman' et placer sa priorité à 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.

Désactiver le cache des fichiers RPMs pour tous les dépôts:

$ 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'.

Activer le cache des fichiers RPM pour tous les dépôts:

$ 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.0-Updates'.


Renommer les dépôts

namerepo ou nr

Exemple de sortie:

$ zypper nr 3 upd
Repository 'openSUSE-11.0-Updates' renamed to 'upd'.

Cette commande n'est actuellement capable de changer que l'alias d'un dépôt. Si vous désirez changer le nom affiché du dépôt, réferrez-vous à la commande mr.

Conservez les alias courts et simples pour une utilisation plus aisée des arguments des commandes et des options --repo. Utiliser un alias est plus sûr qu'utiliser un numéro de dépôt (puisque qu'il peut changer et vous induire en erreur) et plus facile qu'utiliser l'URI (qui sont longues, et nécissitant un copié-collé).


Exporter/Importer

repos -e

Vous pouvez exporter la liste complète des dépôts dans un fichier et le réimporter plus tard ou sur une autre machine.

Exemple de sortie:

zypper lr --export backups/repos/foo.repo
zypper ar backups/repos/foo.repo


Gestion des paquets

Sélectionner des paquets

Il y a plusieurs façon de choisir les paquets pour les installer ou les supprimer.

  • 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


Installation de paquets

install ou in

Exemple de sortie:

Vous pouvez installer les paquets à la fois par leur nom...

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

...ou par le service qu'ils fournissent:

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

Autres exemples:

zypper in yast*                     # installe tous les modules yast
zypper in -t pattern lamp_server    # installe le pattern lamp_server (paquets requis pour un serveur LAMP)
zypper in vim -emacs                # installe vim et supprime emacs en une seule traite
zypper in amarok packman:libxine1   # installe libxine1 du dépôt packman et amarok de n'importe quel dépôt
zypper in bitchx-1.1-81.x86_64.rpm  # installe le RPM bitchx depuis un répertoire local
zypper in -f subversion             # force la réinstallation de subversion


Suppression de paquets

remove ou rm

La commande removeest similaire à la commande install, à l'exception que l'effet est opposé :O)

Exemple de sortie:

$ 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


Paquets sources et dépendances de compilation

source-install ou si

Exemple de sortie:

$ 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]:

Vous pouvez également installer uniquement les dépendances de compilation ou le paquet source:

zypper in -D zypper    # seulement le paquet source (pas de dépendance de compilation)
zypper in -d zypper    # seulement les dépendances de compilation (pas de paquet source)


Mise à jour des paquets

update ou up
dist-upgrade ou dup

Met à jour les paquets si une version plus récente est disponible. Voir aussi Gestion des mises à jour pour plus d'informations.


zypper dup                 # utilise l'algorithme de mise à jour de la distribution (gère la séparation des paquets, les paquets non maintenus et similaire)
zypper up                  # met à jour tous les paquets installés avec des versions plus récentes dans la mesure du possible
zypper up libzypp zypper   # met à jour libzypp et zypper
zypper in sqlite3          # met à jour ou installe sqlite3 s'il n'est pas encore installé

Querying

Searching Packages

search

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 i in the first column says the package is already installed. 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 (OBS, openSUSE 11.0)
i | virtualbox-ose | package | 1.5.6-33.1 | x86_64 | openSUSE-11.0-Oss
v | virtualbox-ose | package | 1.5.6-20.5 | x86_64 | VirtualBox OSE (OBS, openSUSE 11.0)
v | virtualbox-ose | package | 1.6.2-2.1  | i586   | VirtualBox OSE (OBS, openSUSE 11.0)
v | virtualbox-ose | package | 1.5.6-33.1 | i586   | openSUSE-11.0-Oss
v | virtualbox-ose | package | 1.5.6-20.3 | i586   | VirtualBox OSE (OBS, openSUSE 11.0)

The i mean this particular version is installed, v means other version of this package is currently installed.

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

$ zypper info amarok
Reading installed packages...


Information for package amarok:

Repository: Packman 11.0
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

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.0
v | MozillaFirefox | package | 2.9.95-25.1 | x86_64 | openSUSE-11.0-Oss
v | MozillaFirefox | package | 3.0-0.1     | i586   | Updates for 11.0
v | MozillaFirefox | package | 2.9.95-25.1 | i586   | openSUSE-11.0-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 addlock removelock

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

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

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


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.

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

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