Table of Content

This is a four-parts article. There are few sections here.

Part One
  • Preface: Test Bed
  • Getting Started With Docker
  • Issues on Minimal Install: No Reset, No Manual
  • Package Management: ZYpp Frontend, Get Help, Zypper Shell
  • Updating System: OS Release, List Updates, Update, Upgrades, Patch Check, Process Being Used
  • Package IRSIF: Install, Download Only, Removal, Dependency Removal, Query Search, Show Info, File List
  • What's Next
Part Two
  • Dependency: Help, Dependency, Reverse Dependency, Test, Verify
  • Group: Pattern
  • System Wide: List Packages
  • History: The Log File
  • Clean Up
  • What's Next
Part Three
  • Repositories: List, Add/Remove, Modify, Service List, Additional, Mirror
  • What's Next
Part Four
  • Build from Source: General Requirement, Download and Extract, Build Dependencies, Source Path, Build, Install RPM
  • Inspect Package: rpmlint, rpm -Qpl, rpmls, rpm2cpio
  • Hold Package: Case Example, Add Lock, Test Example, Remove Lock
  • Interesting Issue: systemd Dependencies
  • Conclusion

Preface

Goal: Examine Package Manager, Focus on Command Line Interface

Using openSUSE minimal install in Docker, is a good way to learn zypper. Zypper is a Package Manager utilized by openSUSE. With minimal install, there is no need, to download 4GB of full installation packages.

We need Tumbleweed rolling release with more often update than leap, so that we have a chance to play more with package cycle.

Test Bed

  1. Container: Docker

  2. Operating System: Artix (OpenRC )

  3. Window Manager: Herbstluftwm

Since we are going to use docker again, you can read a common overview here.

Of course you can use virtualization, the issue is distraction. We need to avoid tendency to focus on GUI tools. At the same time, limiting the scope to CLI tools. Most of the time, CLI tools is considered lower level than the GUI one.


Getting Started With Docker

As usual, first, we do attach docker process.

$ docker pull opensuse/amd64:tumbleweed

Docker Pull openSUSE Tumbleweed

$ docker image list  

  --filter "reference=opensuse/*:*"
  --format 'table {{.Repository}}\t{{.Size}}'

REPOSITORY          SIZE
opensuse/amd64      101MB

By the container image size, openSUSE is good at managing minimal install.

$ docker run -it opensuse/amd64:tumbleweed bash
bash-4.4# exit
$ docker ps

  --format 'table {{.Image}}\t{{.Names}}\t{{.Status}}'

IMAGE                       NAMES                 STATUS
opensuse/amd64:tumbleweed   elegant_nightingale   Up 9 hours

Docker openSUSE: List Running Containers

$ docker start elegant_nightingale
elegant_nightingale
$ docker attach elegant_nightingale
bash-4.4# 

Docker openSUSE: Getting Started


Issues on Minimal Install

No Reset

Since I use terminal with a lot of screenshot, I utilize the $ reset command frequently. Which is not available in openSUSE. I can understand that minimal install, could be a based for embedded system, that is no need for either reset nor manual.

There are two workaround, first is to emulate with character.

$ echo -e '\0033\0143'

Or install ncurses-utils, which contain $ reset command.

$ zypper install ncurses-utils
$ reset

No Manual

No manual in openSUSE Docker. Minimal install is designed to be minimal, such as embedded system. The manual should not be in minimal install. Therefore we need to tweak this setting for our need.

Change rpm.install.excludedocs from yes to no.

$ cat /etc/zypp/zypp.conf | grep excludedocs
## Options for package installation: excludedocs
rpm.install.excludedocs = no

If necessary later, you still need to reinstall some packages, so that the manual pages available in /usr/share/man/

$ zypper --quiet install --force man-pages man coreutils
The following package is going to be upgraded:
  coreutils

The following 2 packages are going to be reinstalled:
  man man-pages

1 package to upgrade, 2 to reinstall.
Overall download size: 5.5 MiB. Already cached: 0 B. After the
operation, additional 34.8 KiB will be used.
Continue? [y/n/...? shows all options] (y): y

