Hi.
I have a Nextcloud (11.0.3 stable) on a Raspi3 with lighttpd, after having a bunch of locked files that i deleted i ran “sudo -u www-data php occ files:scan --all”, but accidentally the server got rebooted while the scan ran and now it can’t complete and produces these errors. What do i do?
(I had to remove hashtags otherwise the formatting were affected)
As the first line of the error states there is a file still in lock state. If you manually removed the file it will still keep the lock state in its database.
Depending on what kind of lock mechanism you use, you will need to clear it, and then do a rescan.
If you are using Redis you can run the following command (as root):
@X4LD1M0 Thank you for your quick reply.
The file “files/dc9e587002a9d3d7bfd9cf3865984567” does not exist in the nextcloud data/user/flies folder.
I haven’t got much knowledge of different commands, i only installed nextcloud as it came out of the box. The only thing i changed was to put the data on an USB disk and changed the web server to lighttpd from apache, that seemed to lose connection and timed out all the time.
I was trying to rescan the files to the database with the occ command.
@X4LD1M0
I’m very sorry that i didn’t reply earlier.
The server seems to have fixed the error during some of it’s internal cleaning or scan.
Thank you for your help.
@X4LD1M0
And i was completely wrong. A couple of other errors related to the locked file got fixed (it could not get uploaded because it was to big. - 23Gb).
When i login to the mysql and try “use nextloud” it tells ne it’s not there:
copy pasted it
plus the status from mysql
And under it my config.php from the server. (xxx the stuff i’m not sure if should be posted)
I really appreciate your help, DB and webserver are very new to me.
Thanks you
mysql Ver 15.1 Distrib 10.0.30-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
Connection id: 38
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 10.0.30-MariaDB-0+deb8u1 (Raspbian)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 2 days 3 hours 8 min 22 sec
Threads: 1 Questions: 123 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 78 Queries per second avg: 0.000
From your NC config it shows that it is using sqlite, not mysql. So the commands I provided will be useless. I am not so experienced with sqlite, so will need to do a bit of digging into how to access the database.
sqlite has a very bad performance so it should only be used when there is not way to use a real database (some hosting environments). So I would recommend to switch to mysql first. File locking is then much faster with redis as locking cache.
On a raspberry, you don’t have too many resources but it should be enough to use mysql and redis. You might review the cache settings after some time that they are large enough for your database (but not too large).
The mysql process might be running but it doesn’t mean it is actively used. In your config.php you wrote:[quote=“moteprime, post:6, topic:11861”]
‘dbtype’ => ‘sqlite3’,
[/quote]
Which says to NC to use sqlite. Also there are no details for username/password which would be required for MySQL.
The username/password to use can be defined by yourself, by adding the details to mysql. This goes more into the mysql management. I will give some examples.
First you need to login to mysql (on command line) to run the following commands. Normally this is done as root user, and depending if you have set a password, you will also need to provide it to be able to login. (Recommendation is to always have root set with a password for mysql for security purposes).
Then you can run the following commands:
CREATE DATABASE 'nextcloud' CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON nextcloud.* 'nextcloud_user'@'localhost' IDENTIFIED BY 'nextcloud_pass'; FLUSH PRIVILEGES;
What this does is the following:
Create the (clear new) database
Set the user privileges on the new database
Create the new user with password
Once this is done you can run the conversion command:
php occ db:convert-type --all-apps mysql nextcloud_user 127.0.0.1 nextcloud
It will ask for the password, which is the one defined in the GRANT command as ‘nextcloud_pass’.
If course you can change the user and password to what every you want, as long you make sure you define them also in the conversion command.
@X4LD1M0 Thank you, that’s exactly what i needed, especially the nextcloud user.
Is that user defined in the nextcloud serverscripts?
Are the character specification necessary?
@X4LD1M0
I’m sorry to ask again, but the thing a cannot figure out are what i put in i the “”
‘nextcloud’ Isn’t it just nextcloud. I haven’t changed anything from standard installation.
And the ‘nextcloud_user’@‘localhost’, Is it the web user, the linux user or the nextcloud user, and ‘localhost’ are the 127.0.0.1 ip number or can i just leave locahost?
It is my first time working with a database myself.
CREATE DATABASE <database name> CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON <database name>.* '<db username>'@'localhost' IDENTIFIED BY '<db password>';
<database name> is the new database which you assign to store all the NextCloud data.
<db username> is the unique username which the NC application will use to identify itself to mysql (which will give it access to the <database name> only
<db password> is the password associated with the <db username>
So the username and password are separate details only for mysql login. Using this process you can have unique usernames which give only access to specific databases, so you can have multiple applications talking to the same mysql process, but each can only access its own information due to the login process.
You can leave localhost, since this is by default set in the /etc/hosts file to 127.0.0.1. If you want you can replace it with 127.0.0.1 just to bypass the DNS process.
@X4LD1M0 Thank you so much.
I’m sorry i do not reply faster, but i’m working on this on the side. I’m am very grateful for your help, and will get back with results and more appreciation as soon as I can.