Deleted files automatically re-appear - deleting impossible

Hi all,

I am running Nextcloud 13.0.1 on a Raspberry Pi with the latest Raspian version. I am synchronizing my files with three Windows computers (2x Win7 1x WIn10) Using the latest Nextcloud client, plus two android devices using Foldersync, also latest version.

My problem now is, that whenever I delete a file, it automatically re-apperas on the device. Sometimes after seconds, sometimes after hours - but it re-appears.

I have tried to delete it on the physical hard drive (not just the device mirror), on multiple instances (unfortunately I never have all computers at one physical location so I can’t delete it on all devices the same time) I have tried to delete the trash folder, nothing helps. latest after some days, the dleted file(s) are back again.

Does someone have any idea on what can be wrong with my setup?

Thanks a lot

Markus

Does it happen if you delete it in the synced folder and over the web interface as well?

It’s all the same user, not a shared folder (for shared folders please check the permissions).

Anything in the logs? The drive has which file system? It is not read only (it can fall back to read-only after problems)?

Hello tfidd,

thanks four your feedback. The “return of the files” happens everywhere. It happens on the shared drice on the PC as well as on the web interfache as well as after deleting it straight from the hard drive. It is all the same user, nothing shared, only myself. I actually havent tested with another user, maybe its a try to test it.

THe permissions should be OK, as I can delete the files and as they are gone at first. I havent seen any log files to the erase. Were can I find them? When I check the activity of my account, I see “file” deleted and shortly afterwards “file” created…

I am using ad harddrive raspberry pi and as hard drive a NAS which is implementes as external storage SMB/CIFS. Write access works without issues. I have nowhere set any access permissions.

Really strange.

Thanks for your help

Markus

it could take a while but you could try to rescan your filesystem and clean your cache with:

  • sudo -u www-data php occ files:scan --all

  • files:cleanup

and post your php-fpm config for your nextcloud service.

PS: replace www-data with your applicable user
https://docs.nextcloud.com/server/13/admin_manual/configuration_server/occ_command.html#file-operations-label

Hi Michael,

I have run the scan as you described. No anomalies were found:

$ sudo -u www-data php occ files:scan --all

Scanning files for 4 users
Starting scan for user 1 out of 4 (user1)
Starting scan for user 2 out of 4 (user2)
Starting scan for user 3 out of 4 (user3)
Starting scan for user 4 out of 4 (user4)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 63      | 2227  | 00:01:54     |
+---------+-------+--------------+
$ sudo -u www-data php occ files:cleanup
0 orphaned file cache entries deleted

then I was looking for the php-fpm config file. Unfortunately I wasn’t able to find it. Can you give me a hint were I can find it? I am using

Linux raspberrypi 4.9.80-v7+

Nextcloud 13.0.1

php#
Version: 7.0.27

Art: mysql
Version: 10.1.23

Thanks

Markus

try to look into this path /etc/php/7.0/fpm/pool.d/

this may vary with your setup and your php setup (but fpm is the default at current)

maybe you could give a hint how you installed nextcloud.

Hello Michael,

the directory you described doesn`t exist in my installation. I’m just wondering if you are talking about the php config file located at

/var/www/html/config/config.php?

This contains only ip addresses and passwords. I have further seen an ini file at

/etc/php/7.0/apache2/php.ini

The instruction I used for the isntallation is this one:

It is german, but the commands are in english of course :wink:

Thanks

Markus

ah ok that’s the way :wink:

ok you are using the apache mod for php and not the php-fpm. That is ok, but I may found a problem, in your Tutorial there is nothing mentioned that output buffering should be deactivated in the php config

output_buffering = 0

If it is not deactivated it could occur some serious memory issues.

https://docs.nextcloud.com/server/13/admin_manual/configuration_files/big_file_upload_configuration.html#configuring-php

1 Like

Hi Michael,

thanks for the hint. The default value was output_buffering=4096. I changed it to “0”. But thats a different issue and has nothing to do with my original proplem of re-appearing files. Just in case it may say something to you, I wanted to attach my php.ini file. Unfortunately I did not find any upload button in this forum. So I post here all the uncommented lines from my php.ini file. To me everything looks ok, but my knowledge on Nextcloud is not the best.

Thanks

Markus

[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 0
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = “GPCS”
request_order = “GP”
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = “text/html”
default_charset = “UTF-8”
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = “%Y-%m-%d %H:%M:%S”
ibase.dateformat = “%Y-%m-%d”
ibase.timeformat = “%H:%M:%S”
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = “a=href,area=href,frame=src,input=src,form=fakeentry”
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir=“/tmp”
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
[curl]
[openssl]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Hi Markus,

did you restart apache process after editing your php.ini file?

systemctl restart apache2

if you delete the file, is it deleted on your filesystem or does it still exists in your nextcloud data directory? Are there any issues in your logfile (in your admin settings on nextcloud)

did you have a look in your Computer setups that there are maybe some issues with for example clock time or Security Appliances that may interfer with the sync of Nextcloud? Maybe some of your devices is reuploading the file? you could see this in activity stream or log file if set to info in nextcloud.

Hello Michael,

shame on me. After your statement if some devices are re-uploading the files, I doublechecked (again) al my clients. And this time really, I discovered an option in the Android Foldersync app. This ption is called “sync deleted files” and it was unchecked. So really, the files were copied back from the android device. I checked this option and now the files are gone. Stupid, I sohould have found this on my own. But somehow you need helt to find the clear things.

Thanks anyway.

Markus

1 Like