Zypper lr output

Quite commonly, the most important output column when sharing repos asking for help is the URL. The URL is not included in default output, like so:

> zypper lr
Repository priorities in effect:	(See 'zypper lr -P' for details)
      90 (raised priority)  :  1 repository
      99 (default priority) :  6 repositories

# | Alias          | Name           | Enabled | GPG Check | Refresh
--+----------------+----------------+---------+-----------+--------
1 | FCL-leap       | FCL-leap       | Yes     | (  ) No   | No
2 | KDE3           | KDE3           | Yes     | (r ) Yes  | No
3 | MultimediaLibs | MultimediaLibs | Yes     | (r ) Yes  | Yes
4 | NonOSS         | NonOSS         | Yes     | (r ) Yes  | Yes
5 | OSS            | OSS            | Yes     | (r ) Yes  | Yes
6 | PackmanE       | PackmanE       | Yes     | (r ) Yes  | No
7 | openh264       | openh264       | Yes     | (r ) Yes  | No

Zypper’s -d option is needed to show the URL:

> zypper lr -d
# | Alias          | Name           | Enabled | GPG Check | Refresh | Keep | Priority | Type   | URI                                                                     | Service
--+----------------+----------------+---------+-----------+---------+------+----------+--------+-------------------------------------------------------------------------+--------
1 | FCL-leap       | FCL-leap       | Yes     | (  ) No   | No      | -    |   99     | rpm-md | http://silk.apana.org.au/rpm-opensuse15-unstable-dev                    |
2 | KDE3           | KDE3           | Yes     | (r ) Yes  | No      | -    |   99     | rpm-md | http://cdn.opensuse.org/repositories/KDE:/KDE3/16.0/               |
3 | MultimediaLibs | MultimediaLibs | Yes     | (r ) Yes  | Yes     | -    |   99     | rpm-md | http://cdn.opensuse.org/repositories/multimedia:/libs/16.0/        |
4 | NonOSS         | NonOSS         | Yes     | (r ) Yes  | Yes     | -    |   99     | rpm-md | http://cdn.opensuse.org/distribution/leap/16.0/repo/non-oss/       |
5 | OSS            | OSS            | Yes     | (r ) Yes  | Yes     | -    |   99     | rpm-md | http://cdn.opensuse.org/distribution/leap/16.0/repo/oss/           |
6 | PackmanE       | PackmanE       | Yes     | (r ) Yes  | No      | -    |   90     | rpm-md | http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_Leap_16.0/Essentials |
7 | openh264       | openh264       | Yes     | (r ) Yes  | No      | -    |   99     | rpm-md | http://codecs.opensuse.org/openh264/openSUSE_Leap/                      |

I find that output annoyingly includes too much, such as duplicate names and lengthy names, causing excess horizontal scrolling with text big enough to see, even when the code block is using as much browser width as allowed. So, I reconfigure:

> grep tCol /etc/zypp/zypper.conf
 repoListColumns = Au

to get the following:

> zypper lr
Repository priorities in effect:	(See 'zypper lr -P' for details)
      90 (raised priority)  :  1 repository
      99 (default priority) :  6 repositories

# | Alias          | Enabled | GPG Check | URI
--+----------------+---------+-----------+------------------------------------------------------------------------
1 | FCL-leap       | Yes     | (  ) No   | http://silk.apana.org.au/rpm-opensuse15-unstable-dev
2 | KDE3           | Yes     | (r ) Yes  | http://cdn.opensuse.org/repositories/KDE:/KDE3/16.0/
3 | MultimediaLibs | Yes     | (r ) Yes  | http://cdn.opensuse.org/repositories/multimedia:/libs/16.0/
4 | NonOSS         | Yes     | (r ) Yes  | http://cdn.opensuse.org/distribution/leap/16.0/repo/non-oss/
5 | OSS            | Yes     | (r ) Yes  | http://cdn.opensuse.org/distribution/leap/16.0/repo/oss/
6 | PackmanE       | Yes     | (r ) Yes  | http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_Leap_16.0/Essentials
7 | openh264       | Yes     | (r ) Yes  | http://codecs.opensuse.org/openh264/openSUSE_Leap/

