Can not create new user in NC 11

With Nextcloud 11.0.0, when I try to create a new user after creating and logging into the admin account, i get a dialog that says that I must enter my password for this action. I try entering my password several times but it just asks again for the password and does not succeed. Starting over with Nextcloud 10.0.2, I don’t have this problem – the new user is created without a prompt for a password.

System information:

  • Debian 8.5
  • MariaDB 10.0.28 (also tried with mysql-server instead of mariadb-server and got same result)
  • PHP 5.6.28
  • Apache 2.4.10

My database and database user are both called nextcloud. My admin account is named ncadmin. I tried several guides for installing Nextcloud (e.g. https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-nextcloud-on-ubuntu-16-04 and Complete NC installation on Debian with Spreed.me and TURN step by step) but got the same result.

Looking at the error log after installing 11.0.0 and logging into the admin account I see:

Error	no app in context	InvalidArgumentException: The given object name is invalid

    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 892: OC\Activity\Event->setObject('files', 2, false)
    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 184: OCA\Activity\FilesHooks->addNotificationsForUser('ncadmin', 'created_self', Array, 2, false, true, true, 0, 'file_created')
    /var/www/nextcloud/apps/activity/lib/FilesHooks.php - line 111: OCA\Activity\FilesHooks->addNotificationsForFileAction('/', 'file_created', 'created_self', 'created_by')
    /var/www/nextcloud/apps/activity/lib/FilesHooksStatic.php - line 45: OCA\Activity\FilesHooks->fileCreate('/')
    [internal function] OCA\Activity\FilesHooksStatic fileCreate(Array)
    /var/www/nextcloud/lib/private/legacy/hook.php - line 106: call_user_func(Array, Array)
    /var/www/nextcloud/lib/private/Files/View.php - line 1237: OC_Hook emit('OC_Filesystem', 'post_create', Array)
    /var/www/nextcloud/lib/private/Files/View.php - line 1163: OC\Files\View->runHooks(Array, '/ncadmin/files', true)
    /var/www/nextcloud/lib/private/Files/View.php - line 266: OC\Files\View->basicOperation('mkdir', '/ncadmin/files', Array)
    /var/www/nextcloud/lib/private/Files/Node/Folder.php - line 149: OC\Files\View->mkdir('/ncadmin/files')
    /var/www/nextcloud/lib/private/Files/Node/Root.php - line 380: OC\Files\Node\Folder->newFolder('/ncadmin/files')
    [internal function] OC\Files\Node\Root->getUserFolder('ncadmin')
    /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php - line 65: call_user_func_array(Array, Array)
    /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php - line 282: OC\Files\Node\LazyRoot->__call('getUserFolder', Array)
    /var/www/nextcloud/lib/private/Server.php - line 948: OC\Files\Node\LazyRoot->getUserFolder('ncadmin')
    /var/www/nextcloud/lib/private/User/Session.php - line 411: OC\Server->getUserFolder('ncadmin')
    /var/www/nextcloud/lib/private/User/Session.php - line 479: OC\User\Session->prepareUserLogin(true)
    /var/www/nextcloud/lib/private/User/Session.php - line 299: OC\User\Session->loginWithPassword(*** sensitive parameters replaced ***)
    /var/www/nextcloud/lib/private/Setup.php - line 393: OC\User\Session->login(*** sensitive parameters replaced ***)
    /var/www/nextcloud/core/Controller/SetupController.php - line 65: OC\Setup->install(Array)
    /var/www/nextcloud/lib/base.php - line 957: OC\Core\Controller\SetupController->run(Array)
    /var/www/nextcloud/index.php - line 40: OC handleRequest()
    {main}

	2016-12-14T05:48:25-0500
Error	mysql.setup	Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params ["oc_ncadmin"]: SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'nextcloud'@'localhost' for table 'user'	2016-12-14T05:47:56-0500

The second message there is pretty confusing to me. Why is it looking in mysql.user for oc_ncadmin? The database account in mysql.user is named nextcloud. Also, the admin user account is named ncadmin, not oc_ncadmin. Querying the mysql database from the command line, I do see a ncadmin user in the users table (not oc_ncadmin).

After trying and failing to create a new user, the following message appears in the log file:

Warning	core	Login failed: 'ncadmin' (Remote IP: 'xxx.xxx.xxx.xxx')

However, i can logout and log in again as ncadmin without a problem.

Looking at the error logs after installing 10.0.2 and logging in as the admin user, I see:

Error 	mysql.setup 	Database creation failed: An exception occurred while executing 'GRANT ALL PRIVILEGES ON `nextcloud` . * TO 'nextcloud'': SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'nextcloud'@'localhost' to database 'nextcloud' 	2016-12-14T11:00:42+00:00 	--
Error 	mysql.setup 	Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params ["oc_ncadmin"]: SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'nextcloud'@'localhost' for table 'user' 	2016-12-14T11:00:42+00:00

So that mysql error shows up here as well. Creating a new user does not prompt for a password and does not generate any log messages. Any suggestions for what I could do to get account creation to work with Nextcloud 11?

there is a problem in installing nextcloud via CLI (Installing NC 11.0.0 from scratch problem) and or using NC11 under certain circumstances.

this looks like a core-issue to me and i believe there’s nothing you can do atm except using NC 10.x.

but as always, i could be wrong, remember that.

I don’t think the issue described in that link is my problem because I created the Nextcloud database on the command line myself each time before I tried to access the web interface. Specifically, I did

