Half server deleted after ubuntu upgrade

Hi !

Yesterday i upgraded my owncloud server from 9.0 to 9.1 on Ubuntu inside hyper-v virtual machine. Everything went right. But then i tried to upgrade my Ubuntu itself from 14.04.1 to 16.04.1 LTS (pretty huge gap...) via apt-get update/upgrade and more than half of my owncloud server directory wiped from /var/www/owncloud.

Here is my owncloud folder on ubuntu 14 :

user@owncloud-hv:/var/www/owncloud$ ls -l
total 192
drwxr-xr-x 29 www-data www-data  4096 août   1 17:59 3rdparty
drwxr-xr-x 34 www-data www-data  4096 août   1 18:29 apps
drwxr-xr-x  2 www-data www-data  4096 mars   8 15:09 assets
-rw-r--r--  1 root     root      8301 juil. 20 11:15 AUTHORS
drwxrwxr-x  2 www-data www-data  4096 août   1 18:28 config
-rw-r--r--  1 root     root      3805 juil. 20 11:15 console.php
-rw-r--r--  1 root     root     34520 juil. 20 11:15 COPYING-AGPL
drwxr-xr-x 17 www-data www-data  4096 août   1 17:59 core
-rw-r--r--  1 root     root      5032 juil. 20 11:15 cron.php
drwxr-xr-x  2 www-data www-data  4096 août   2 15:40 data
-rw-r--r--  1 root     root     35830 juil. 20 11:15 db_structure.xml
drwxr-xr-x  2 www-data www-data  4096 mars   8 15:09 etc
-rw-r--r--  1 root     root       179 juil. 20 11:15 index.html
-rw-r--r--  1 root     root      2282 juil. 20 11:15 index.php
drwxr-xr-x  3 www-data www-data  4096 août   1 17:59 l10n
drwxr-xr-x  6 www-data www-data  4096 août   1 17:59 lib
-rwxr-xr-x  1 root     root       283 juil. 20 11:15 occ
drwxr-xr-x  2 www-data www-data  4096 août   1 17:59 ocs
drwxr-xr-x  2 www-data www-data  4096 août   1 17:59 ocs-provider
-rw-r--r--  1 root     root      3086 juil. 20 11:15 public.php
-rw-r--r--  1 root     root      5428 juil. 20 11:15 remote.php
drwxr-xr-x  4 www-data www-data  4096 mars  14 18:15 resources
-rw-r--r--  1 root     root        26 juil. 20 11:15 robots.txt
drwxr-xr-x 12 www-data www-data  4096 août   1 17:59 settings
-rw-r--r--  1 root     root      1893 juil. 20 11:15 status.php
drwxr-xr-x  4 www-data www-data  4096 août   1 17:59 themes
drwxr-xr-x  7 www-data www-data  4096 août   1 17:59 updater
-rw-r--r--  1 root     root       234 juil. 20 11:15 version.php

After ubuntu update, only apps folder, core and two others were there (didn't note which one...)

Fortunately i did a snapshot of my VM before and was able to rollback... but, wtf happened ? :open_mouth:

Do you guys have any idea on what could have happened ? Thanks for any help...

Can you post a log of the package upgrade? Without that its very unlikely that anyone can just guess what happened here.

Thanks for quick answer ! I'll try to do it again and keep that log file before rollbacking.

Btw, does permissions on file in my /var/www/owncloud directory sounds good ? I'm a bit confused by root and www-data permission mix...

Ah, forgot to mention. Might be possible that this was caused by the upgrade from PHP 5 to 7.

Could be possible that a simple:

apt-get install owncloud owncloud-deps-php7.0

is doing the trick (when using the correct 16.04 repos from owncloud.org).

nice shot mate !

user@owncloud-hv:~$ php -v
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)

I'll try tonight, thanks !

So, i did the PHP7 upgrade before trying apt upgrade of the system.

Everything was OK until at the end of the upgrade,files and folders were removed by apt...

I caught apt log (http://www.filedropper.com/logapt).

dist upgrade / apt-term.log line 4159
Removing owncloud (9.1.0-1.1) ...

and line 12143, i found the 4 directories mentioned above :

dpkg: warning: while removing owncloud-files, directory '/var/www/owncloud/apps' not empty so not removed
dpkg: warning: while removing owncloud-files, directory '/var/www/owncloud/config' not empty so not removed
dpkg: warning: while removing owncloud-files, directory '/var/www/owncloud/themes' not empty so not removed
dpkg: warning: while removing owncloud-files, directory '/var/www/owncloud/data' not empty so not removed

So apt remove php5 and delete owncloud files while doing cleaning at the end of upgrade...

Have a look at the following discussion for some hints: