A compendiary overview of Zypper {WIKI}

Scripting with Zypper

(Applicable to all scripts sh, bash, etc)
at this point if you are writing scripts this is just a helpful reference and I will not be very user friendly here. RTM my friends

For all non interactive scripts. You may state the following command to prevent all user input. The patch version skips all patches which have issues and would ultimately need user input

zypper --non-interactive or zypper --non-interactive patch

Running a script without GPG checks. This can be done with the following command
zypper --no-gpg-checks

Want it to auto agree with licenses for a nice automation sequence? We can do that to

zypper --auto-agree-with-licenses

Want to specify your own output (assuming you already know how). This is how you silence zyppers rather verbose output

zypper --quiet

Want to log the entire process in an XML file. Let's DOOOO EEET!

zypper --xmlout [name.xml] [arguments ran]

More information to come later. Theres a lot you can do but this is suppose to cover the basics. For more information please refer to SUSE's documentation https://en.opensuse.org/SDB:Zypper_usage

2 Likes

Querying Packages

Searching
zypper se [arguments]

  • -dC --match-words [words] -- Find packages with these keywords in their summary

  • 'yast*' -- Hey there's my pet the wild card again. Good Boy you rescued us again. This shows all packages with this in their name

  • -r [repo name] -- shows all packages in that repository

  • -i [package name] -- see all package named similarly to the name that are installed

  • -t pattern -r [repo name] -- List all patterns in this repo specificied

Got Info?

zypper info [package] or zypper info [patch] [package] -- Gets information on a specific package or patch to a package. Sometimes you get a nice changelog.

Want information on dependencies? This is rather unique to OpenSUSE as far as I know.

zypper what-provides [package] or zypper wp [package] -- Provides dependency list and information for the specified package.

2 Likes

Utilities for diagnosing broken systems

There are two utilities at your disposal. A verify tool to verify the integrity of installed packages and an install all recommendations tool.

Verifying Packages

zypper verify -- verifies all packages on the system and lists all issues currently occurring and why they are occurring as well as possible solutions to the issue if any. It practically tells you have to fix your system

Installing all recommended packages
zypper install-new-recommends or zypper inr -- Installs all recommended packages for full functionality of a program you have or have not already fully installed on your system.

2 Likes

Package Locking

So why would you want to lock a package? Well maybe its more stable than its update. Maybe you are trying to keep functionality that got removed or broken in the next update. This will be what you want to run.

"al can be used instead of addlock"

zypper addlock [package] -- locks specified package

"rl can be used instead of removelock"

zypper removelock [package] -- unlocks the specified package allowing updates to be performed

List Locking. We can lock an entire list of programs by running the locks command which locks all the packages lists afterwards

zypper locks [package list]

2 Likes

Update Management

Listing Needed Patches
zypper list-patches -- Lists only needed patches
or
zypper lp

Applying Patches
zypper patch -- Applies all patches to all programs

Listing all Patches
zypper patches -- Lists all patches necessary and unecessary

Checking Patches
zypper patch-check [package] -- checks for package patches on specified package
or
zypper pchk -- checks patches for integrity

Getting Information About Patches

zypper patch-info -- Gets the information on a specific package patch
zypper info -t patch -- same as above

Got Updates?
zypper list-updates -- Lists all updates
or
zypper lu -- same as above
or
zypper update -- Updates all packages
or
zypper up --same as above

2 Likes

Distribution Upgrades

I made a section for this because I defer from opensuse's official process a bit.

first we will want to run

zypper refresh

then

zypper up

then finally here is the distribution upgrade command

zypper dup -- Upgrades the system to the latest stable release. Or if on tumbleweed it will upgrade you to the next daily if you havent already.

2 Likes

Frequently Used Vocabulary (FUV)

Repositories: HTTP or FTP server, DVD, or a folder on a local disc.
where a group or set of packages are located.

Resource Identfiers (URI): To specify locations of repositories or other resources (RPM files, .repo files) you can use any type of URIs
supported by libzypp. See http://en.opensuse.org/
Libzypp/URI for a complete list and usage examples.

Refresh: Refreshing a repository means downloading metadata
of packages from the medium (if needed), storing it in
local cache (typically under /var/cache/zypp/raw/
directory) and preparsing the metadata
into .solv files (building the solv cache), typically under
/var/cache/zypp/solv/.

