Skip to main content

Zypper tips

To check from which repo package came from

# rpm # rpm -qa qa --qf qf '%-20{NAME}  %-20{VENDOR}\n'  'libav*5[678]'

To install only packages from one repo

#zypper in #zypper in -pvdm-kde43 kde43 amarok

Change the behaviour of download-install-download-install-download to download all-install all

modify /etc/zypp/zypp.conf and find and change:

commit.downloadMode downloadMode =  DownloadInAdvance

upgrading your system using 'zypper dup'

  • When you want to do an upgrade, "zypper dup" actually brings your system to the version of the available packages. This may mean downgrading and removing of installed packages.
  • The recommended way of doing this is to perform it against a specific repo: use

zypper dup zypper dup -from repo from repo -r,  --repo repo <alias|#|URI>    Load only the specified     Load only the specified repository.
zypper dup zypper dup -r 5 r 5 -r 6 r 6 -7

  • If you intend to use "zypper dup" without any specific repostitory, you need to define repo priorities if you don't want to encounter surprises.

=if you want to find a certain file:=

zypper in zypper in 'libqtiff.so()(64bit)'
Reading installed Reading installed packages...
'libqt4-x11' providing  providing 'libqtiff.so()(64bit)' is already  is already installed.
Nothing to Nothing to do.

if you want to install a certain version:

zypper in MozillaFirefox zypper in MozillaFirefox \>=  3

Other examples:

zypper in zypper in yast*                     # install all yast                      # install all yast modules
zypper in zypper in -t pattern lamp_server    # install lamp_server pattern t pattern lamp_server    # install lamp_server pattern (packages  needed for a LAMP packages  needed for a LAMP server)  
zypper in vim zypper in vim -emacs                # install vim and remove emacs in one emacs                # install vim and remove emacs in one go
zypper in amarok zypper in amarok packman:libxine1   # install libxine1 from packman and  amarok from any libxine1   # install libxine1 from packman and  amarok from any repo
zypper in zypper in bitchx-1.1-81.x86_64.rpm  # install bitchx rpm from local rpm  # install bitchx rpm from local directory
zypper in zypper in -f subversion             # force reinstallation of f subversion             # force reinstallation of subversion

search packages

zypper search zypper search ---match-exact exact virtualbox-ose
Reading installed Reading installed packages...
| Name            Name           | Type     Type    | Version     Version    | Arch    Arch   |  Repository
--+----------------+---------+------------+--------+------------------------------------
|  virtualbox-ose ose | package  package |  1.6.2-2.1  1  | x86_64  x86_64 | VirtualBox  VirtualBox OSE
|  virtualbox-ose ose | package  package |  1.5.6-33.| x86_64  x86_64 |  openSUSE-11.1-Oss
|  virtualbox-ose ose | package  package |  1.5.6-20.| x86_64  x86_64 | VirtualBox OSE  VirtualBox OSE (
|  virtualbox-ose ose | package  package |  1.6.2-2.1  1  | i586    i586   | VirtualBox  VirtualBox OSE
|  virtualbox-ose ose | package  package |  1.5.6-33.| i586    i586   |  openSUSE-11.1-Oss
|  virtualbox-ose ose | package  package |  1.5.6-20.| i586    i586   | VirtualBox  VirtualBox OSE

patterns

list patterns:

zypper zypper patterns

information on packages

zypper if zypper if amarok

Information for package Information for package amarok:
Repository:  @System
Name:  amarok
Version:  2.2.0-38.1
Arch:  x86_64
Vendor:  obs://build.opensuse.org/KDE
Installed:  Yes
Status:  up-to-date
Installed Installed Size:  24.MiB
Summary: Media Player for  Media Player for KDE
Description:
Amarok is a media player for all kinds of Amarok is a media player for all kinds of media. This includes  This includes MP3,  Ogg
Vorbis, audio  audio CDs, podcasts and  podcasts and streams. Play lists can be stored  Play lists can be stored in
.m3u or m3u or .pls pls files.

Other examples:

zypper info zypper info -t patch MozillaFirefox    # show information about t patch MozillaFirefox    # show information about 'MozillaFirefox'  patch
zypper zypper patch-info MozillaFirefox       # the same as info MozillaFirefox       # the same as above
zypper info zypper info -t pattern lamp_server     # show info about t pattern lamp_server     # show info about 'lamp_server'  pattern
zypper info zypper info -t product t product openSUSE-FTP    # show info about specified 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

Regarding optional dependencies, we do have them, and use them. They're enabled by default. To avoid the several hundred unexpected packages like in the example in the article you can use zypper with --no-recommends or turn them off in the zypper.conf config file.

The zypper summary before an installation distinguishes between hard dependencies and recommends, so you can see what turning recommends off would have saved you even if you didn't.

package locks

To lock all packages starting with 'yast2', do:

zypper al zypper al 'yast2*'
Reading installed Reading installed packages...
Specified lock has been successfully Specified lock has been successfully added

To list currently active locks:

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

To remove a lock, do:

zypper rl zypper rl yast2-packager

Other examples:

zypper al zypper                   # lock package zypper al zypper                   # lock package 'zypper'  (exact exact match)
zypper al zypper al -repo-oss oss virtualbox*  # restrict the lock to   # restrict the lock to 'repo-oss'  repository   repository (allowing installation from allowing installation from others)
zypper rl 3                        # remove lock by zypper rl 3                        # remove lock by number

rpm examples

# rpm # rpm -qi  amarok                 Show details of qi  amarok                 Show details of package
# rpm # rpm -qf  qf  /usr/sbin/sshd         Shows where file came sshd         Shows where file came from
# rpm # rpm -qR qR openssh-server          Show dependencies server          Show dependencies - What do I need for this package to  What do I need for this package to work?
# rpm # rpm --whatrequires initscripts  Find reverse dependencies whatrequires initscripts  Find reverse dependencies - What will break if I remove this  What will break if I remove this package
# rpm # rpm -qip                        Show details of not yet installed qip                        Show details of not yet installed package
# rpm # rpm --verify verify openssh-server     Find out if any files in the package have been modified since server     Find out if any files in the package have been modified since install.
# rpm # rpm -qlv postfix                list all files in a qlv postfix                list all files in a rpm