Firstly, I had been using the OpenSuse OwnCloud repositories, but in any case the official Debian repositories no longer ship OwnCloud.
Testing the install
As per comments by goldilocks, I wanted to test OwnCloud's repo for Debian. At first, I wanted to manually unpack it alongside my previous package install.
$ wget https://download.owncloud.org/download/repositories/stable/Debian_8.0/all/owncloud-files_9.0.2-1.1_all.deb
$ dpkg-deb -R owncloud-files_9.0.2-1.1_all.deb owncloud-files_9.0.2-1.1_all
$ sudo cp -r owncloud-files_9.0.2-1.1_all/var/www/owncloud /var/www/owncloud-9
I was buoyed by the fact that the url had any
in it, instead of amd64
or i386
(which elements of my original OpenSuse repositories had). However, after installing and navigating to the new webpage, I got the error:
Can't write into config directory!
This can usually be fixed by giving the webserver write access to the config directory.
This was probably because I installed manually rather than using apt-get
. I gave write permission to the files that had it in my previous install.
sudo chown -R www-data: owncloud-9/{apps,assets,config,data}
This now worked fine!
Installing via the package manager
I now attempted to upgrade using the package manager. I was upgrading from 8.1.8 to 9.0.2. OwnCloud suggests that
it is best to update your ownCloud installation with every new point release, and to never skip any major releases.
so I was happy enough to directly upgrade. I backed up /var/www/owncloud
and my data directories, then ran the following.
$ wget -nv https://download.owncloud.org/download/repositories/stable/Debian_8.0/Release.key -O Release.key
$ sudo apt-key add - < Release.key
I edited /etc/apt/sources.list.d/owncloud.list
, removing the OpenSuse repository and adding
deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /
I crossed my fingers and ran
$ sudo apt-get update
$ sudo apt-get dist-upgrade
This had the following warnings
dpkg: warning: while removing owncloud-server, directory '/var/www/owncloud/config' not empty so not removed
dpkg: warning: while removing owncloud-server, directory '/var/www/owncloud/apps' not empty so not removed
Configuration file '/etc/apache2/conf-available/owncloud.conf.distrib'
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versio
I selected yes. I then attempted to complete my upgrade.
$ sudo -u www-data php occ upgrade
ownCloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Reset log level
Ugh. I understood "major release" to mean 8.x.x
to 9.x.x
. However it appears the devs use "major release" as equivalent to "point release"… which is confusing because they use two different phrases for the one thing.
Fixing the upgrade
I manually downloaded OwnCloud 8.2.5, and extracted it alongside the package installation.
$ wget https://download.owncloud.org/community/owncloud-8.2.5.tar.bz2
$ tar -xjf owncloud-8.2.5.tar.bz2
$ sudo mv owncloud /var/www/owncloud-8.2.5
$ sudo chown -R www-data: owncloud-8.2.5
$ sudo cp /var/www/owncloud{,-8.2.5}/config/config.php
$ cd /var/www/owncloud-8.2.5
$ sudo -u www-data php /var/www/owncloud-8.2.5/occ upgrade
PHP Warning: flock() expects parameter 1 to be resource, boolean given in /var/www/owncloud-8.2.5/lib/private/config.php on line 198
An unhandled exception has been thrown:
exception 'Exception' with message 'Could not acquire a shared lock on the config file /var/www/owncloud-8.2.5/config/config.php' in /var/www/owncloud-8.2.5/lib/private/config.php:199
Stack trace:
#0 /var/www/owncloud-8.2.5/lib/private/config.php(59): OC\Config->readData()
#1 /var/www/owncloud-8.2.5/lib/base.php(133): OC\Config->__construct('/var/www/ownclo...')
#2 /var/www/owncloud-8.2.5/lib/base.php(495): OC::initPaths()
#3 /var/www/owncloud-8.2.5/lib/base.php(1083): OC::init()
#4 /var/www/owncloud-8.2.5/console.php(42): require_once('/var/www/ownclo...')
#5 /var/www/owncloud-8.2.5/occ(11): require_once('/var/www/ownclo...')
#6 {main}
The "shared lock" part made me think that this was related to having multiple versions installed, so I removed the other versions temporarily. However, I had just forgotten to chown on the config file.
$ sudo chown -R www-data: /var/www/owncloud-8.2.5/config/config.php
I ran occ upgrade
successfully, then moved the original OwnCloud install back, making sure to copy config/config.php
from the intermediate to newest install. I completed the upgrade again.
$ sudo -u www-data php /var/www/owncloud/occ upgrade
$ sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off
This worked fine, and I now have a working, up-to-date OwnCloud!