Services: Services are one level above repositories and serve to
manage repositories or to do some special tasks.
Libzypp currently supports only one type of services, the
Repository Index Service (RIS).

Package Types: zypper works with several types of resource objects, called resolvable. A resolvable is a package, patch, pattern, or a product.

package: an ordinary RPM package

patch: update of one or more packages.

pattern: group of packages required or recommended to install some functionality

product: group of packages which are necessary to install a product

2 Likes

SOURCES
https://en.opensuse.org/SDB:Zypper_usage
https://en.opensuse.org/SDB:Manual_pages

Lots of personal experience

The memes should suffice

4 Likes

Just a few things I want to point out.

A good number of these commands will actually run without root privileges. Any time you are trying to do a search or your want to list out your repos, you do not have to run root. However if you want zypper to change something, then you will need root privilege.

Also, you almost never need to use zypper ref. Most zypper commands will auto refresh the repos ONLY IF THE REPOS ARE OUT OF DATE.

This is probably the coolest thing about zypper. It actually knows when it should refresh the repos or not.

With Apt, DNF, and several other package managers, they will just either auto refresh every time, or not at all and you have to refresh the repos yourself.

1 Like

I didnt forget those. I just ran out of edits. I literally can not edit for 24 hours because I hit a discourse limit. Its a bit retarded. but yeah I love zypper.

About the root stuff. Whenever I run zypper I just get in the habit of starting with a sudo -i or a sudo -v.

Thanks for the feedback @Tjj226_Angel

2 Likes

Great overview. It doesn't look like you missed anything. It's IMO the best package manager, and it's great to see someone posting a tutorial for those converting to it

Well I figure that its amongst one of the more complex package managers. I may take a break for a bit. Maybe Ill do a yast tutorial? ehhh anyways yup NP. I definitely wanted to see a zypper write up on here.

1 Like

Nice post, you really get to the root of this stuff.

1 Like

DNF and Apt 1.1 are now a lot more like zypper.

You kind of have to change some settings and really mess around with it a bit, but yeah. Everyone seems to have acknowledged the power of zypper and is trying to copy it in one way or another.

Oh yeah they are always pulling a Microsoft or an Apple here and there. I think its power comes from the fact that they took the best of SLACKWARE and RHEL then put it together in a rather unique form. Of all the RHEL based distros, OpenSuse is my favorite.

Also Thanks @wyrm I try. ;)

1 Like

Ehhhhhhhhhh. IDK. I probably would not call it an apple or microsoft thing, but it does seem rather similar.

Fedora and opensuse usually are pretty good about working together and I would not be surprised if someone from opensuse helped make DNF.

Apt 1.1 could very well have preceded zypper lol. That project has been on the back burner for god knows how long.

1 Like

I forgot fedora switched to DNF. Yeah sorry about the bad microsoft/apple pun I was not being serious. APT1.1 is a bit retarded in my opinion. I do not like apt. I never really liked it. Ubuntu seems to break quite frequently for some odd reason. Probably too bleeding edge. LTS is actually pretty stable though.

Maybe you could write a wiki on DNF? and we can compare differences

No need.

DNF functions exactly like YUM.

All the differences are under the hood.

And the thing about apt is that it is old as shit. So its fairly advanced for being so old. The issue (or at least the way I understand the issue) is that a bunch of people want to work on apt and improve it, but very few changes are even permitted and even fewer are considered for release.

That is why apt 1.1 is kind of exciting because it is the first real face lift we have seen for apt in forever.

And when I talk about apt, I am only talking about it in relation to debian.

Ubuntu is broken, cause ubuntu has gone so far downhill it is not even funny. They spend more time forking software that does not need to be forked than they do improving their distro and taking care of known bugs.

Thats why mint is so popular. Mint tries to clean up the mess ubuntu leaves behind and adds a nice DE.

2 Likes

Awesome thank you! ☺

Tis sad. you see all the other guides that got tons of attention around but werent Wikid.. do you know how beautiful they would be if they were. LOL Also it is kinda sad. It looks like tutorials used to get a lot of attention when it was a new section. Now not so much..... oh well hope someone finds it useful.

Are you considering the wonders and amazingness of OpenSuse @MisteryAngel