What's the return value when the patch install failed by using "zypper in"

Sometimes, the return value of “zypper in -t patch patch_name” is not equal 0, even if the patch installed successful.
How can I know if the patch have been installed successful?

zypper info -t patch nameofthepatch | grep -i Status
zypper se -t patch

Usually patch exit codes mean the package management itself was patched and needed to restart or there was a Kernel update that requires a system reboot to take effect.

Here’s a complete list of exit codes, taken from 13.1’s “man zypper”:

EXIT CODES

There are several exit codes defined for zypper for use e.g. within
scripts. These codes are defined in header file src/zypper-main.h
found in zypper source package. Codes from interval (1-5) denote an
error, numbers (100-105) provide a specific information, 0
represents a normal successful run. Following is a list of these
codes with descriptions.

0 - ZYPPER_EXIT_OK
Successfull run of zypper with no special info.

1 - ZYPPER_EXIT_ERR_BUG
Unexpected situation occured, probably caused by a bug.

2 - ZYPPER_EXIT_ERR_SYNTAX
zypper was invoked with an invalid command or option, or a bad syntax.

3 - ZYPPER_EXIT_ERR_INVALID_ARGS
Some of provided arguments were invalid. E.g. an invalid URI was provided to the addrepo command.

4 - ZYPPER_EXIT_ERR_ZYPP
A problem is reported by ZYPP library.

5 - ZYPPER_EXIT_ERR_PRIVILEGES
User invoking zypper has insufficient privileges for specified operation.

6 - ZYPPER_EXIT_NO_REPOS
No repositories are defined.

7 - ZYPPER_EXIT_ZYPP_LOCKED
The ZYPP library is locked, e.g. packagekit is running.

100 - ZYPPER_EXIT_INF_UPDATE_NEEDED
Returned by the patch-check command if there are patches available for installation.

101 - ZYPPER_EXIT_INF_SEC_UPDATE_NEEDED
Returned by the patch-check command if there are security patches available for installation.

102 - ZYPPER_EXIT_INF_REBOOT_NEEDED
Returned after a successfull installation of a patch which requires reboot of computer.

103 - ZYPPER_EXIT_INF_RESTART_NEEDED
Returned after a successfull installation of a patch which requires restart of the package manager itself. This means that one of patches to be installed affects the package manager itself and the command used (e.g. zypper update) needs to be executed once again to install any remaining patches.

104 - ZYPPER_EXIT_INF_CAP_NOT_FOUND
Returned by the install and the remove command in case any of the
arguments does not match any of the available (or installed) package names
or other capabilities.

105 - ZYPPER_EXIT_ON_SIGNAL
Returned upon exiting after receiving a SIGINT or SIGTERM.

So check if the exit code is less than 100 (and higher than 0 of course) to see if there has been an error.

On 2014-07-24 10:56, gopdoly wrote:
>
> Sometimes, the return value of “zypper in -t patch patch_name” is not
> equal 0, even if the patch installed successful.
> How can I know if the patch have been installed successful?

man zypper, search “EXIT CODES”. There you get the entire list.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))