Difference between revisions of "Update contribs"

From SME Server
Jump to navigationJump to search
(Undo revision 33016 by Mmccarn (talk))
(Add notes on correcting yum source after using smedev, smetest or smecontribs-testing)
 
(8 intermediate revisions by 3 users not shown)
Line 14: Line 14:
 
Yum doesn't do this job in one command but small scripts must be used for this purpose.
 
Yum doesn't do this job in one command but small scripts must be used for this purpose.
  
===Scripts===
+
===yumcheck.sh===
3 scripts are available at this time:
 
 
 
====yumcheck.sh====
 
  
 
yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
 
yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
Line 23: Line 20:
 
yumcheck.sh is an attachment to [[bugzilla:10158]]
 
yumcheck.sh is an attachment to [[bugzilla:10158]]
  
Install at the sme server shell using:
+
Install at the sme server shell using (updated 2017-12-14):<br />
  <nowiki>curl -s https://bugs.contribs.org/attachment.cgi?id=5828 |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
+
(If this curl command doesn't work you can open the bug using the link above, view the attachment, create a local file with the same content, and make the local file executable)
chmod +x /usr/local/bin/yumcheck.sh
+
  curl -s <nowiki>https://bugs.contribs.org/attachment.cgi?id=6016</nowiki> |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
</nowiki>
+
chmod +x /usr/local/bin/yumcheck.sh
 +
 
  
 
Usage:
 
Usage:
 
: <tt>yumcheck.sh</tt>
 
: <tt>yumcheck.sh</tt>
 
:: Check for updates for all packages installed from non-standard repos.  Output only info for packages that need updates
 
:: Check for updates for all packages installed from non-standard repos.  Output only info for packages that need updates
 +
:: Indicate before exit if any packages were installed using ''yum localinstall''
 +
:: Indicate before exit if the server requires ''signal-event post-upgrade; signal-event reboot''
 
: <tt>yumcheck.sh update</tt>
 
: <tt>yumcheck.sh update</tt>
 
:: Run in verbose mode, do the updates, prompt the user after checking each repo if updates are pending
 
:: Run in verbose mode, do the updates, prompt the user after checking each repo if updates are pending
 
: <tt>yumcheck.sh update -q -y</tt>
 
: <tt>yumcheck.sh update -q -y</tt>
 
:: Show only those items to be updated, do the updates, and answer 'yes' to each suggested update.
 
:: Show only those items to be updated, do the updates, and answer 'yes' to each suggested update.
 +
: <tt>yumcheck.sh @/ </tt>
 +
:: List all rpms that have been installed using ''yum localinstall''
 +
: <tt>yumcheck.sh @smecontribs @sogo @/</tt>
 +
:: Check for updates from "smecontribs", "sogo3", and any locally installed rpms
 +
:: Note that "@sogo" will be expanded to "sogo3" at runtime.  Likewise, "@sme" would expand to "smecontribs"
  
 
Notes:
 
Notes:
 
* Using the default settings will list updates from the enabled repositories multiple times (once for each disabled repo with installed packages)
 
* Using the default settings will list updates from the enabled repositories multiple times (once for each disabled repo with installed packages)
 
* Since this command starts from the output of <tt>/sbin/e-smith/audittools/newrpms</tt>, it is possible to get errors.  That is, if you configure a repository, install a package from it, then remove the configuration, this script will error.
 
* Since this command starts from the output of <tt>/sbin/e-smith/audittools/newrpms</tt>, it is possible to get errors.  That is, if you configure a repository, install a package from it, then remove the configuration, this script will error.
 +
* Arguments starting with "@" are stripped out and handled separately.  If *all* arguments start with "@", the default "check-update -q" will be passed to yum.
 +
 +
=== Problems ===
 +
 +
==== smeupdates-testing ====
 +
You might be directed in the forums or in bugzilla to install an update to a package from the smedev, smetest, or smeupdates-testing repository.  Once the developer is confident that the update works and solves the problem, it gets "released" to smeupdates or smecontribs.  In this case, yumcheck.sh will continue to look for updates only in original repo until you have installed the "released" version from the correct repository.
 +
 +
Assuming you have been directed to update "smeserver-php-scl" from the "smecontribs-testing" repository, you would "correct" the package once it is released by running:<syntaxhighlight lang="bash">
 +
yum --enablerepo=smecontribs reinstall smeserver-php-scl
 +
</syntaxhighlight>Note: "yum reinstall" works only for identical package versions.  If smecontribs has a newer version, you can get it using "yum --enablerepo=smecontribs update smeserver-php-scl"
 +
 +
==== Changed Dependencies ====
 +
From time to time an rpm will acquire new dependencies. Since yumcheck.sh is restricting each repository to only the packages that already came from that repository, the update will fail.
 +
 +
To work around this problem, you will need to update the affected packages manually with the source repository enabled.
 +
 +
Be sure to check the output of your yum update command carefully before allowing the update to be installed - make sure that no SME-specific rpms are included in the update!
 +
 +
Example:
 +
 +
yumcheck.sh fails to run due to a dependency problem:<syntaxhighlight lang="bash">
 +
# yumcheck.sh update
 +
...
 +
Error: Package: php71-php-mcrypt-7.1.25-1.el6.remi.x86_64 (installed)
 +
          Requires: php71-php-common(x86-64) = 7.1.25-1.el6.remi
 +
...
  
====script 1====
+
</syntaxhighlight>Find the repository that the installed package came from:<syntaxhighlight lang="bash">
 +
# yum info php71-php-mcrypt
 +
# yum info php71-php-mcrypt
 +
Loaded plugins: fastestmirror, post-transaction-actions, smeserver
 +
Loading mirror speeds from cached hostfile
 +
* base: centos2.zswap.net
 +
* smeaddons: mirror.canada.pialasse.com
 +
* smeextras: mirror.canada.pialasse.com
 +
* smeos: mirror.canada.pialasse.com
 +
* smeupdates: mirror.canada.pialasse.com
 +
* updates: centos2.zswap.net
 +
Installed Packages
 +
Name        : php71-php-mcrypt
 +
Arch        : x86_64
 +
Version    : 7.1.25
 +
Release    : 2.el6.remi
 +
Size        : 39 k
 +
Repo        : installed
 +
From repo  : remi-safe
 +
Summary    : Standard PHP module provides mcrypt library support
 +
URL        : http://www.php.net/
 +
License    : PHP
 +
Description : The php71-php-mcrypt package contains a dynamic shared object that will add
 +
            : support for using the mcrypt library to PHP.
 +
</syntaxhighlight>Do an update with only the indicated repository enabled:<syntaxhighlight lang="bash">
 +
# yum --disablerepo=* --enablerepo=remi-safe update
 +
...
 +
Dependencies Resolved
  
#!/bin/bash
+
============================================================================================================================================================
   
+
  Package                                  Arch                          Version                                    Repository                        Size
echo "List of available repos beside SME:";
+
============================================================================================================================================================
#list the disabled repos
+
Updating:
for repo in $(yum repolist disabled |awk  '$1 !~ /id|Modules|repolist:/ {print $1}'); do
+
php54-php                                x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.4 M
+
php54-php-bcmath                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        59 k
      echo $repo;
+
php54-php-cli                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        2.7 M
+
php54-php-common                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        581 k
done
+
php54-php-enchant                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        44 k
echo "";
+
php54-php-gd                              x86_64                        5.4.45-16.el6.remi                          remi-safe                        125 k
+
php54-php-imap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        65 k
# repo selection
+
php54-php-ldap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        56 k
index=0;
+
php54-php-mbstring                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        498 k
repos="";
+
php54-php-mcrypt                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        49 k
proceed="proceed";
+
php54-php-mysqlnd                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.8 M
+
php54-php-pdo                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        91 k
until [ "$repos" == "$proceed" ]; do
+
php54-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
+
php54-php-process                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        54 k
        repos[$index]=$repos;
+
php54-php-soap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        160 k
        ((index=index+1));
+
php54-php-tidy                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        51 k
        read -p 'Enter 1x repo name for selection or "proceed" to start the updating: ' repos;
+
php54-php-xml                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        119 k
+
php55-php                                x86_64                        5.5.38-10.el6.remi                          remi-safe                        1.4 M
done
+
php55-php-bcmath                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        60 k
+
php55-php-cli                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        2.6 M
# remove the repo "proceed"
+
php55-php-common                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        672 k
repos=("${repos[@]:1}");
+
php55-php-enchant                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        45 k
+
php55-php-gd                              x86_64                        5.5.38-10.el6.remi                          remi-safe                        67 k
+
php55-php-imap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        66 k
for repo in "${repos[@]}"; do
+
php55-php-ldap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        57 k
        echo "";
+
php55-php-mbstring                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        512 k
        echo "======================================";
+
php55-php-mcrypt                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        50 k
        echo -e "\tUPDATE from repo: "$repo;
+
php55-php-mysqlnd                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        175 k
        echo "======================================";
+
php55-php-pdo                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        93 k
   
+
php55-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
        # generate the list of rpm installed from the repo
+
php55-php-process                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        58 k
        for rpm in $(/sbin/e-smith/audittools/newrpms |awk -v repo_awk=@$repo 'repo_awk==$3 {print $1}'); do
+
php55-php-soap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        163 k
   
+
php55-php-tidy                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        52 k
                rpms=$rpm' '$rpms
+
php55-php-xml                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        150 k
   
+
php56-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
        done
+
php70-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
   
+
php71-php                                x86_64                        7.1.25-2.el6.remi                          remi-safe                        1.4 M
# updating
+
php71-php-bcmath                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        68 k
        yum --enablerepo=$repo update $rpms;
+
php71-php-cli                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        2.7 M
   
+
php71-php-common                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        597 k
  done
+
php71-php-enchant                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        53 k
   
+
  php71-php-fpm                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        1.4 M
  exit 0
+
php71-php-gd                              x86_64                        7.1.25-2.el6.remi                          remi-safe                        70 k
 +
php71-php-imap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        73 k
 +
php71-php-json                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        62 k
 +
php71-php-ldap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        65 k
 +
php71-php-mbstring                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        522 k
 +
php71-php-mcrypt                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        58 k
 +
php71-php-mysqlnd                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        164 k
 +
php71-php-pdo                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        102 k
 +
php71-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        370 k
 +
php71-php-process                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        66 k
 +
php71-php-soap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        156 k
 +
php71-php-tidy                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        60 k
 +
php71-php-xml                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        155 k
 +
php72-php                                x86_64                        7.2.13-2.el6.remi                          remi-safe                        1.5 M
 +
php72-php-bcmath                          x86_64                        7.2.13-2.el6.remi                          remi-safe                        70 k
 +
php72-php-cli                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        2.9 M
 +
  php72-php-common                          x86_64                        7.2.13-2.el6.remi                          remi-safe                        627 k
 +
php72-php-enchant                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        54 k
 +
php72-php-gd                              x86_64                        7.2.13-2.el6.remi                          remi-safe                        73 k
 +
php72-php-imap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        74 k
 +
  php72-php-json                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        64 k
 +
php72-php-ldap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        69 k
 +
  php72-php-mbstring                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        557 k
 +
php72-php-mysqlnd                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        166 k
 +
php72-php-pdo                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        104 k
 +
  php72-php-process                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        67 k
 +
  php72-php-soap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        157 k
 +
  php72-php-tidy                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        61 k
 +
  php72-php-xml                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        156 k
  
Using this script is very easy:
+
Transaction Summary
* you get the list of all available repositories
+
============================================================================================================================================================
* enter 1 by 1 the name of the repo you want to update from
+
Upgrade      71 Package(s)
* enter 'proceed' after the last repo
 
* for each repo, yum show the list of rpms that could be updated and ask (Y/N) before starting
 
  
eg.:
+
Total size: 30 M
List of available repos beside SME:
+
Is this ok [y/N]: y
centosplus
+
...
contrib
 
epel
 
extras
 
fasttrack
 
fws
 
remi
 
smecontribs
 
smedev
 
smetest
 
smeupdates-testing
 
sogo3
 
 
Enter 1x repo name for selection or "proceed" to start the updating: epel
 
Enter 1x repo name for selection or "proceed" to start the updating: fws
 
Enter 1x repo name for selection or "proceed" to start the updating: proceed
 
  
====script 2====
+
Updated:
This script is much shorter, runs faster and doesn't require to enter the name of the several repos:
+
  php54-php.x86_64 0:5.4.45-16.el6.remi              php54-php-bcmath.x86_64 0:5.4.45-16.el6.remi        php54-php-cli.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-common.x86_64 0:5.4.45-16.el6.remi      php54-php-enchant.x86_64 0:5.4.45-16.el6.remi      php54-php-gd.x86_64 0:5.4.45-16.el6.remi         
 +
  php54-php-imap.x86_64 0:5.4.45-16.el6.remi        php54-php-ldap.x86_64 0:5.4.45-16.el6.remi          php54-php-mbstring.x86_64 0:5.4.45-16.el6.remi   
 +
  php54-php-mcrypt.x86_64 0:5.4.45-16.el6.remi      php54-php-mysqlnd.x86_64 0:5.4.45-16.el6.remi      php54-php-pdo.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-pear.noarch 1:1.10.7-1.el6.remi          php54-php-process.x86_64 0:5.4.45-16.el6.remi      php54-php-soap.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-tidy.x86_64 0:5.4.45-16.el6.remi        php54-php-xml.x86_64 0:5.4.45-16.el6.remi          php55-php.x86_64 0:5.5.38-10.el6.remi           
 +
  php55-php-bcmath.x86_64 0:5.5.38-10.el6.remi      php55-php-cli.x86_64 0:5.5.38-10.el6.remi          php55-php-common.x86_64 0:5.5.38-10.el6.remi     
 +
  php55-php-enchant.x86_64 0:5.5.38-10.el6.remi      php55-php-gd.x86_64 0:5.5.38-10.el6.remi            php55-php-imap.x86_64 0:5.5.38-10.el6.remi       
 +
  php55-php-ldap.x86_64 0:5.5.38-10.el6.remi        php55-php-mbstring.x86_64 0:5.5.38-10.el6.remi      php55-php-mcrypt.x86_64 0:5.5.38-10.el6.remi     
 +
  php55-php-mysqlnd.x86_64 0:5.5.38-10.el6.remi      php55-php-pdo.x86_64 0:5.5.38-10.el6.remi          php55-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php55-php-process.x86_64 0:5.5.38-10.el6.remi      php55-php-soap.x86_64 0:5.5.38-10.el6.remi          php55-php-tidy.x86_64 0:5.5.38-10.el6.remi       
 +
  php55-php-xml.x86_64 0:5.5.38-10.el6.remi          php56-php-pear.noarch 1:1.10.7-1.el6.remi          php70-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php71-php.x86_64 0:7.1.25-2.el6.remi              php71-php-bcmath.x86_64 0:7.1.25-2.el6.remi        php71-php-cli.x86_64 0:7.1.25-2.el6.remi         
 +
  php71-php-common.x86_64 0:7.1.25-2.el6.remi        php71-php-enchant.x86_64 0:7.1.25-2.el6.remi        php71-php-fpm.x86_64 0:7.1.25-2.el6.remi         
 +
  php71-php-gd.x86_64 0:7.1.25-2.el6.remi            php71-php-imap.x86_64 0:7.1.25-2.el6.remi          php71-php-json.x86_64 0:7.1.25-2.el6.remi       
 +
  php71-php-ldap.x86_64 0:7.1.25-2.el6.remi          php71-php-mbstring.x86_64 0:7.1.25-2.el6.remi      php71-php-mcrypt.x86_64 0:7.1.25-2.el6.remi     
 +
  php71-php-mysqlnd.x86_64 0:7.1.25-2.el6.remi      php71-php-pdo.x86_64 0:7.1.25-2.el6.remi            php71-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php71-php-process.x86_64 0:7.1.25-2.el6.remi      php71-php-soap.x86_64 0:7.1.25-2.el6.remi          php71-php-tidy.x86_64 0:7.1.25-2.el6.remi       
 +
  php71-php-xml.x86_64 0:7.1.25-2.el6.remi          php72-php.x86_64 0:7.2.13-2.el6.remi                php72-php-bcmath.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-cli.x86_64 0:7.2.13-2.el6.remi          php72-php-common.x86_64 0:7.2.13-2.el6.remi        php72-php-enchant.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-gd.x86_64 0:7.2.13-2.el6.remi            php72-php-imap.x86_64 0:7.2.13-2.el6.remi          php72-php-json.x86_64 0:7.2.13-2.el6.remi       
 +
  php72-php-ldap.x86_64 0:7.2.13-2.el6.remi          php72-php-mbstring.x86_64 0:7.2.13-2.el6.remi      php72-php-mysqlnd.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-pdo.x86_64 0:7.2.13-2.el6.remi          php72-php-process.x86_64 0:7.2.13-2.el6.remi        php72-php-soap.x86_64 0:7.2.13-2.el6.remi       
 +
  php72-php-tidy.x86_64 0:7.2.13-2.el6.remi          php72-php-xml.x86_64 0:7.2.13-2.el6.remi         
  
#!/bin/bash
+
Complete!
 
for repo in $(/sbin/e-smith/audittools/newrpms |grep \@ |awk ' {print $3}' |sort -u |sed s/@//); do
 
 
        # generate the list of rpm installed from the repo
 
        for rpm in $(/sbin/e-smith/audittools/newrpms |awk -v repo_awk=@$repo 'repo_awk==$3 {print $1}'); do
 
                rpms=$rpm' '$rpms
 
        done
 
 
        echo -e "\n\n===";
 
        echo -e "Repo: "$repo;
 
        echo -e "\nIncludePkgs: "$rpms;
 
        echo "===";
 
        # updating
 
        yum --enablerepo=$repo --setopt="$repo.includepkgs='$rpms'" update
 
 
done
 
 
exit 0
 
  
The script
+
</syntaxhighlight>
* runs 'newrpms' to get all repos that have been used to install non-standard packages
 
* creates a list of rpms for each such repo
 
* uses "--setopts" to specify "includepkgs" for each repo during update
 
* asks for Y/N and runs the update
 
  
 +
The objective is to update only the package or packages that are blocking safe updates using yumcheck.sh.  If updating as above (with only the indicated repository enabled) includes too many packages, you might need to add package names to the update command.  If the indicated packages include dependencies from other repositories you may need to enable those other repositories.
 +
 +
The epel repository, for example, contains many useful packages (fail2ban, nodejs, roundcube, imapsync, and many more) - but "yum --enablerepo=epel update" would break horde and php on a SME server.  In that case you would add the affected package to the update command:<syntaxhighlight lang="bash">
 +
# yum --enablerepo=epel update roundcube
 +
</syntaxhighlight>
  
 
===Related Information===
 
===Related Information===
 +
====Alternative Scripts====
 +
: [https://wiki.contribs.org/Talk:Update_contribs Original scripts]
 
====Forum====
 
====Forum====
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
Line 154: Line 231:
 
  |disablecache=1
 
  |disablecache=1
 
  |noresultsmessage="Bug not found"
 
  |noresultsmessage="Bug not found"
  |headers=show}}
+
  |headers=show}}   [[Category:Howto]]    [[Category:Tools]]  [[Category:Updating]]
 
 