If repoListColumns = Au doesn’t produce quite the result you, or would-be helpers, like, there are alternative options shown in zypper.conf just before that options line that you/they might like better. Here in the forums, people might complain about absence of priorities, but when only one is non-default, and it’s assumed (at least by me) to be Packman, which defaults to 90 IIRC, among them, complaints will likely be absent. Still, p can be specified:

> grep tCol /etc/zypp/zypper.conf
 repoListColumns = Apu
> zypper lr
# | Alias          | Enabled | GPG Check | Priority | URI
--+----------------+---------+-----------+----------+------------------------------------------------------------------------
1 | FCL-leap       | Yes     | (  ) No   |   99     | http://silk.apana.org.au/rpm-opensuse15-unstable-dev
2 | KDE3           | Yes     | (r ) Yes  |   99     | http://cdn.opensuse.org/repositories/KDE:/KDE3/16.0/
3 | MultimediaLibs | Yes     | (r ) Yes  |   99     | http://cdn.opensuse.org/repositories/multimedia:/libs/16.0/
4 | NonOSS         | Yes     | (r ) Yes  |   99     | http://cdn.opensuse.org/distribution/leap/16.0/repo/non-oss/
5 | OSS            | Yes     | (r ) Yes  |   99     | http://cdn.opensuse.org/distribution/leap/16.0/repo/oss/
6 | PackmanE       | Yes     | (r ) Yes  |   90     | http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_Leap_16.0/Essentials
7 | openh264       | Yes     | (r ) Yes  |   99     | http://codecs.opensuse.org/openh264/openSUSE_Leap/

Wider, Apu than Au, but not as much as duplicate name columns produce. :slight_smile: Full “Priority” as column title rather than an abbreviation causes much whitespace. I don’t believe priority numbers bigger than 99 are supported, and wish that title were an abbreviation. :stuck_out_tongue:

1 Like

If that is true then, the “man” page is documenting an error … :smiling_imp:

  • Code is fact. Documentation is fiction.
   modifyrepo (mr) options --all|--remote|--local|--medium-type
       Modify properties of repositories specified by alias, name, number, or URI or one of the aggregate options.

       -p, --priority [1-2147483647]|0
           Set the priority of the repository. Priority of 1 is the highest, and 2147483647 is the lowest. -p 0
           will set the priority back to the default (99). Packages from repositories with higher priority will be
           used even if there are better versions available in a repository with a lower priority.
LT-B:~ # zypper mr -p 199200 7
Repository 'https-download.opensuse.org-de633399' priority has been set to 199200.
LT-B:~ # zypper lr -d
Refreshing service 'NVIDIA'.
Refreshing service 'openSUSE'.
#  | Alias                                | Name      | Enabled | GPG Check | Refresh | Keep | Priority | Type     | URI                                                                                  | Service
---+--------------------------------------+-----------+---------+-----------+---------+------+----------+----------+--------------------------------------------------------------------------------------+---------
...
 7 | https-download.opensuse.org-de633399 | multime-> | No      | ----      | ----    | -    | 199200   | rpm-md   | https://download.opensuse.org/repositories/multimedia:/proaudio/openSUSE_Tumbleweed/ | 
...
LT-B:~ #

OK, the “man” pages are fiction – and, in general, “documentation is fiction” …

  • But –

FILES
/etc/zypp/zypper.conf, $HOME/.zypper.conf
Global (system-wide) and user’s configuration file for zypper. These files are read when zypper starts up
and --config option is not used.

       User’s settings are preferred over global settings. Similarly, command line options override the settings in
       either of these files. To sum it up, the order of preference is as follows (from highest to lowest):

        1. Command line options

        2. $HOME/.zypper.conf

        3. /etc/zypp/zypper.conf

        4. [/etc/zypp/zypp.conf] (system-wide defaults for all libzypp based applications)

       See the comments in /etc/zypp/zypper.conf for a list and description of available options.

           Note

           The system-wide /etc/zypp/zypp.conf is mentioned here just because some zypper command line options
           allow one to overwrite system-wide defaults defined there. zypp.conf and zypper.conf have different
           content and serve different purpose.