Docker openSUSE: Enable Manual Issue


Package Management

ZYpp Frontend

Zypper

Get Help

Read the fine manual. Helpless or help more.

$ zypper help | less
$ zypper help install

Zypper Shell

Most modern package manager has shell feature, that enable user to focus on the task of managing package.

$ zypper shell
zypper> help in
install (in) [options] <capability|rpm_file_uri> ...

Docker openSUSE: Zypper Shell


Updating System

First Thing First

First thing to do is updating my system as usual.

  • OS Release

  • List Update

  • Update

  • Distribution Upgrade

  • Process that still being used after update and upgrade.

OS Release

$ cat /etc/os-release 
NAME="openSUSE Tumbleweed"
...

List Updates

$ zypper lu
Loading repository data...
Reading installed packages...
No updates found.

Equal to:

$ zypper list-updates
Loading repository data...
Reading installed packages...
S | Repository | Name             | Current Version | Available Version | Arch  
--+------------+------------------+-----------------+-------------------+-------
v | OSS        | coreutils        | 8.27-2.3        | 8.27-3.1          | x86_64
v | OSS        | krb5             | 1.15.1-3.2      | 1.15.1-4.1        | x86_64
v | OSS        | libzypp          | 16.14.0-1.1     | 16.15.3-1.1       | x86_64
v | OSS        | openSUSE-release | 20170816-1.2    | 20170821-1.2      | x86_64
v | OSS        | pam-config       | 0.91-3.2        | 0.92-1.1          | x86_64
v | OSS        | zypper           | 1.13.29-1.1     | 1.13.31-1.1       | x86_64

Docker Zypper: List Update

Update

This will update only newer packages.

$ zypper up
Loading repository data...
Reading installed packages...

Nothing to do.

Equal To:

$ zypper update
Loading repository data...
Reading installed packages...

The following 6 packages are going to be upgraded:
  coreutils krb5 libzypp openSUSE-release pam-config zypper

The following product is going to be upgraded:
  "openSUSE Tumbleweed"

6 packages to upgrade.
Overall download size: 5.9 MiB. Already cached: 0 B. After the
operation, additional 94.7 KiB will be used.
Continue? [y/n/...? shows all options] (y):

Docker Zypper: Update

Upgrade

This is similar to update, but affect all packages. Wider than just new package. This distribution upgrade also works in tumbleweed rolling release. You can see that both are slightly different.

$ zypper dup
Warning: ...
Loading repository data...
Reading installed packages...
Computing distribution upgrade...

Nothing to do.

Equal To:

$ zypper dist-upgrade
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Loading repository data...
Reading installed packages...
Computing distribution upgrade...

The following NEW package is going to be installed:
  openSUSE-release-ftp

1 new package to install.
Overall download size: 7.1 KiB. Already cached: 0 B. After the
operation, additional 66.0 B will be used.
Continue? [y/n/...? shows all options] (y):

Docker Zypper: Distribution Upgrade

Patch Check

Another update method.

$ zypper pchk

Equal To:

$ zypper patch-check
Loading repository data...
Reading installed packages...

0 patches needed (0 security patches)

Process Being Used

Sometimes there are process still being used by upgraded package, we can check this using $ zypper ps -s.

$ zypper ps 
Check failed:
Please install package 'lsof' first.

$ zypper in lsof

$ zypper ps -s
No processes using deleted files found.

You can see a more complete example about this process, in my previous opensuse full install article.


Package IRSIF

Install, Remove, Search, Info, File

Package Install

Consider our favorite example package below.

$ zypper in man nano htop ncdu fish

Equal To:

$ zypper install man nano htop ncdu fish
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 31 NEW packages are going to be installed:
  aaa_base bc cron cronie dbus-1 desktop-file-utils fish
  glibc-locale groff htop kbd kmod less libgdbm4 libglib-2_0-0
  libpcre2-32-0 libpipeline1 libpython2_7-1_0 man nano ncdu
  ncurses-utils pkg-config python-base python-curses
  python-rpm-macros system-user-man systemd
  systemd-presets-branding-CAASP udev update-desktop-files

