Server: New added permissions got lost on every nextcloud restart

Created on 15 Oct 2020  路  5Comments  路  Source: nextcloud/server

Steps to reproduce
(still working on new installed system)
Create folder (or use existing)
Share with additional local user or group (email/link share is persistant) ->Check: new share is usable by added user/group
Restart nextcloud

Expected behaviour
Newly added share permissions should be persistant to nextcloud restarts

Actual behaviour
Only previous share permissions (before August 2020 - maybe until 18.0.x) are active/visible (changes are not persistant)

Server configuration
OS: Ubuntu 20.04 64Bit Linux 5.4.0-51-generic
Official Snap latest/stable: 19.0.4snap1 2020-10-14 (23743)
Was first recognized on 19.0.1, on Ubuntu 18.04, but maybe still older

0. Needs triage bug needs info

All 5 comments

Are you sure there isn't an issue with your database?
Can you export the share table before and after reboot?
Can you see your share in here?

Looks like the database entry got lost on restart. Right before restart I added a new share (so it's the last entry).

Last entries of oc_share (from dump before and after restart - , and are used for user- and foldernames):

  • Before restart:
    (3084,2,'<user1>','<admin1>','<admin1>',393,'folder','149580',NULL,149580,'<folder1>',1,1558082285,0,NULL,NULL,0,NULL,NULL,0,NULL,0,NULL), (3086,0,'<user2>','<admin1>','<admin1>',0,'folder','86905',NULL,86905,'<folder2>',15,1603208219,1,NULL,NULL,0,NULL,NULL,0,NULL,0,NULL);
  • After restart:
    (3084,2,'<user1>','<admin1>','<admin1>',393,'folder','149580',NULL,149580,'<folder1>',1,1558082285,0,NULL,NULL,0,NULL,NULL,0,NULL,0,NULL);

(parent of new share is now a group folder - but problem issn't related to this, I switched to group folders last week to reduce the number of active shares)

Is there any process checking/killing/cleaning database entries at restart and is there any log what could get a glue why it's getting deleted?

Could be a cron job just firing on boot

After some testing: all oc_share entries with parent=0 were deleted on restart.

The question seems to be why a newly added user to a share got this value: already existing users of the same share (added on the same way [as users - not using a group] some time earlier) have parent=NULL.
Changing parent value on newly added user from 0 to NULL (no parent share) before restarting nextcloud keeps this share entry existing after restart.

So why are new share entries get parent=0 instead of NULL or parent share id?

So why are new share entries get parent=0 instead of NULL or parent share id?

Ok, that was simple. Comparing table definition of oc_share with a second NC installation (on my Raspberry 4B) shows the difference. The default value for "parent" and "file_source" was different between them (both on same Ubuntu Snap and both without touching this database directly ever before). Setting default values of "parent" (and "file_source") from 0 to NULL solved my problem.

I wonder if this change is related to a restore operation of calendar and contact items using NextBackup a few month ago. It was the only database operation outside of regular NextCloud usage. So this issue may be a NextBackup-related issue.

Thank You @skjnldsv for Your help !

Was this page helpful?
0 / 5 - 0 ratings