What I find a little bit annoying is, the “Zypp” has system-wide directories for system-specific customisations and distribution-specific customisations –

  • ‘/etc/zypp/zypp.conf.d/’
  • ‘/usr/etc/zypp/zypp.conf.d/’

Zypper” doesn’t have this facility – either specific users add their customisations to ‘$HOME/.zypper.conf’ or, the system’s administrator edits ‘/etc/zypp/zypper.conf’ –

  • which, at the next “Zypper” update either gets clobbered or, moved to a “.rpmsave” file …
 > LANG=C.UTF-8 zypper repos --details --sort-by-priority 
#  | Alias                      | Name                                     | Enabled | GPG Check | Refresh | Keep | Priority | Type   | URI                                                                                      | Service
---+----------------------------+------------------------------------------+---------+-----------+---------+------+----------+--------+------------------------------------------------------------------------------------------+---------
 5 | mozilla-obs                | Mozilla OBS Project                      | No      | ----      | ----    | -    |   80     | rpm-md | https://download.opensuse.org/repositories/mozilla/openSUSE_Tumbleweed                   | 
 8 | openSUSE:repo-non-oss      | repo-non-oss                             | Yes     | (r ) Yes  | Yes     | -    |   99     | rpm-md | http://cdn.opensuse.org/tumbleweed/repo/non-oss                                          | openSUSE
  . 
  . 
13 | openSUSE:update-tumbleweed | update-tumbleweed                        | Yes     | (r ) Yes  | Yes     | -    |   99     | rpm-md | http://cdn.opensuse.org/update/tumbleweed                                                | openSUSE
 . 
 . 
 3 | kde:extra                  | KDE: Extra - Tumbleweed                  | Yes     | (r ) Yes  | Yes     | -    |  105     | rpm-md | https://download.opensuse.org/repositories/KDE:/Extra/openSUSE_Tumbleweed                | 
 4 | libdvdcss                  | VideoLAN - libdvdcss                     | Yes     | (r ) Yes  | Yes     | -    |  110     | rpm-md | https://download.videolan.org/SuSE/Tumbleweed                                            | 
 >

Only the openSUSE service repositories are set to the default priority of “99” …

I’m using a priority of 110, and that seems to be working.

This is on a Leap 16.0 system. I have the Tumbleweed main directory at a priority of 110. I use it for installing the kernel (I’m having problems with the Leap 16.0 kernel). And, thus far, zypper has never attempted to install anything other that the kernel from the Tumbleweed repo.

I made the change to “Au” and did not get the URL addy. I got no change, i.e., -d is still needed to get URL. Is reboot, login, or source needed to get zypper changes made?

tom kosvic

A couple of years ago I rediscovered awk and it is awksome for zypper output:

knurpht@Lenovo-P16:~> zypper lr -d | awk -F "|" 'NR>2 { print substr($2 $10,2) }'
google-chrome               https://dl.google.com/linux/chrome/rpm/stable/x86_64     
openSUSE:repo-non-oss       http://cdn.opensuse.org/tumbleweed/repo/non-oss          
openSUSE:repo-openh264      https://codecs.opensuse.org/openh264/openSUSE_Tumbleweed 
openSUSE:repo-oss           http://cdn.opensuse.org/tumbleweed/repo/oss              
openSUSE:repo-oss-debug     http://cdn.opensuse.org/debug/tumbleweed/repo/oss        
openSUSE:repo-oss-source    http://cdn.opensuse.org/source/tumbleweed/repo/oss       
openSUSE:update-tumbleweed  http://cdn.opensuse.org/update/tumbleweed                
knurpht@Lenovo-P16:~> 

What is does:

  • Takes zypper lr -d as the input, then uses awk to tear it apart:
    ** -F sets the field separator as |
    ** NR>2 skips the 1st 2 lines ( headers )
    ** print prints to stdout
    ** substr($2 $10,2) strips the leading space char from the ouput line

AFAICS, no.

I created a $HOME/.zypper.conf file – it’s still open in Vim …
Content:

## Configuration file for Zypper.
##
## location: /etc/zypp/zypper.conf (system-wide)
##       or: $HOME/.zypper.conf    (user-specific)
##
[main]
repoListColumns = Au

I initially forgot to include the line with “[main]” and Zypper warned with the following:

 > zypper repos
AugeasException: /home/???/.zypper.conf
parse_failed: at 5:0: Get did not match entire input
*** Augeas exception: No config files read, sticking with defaults.

Inserted “[main]” at line #5 → “repoListColumns = Au” became line #6 → hit “:w” in Vim and then in another Konsole window «I’m using KDE Plasma 6» →

 > LANG=C.UTF-8 zypper repos
Repository priorities in effect:                                                        (See 'zypper lr -P' for details)
      99 (default priority) :  5 repositories
     102 (lowered priority) :  1 repository
     103 (lowered priority) :  2 repositories
     105 (lowered priority) :  1 repository
     110 (lowered priority) :  1 repository

#  | Alias                      | Enabled | GPG Check | URI
---+----------------------------+---------+-----------+-----------------------------------------------------------------------------------------
 1 | essentials                 | Yes     | (r ) Yes  | https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/Essentials

I like the awk string. Would like to get “enabled-y/n” and “priority” columns added to std-out. Will try to tinker some with your string.

If it works, I’ll post it back here.

Thanks, tom kosvic

The $ references are the column numbers, some counting and inseting and done. Not much tinkering needed.

@knurpht , modding $ parameters and others as needed is “tinkering” at my current level of competence. Joke!!

Used to develop numerical solutions to Partial Differential Equation sets some decades ago.

tom kosvic

Or just use zypper lr -u Am I missing something here??

You mean besides eliminating or reducing the need for horizontal scrolling to see all output that includes URLs?

Until this thread, I’d not seen a priority posted here or elsewhere >99, hence my belief, now updated. Still, the priority column is not nearly the waste of showing two complete name columns, especially when URLs are included.

Post 177768/7 and post 194347/5 here are interesting: condensed Name columns in both. Whereis/whatis the zypper option to produce the condensed Name column like that. I don’t see anything about it in man zypper’s repos section. /condens and /compact produce nothing.

@sfalken , you are right on. ‘sudo zypper lr -u’ gives urls and fits on normal sized terminal w/o line breaks.

tom kosvic

well said :wink:

Tom:
While “sudo zypper lr -u” is really nice and gives the repo’s URLs, I do wonder if we can order this very list by priority? I had to have the packman repo before the regular opensuse repos, in order to get the video programs working whenever I do an update.
- Randall

The man page has -P for that, like -u for URLs. Also, in zypper.conf, where you can configure columns, the included instructions tell you capital letter determines sort order, so use aPu instead of Apu for repoListColumns.

zypper lr display options for reference.

tom@mydesktop: ~ $ sudo zypper lr --help
repos (lr) [OPTIONS] [REPO] ...

List all defined repositories.

  Command options:

-e, --export <FILE.repo>    Export all defined repositories as a single local .repo file.
-a, --alias                 Show also repository alias. Default: false
-n, --name                  Show also repository name. Default: false
-r, --refresh               Show also the autorefresh flag. Default: false
-k, --keep-packages         Show also the keep-packages flag. Default: false
-u, --uri                   Show also base URI of repositories. Default: false
-p, --priority              Show also repository priority. Default: false
-d, --details               Show more information like URI, priority, type. Default: false
-s, --service               Show also alias of parent service. Default: false
-E, --show-enabled-only     Show enabled repos only. Default: false
-U, --sort-by-uri           Sort the list by URI. Default: false
-N, --sort-by-name          Sort the list by name. Default: false
-P, --sort-by-priority      Sort the list by repository priority. Default: false
-A, --sort-by-alias         Show also alias of parent service. Default: false

tom@mydesktop: ~ $