Zypper Commands Crash Course

canute
4 min readSep 14, 2023

--

  • Syntax : zypper --global-option command --specific-option command_argument
  • zypper sh starts the zypper shell, if you will be using zypper in a streak, use sudo zypper sh . To exit the shell, type exit or quit or ctrl+D
  1. Commands
  • info or if :

## info about a repo : info -r alias|name|#|URI

## info about a package : info package_name

## info about what a package provides : info --provides package_name

## info about what a package requires : info --requires package_name

## what are the recommended packages : info --recommends package_name

## what are the suggested packages : info --suggests package_name

  • install or in

## install local rpm package : install ~/Downloads/discord.rpm

## install URL rpm package : install http://some.site/discord.rpm

## install from your zypper repos : install discord

## install a specific version (when distinct versions available in your distinct zyppr repos) : install discord=0.29.1

Case 1 : You need to replace discord v0.2 with discord v0.1 (downgrading isnt working) but uninstallation of discord removes important dependencies.

Solution 1 : install -- -discord discord=0.1

-> In this command, -discord will remove discord without removing its dependencies, however -discord can be confused as a specific option, therefore -- is used

## install package from that repo : install -r repo_name_or_alias_or_# package_name or --from also works

## Install even if the item is already installed (reinstall), downgraded or changes vendor or architecture : install -f package_name

## Allow to replace a newer item with an older one. Handy if you are doing a rollback. Unlike — force it will not enforce a reinstall, if the item is already installed with the requested version : install --oldpackage package_name

## Install the packages even if they replace files from other, already installed, packages. Default is to treat file conflicts as an error : install --replacefiles ungoogled-chromium

## Test the installation, do not actually install any package : install package_name --dry-run

## Details for installation (version, arch, repo) : install --repo repo_name --details package_name

## Don’t require user interaction (no qna) : install -y package_name or --no-confirm

## Silently install unsigned rpm packages : install --allow-unsigned-rpm ~/Downloads/package.rpm

## If dependency problem, ask user to manually select : install -R package_name or --no-force-resolution {This is enabled by default when installing/upgrading packages}

## If dependency problem, automatically solve them : install --force-resolution package_name

## Install also recommended packages in addition to the required ones : install --recommends package_name

## Do not install recommended packages, but only required ones : install --no-recommends package_name

## Only download the packages for later installation : install -d package_name

## First download all packages, then start installing. This is the default : install --download-in-advance package_1 package_2

## Download one package, install it immediately, and continue with the rest until all are installed : install --download-as-needed package1 package2

## To keep the system in consistent state without the need to download all packages in advance : install --download-in-heaps package1 package2

## Allow downgrade : install --allow-downgrade package_name

## Don’t allow downgrade : install --no-allow-downgrade package_name

## Allow vendor change : install --allow-vendor-change package_name

## Don’t allow vendor change : install --no-allow-vendor-change package_name

NOTE : All three below give same result -

$ zypper install virtualbox-ose-2.0.6

$ zypper install virtualbox-ose=2.0.6

$ zypper install virtualbox-ose = 2.0.6

  • inr scans all installed packages and installs all recommended packages accordingly : inr --details
  • rm or remove

## all reasonable specific options for in also works for rm

## Automatically remove dependencies which become unneeded after removal of requested packages : rm -u package_name

## No automatic removal of unneeded dependencies : rm -U package_name

  • Autoremoves installed kernels according to dedault rules : purge-kernels -D
  • List updates = lu

## List all packages for which newer versions are available, regardless whether they are installable or not : lu -a

  • Update = up

## Skip interactive patches, that is, those that need reboot, contain a message, or update a package whose license needs to be confirmed : up --skip-interactive

## all reasonable specific options for in also works for up

  • distro upgrade = dup

## all reasonable specific options for in also works for dup

## Ex : $ zypper dup — from factory — from packman

NOTE : installed packages not provided by any repo are often denoted as being unwanted, orphaned or dropped.

  • packages or pa

--orphaned

Show packages which are orphaned (without repository).

--suggested

Show packages which are suggested.

--recommended

Show packages which are recommended.

--unneeded

Show packages which are unneeded.

  • search or se

## Show all available versions of matching packages, each version in each repository on a separate line : se --details package_name or -s

se --requires package_name

Search for packages which require the search strings.

se --recommends package_name

Search for packages which recommend the search strings.

se --suggests package_name

Search for packages which suggest the search strings.

se --conflicts package_name

Search for packages conflicting with the search strings.

## Search also in summaries and description : se -d package_name

## Show only installed packages : se -i package_name

## Like -s with additional information where the search has matched : se -v package_name

## Wildcard search : se string*

  • To manage repos, I recommend you to read the manual part or just use ‘Software Repositories’ in yast2
  • Package Locks :

## ll is list locks

## al is add lock

## rl is remove lock

## Lock a package to a specific version : al package_name=1.1.2

2. Global options

  • In non-interactive mode do not skip patches which have the rebootSuggested-flag set : --non-interactive-include-reboot-patches
  • Switches to XML output. This option is useful for scripts or graphical frontends using zypper : -x
  • Use an additional repository for this operation. The repository aliased tmp# and named by the specified URI will be added for this operation and removed at the end : -p http://download.opensuse.org/update/tumbleweed/
  • Do not auto-refresh repositories (ignore the auto-refresh setting) : --no-refresh
  • It will cause zypper to act as if there were no packages installed in the system. Use with caution as you can damage your system using this option : --disable-system-resolvables

--

--

No responses yet