31 new packages to install.
Overall download size: 24.7 MiB. Already cached: 0 B. After the
operation, additional 190.3 MiB will be used.
Continue? [y/n/...? shows all options] (y): 

Docker Zypper: Install

Note that you can reinstall using -f argument.

$ zypper install --force man nano htop ncdu fish

Download

Download without install is possible.

$ zypper in --download-only wget
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  wget

1 new package to install.
Overall download size: 667.1 KiB. Already cached: 0 B. Download
only.
Continue? [y/n/...? shows all options] (y): 

Docker Zypper: Download Only

And you can continue with install later.

$ zypper in wget

Package Removal

$ zypper rm systemd

Equal to:

$ zypper remove systemd
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 13 packages are going to be REMOVED:
  aaa_base ca-certificates ca-certificates-mozilla cron cronie
  desktop-file-utils fish htop issue-generator man openSUSE-release
  systemd update-desktop-files

The following product is going to be REMOVED:
  "openSUSE Tumbleweed"

13 packages to remove.
After the operation, 21.3 MiB will be freed.
Continue? [y/n/...? shows all options] (y):

Docker Zypper: Remove

Dependency Removal

Supposed you install ViM, and later desire to remove ViM, with all dependencies.

$ zypper remove --clean-deps vim

Equal to:

$ zypper rm -u vim
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 3 packages are going to be REMOVED:
  libdb-4_8 perl vim

3 packages to remove.
After the operation, 45.3 MiB will be freed.
Continue? [y/n/...? shows all options] (y): 

Docker Zypper: Dependency

$ zypper se fish

Equal to:

$ zypper search fish
Loading repository data...
Reading installed packages...

S  | Name                           | Summary          | Type       
---+--------------------------------+------------------+------------
   | Bluefish                       | Text editor wi-> | application
   | Catfish                        | Versatile file-> | application
   | Cuttlefish                     | Icon Previewer-> | application
   | bluefish                       | A feature-Rich-> | package    
   | catfish                        | Versatile File-> | package    
   | catfish-lang                   | Translations f-> | package    
i+ | fish                           | A user friendl-> | package    
   | ghc-cipher-blowfish            | Blowfish cipher  | package    
   | ghc-cipher-blowfish-devel      | Haskell cipher-> | package    

Docker Zypper: Query Search

Package Show Info

$ zypper if fish

Eauql to

$ zypper info fish
Loading repository data...
Reading installed packages...


Information for package fish:
-----------------------------
Repository     : OSS                              
Name           : fish                             
Version        : 2.6.0-1.2                        
Arch           : x86_64                           
Vendor         : openSUSE                         
Installed Size : 7.5 MiB                          
Installed      : Yes                              
Status         : up-to-date                       
Source package : fish-2.6.0-1.2.src               
Summary        : A user friendly interactive shell
Description    :                                  
    fish is a user friendly command line shell for UNIX-like
    operating systems

Docker Zypper: Show Info

Package File List

My bad, I cannot find any reference about listing files in particular package. Therefore I use the lower level rpm -ql instead.

$ rpm --query --list ncdu
/usr/bin/ncdu
/usr/share/doc/packages/ncdu
/usr/share/doc/packages/ncdu/COPYING
/usr/share/doc/packages/ncdu/ChangeLog
/usr/share/doc/packages/ncdu/README
/usr/share/man/man1/ncdu.1.gz

Docker RPM: Query List

However there is this zypper -f command, similar with rpm -qf instead.

$ zypper search --file /etc/manpath.config 
Loading repository data...
Reading installed packages...

S  | Name | Summary                            | Type   
---+------+------------------------------------+--------
i+ | man  | A Program for Displaying man Pages | package

Docker Zypper: Search File


What’s Next

Zypper has amazing repository commands, so many commands that this topic deserve its own long article. Consider finish reading [ Part Two ].

Thank you for reading