CREATE DATABASE nextcloud;
GRANT ALL ON nextcloud.* to 'nextcloud'@'localhost' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;

as suggested in the Digital Ocean tutorial I linked to.

The clock on my server was way off from the clock on the client I was connecting from. Setting them to the same time fixed the problem for me.

See also https://github.com/nextcloud/server/issues/2734

EDIT: Partial solution found!
I was able to create a new user via occ. while trying I was prompted, that my password was one of the most common passwords.

Password is within the 1,000,000 most common passwords. Please choose another one.

When I try to add a user with a weak password in the web interface I do not get any error message. Instead it does nothing. This might be a bug #2004 in NC11 or is a result of another error as i still get errors in the browser (see below).


BEGIN OF THE ORIGINAL TEXT

I still have troubles to create a new user.
I access my server from a different time zone. My server uses CET and my client PET. I checked the system time on both client and server. Furthermore I had a look at the browser output.

System information
Ubuntu 16.04 LTS Server
MySQL 5.7.16
PHP 7.0.8
Nginx 1.10.0
Nextcloud 11.0.0 upgraded from 10.2

Time
I checked if the clocks run synchronous (there might be a second gap, because i issued the commands one after another)

sudo hwclock --debug

The UTC time ist the same.

-> Server

hwclock von util-linux 2.27.1
Using the /dev interface to the clock.
Die Hardwareuhr läuft vermutlich in UTC.
Auf Uhrtick wird gewartet …
… Uhrtick wurde empfangen
Zeit gelesen aus Hardwareuhr: 2017/01/03 01:54:00
Zeit der Hardwareuhr: 2017/01/03 01:54:00 = 1483408440 Sekunden seit 1969
Time since last adjustment is 1483408440 seconds
Calculated Hardware Clock drift is 0.000000 seconds
Di 03 Jan 2017 02:53:59 CET  .140272 seconds

-> Client

hwclock von util-linux 2.27.1
Using the /dev interface to the clock.
Die Hardwareuhr läuft vermutlich in UTC.
Auf Uhrtick wird gewartet …
… Uhrtick wurde empfangen
Zeit gelesen aus Hardwareuhr: 2017/01/03 01:54:01
Zeit der Hardwareuhr: 2017/01/03 01:54:01 = 1483408441 Sekunden seit 1969
Time since last adjustment is 1483408441 seconds
Calculated Hardware Clock drift is 0.000000 seconds
Mo 02 Jan 2017 20:54:00 PET  .218000 seconds

Expected behavior
A user is created after the button “create” is clicked

Actual behavior
The button is clicked and than nothing happens. I do NOT get an extra password prompt. No new user is created.

Browser errors

When i enter the user page I get:
EDIT: This error is not present without Chrome extensions!

VM741:674 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' 'nonce-enUxVTl3UUEvdUNBVVRLQ3c0QzM0bndZK0JObmVhTUhIRHkyTmNocTlQZz06cks0SGt6TnhrWTNDRjF6QXJyUGNteTkrb2ljbE9OTm1SQTdFVWI1ZTI0dz0='". Either the 'unsafe-inline' keyword, a hash ('sha256-8UwpdwiuqXJty4DoSWEA9W+FMdXW5Ol0a3ZjF7czsyo='), or a nonce ('nonce-...') is required to enable inline execution.

when i click the button “create” I get:

users.js?v=0a1b55a…:953 Uncaught TypeError: Cannot read property 'message' of undefined
    at Object.<anonymous> (users.js?v=0a1b55a…:953)
    at j (jquery.min.js?v=0a1b55a…:2)
    at Object.fireWith [as rejectWith] (jquery.min.js?v=0a1b55a…:2)
    at x (jquery.min.js?v=0a1b55a…:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js?v=0a1b55a…:4)

Additional information
-> Enabled App list
Enabled:

  • activity: 2.4.1
  • admin_audit: 1.1.0
  • comments: 1.1.0
  • dav: 1.1.1
  • federatedfilesharing: 1.1.1
  • federation: 1.1.1
  • files: 1.6.1
  • files_external: 1.1.2
  • files_pdfviewer: 1.0.1
  • files_retention: 1.0.1
  • files_sharing: 1.1.1
  • files_texteditor: 2.2
  • files_trashbin: 1.1.0
  • files_versions: 1.4.0
  • files_videoplayer: 1.0.0
  • firstrunwizard: 2.0
  • gallery: 16.0.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.0
  • notifications: 1.0.1
  • password_policy: 1.1.0
  • provisioning_api: 1.1.0
  • serverinfo: 1.1.1
  • sharebymail: 1.0.1
  • survey_client: 0.1.5
  • systemtags: 1.1.3
  • templateeditor: 0.2
  • theming: 1.1.1
  • twofactor_backupcodes: 1.0.0
  • updatenotification: 1.1.1
  • workflowengine: 1.1.1
    Disabled:
  • calendar
  • encryption
  • external
  • files_accesscontrol
  • files_automatedtagging
  • richdocuments
  • user_external
  • user_ldap
  • user_saml

Add user via occ
Adding the user via occ works!

XXX@XXX-Server:/var/www/nextcloud$ sudo -u www-data php occ user:add download
Enter password: 
Confirm password: 
The user "download" was created successfully

Missing Information
Please tell me, what is needed. If possible tell me the commands. Still new to LAMP though.