[[Category: Howto]]
 

Latest revision as of 16:10, 15 December 2018

Is this article helpful to you?
Please consider donating or volunteering
Thank you!

Update contribs

Background

Important.png Note:
These scripts depend on a yum feature introduced in Centos 6 / SME 9, and will not work on earlier versions


Due to dependencies, the installation of contribs requires very often the installation of rpms coming from 3rd party (non-SME) repositories.

Enabling 3rd party repositories during a general yum update can pull in packages that are incompatible with SME server such as newer versions of PHP, mysql, samba, etc.

Updating the installed contribs needs sometimes to update the dependencies or sometimes only the dependencies get updated.

In order to avoid serious problems of compatibility, it is very important that all the rpms get updated only from the repository they are installed from, instead of only taking the most recent release existing in all the repositories that are available.

Yum doesn't do this job in one command but small scripts must be used for this purpose.

yumcheck.sh

yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.

yumcheck.sh is an attachment to bugzilla:10158

Install at the sme server shell using (updated 2017-12-14):
(If this curl command doesn't work you can open the bug using the link above, view the attachment, create a local file with the same content, and make the local file executable)

curl -s https://bugs.contribs.org/attachment.cgi?id=6016 |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
chmod +x /usr/local/bin/yumcheck.sh


Usage:

yumcheck.sh
Check for updates for all packages installed from non-standard repos. Output only info for packages that need updates
Indicate before exit if any packages were installed using yum localinstall
Indicate before exit if the server requires signal-event post-upgrade; signal-event reboot
yumcheck.sh update
Run in verbose mode, do the updates, prompt the user after checking each repo if updates are pending
yumcheck.sh update -q -y
Show only those items to be updated, do the updates, and answer 'yes' to each suggested update.
yumcheck.sh @/
List all rpms that have been installed using yum localinstall
yumcheck.sh @smecontribs @sogo @/
Check for updates from "smecontribs", "sogo3", and any locally installed rpms
Note that "@sogo" will be expanded to "sogo3" at runtime. Likewise, "@sme" would expand to "smecontribs"

Notes:

  • Using the default settings will list updates from the enabled repositories multiple times (once for each disabled repo with installed packages)
  • Since this command starts from the output of /sbin/e-smith/audittools/newrpms, it is possible to get errors. That is, if you configure a repository, install a package from it, then remove the configuration, this script will error.
  • Arguments starting with "@" are stripped out and handled separately. If *all* arguments start with "@", the default "check-update -q" will be passed to yum.

Problems

smeupdates-testing

You might be directed in the forums or in bugzilla to install an update to a package from the smedev, smetest, or smeupdates-testing repository. Once the developer is confident that the update works and solves the problem, it gets "released" to smeupdates or smecontribs. In this case, yumcheck.sh will continue to look for updates only in original repo until you have installed the "released" version from the correct repository.

Assuming you have been directed to update "smeserver-php-scl" from the "smecontribs-testing" repository, you would "correct" the package once it is released by running:

yum --enablerepo=smecontribs reinstall smeserver-php-scl

Note: "yum reinstall" works only for identical package versions. If smecontribs has a newer version, you can get it using "yum --enablerepo=smecontribs update smeserver-php-scl"

Changed Dependencies

From time to time an rpm will acquire new dependencies. Since yumcheck.sh is restricting each repository to only the packages that already came from that repository, the update will fail.

To work around this problem, you will need to update the affected packages manually with the source repository enabled.

Be sure to check the output of your yum update command carefully before allowing the update to be installed - make sure that no SME-specific rpms are included in the update!

Example:

yumcheck.sh fails to run due to a dependency problem:

# yumcheck.sh update
...
Error: Package: php71-php-mcrypt-7.1.25-1.el6.remi.x86_64 (installed)
           Requires: php71-php-common(x86-64) = 7.1.25-1.el6.remi
...

Find the repository that the installed package came from:

# yum info php71-php-mcrypt
# yum info php71-php-mcrypt
Loaded plugins: fastestmirror, post-transaction-actions, smeserver
Loading mirror speeds from cached hostfile
 * base: centos2.zswap.net
 * smeaddons: mirror.canada.pialasse.com
 * smeextras: mirror.canada.pialasse.com
 * smeos: mirror.canada.pialasse.com
 * smeupdates: mirror.canada.pialasse.com
 * updates: centos2.zswap.net
Installed Packages
Name        : php71-php-mcrypt
Arch        : x86_64
Version     : 7.1.25
Release     : 2.el6.remi
Size        : 39 k
Repo        : installed
From repo   : remi-safe
Summary     : Standard PHP module provides mcrypt library support
URL         : http://www.php.net/
License     : PHP
Description : The php71-php-mcrypt package contains a dynamic shared object that will add
            : support for using the mcrypt library to PHP.

Do an update with only the indicated repository enabled:

# yum --disablerepo=* --enablerepo=remi-safe update
...
Dependencies Resolved

============================================================================================================================================================
 Package                                   Arch                          Version                                     Repository                        Size
============================================================================================================================================================
Updating:
 php54-php                                 x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.4 M
 php54-php-bcmath                          x86_64                        5.4.45-16.el6.remi                          remi-safe                         59 k
 php54-php-cli                             x86_64                        5.4.45-16.el6.remi                          remi-safe                        2.7 M
 php54-php-common                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        581 k
 php54-php-enchant                         x86_64                        5.4.45-16.el6.remi                          remi-safe                         44 k
 php54-php-gd                              x86_64                        5.4.45-16.el6.remi                          remi-safe                        125 k
 php54-php-imap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                         65 k
 php54-php-ldap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                         56 k
 php54-php-mbstring                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        498 k
 php54-php-mcrypt                          x86_64                        5.4.45-16.el6.remi                          remi-safe                         49 k
 php54-php-mysqlnd                         x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.8 M
 php54-php-pdo                             x86_64                        5.4.45-16.el6.remi                          remi-safe                         91 k
 php54-php-pear                            noarch                        1:1.10.7-1.el6.remi                         remi-safe                        371 k
 php54-php-process                         x86_64                        5.4.45-16.el6.remi                          remi-safe                         54 k
 php54-php-soap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        160 k
 php54-php-tidy                            x86_64                        5.4.45-16.el6.remi                          remi-safe                         51 k
 php54-php-xml                             x86_64                        5.4.45-16.el6.remi                          remi-safe                        119 k
 php55-php                                 x86_64                        5.5.38-10.el6.remi                          remi-safe                        1.4 M
 php55-php-bcmath                          x86_64                        5.5.38-10.el6.remi                          remi-safe                         60 k
 php55-php-cli                             x86_64                        5.5.38-10.el6.remi                          remi-safe                        2.6 M
 php55-php-common                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        672 k
 php55-php-enchant                         x86_64                        5.5.38-10.el6.remi                          remi-safe                         45 k
 php55-php-gd                              x86_64                        5.5.38-10.el6.remi                          remi-safe                         67 k
 php55-php-imap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                         66 k
 php55-php-ldap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                         57 k
 php55-php-mbstring                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        512 k
 php55-php-mcrypt                          x86_64                        5.5.38-10.el6.remi                          remi-safe                         50 k
 php55-php-mysqlnd                         x86_64                        5.5.38-10.el6.remi                          remi-safe                        175 k
 php55-php-pdo                             x86_64                        5.5.38-10.el6.remi                          remi-safe                         93 k
 php55-php-pear                            noarch                        1:1.10.7-1.el6.remi                         remi-safe                        371 k
 php55-php-process                         x86_64                        5.5.38-10.el6.remi                          remi-safe                         58 k
 php55-php-soap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        163 k
 php55-php-tidy                            x86_64                        5.5.38-10.el6.remi                          remi-safe                         52 k
 php55-php-xml                             x86_64                        5.5.38-10.el6.remi                          remi-safe                        150 k
 php56-php-pear                            noarch                        1:1.10.7-1.el6.remi                         remi-safe                        371 k
 php70-php-pear                            noarch                        1:1.10.7-1.el6.remi                         remi-safe                        371 k
 php71-php                                 x86_64                        7.1.25-2.el6.remi                           remi-safe                        1.4 M
 php71-php-bcmath                          x86_64                        7.1.25-2.el6.remi                           remi-safe                         68 k
 php71-php-cli                             x86_64                        7.1.25-2.el6.remi                           remi-safe                        2.7 M
 php71-php-common                          x86_64                        7.1.25-2.el6.remi                           remi-safe                        597 k
 php71-php-enchant                         x86_64                        7.1.25-2.el6.remi                           remi-safe                         53 k
 php71-php-fpm                             x86_64                        7.1.25-2.el6.remi                           remi-safe                        1.4 M
 php71-php-gd                              x86_64                        7.1.25-2.el6.remi                           remi-safe                         70 k
 php71-php-imap                            x86_64                        7.1.25-2.el6.remi                           remi-safe                         73 k
 php71-php-json                            x86_64                        7.1.25-2.el6.remi                           remi-safe                         62 k
 php71-php-ldap                            x86_64                        7.1.25-2.el6.remi                           remi-safe                         65 k
 php71-php-mbstring                        x86_64                        7.1.25-2.el6.remi                           remi-safe                        522 k
 php71-php-mcrypt                          x86_64                        7.1.25-2.el6.remi                           remi-safe                         58 k
 php71-php-mysqlnd                         x86_64                        7.1.25-2.el6.remi                           remi-safe                        164 k
 php71-php-pdo                             x86_64                        7.1.25-2.el6.remi                           remi-safe                        102 k
 php71-php-pear                            noarch                        1:1.10.7-1.el6.remi                         remi-safe                        370 k
 php71-php-process                         x86_64                        7.1.25-2.el6.remi                           remi-safe                         66 k
 php71-php-soap                            x86_64                        7.1.25-2.el6.remi                           remi-safe                        156 k
 php71-php-tidy                            x86_64                        7.1.25-2.el6.remi                           remi-safe                         60 k
 php71-php-xml                             x86_64                        7.1.25-2.el6.remi                           remi-safe                        155 k
 php72-php                                 x86_64                        7.2.13-2.el6.remi                           remi-safe                        1.5 M
 php72-php-bcmath                          x86_64                        7.2.13-2.el6.remi                           remi-safe                         70 k
 php72-php-cli                             x86_64                        7.2.13-2.el6.remi                           remi-safe                        2.9 M
 php72-php-common                          x86_64                        7.2.13-2.el6.remi                           remi-safe                        627 k
 php72-php-enchant                         x86_64                        7.2.13-2.el6.remi                           remi-safe                         54 k
 php72-php-gd                              x86_64                        7.2.13-2.el6.remi                           remi-safe                         73 k
 php72-php-imap                            x86_64                        7.2.13-2.el6.remi                           remi-safe                         74 k
 php72-php-json                            x86_64                        7.2.13-2.el6.remi                           remi-safe                         64 k
 php72-php-ldap                            x86_64                        7.2.13-2.el6.remi                           remi-safe                         69 k
 php72-php-mbstring                        x86_64                        7.2.13-2.el6.remi                           remi-safe                        557 k
 php72-php-mysqlnd                         x86_64                        7.2.13-2.el6.remi                           remi-safe                        166 k
 php72-php-pdo                             x86_64                        7.2.13-2.el6.remi                           remi-safe                        104 k
 php72-php-process                         x86_64                        7.2.13-2.el6.remi                           remi-safe                         67 k
 php72-php-soap                            x86_64                        7.2.13-2.el6.remi                           remi-safe                        157 k
 php72-php-tidy                            x86_64                        7.2.13-2.el6.remi                           remi-safe                         61 k
 php72-php-xml                             x86_64                        7.2.13-2.el6.remi                           remi-safe                        156 k

Transaction Summary
============================================================================================================================================================
Upgrade      71 Package(s)

Total size: 30 M
Is this ok [y/N]: y
...

Updated:
  php54-php.x86_64 0:5.4.45-16.el6.remi              php54-php-bcmath.x86_64 0:5.4.45-16.el6.remi        php54-php-cli.x86_64 0:5.4.45-16.el6.remi         
  php54-php-common.x86_64 0:5.4.45-16.el6.remi       php54-php-enchant.x86_64 0:5.4.45-16.el6.remi       php54-php-gd.x86_64 0:5.4.45-16.el6.remi           
  php54-php-imap.x86_64 0:5.4.45-16.el6.remi         php54-php-ldap.x86_64 0:5.4.45-16.el6.remi          php54-php-mbstring.x86_64 0:5.4.45-16.el6.remi     
  php54-php-mcrypt.x86_64 0:5.4.45-16.el6.remi       php54-php-mysqlnd.x86_64 0:5.4.45-16.el6.remi       php54-php-pdo.x86_64 0:5.4.45-16.el6.remi         
  php54-php-pear.noarch 1:1.10.7-1.el6.remi          php54-php-process.x86_64 0:5.4.45-16.el6.remi       php54-php-soap.x86_64 0:5.4.45-16.el6.remi         
  php54-php-tidy.x86_64 0:5.4.45-16.el6.remi         php54-php-xml.x86_64 0:5.4.45-16.el6.remi           php55-php.x86_64 0:5.5.38-10.el6.remi             
  php55-php-bcmath.x86_64 0:5.5.38-10.el6.remi       php55-php-cli.x86_64 0:5.5.38-10.el6.remi           php55-php-common.x86_64 0:5.5.38-10.el6.remi       
  php55-php-enchant.x86_64 0:5.5.38-10.el6.remi      php55-php-gd.x86_64 0:5.5.38-10.el6.remi            php55-php-imap.x86_64 0:5.5.38-10.el6.remi         
  php55-php-ldap.x86_64 0:5.5.38-10.el6.remi         php55-php-mbstring.x86_64 0:5.5.38-10.el6.remi      php55-php-mcrypt.x86_64 0:5.5.38-10.el6.remi       
  php55-php-mysqlnd.x86_64 0:5.5.38-10.el6.remi      php55-php-pdo.x86_64 0:5.5.38-10.el6.remi           php55-php-pear.noarch 1:1.10.7-1.el6.remi         
  php55-php-process.x86_64 0:5.5.38-10.el6.remi      php55-php-soap.x86_64 0:5.5.38-10.el6.remi          php55-php-tidy.x86_64 0:5.5.38-10.el6.remi         
  php55-php-xml.x86_64 0:5.5.38-10.el6.remi          php56-php-pear.noarch 1:1.10.7-1.el6.remi           php70-php-pear.noarch 1:1.10.7-1.el6.remi         
  php71-php.x86_64 0:7.1.25-2.el6.remi               php71-php-bcmath.x86_64 0:7.1.25-2.el6.remi         php71-php-cli.x86_64 0:7.1.25-2.el6.remi           
  php71-php-common.x86_64 0:7.1.25-2.el6.remi        php71-php-enchant.x86_64 0:7.1.25-2.el6.remi        php71-php-fpm.x86_64 0:7.1.25-2.el6.remi           
  php71-php-gd.x86_64 0:7.1.25-2.el6.remi            php71-php-imap.x86_64 0:7.1.25-2.el6.remi           php71-php-json.x86_64 0:7.1.25-2.el6.remi         
  php71-php-ldap.x86_64 0:7.1.25-2.el6.remi          php71-php-mbstring.x86_64 0:7.1.25-2.el6.remi       php71-php-mcrypt.x86_64 0:7.1.25-2.el6.remi       
  php71-php-mysqlnd.x86_64 0:7.1.25-2.el6.remi       php71-php-pdo.x86_64 0:7.1.25-2.el6.remi            php71-php-pear.noarch 1:1.10.7-1.el6.remi         
  php71-php-process.x86_64 0:7.1.25-2.el6.remi       php71-php-soap.x86_64 0:7.1.25-2.el6.remi           php71-php-tidy.x86_64 0:7.1.25-2.el6.remi         
  php71-php-xml.x86_64 0:7.1.25-2.el6.remi           php72-php.x86_64 0:7.2.13-2.el6.remi                php72-php-bcmath.x86_64 0:7.2.13-2.el6.remi       
  php72-php-cli.x86_64 0:7.2.13-2.el6.remi           php72-php-common.x86_64 0:7.2.13-2.el6.remi         php72-php-enchant.x86_64 0:7.2.13-2.el6.remi       
  php72-php-gd.x86_64 0:7.2.13-2.el6.remi            php72-php-imap.x86_64 0:7.2.13-2.el6.remi           php72-php-json.x86_64 0:7.2.13-2.el6.remi         
  php72-php-ldap.x86_64 0:7.2.13-2.el6.remi          php72-php-mbstring.x86_64 0:7.2.13-2.el6.remi       php72-php-mysqlnd.x86_64 0:7.2.13-2.el6.remi       
  php72-php-pdo.x86_64 0:7.2.13-2.el6.remi           php72-php-process.x86_64 0:7.2.13-2.el6.remi        php72-php-soap.x86_64 0:7.2.13-2.el6.remi         
  php72-php-tidy.x86_64 0:7.2.13-2.el6.remi          php72-php-xml.x86_64 0:7.2.13-2.el6.remi           

Complete!

The objective is to update only the package or packages that are blocking safe updates using yumcheck.sh. If updating as above (with only the indicated repository enabled) includes too many packages, you might need to add package names to the update command. If the indicated packages include dependencies from other repositories you may need to enable those other repositories.

The epel repository, for example, contains many useful packages (fail2ban, nodejs, roundcube, imapsync, and many more) - but "yum --enablerepo=epel update" would break horde and php on a SME server. In that case you would add the affected package to the update command:

# yum --enablerepo=epel update roundcube

Related Information

Alternative Scripts

Original scripts

Forum

How to update completely and properly a SME?

Bugzilla

IDProductComponentSummary
10158SME Server FutureNew Feature RequestNFR Improve support for 3rd party repositories