Nextcloud deletes and adding some files in a endless loop

I am new in Nextcloud, have low knowledge about Linux/Ubuntu, but I have installed nextcloud server on Ubuntu and got it working in one year without any problems.

Now the Nextcloud has a problem and it constantly removing files from a folder and then it adding it again in a endless loop.

The problem appears when I used the Android App after I adding some files in that folder, and I saw on my computer that it removed it, adding it, removed it adding it over and over again forever.

I have restarted the Server, and all clients and the problem is still there and I really dont know where to start to troubleshooting.

Some hidden files called “.IMG_20210414_231319.jpg.~7396” is adding and removing all the time. It seems that it is some cocflicts that I have no control over to fix. If I delete all files (when it appers), it just appers again later. If I delete the entire folder, the folder appers. I dont know how to search on google to found out what happend so I created a account here, and now I am here.

Anyone who know the symtom? or how to troubleshoot?

I used Windows Nextcloud Version 3.1.3
Android Nextcloud Client 3.1.5.1
Ubuntu Nextcloud Server 20.0.8.1

Okej, all new files I added to nextlcoud on PC and Android just deletes, added again, deleted, added all the time… Something is really out of sync.

The only thing I can see is that some files get an error “Connection closed” between 10 minutes and the do not got deleted, only an icon with a cross over, not the green checked icon.

Hello Alex, how are you doing?

Okay, so let me understand one thing:

You said that the problem started after you try to use your application trough the Android Client. Is that right?

If you access your nextcloud via web on a computer or even with your phone, the error persists?

That’s occurring to all users or just to a specific one?

Have a nice day man!

:smiley:

Hmm, I dont think the Android App was the problem. All my accounts in Nextcloud, on Windows Client and Android app has this serious problem. When I create any file in any client and any folder in any account it removes the file/folder and then if appears again back over and over again.

If I login to the web client I can see the files exist there, and it removes and appears even there too. It is like the Nextcloud server is in a syncing problem loop.

Okay, have you tried this?
sudo -u www-data php /var/www/nextcloud/occ files:scan --all

And also:
sudo -u www-data php /var/www/nextcloud/occ files:scan-app-data

Try that and tell me the results.

Good luck mate!

Okey, I will try the sudo commands, I just want you to see this GIF how it looks.

It looks like this in repeate when I add a test folder and copy in a file.

1 Like

Hmm, thank’s for sharing it.

Did you ran those commands?

I tried run the commands but failed.
I first had to install PHP with “sudo apt install php”
Next is that my nextcloud server is located in “/snap/nextcloud” and I just tried to scan that folder but I got no result at all.
Just remember that I have used Linux few times so I am a beginner.

1 Like

Okay mate, welcome to the penguin club then :slight_smile:

So you are running a snap installation of nextcloud, you need to ran occ with this command instead:
sudo nextcloud.occ files:scan --all

And also:
sudo nextcloud.occ files:scan-app-data

Try that and tell me if works.

This is the result:

files scan 2

The account Alexander Music is the only account that is not used.
Any ideas?

Something is really really musterious.

I have closed all clients and only login to the web client. Listen now…

When i login, after 5 minutes I automatically logouts, I logging in again and my latest added files is removed. After like 5 minutes again, I logged out automatically again… I logging in again and my latest files is back again! Over and over again.

It feels like the nextcloud service is crashing and restart it in a previous state or something like that.

I can se somethmes in the web client a message popsup when i try to load a page “Problem loading page, reloading in 1 second”, so something is happening under the hood.

Perfect mate! So no bugs about that, did you tested your application after that?

If you already tested it, please ran these commands:

1) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
2) chown -R www-data:www-data /var/www/nextcloud/
3) chmod -R 770 /var/www/nextcloud/
4) sudo -u www-data php /var/www/nextcloud/occ maintenance:repair
5) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-columns
6) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
7) sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
8) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
9) sudo systemctl restart apache2

Also, check your php version running “php -v”, that can help a lot.

Make sure you have php-fpm installed and running.

Hope this helps, have a nice weekend.

All the best!

:smiley:

Hehe, well.

Because I have a Snap installation of Nextcloud I had to do more like this? Anyway, I tried this:
sudo nextcloud.occ maintenance:mode --on
sudo nextcloud.occ maintenance:repair
sudo nextcloud.occ db:add-missing-columns
sudo nextcloud.occ db:add-missing-indices
sudo nextcloud.occ maintenance:update:htaccess
Error updating .htaccess file, not enough permissions or “overwrite.cli.url” set to an invalid URL?
sudo nextcloud.occ maintenance:mode --off

I got an error I didnt know how to pass, but I
restarted the Ubuntu (Didnt know how to restart nextcloud itself).

When I logged in to the web browser, I got this:
It works!
This is the default welcome page used to test the correct operation of the Apache2 server…

:woman_shrugging:

1 Like

Okey, It seems it is an separate apache server that is running, maybe when I installed the PHP before?
I stopped the apache with the command: “sudo service apache2 stop”
And the nextcloud web interface works again. Now I am testing it and see if the problems still is there.

1 Like

Sigh… the problem is still there, same behaviour.
I didnt got sudo nextcloud.occ maintenance:update:htaccess to work.
I tried a command sudo nextcloud.occ config:system:set htaccess.RewriteBase --value="/" just before but that didnt helped.

I really appreciate your time to help me :slight_smile:

1 Like

That’s some great news mate!! Congratulations.

Sorry, I didn’t see that you was running a snap installation.

Good work brotha, keep going!

Have a nice weekend.

:smiley:

See Remove index.php from urls · Issue #412 · nextcloud-snap/nextcloud-snap · GitHub

Oh my good… I think I know what happend, really my mistake…
I hade two virtual machines with nextcloud on at the same time, with the same IP adresses.

The nextcloud virtual machine was on a windows 10 based computer until I got an poweredge-server. I copied the nextcloud-vm and continue running it on the new server. After an Windows 10 Update on the first computer it started the original nextcloud VM and both nextcloud VM was running with the same IP :laughing:

Now it really works well again after removing the autostart of the VM from the computer and shutting it down. That explain the mysterious behaviour. :slight_smile:

1 Like

Hello @alex4

Good that you found the problem.

It happens, nice work!

Have a nice week :smiley: