Skip to content
Fabio Mucciante edited this page Jul 24, 2020 · 26 revisions

Welcome to the ZypperUpgraderepo wiki!

ZypperUpgraderepo checks the current and the next version repositories in order to provide a smoother and a safer upgrade process using the zypper dup command.

Besides this main function, it also backups the whole list of repositories and upgrades them all at once.

Checking repositories

The main utility is the repository check, which helps in getting aware that the upgraded repository is available and the new URL is working as expected, reporting Not Found errors or even redirects.

Check the current version

Checking the current repositories can be useful also to detect failures during normal updating procedures:

$ zypper-upgraderepo --check-current

A table with four columns will show:

  • The status for each URL;
  • The number, useful to reference it for further operations;
  • The repository's name;
  • Whether enabled or not;
  • A hint explaining, when possible, how to replace the invalid URL.

The status can be reported by one of these symbols:

  • [V]: Everything works as expected;
  • [W]: The URL has been redirected, the printed URL should be replaced with the printed one;
  • [E]: The URL is invalid, a hint will be printed where possible giving an alternative URL, otherwise it is better to find it manually or remove the repository completely if not needed anymore.

Check for the next version

Before upgrading the current system we can check the status of the repository's URLs for the next version, which are interpolated simply replacing the current version of openSUSE with the newer.

$ zypper-upgraderepo --check-next

The table's result will have the same columns seen before.

Last but not least also a custom (valid) version of openSUSE's repository can be checked to jump from a version to another:

$ zypper-upgraderepo --check-to 15.0

Override one or more URLs

When the checking procedure fails we can repeat it overriding the bad URLs with the suggested or self-discovered ones and check them again.

There are two ways to override the URLs:

  1. Using the --override-url switch;
  2. Exporting the checking result as ini file and importing it after applying the changes.

Override a repo's URL while checking

To replace the invalid URLs on the fly we can make use of the --override-url switch followed by the repository number and the new URL:

$ zypper-upgraderepo --check-next --override-url 4,http://domain.org/new-path/15.0/

Overriding through an output file

This solution allows to create a single file with all the failing URLs, modify it with our favorite text edito and import the changes later:

$ zypper upgraderepo --check-next --only-invalid --only-enabled --ini > ~/output-check.ini
$ vi ~/output-check.ini
$ zipper upgraderepo --check-next --load-overrides ~/output-check.ini
$ zypper upgraderepo --upgrade --load-overrides ~/output-check.ini

While using the ini file we will get a list of repositories where among all the other information, the old_url key keeps the original URL and the url key the newer that will perform the upgrade.

Below an example about a valid upgrade:

[repository_1]
name=Packman_Leap_15.2
alias=Packman_Leap_15.2
url=http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.2/
old_url=http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.1/
priority=99
enabled=Yes
status=Ok

When the URL can't interpolate or just needs a confirmation, that key will be left empty, but a comment above will show what to do:

[repository_5]
name=Hardware tools (openSUSE_Leap_15.2)
alias=hardware
old_url=http://download.opensuse.org/repositories/hardware/openSUSE_Leap_15.1/
# The interpolated URL is invalid, try overriding with the one suggested
# in the fields below or find it manually starting from the old_url.
# The alternatives are:
# 1. Waiting for a repository upgrade;
# 2. Change the provider for the related installed packages;
# 3. Disable the repository putting the enabled status to 'No'.
#
url=
priority=99
enabled=Yes
status=Not Found
hint=Can't find a valid alternative, try manually!

Backup

Before to make any permanent change to the repository's list a backup of them is highly recommended.

The single file backup

Zypper itself allows to backup the list of repositories creating a single file:

$ zypper lr -e ~/backup.repo

And restore the list with:

$ zypper ar ~/backup.repo

The multiple file backup

When, for some reason, you want to make a 1:1 backup of all the repositories installed, the switch --backup may help you:

$ zypper-upgraderepo --backup ~

A tgz file will be placed in the home folder with a squeezed date-time info in the filename.

To restore the list just extract the archive:

$ sudo tar -xvf ~/repos-backup...tgz -C /

Upgrade

The last step before to launch zypper dup is to overwrite all the repositories with the new address.

Upgrade to the next version

Upgrading the repositories to the next versions is as easy as typing:

$ sudo zypper-upgraderepo --upgrade

Automatizing the procedure helps saving time instead of changing them one by one with the command zypper mr ... or editing manually each file.

When a bad URL is detected during the check session, can be replaced appending one or more --override-url:

$ sudo zypper-upgraderepo --upgrade \
    --override-url 2,http://domain.org/correct/path/15.0/ \
    --override-url 3,http://anotherdomain.org/another-path/15.0

Upgrade to a custom version

Sometimes we need to switch to a custom version instead of the next, this is allowed by:

$ sudo zypper-upgraderepo --upgrade-to 15.0

Of course, only existing or existed openSUSE versions will be allowed, don't forget to check the availability of the relative repositories before upgrade!

Other options

General options

  • --no-name Don't change the repository name;
  • --no-alias Don't change the repository alias;
  • --no-hint Don't find an alternative URL;
  • --timeout Change the waiting time for the answer from the repository server before raising a timeout error.

Filtering options

  • --only-enabled Check or upgrade only enabled repositories;
  • --only-repo [,NUMBER2,...] Check only the repositories specified by their comma-separated number;
  • --only-invalid Show only invalid repositories.

View options

  • --ini Export the checking result as ini file which can be used later;
  • --quiet Show only an error message when something wrong happen;
  • --report Show the results as a report adding other details;
  • --sort-by-alias / --sort-by-name / --sort-by-priority Sort the repositories by either alias (default) or name or priority.

Wrap up

To summarize this is the list of operations I execute to upgrade my system:

  1. First of all, if you have unneeded repositories remove or disable them, remove or fix also the wrong repository's URLs using the --check-current operation:

    $ zypper-upgraderepo --check-current
    
  2. Be sure to update the system to the latest packages:

    $ sudo zypper up
    
  3. If you have a brtfs filesystem check this section: Move /var/cache to a separate subvolume, otherwise go to the next step

  4. Check for the next version repositories:

    $ zypper-upgraderepo --check-next
    
  5. If no error occurred then make a backup and upgrade them, otherwise try to apply a fix as discussed above:

    $ zypper-upgraderepo --backup ~
    $ sudo zypper-upgraderepo --upgrade
    
  6. I prefer to download all the packages first:

    $ sudo zypper dup --download-only
    
  7. Once all packages are downloaded, logout from the graphical session and login to one of the textual sessions available (i.e. CTRL+ALT+F1), then start the third init level:

    # init 3
    
  8. Finish the upgrade process:

    # zypper --no-refresh dup
    
  9. Reboot and you are done!

    # reboot now
    

Resources

Clone this wiki locally