-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
ZypperUpgraderepo was born to check the repository availability in order to facilitate the upgrade process of the
openSUSE Leap distribution using the zypper dup
command, but also to discover errors in the URLs reference.
Besides this main checking function over current and next version repositories, it also provides commands to:
- check for an arbitrary version in the list of supported versions (next, last, something in the middle);
- back up the whole list of repositories;
- upgrade the repositories all at once;
- check the status of the current distribution.
With a view to distro upgrade, the repository check operation mainly helps to discover which repositories are ready for the upgrade reporting those URLs not working as expected, i.e Not Found or even Redirected.
Checking the current repositories can be useful also to detect failures during a normal updating process:
$ zypper-upgraderepo --check-current
A table with four columns will show:
- The status;
- The related repository number;
- The repository name;
- Whether enabled or not;
- A hint explaining, when possible, how to replace the invalid URL.
The status can be reported using 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.
When the error can't be fixed either manually or with the help of this script, is better to disable it before the next update starts, or even remove it if totally unneeded.
Before upgrading the current system we can check the status of the repository's URLs for the next version, which are interpolated simply by replacing the current version of openSUSE Leap with the newer.
$ zypper-upgraderepo --check-next
The table's result will show the same columns seen before.
Although is not recommended to upgrade missing some versions we might want to be able to know whether or not the repositories are available also for the latest stable version:
$ zypper-upgraderepo --check-last
Last but not least also a custom (valid) version of openSUSE's repository can be checked to jump from one version to another:
$ zypper-upgraderepo --check-for 15.0
When the checking procedure fails we can repeat it overriding the bad URLs with the suggested or self-discovered ones and check for them again.
There are two ways to override the URLs:
- Using the
--override-url
option; - Exporting the checking result as ini file, applying the changes, and reimporting it.
To replace the invalid URLs on the fly we can make use of the --override-url
option followed by the repository
number and the new URL comma ,
separated:
$ zypper-upgraderepo --check-next --override-url 4,http://domain.org/new-path/15.0/
When the number of URLs to fix grows, there is another way to override the failing repositories which might result in more comfortable:
- export on an ini structured files the invalid repositories using the
--ini
option;$ zypper-upgraderepo --check-next --only-invalid --only-enabled --ini > ~/output.ini
- edit it and fix the URLs;
$ vi ~/output.ini
- reload that file to the next check and upgrade procedure.
$ zypper-upgraderepo --check-next --load-overrides ~/output.ini $ sudo zypper-upgraderepo --upgrade --load-overrides ~/output.ini
Below is an example of the output file structure correctly upgraded:
[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
Two fields describe the old_url and the new url, when the new URL can't be interpolated for any reason, that last key will be left empty and a commented section might suggest 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!
Before making any permanent change to the repository's list a backup is highly recommended.
Zypper itself allows to back up the list of repositories creating a single file:
$ zypper lr -e ~/backup.repo
And restore it with:
$ sudo zypper ar ~/backup.repo
When, for some reason, you want to make a 1:1 backup of all the repositories installed, the --backup
operation
comes in help:
$ zypper-upgraderepo --backup ~
A tgz archive 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 /
After all the repositories have been successfully checked it's time to upgrade their reference before launching
the sudo zypper dup
command.
Upgrading the repositories to the next versions is as easy as typing:
$ sudo zypper-upgraderepo --upgrade
This replaces the manual edit accomplished with the zypper mr ...
command, making it shorter.
Of course, to replace the failing URLs previously detected we can make use of the --override-url
option again:
$ sudo zypper-upgraderepo --upgrade \
--override-url 2,http://domain.org/correct/path/15.0/ \
--override-url 3,http://anotherdomain.org/another-path/15.0
Or reload the output file once it has been fixed using the --load-overrides
option:
$ sudo zypper-upgraderepo --upgrade --load-overrides ~/output.ini
As seen for the --check-last
operation, there is an operation that allows jumping directly to the last
version without upgrading to the next.
$ sudo zypper-ugraderepo --upgrade-to-last
This practice is highly discouraged, and it is always better to upgrade version by version till the last.
Useless to mention that --upgrade-to-last
and --upgrade-to-next
achieve the same task when the next
version is also the last.
Upgrading to a custom version instead of the next or the last is allowed by the --upgrade-to <VERSION>
operation:
$ sudo zypper-upgraderepo --upgrade-to 15.0
Of course, only existing openSUSE versions will be allowed, don't forget to check the availability of the relative repositories before upgrade or downgrade!
If you accidentally upgraded your repositories and forgot to create a backup of them, this operation will give you a hand to reset the changes:
$ zypper-upgraderepo --reset
This operation has been added with the 1.6.0
release, to be honest for scripting purposes, and prints
the status of our current openSUSE Leap distribution in terms of version:
$ zypper-upgraderepo --status
It helps to understand either how many versions our distro is back or if it is currently aligned to the last stable version available.
From time to time other options have been added with minor relevance but that might be useful.
--allow-unstable
: Appends the unstable underworking release in the internal stable releases list.
--no-name
: Don't change the repository name.
--no-alias
: Don't change the repository alias.
--no-hint
: Don't find an alternative URL.
--exit-on-fail
: For scripting purposes, exit when the first error is raised emitting an error code.
--timeout <SECONDS>
: Change the waiting time for the answer from the repository server before raising a timeout error.
--only-enabled
: Check or upgrade only enabled repositories.
--only-repo <NUMBER>[,NUMBER2,...]
: Check only the repositories specified by their comma-separated number.
--only-invalid
: Show only invalid repositories.
--only-protocols <PROTOCOL>[,<PROTOCOL2>,...]
: Filter for a list of protocols (http, https, dir).
--sort-by-alias
/ --sort-by-name
/ --sort-by-priority
: Sort the repositories by either alias (default), name or priority.
--ini
: Export the checking result as ini file.
--quiet
: Show only an error message when something wrong happens.
--report
: Show the results as a report adding other details.
To summarize this is the list of operations I execute to upgrade my system:
-
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
-
Be sure to update the system to the latest packages:
$ sudo zypper up
-
If you have a
brtfs
filesystem check this section: Move /var/cache to a separate subvolume, otherwise go to the next step -
Check for the next version repositories:
$ zypper-upgraderepo --check-next
-
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
-
I prefer to download all the packages first:
$ sudo zypper dup --download-only
-
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
-
Finish the upgrade process:
# zypper --no-refresh dup
-
Reboot and you are done!
# reboot now
- Project page on FreeAptitude
- Under the hood of zypper_upgraderepo gem
- Upgrading openSUSE with zypper
- zypper-upgraderepo 1.2 news on openSUSE Lizards
- My tutorial translated in spanish by openSUSE Mexico team
- My tutorial translated in greek by Efstathios Iosifidis
- Small tutorial on openSUSE Lizards
- zypper-upgraderepo-plugin use this gem as zypper subcommand