Zypper/Usage/10.2

From openSUSE

This article refers to the version '10.2' and it is now obsolete! Reason: 10.2.
Refer to this article's discussion page for more information.
Geeko This article is about how to use Zypper, a command line package manager using the package management library called Libzypp. 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


Image:susemini.png
Version:
10.2
This article is about zypper 0.6.17 as it appeared in openSUSE 10.2. For current version see Zypper/Usage


Contents


Global Options


The following options can be applied to any zypper transaction:

  • -V, --version
    Output the version number
  • -v, --verbose
    Debug output, prints full exception traces.
  • -t, --terse
    Terse output.
  • -s, --table-style
    Table style (integer).
  • -r, --rug-compatible
    Turn on rug compatibility.
  • --non-interactive
    Turn on non-interactive mode. (Under development) In this mode zypper does not prompt the user to make any decisions, but uses reasonable defaults automatically. This is useful to run zypper as a cron job, or as a part of a script. This mode is currently under development, so on some occasions a prompt may appear. Please file a bug report if you encounter such case.

Commands


zypper provides a number of commands (shown as [command] in the SYNTAX section). Each command accepts the option flags listed in the GLOBAL OPTIONS section.

The most commonly used command is zypper update which downloads and installs updates in services to which you are subscribed. If you only want to update software, that is the only command you need.

Printing Help

The general syntax is:

help, -h

Print help. To print general help, use:

zypper -h

To print help for a command, use:

zypper -h [command]

Listing Services

The general syntax is:

service-list, sl

List services aka installation sources.

Example of the output:

testicek2:~ # zypper sl
# | Enabled | Refresh | Type | Name                    | URI
--+---------+---------+------+-------------------------+---------------------------------------------------------------
1 | No      | Yes     | YaST | 20061129-152243         | http://download.opensuse.org/distribution/10.2/repo/non-oss/
2 | Yes     | Yes     | YUM  | SUSE-Linux-10.2-Updates | http://ftp.uni-kl.de/pub/linux/suse/update/10.2
3 | Yes     | Yes     | YaST | 20061129-133739         | ftp://10.20.3.1/netboot/find/openSUSE-10.2-RC3-retail-i386-CD1

Adding Services

Before we can install any packages we must first add a service. The general syntax is:

service-add, sa <URI> [alias]

Add a new service. Accepts the following option flags:

  • -r, --repo <FILE.repo> - Read URI and alias from a file

Example:

