Nextcloud: error while trying to create admin user

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
Hello,

I get the following error after installing the Nextcloud plugin:

Error while trying to create admin user:
Failed to connect the database: An
exception occured in driver:
SQLSTATE[HY000][1045] Access denied
for user 'ncuser'@'localhost' (using
password: YES)​

I installed Owncloud as well, that worked just fine and I was able to create an admin user and sign in. To try and remedy Nextcloud I tried:
  • Creating a user called "ncuser" who has chmod 777, and password "YES", assigned to all groups
    • ncuser does not show up within the nextcloud_1 shell's /etc/passwd.
  • Uninstalling and reinstalling Nextcloud (Youtube video doesn't seem to have this problem, thought it was just me)
  • Create a storage within the nextcloud_1 jail:
    • Source: /mnt/Storage/Nextcloud chmod 777
    • Destination: /Datastorage
    • Trying nextcloud with storage mounted and unmounted
  • tail /var/log/messages does not show errors, there are only results:
    • logfile first created
    • kernel boot file is /boot/kernel/kernel
Not sure if hardware matters, but my stats:
  • Freenas: 9.10.2-U1
  • Boot: 32gb USB drive
  • CPU: i3-4330
  • Motherboard: Supermicro X10SL7-F
  • RAM: Crucial 2x8GB DDR3-1866 ECC UDIMM
  • Storage: ZFS Pool (3x2TB hard drives), does not include 1TB (with nas4free 11.0.0.4 OS) and a new 2TB NAS hard drive (brand new)
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
the user it is referring to is a mysql user, not a user you would normally create on FreeNAS. can you try it again in a fresh jail to see if you hit the same issue
 

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
the user it is referring to is a mysql user, not a user you would normally create on FreeNAS. can you try it again in a fresh jail to see if you hit the same issue

Yeah, I deleted the jail and plugin and tried again. I actually deleted the entire ZFS storage (was messing around). But same issue with the same error.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
very strange.
If you want to debug further you could try the following...
- install the plugin
- make sure mysql is running with the command in the jail 'service mysql-server status'
- double check the database exists with '/usr/pbi/nextcloud-amd64/bin/mysql -e "SHOW DATABASES"'
 

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
Yep, everything checks out so far:
  • mysql is running as pid 44749
  • database seems to exist. In order:
    • information_schema
    • mysql
    • nextcloud
    • performance_schema
    • test
Actually this raises some questions, because iirc I'm the one who created the test database...using nextcloud's "configure the database" page that comes up after trying to create an admin password and name.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yep, everything checks out so far:
  • mysql is running as pid 44749
  • database seems to exist. In order:
    • information_schema
    • mysql
    • nextcloud
    • performance_schema
    • test
Actually this raises some questions, because iirc I'm the one who created the test database...using nextcloud's "configure the database" page that comes up after trying to create an admin password and name.
Weird, you shouldn't need to configure anything.
Nextcloud should be configured to use the nextcloud database and you shouldn't even be given the option to change it.
 

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
So I deleted my ZFS and reinstalled freenas, same error. After putting in your dx commands I found out that:
  • mysql-server does not exist in /etc/rc.d or the local startup directories
  • /usr/pbi/nextcloud-amd64/bin/mysql: No such file or directory
I suppose there is your problem then. This time I didn't configure anything after trying to create an admin user/pass.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
So I deleted my ZFS and reinstalled freenas, same error. After putting in your dx commands I found out that:
  • mysql-server does not exist in /etc/rc.d or the local startup directories
  • /usr/pbi/nextcloud-amd64/bin/mysql: No such file or directory
I suppose there is your problem then. This time I didn't configure anything after trying to create an admin user/pass.
That is very strange, I've never seen someone not have this PBI install correctly. Maybe your system, or some HTTP proxy, cached a corrupt version of the PBI.
You ran the mysql commands in the nextcloud jail?
 

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
So, this is embarrassing. I ran it from the server shell, not the jail shell. Running it from the jail shell gets me almost the same results as before:
  • mysql is running as pid 42372
  • databases:
  • information_schema
  • mysql
  • performance_schema
  • test
I don't have my server running through a proxy or anything, just direct access to gateway. I'm wondering if it is a corrupt cache, why my server keeps downloading it over again. Really hoping it's not a hardware issue ha. Anything I can do to get nextcloud working?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
Unfortunately there's a new error:

upload_2017-2-4_14-35-17.png
 

donsev

Explorer
Joined
Jan 15, 2017
Messages
79
So, new update: I restarted the jail and apparently somehow, someway, the admin user was created and it logged me in. I'm officially inside nextcloud. If you can tell me where the log file is, I'd love to upload it somewhere!
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
So, new update: I restarted the jail and apparently somehow, someway, the admin user was created and it logged me in. I'm officially inside nextcloud. If you can tell me where the log file is, I'd love to upload it somewhere!
It's in /media
Wow, there is definitely something wrong with your jail.
 

ericfoss

Cadet
Joined
Mar 21, 2018
Messages
9
New FreeNAS user here, same issue (Error trying to create admin user, failed to connect to database). My box is fairly fresh, so I don't have a lot of changes.

Steps (I remember):
Running 11
Install plug-in
Added storage (mounted to media if it matters)
(I think I) restarted jail
start plug-in

Then went to https://my-jail-ip, filled out form and tried to "Finish Setup". This is when I got the error and mysql was running, but no db.

Deleting and reinstalled without any storage and now it works...
 

ericfoss

Cadet
Joined
Mar 21, 2018
Messages
9
Oops, duplicate.
 

nadovich

Cadet
Joined
Mar 2, 2018
Messages
6
I was able to get it to work by logging into the jail via the shell, recovering the MySQL root password, setting a user password, and going back to the setup. Even then, it didn't work till I restarted. Obviously, this plugin needs maintenance.
 

nadovich

Cadet
Joined
Mar 2, 2018
Messages
6
And the installation setup integrity scan says:

  • PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.
  • MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read the documentation page about this.
Although the version of NextCloud (16) that was installed seems to be up to date. So, again, I'm thinking this plugin is poorly maintained. Maybe it's best to do a from-scratch installation without the plugin so as to know you have a properly configured system.
 

rmblr

Dabbler
Joined
Jul 16, 2019
Messages
13
And the installation setup integrity scan says:

  • PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.
  • MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read the documentation page about this.
Although the version of NextCloud (16) that was installed seems to be up to date. So, again, I'm thinking this plugin is poorly maintained. Maybe it's best to do a from-scratch installation without the plugin so as to know you have a properly configured system.

While I had no issues in setting up the database, however the install does report the same issues about php envvars and mysql's lack of 4byte char support. The latter is particularly worrisome.

It does seem the plugin is poorly maintained.

Best use one of the existing from-scratch guides such as: https://www.ixsystems.com/community...llation-of-nextcloud-16-in-iocage-jail.62485/
 

nadovich

Cadet
Joined
Mar 2, 2018
Messages
6
Thanks, @rmblr , I'll look into that. Pity the plugin isn't maintained. Whoever's in charge should delete the plugin, or fix it.
 
Top