El sistema nos avisa al acceder como administrador que la versión 8.1.3 está disponible.

Empleamos la aplicación de ‘Actualizaciones’ que viene en la sección ‘Administración’ al acceder como administrador.

El primer error que nos encontramos es que el sistema no tiene permisos de escritura en los archivos de owncloud. Es curioso porque los permisos están configurados de acuerdo a las instrucciones de seguridad dadas por el equipo de owncloud (https://doc.owncloud.org/server/8.0/admin_manual/installation/installation_wizard.html):

— inicio de la cita —

Setting Strong Directory Permissions

For hardened security we recommend setting the permissions on your ownCloud directories as strictly as possible, and for proper server operations. This should be done immediately after the initial installation. Your HTTP user must own the config/, data/ and apps/ directories so that you can configure ownCloud, create, modify and delete your data files, and install apps via the ownCloud Web interface.

You can find your HTTP user in your HTTP server configuration files. Or you can use phpinfo. To do this, create a plain text file with the following line in it:

 <?php phpinfo(); ?>

Name it phpinfo.php and place it in your Web root, and then open it in a Web browser, for example http://localhost/phpinfo.php. Look for the User/Group line.

  • The HTTP user and group in Debian/Ubuntu is www-data.
  • The HTTP user and group in Fedora/CentOS is apache.
  • The HTTP user and group in Arch Linux is http.
  • The HTTP user in openSUSE is wwwrun, and the HTTP group is www.

Note

When using an NFS mount for the data directory, do not change its ownership from the default. The simple act of mounting the drive will set proper permissions for ownCloud to write to the directory. Changing ownership as above could result in some issues if the NFS mount is lost.

The easy way to set the correct permissions is to copy and run this script. Replace the ocpath variable with the path to your ownCloud directory, and replace the htuser and htgroup variables with your HTTP user and group:

#!/bin/bash
ocpath='/var/www/owncloud'
htuser='www-data'
htgroup='www-data'

find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750

chown -R root:${htuser} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/

chown root:${htuser} ${ocpath}/.htaccess
chown root:${htuser} ${ocpath}/data/.htaccess

chmod 0644 ${ocpath}/.htaccess
chmod 0644 ${ocpath}/data/.htaccess

If you have customized your ownCloud installation and your filepaths are different than the standard installation, then modify this script accordingly.

This lists the recommended modes and ownership for your ownCloud directories and files:

  • All files should be read-write for the file owner, read-only for the group owner, and zero for the world
  • All directories should be executable (because directories always need the executable bit set), read-write for the directory owner, and read-only for the group owner
  • The apps/ directory should be owned by [HTTP user]:[HTTP group]
  • The config/ directory should be owned by [HTTP user]:[HTTP group]
  • The themes/ directory should be owned by [HTTP user]:[HTTP group]
  • The data/ directory should be owned by [HTTP user]:[HTTP group]
  • The [ocpath]/.htaccess file should be owned by root:[HTTP group]
  • The data/.htaccess file should be owned by root:[HTTP group]
  • Both .htaccess files are read-write file owner, read-only group and world

— fin de la cita —

Para solucionar el problema hacemos un cambio de permisos en el directorio owncloud, pasándolos todos a 770:

chown -R 770 /var/www/owncloud

Una vez finalizada la copia de seguridad y descomprimida la nueva versión, el sistema solicita la actualización, que se puede ejecutar clicando en la ventana que aparece en la web (nada recomendable porque no nos aparecen los errores y casi nunca finaliza correctamente) o mediante el comando siguiente ejecutado como el usuario www-data (en Debian):

php /var/www/owncloud/occ upgrade

Sin embargo, al ejecutarlo el sistema arrojó el siguiente error:

An unhandled exception has been thrown:
OC\HintException: [0]: Missing memcache class \OC\Memcache\APCu for local cache (Is the matching PHP module installed and enabled ?)

Para evitarlo hay que añadir la siguiente línea al archivo /etc/php5/apache2/conf.d/20-apc.ini (en Debian) (https://github.com/owncloud/core/issues/17329):

apc.enable_cli=1

Reiniciamos el servidor apache:

service apache2 restart

Entonces volvemos a tratar de ejecurar el upgrade y el sistema actualiza sin problemas.

Si el sistema avisa de que el modo de mantenimiento permanece activo, para desactivarlo y que owncloud sea funcional de nuevo habría que ejecutar el siguiente comando como usuario www-data:

php /var/www/owncloud/occ maintenance:mode --off

 

Por último, habría que dejar los permisos como al principio, para lo que corremos el script que se indica arriba.