testicek2:~ # zypper sa http://ftp.uni-kl.de/pub/linux/suse/update/10.2 SUSE-Linux-10.2-Updates
Determining http://ftp.uni-kl.de/pub/linux/suse/update/10.2 source type...
http://ftp.uni-kl.de/pub/linux/suse/update/10.2 is type YUM
Added Installation Sources:
[x]* SUSE-Linux-10.2-Updates (http://ftp.uni-kl.de/pub/linux/suse/update/10.2)

Deleting Services

service-delete, sd <URI|alias>

Delete a service.

Example:

zypper sd http://ftp.uni-kl.de/pub/linux/suse/update/10.2

or

zypper sd SUSE-Linux-10.2-Updates

Renaming Services

The general syntax is:

service-rename, sr <URI|alias> <new-alias>

Rename a service.

Installing Resolvables

The general syntax is:

install, in [packagename] 
Install packages or resolvables. 

Accepts the following option flags:

  • -c, --catalog - Only from this catalog (FIXME)
  • -t, --type,-t [resolvable] - Type of resolvable (default: package)

Without options the command search a resolvable in all services. To use only one selected service, use option -c with the URI or alias of the catalog.

Removing Resolvables

The general syntax is:

remove, rm  [packagename]

Remove packages or resolvables. Accepts the following option flags:

  • -t, --type [resolvable] - Type of resolvable (default: package)

Searching Resolvables

The general syntax is:

search, se [pattern]

Search for packages matching a pattern. Accepts the following option flags:

  • --match-all - Search for a match to all search strings (default)
  • --match-any - Search for a match to any of the search strings
  • --match-substrings - Matches for search strings may be partial words (default)
  • --match-words - Matches for search strings may only be whole words
  • --match-exact - Searches for an exact package name
  • -d, --search-descriptions - Search also in package summaries and descriptions.
  • -c, --case-sensitive - Perform case-sensitive search.
  • -i, --installed-only - Show only packages that are already installed.
  • -u, --uninstalled-only - Show only packages that are not curenly installed.
  • -t, --type - Search only for packages of specified type.
  • --sort-by-name - Sort packages by name (default).
  • --sort-by-catalog - Sort packages by catalog.

Example:

testicek2:~ # zypper se help
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
S | Catalog         | Type    | Name        | Version       | Arch
--+-----------------+---------+-------------+---------------+-------
  | 20061115-083114 | package | devhelp     | 0.10-55       | i586
i | 20061115-083114 | package | gimp-help   | 0.9-40        | noarch
i | 20061115-083114 | package | susehelp    | 2006.06.20-22 | noarch
i | 20061115-083114 | package | susehelp_cz | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_de | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_en | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_es | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_fr | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_hu | 2006.06.20-22 | noarch
  | 20061115-083114 | package | susehelp_it | 2006.06.20-22 | noarch

Checking Patches

The general syntax is:

patch-check, pchk

Check for patches.

Example:

testicek2:~ # zypper pchk
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...
2 patches needed. ( 0 security patches )

Listing Patches

The general syntax is:

patches, pch

List available patches.

Example:

testicek2:~ # zypper pch
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...
Catalog                 | Name               | Version | Category    | Status
------------------------+--------------------+---------+-------------+-----------
SUSE-Linux-10.2-Updates | kwin-decor-suse2   | 2213-0  | optional    | Not Needed
SUSE-Linux-10.2-Updates | suspend            | 2247-0  | recommended | Needed
SUSE-Linux-10.2-Updates | update-test-trival | 2212-0  | optional    | Not Needed
SUSE-Linux-10.2-Updates | update-test-trival | 2214-0  | recommended | Needed

Obtaining Detailed Information about a Patch

The general syntax is: patch-info [patchname1] [patchname2]... Show full info for patches.

Example:

testicek2:~ # zypper patch-info suspend
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...

Information for patch suspend:
Name: suspend Version: 2247-0 Arch: noarch Status: Broken Category: recommended Created On: Fri Nov 10 02:44:36 2006 Reboot Required: No Package Manager Restart Required: No Interactive: No Summary: supend to disk never resumes, but reboots instead Description: Due to an error in the "resume" program, resume from suspend to disk was not possible. The machine booted up normally instead.
Provides: patch: suspend == 2247-0
Requires: atom: suspend == 0.20.20061106-4

Listing Updates

The general syntax is:

list-updates, lu

List updates. Accepts the following option flags:

  • -t, --type - Type of resolvable (default: patch)

Example:

testicek2:~ # zypper lu
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...
Catalog                 | Name               | Version | Category    | Status
------------------------+--------------------+---------+-------------+-------
SUSE-Linux-10.2-Updates | suspend            | 2247-0  | recommended | Needed
SUSE-Linux-10.2-Updates | update-test-trival | 2214-0  | recommended | Needed

Updating

The general syntax is:

update, up

Update packages.

  • -t, --type - Type of resolvable (default: patch)

Example:

testicek2:~ # zypper update
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...
Summary:
<install>   [S3:0][patch]suspend-2247-0.noarch
<uninstall> [S0:0][package]update-test-trival-1.1-2.noarch
<install>   [S3:0][patch]update-test-trival-2214-0.noarch
<install>   [S3:0][package]update-test-trival-99.9-99.9.noarch
<install>   [S3:0][atom]suspend-0.20.20061106-4.i586
<install>   [S3:0][package]suspend-0.20.20061106-4.i586
<install>   [S3:0][atom]update-test-trival-99.9-99.9.noarch
<uninstall> [S0:0][package]suspend-0.5-2.i586
Continue? [y/n] y
Downloading: [S3:0][package]update-test-trival-99.9-99.9.noarch, 3.2 K(354 B unpacked)
Installing: [S3:0][package]update-test-trival-99.9-99.9.noarch
Downloading: [S3:0][package]suspend-0.20.20061106-4.i586, 479.0 K(1.0 M unpacked)
Installing: [S3:0][package]suspend-0.20.20061106-4.i586

Obtaining Information about Packages

The general syntax is:

info, if ['packagename']

Show full info for packages.

Example:

testicek2:~ # zypper info suspend
Restoring system sources...
Parsing metadata for 20061115-083114...
Parsing metadata for SUSE-Linux-10.2-Updates...
Parsing RPM database...

Information for package suspend:

Catalog: SUSE-Linux-10.2-Updates Name: suspend Version: 0.20.20061106-4 Arch: i586 Installed: Yes Status: out-of-date (version 0.5-2 installed) Installed Size: 1.0 M Summary: A Set Of Tools To Support Sleep Modes Description: A set of tools to support suspending notebooks, working around the specific problems each machine has.

Authors: -------- Pavel Machek <pavel@suse.cz> Rafael J. Wysocki <rjw@sisk.pl> and others. testicek2:~ # zypper update Restoring system sources... Parsing metadata for 20061115-083114... Parsing metadata for SUSE-Linux-10.2-Updates... Parsing RPM database... Summary: <install> [S3:0][patch]suspend-2247-0.noarch <uninstall> [S0:0][package]update-test-trival-1.1-2.noarch <install> [S3:0][patch]update-test-trival-2214-0.noarch <install> [S3:0][package]update-test-trival-99.9-99.9.noarch <install> [S3:0][atom]suspend-0.20.20061106-4.i586 <install> [S3:0][package]suspend-0.20.20061106-4.i586 <install> [S3:0][atom]update-test-trival-99.9-99.9.noarch <uninstall> [S0:0][package]suspend-0.5-2.i586 Continue? [y/n] y Downloading: [S3:0][package]update-test-trival-99.9-99.9.noarch, 3.2 K(354 B unpacked) Installing: [S3:0][package]update-test-trival-99.9-99.9.noarch Downloading: [S3:0][package]suspend-0.20.20061106-4.i586, 479.0 K(1.0 M unpacked) Installing: [S3:0][package]suspend-0.20.20061106-4.i586

Using zypper in Scripts


Since version 0.6.16 zypper supports global non-interactive mode for use from within scripts or as a cron job. In this mode zypper doesn't prompt user for any answers and uses default answers instead.

Non-interactive mode can be turned on with --non-interactive global option. This global option supersedes the --no-confirm and --skip-interactive command options (these will still be supported however).

For example, to update your system automatically without confirmation, you could use:

 zypper update --no-confirm --type=patch --skip-interactive

Since version 0.6.16 you just type:

 zypper --non-interactive update --type=patch

This command does not require confirmation from the administrator to proceed with update and also skips all interactive patches which would need an additional confirmation.

Currently, the global non-interactive mode is under development and is supported with install, update, and remove commands. In future it will allow you to execute any zypper's command non-interactively.

Using zypper together with zmd and rug


zypper and zmd are not synchronized in openSUSE 10.2. You can use them together but you find a lot of problems with synchronization. To prevent this situation, use only one tool for software management from command line. The zypper (openSUSE Software Management pattern) is good solution for standalone workstation or laptop. If you want to use openSUSE 10.2 in the network or in the environment managed by Novell ZENworks, use zmd and rug (Enterprise Software Management pattern).

Both, zypper and rug, are installed in the standard installation. To install zypper only, unselect the Enterprise Software Management pattern in the software selection during installation. After installation, you can uninstall the rug and zmd via YaST. To do it, proceed as follow:

  1. open YaST and select Software Management.
  2. Use Filter to display Patterns.
  3. Unselect pattern Enterprise Software Management.
  4. Click Accept.


Example of the zypper output on the computer with rug and zmd:

testicek2:~ # zypper sd http://ftp.uni-kl.de/pub/linux/suse/update/10.2 SUSE-Linux-10.2-Updates
6552 zmd
ZENworks Management Daemon is running.
WARNING: this command will not synchronize changes.
Use rug or yast2 for that.
testicek2:~ # zypper sa http://ftp.uni-kl.de/pub/linux/suse/update/10.2 SUSE-Linux-10.2-Updates
6552 zmd
ZENworks Management Daemon is running.
WARNING: this command will not synchronize changes.
Use rug or yast2 for that.
Determining http://ftp.uni-kl.de/pub/linux/suse/update/10.2 source type...
http://ftp.uni-kl.de/pub/linux/suse/update/10.2 is type YUM
Added Installation Sources:
[x]* SUSE-Linux-10.2-Updates (http://ftp.uni-kl.de/pub/linux/suse/update/10.2)