-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
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.
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.
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.
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
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:
- Using the
--override-url
switch; - Exporting the checking result as ini file and importing it after applying the changes.
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/
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!
Before to make any permanent change to the repository's list a backup of them is highly recommended.
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
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 /
The last step before to launch zypper dup
is to overwrite all the repositories with the new address.
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
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!
- --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.
- --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.
- --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.
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