Mailinabox: Nextcloud upgrade didn't complete successfully on upgrade to 0.23a from 0.22

Created on 31 May 2017  路  17Comments  路  Source: mail-in-a-box/mailinabox

After performing the upgrade, I received an error when hitting /cloud that said "Can鈥檛 write into config directory!". I also saw this error in the terminal, with a (broken) link that suggested how to fix the permissions for Owncloud. After reading through the setup scripts, and a bunch of troubleshooting, I ended up fixing this by doing the following (after backing up my owncloud directories):

sudo ln -s /home/user-data/owncloud/config.php /usr/local/lib/owncloud/config/config.php
sudo chown -R www-data:www-data /usr/local/lib/owncloud/config/
sudo chown -R www-data:www-data /usr/local/lib/owncloud/apps/

Hitting the /cloud page then said I needed to upgrade Nextcloud. Doing this from the browser failed, so I went and did it from the terminal. After a bunch of troubleshooting, the following worked to get things working again:

cd /usr/local/lib/owncloud/
sudo chmod 775 occ
sudo -u www-data php /usr/local/lib/owncloud/occ upgrade
sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable user_external
sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable contacts
sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable calendar
sudo -u www-data php /usr/local/lib/owncloud/occ upgrade
sudo shutdown -r 0

I'm not sure what actually went wrong with the upgrade script (it looked like it should be doing the above). Repeated running of the script/sudo mailinabox didn't work either, only after doing the above was I able to get Nextcloud working again.

All 17 comments

@deflume1 thank you for sharing this, I'm having the same problem.

There is a script that wel restore Nextcloud/ownCloud to it's previous state.

tools/owncloud-restore.sh 

As you said, the ownership is set during the setup. Did you see what the ownership was before you corrected it?

@yodax in my scrambling to try and get my server working again, I didn't write it down 馃槥 , and reconstructed this from my bash history. I am pretty sure it was either root:root or root:www-data though. I just tried running sudo mailinabox again (to see if I could get it to break my machine), but unluckily (luckily?) the script is smart enough to check the Nextcloud version before attempting an upgrade.

It looks like https://github.com/mail-in-a-box/mailinabox/blob/master/setup/owncloud.sh#L248 potentially isn't being hit, since everything in /usr/local/lib/owncloud is root:root except for apps and config, which I chown'd manually

Sorry for the spitballing, but I would have also expected it here: https://github.com/mail-in-a-box/mailinabox/blob/master/setup/owncloud.sh#L90 . I thought maybe the -f flag would cause the command to fail if the first path supplied was invalid (after seeing the "suppress errors" comment, but local testing using something like:

sudo chown -R -f chris:chris aaa awesome

where aaa is an invalid path, and awesome is a valid one, shows that ownership is correctly set on awesome despite aaa not existing.

Making me think that maybe InstallOwncloud() is never being called

InstallOwncloud() is called here if you upgrade from .22 to .23. Otherwise it wouldn't even try to install. But since that contains L90 with the chown, it should work.

I've tested upgrading a lot for this and never once came across this. It obviously is a problem, but I can't explain it. Where do you host your install?

I have a pretty typical setup (Ubuntu 14.04.5 LTS) with no customizations. The only caveat is that I run on an EC2 instance with external DNS, instead of, say, a DigitalOcean droplet, but otherwise there's nothing special here.

Some cloud providers have some esoteric cloud setups. I thought I would try to reproduce it on the host you use. But setting that up for EC2 and external dns is a bit involved.

It probably wasn't going to be the issue anyway.

I agree. I know that it's a little bit weird from a setup standpoint, but this sort of thing seemed likely to occur on other platforms. @kuking how is your install hosted? You had the same issue, right?

vanilla DigitalOcean, I did not install v23, because timing -- upgrade went directly from 22 into 23a. Maybe something in v23 worked that is not anymore in v23a.

When I discovered owncloud "no more", but nextcloud ... was like WOW! now I need to change all my clients (ios, android, osx, linux, win, etc.)... IF there are clients... IF they work ... Honestly it is scary for people who rely on this software. Still, please accept this as constructive as I appreciate lots the work you do in mailinabox.
/edit typo

@kuking I will say that once the permissions issue was fixed, and the upgrade actually completed, there's no functional difference for most clients between Nextcloud/Owncloud. I use DAVDroid for syncing on Android, and Thunderbird/Lightning for my calendar/contacts everywhere else, and I didn't need to update any settings after the upgrade.

That was my best hope, that nextcloud was a owncloud fork. Thanks @deflume1 !

I'm not sure how to proceed here. The code to set the permissions is there, it isn't conditional. I can't reproduce it. 馃槥

If someone comes across this again perhaps they can have a look at the current permissions.

Sounds good @yodax . Let's leave the issue open for now, maybe as people upgrade in the next couple of weeks someone will come across this, and be able to fill in the details I couldn't. My system is good for now, and hopefully if people get borked my initial post can get them unstuck.

Ok, I leave this here for anybody that might find it useful:

symptoms: calendar, files & contacts sync stop working. Visiting https://your-server/cloud failed with error message 'Can鈥檛 write into config directory!'

Solution: (allegedly): chown www-data.www-data -R /usr/local/lib/owncloud

that let me finish the installation (going to https://your-server/cloud), unfortunately when prompted for creating an 'admin' user, and I DID use my own user. I believe this triggered a 'cleanup' of everything owncloud of my account, therefore, my OSX client automatically prompted:

All the files in your local sync folder 'XXX' were deleted. These deletes will be synchronized with your server, making such files unavailable unless restored.
Are you sure you want to sync those actions with the server?
If this was an accident and you decide to keep your files, they will be re-synced from the server.

At this stage I killed the osx client, but luckily restoring last backup was enough: tools/owncloud-restore.sh xxxxx (backup before last upgrade.)

So far, everything seems to be working. but super scary and not sure if -really- everything is working.

/edit updates: So far, https://your-server/mail works, file and calendar sync works.

Just a little feedback: Just updated from v0.22 to 0.23a and everything went smooth as butter.
I am on a typical install with no modifications.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmars picture cmars  路  6Comments

hachre picture hachre  路  5Comments

hiqbn picture hiqbn  路  5Comments

frank-dspeed picture frank-dspeed  路  3Comments

timkofu picture timkofu  路  3Comments