Backgroundscan not working - Error Failed to setup file system in backgroundscanner.php #109

Closed
marco-aa opened this Issue Apr 24, 2016 · 17 comments

Projects

None yet

4 participants

@marco-aa
marco-aa commented Apr 24, 2016 edited

Hello all :-)

i'm using OwnCloud 8.2.3 and antivirus app 0.8.0.1. on Centos 7.2 running SELinux active. (checked audit2allow - looking good )

I found "Error files_antivirus Failed to setup file system" in my Administrator Log.

I looked at backgroundscanner.php and i found that
A)
in funciton initFS() the line $results = $this->userManager->search('', 2, 0); has no result.
userManager object is working. No result found.
If i change the line \OC_Util::setupFS($anyUser->getUID()); to \OC_Util::setupFS('my-admin-user');
the background scan is working. (i did a test with a EICA-Test-File).
B)
File is not deleted with my "workaround" (i checked my settings on the adminpanel delete and not logging was set)
C)
By the way will the setupFS only work an files under my "my-admin-user" or will it scan all files for example from the private folders of other owncloud users ?

Somebody has a idea ? Thanks a lot

@goopen
goopen commented May 9, 2016

Not sure if this is related but I get this error in my logs. This is on 9.0.2 however.

Error while running background job (class: OC\BackgroundJob\Legacy\RegularJob, arguments: Array ( [0] => OCA\Files_Antivirus\Cron\Task [1] => run ) ): {"Exception":"OCP\\Files\\NotFoundException","Message":"File with id \"42\" has not been found.","Code":0,"Trace":"#0 \/var\/www\/owncloud\/apps\/files_antivirus\/lib\/backgroundscanner.php(78): OC\\Files\\View->getPath('42')\n#1 \/var\/www\/owncloud\/apps\/files_antivirus\/lib\/cron\/task.php(21): OCA\\Files_Antivirus\\BackgroundScanner->run()\n#2 [internal function]: OCA\\Files_Antivirus\\Cron\\Task::run()\n#3 \/var\/www\/owncloud\/lib\/private\/backgroundjob\/legacy\/regularjob.php(31): call_user_func(Array)\n#4 \/var\/www\/owncloud\/lib\/private\/backgroundjob\/job.php(52): OC\\BackgroundJob\\Legacy\\RegularJob->run(Array)\n#5 \/var\/www\/owncloud\/cron.php(145): OC\\BackgroundJob\\Job->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#6 {main}","File":"\/var\/www\/owncloud\/lib\/private\/files\/view.php","Line":1643}
@PVince81
Contributor
PVince81 commented Jul 6, 2016

@VicDeo is that realted to the IRC discussion of today ?

What steps/fixes are required to make this work again ?

@VicDeo
Member
VicDeo commented Jul 6, 2016

@PVince81 yes, that's it.
this hacky method https://github.com/owncloud/files_antivirus/blob/master/lib/backgroundscanner.php#L92

should be removed and replaced with something like TagBasedRetention does.

I started with it but completely switched to Updater before achieving any positive results.

@PVince81
Contributor
PVince81 commented Jul 6, 2016

@VicDeo can you link all steps and PRs here, to get an overview ?

@PVince81
Contributor
PVince81 commented Jul 6, 2016

From what I understand it's already broken in 8.2 ? Setting to 8.2.7

@PVince81 PVince81 added this to the 8.2.7 milestone Jul 6, 2016
@VicDeo
Member
VicDeo commented Jul 6, 2016

@PVince81 there is no exact steps or PRs. Just a little stash on my local machine.
In fact what I was doing is reverse engineering of TagBasedRetention.

This is related to the fact that there is no easy way to iterate through the files of all users within a cronjob with the following limitations:

  • exclude directories
  • exclude zero-sized files (and potentially exclude very large size)
  • exclude certain files by their fileIds (already scanned files)
@PVince81
Contributor

@VicDeo can you make a WIP PR out of the stash ?

@VicDeo
Member
VicDeo commented Jul 12, 2016 edited

@PVince81 Here you are #118

@PVince81
Contributor

@VicDeo thanks!

@PVince81 PVince81 modified the milestone: 8.2.8, 8.2.7 Jul 18, 2016
@ghost Unknown referenced this issue in owncloud/core Aug 10, 2016
Closed

BackgroundScanner logs File not found #25759

@PVince81
Contributor

Waiting for the backport #128 to be merged before closing

@PVince81
Contributor

@VicDeo by the way, does this need backport to 8.2 ?

@PVince81 PVince81 modified the milestone: 8.2.9, 8.2.8 Sep 21, 2016
@PVince81 PVince81 modified the milestone: 8.2.10, 8.2.9 Oct 20, 2016
@PVince81
Contributor
PVince81 commented Nov 8, 2016

@VicDeo ping

@VicDeo
Member
VicDeo commented Nov 8, 2016 edited

@PVince81 well, this issue was 100% reproducible with 9.0/9.1 but the apps works as expected for me on the same environment with 8.2.8:

{"reqId":"DzmW+tPS9rs3illL1KKj","remoteAddr":"127.0.0.1","app":"files_antivirus","message":"Scan started File: 13Account: P Path: P\/files\/ownCloud_User_Manual.pdf","level":0,"time":"2016-11-08T14:35:29+00:00","method":"GET","url":"\/~deo\/latest82\/cron.php"}
{"reqId":"DzmW+tPS9rs3illL1KKj","remoteAddr":"127.0.0.1","app":"files_antivirus","message":"Scan is done File: 13Account: P Path: P\/files\/ownCloud_User_Manual.pdf","level":0,"time":"2016-11-08T14:35:59+00:00","method":"GET","url":"\/~deo\/latest82\/cron.php"}
{"reqId":"DzmW+tPS9rs3illL1KKj","remoteAddr":"127.0.0.1","app":"files_antivirus","message":"Exit code :: 0 Response :: stdin: OK\n\n----------- SCAN SUMMARY -----------\nKnown viruses: 5056690\nEngine version: 0.99.2\nScanned directories: 0\nScanned files: 1\nInfected files: 0\nData scanned: 4.10 MB\nData read: 3.46 MB (ratio 1.18:1)\nTime: 31.875 sec (0 m 31 s)\n","level":0,"time":"2016-11-08T14:36:01+00:00","method":"GET","url":"\/~deo\/latest82\/cron.php"}

It is possible to backport nevertheless.

@VicDeo
Member
VicDeo commented Nov 8, 2016

@PVince81 not backportable to 8.2 :(
Call to undefined method OC\Files\Config\MountProviderCollection::getMountCache()

@PVince81
Contributor

Maybe the error reported here is due to something else since it works for you in the same env.

@VicDeo VicDeo was assigned by PVince81 Nov 21, 2016
@PVince81
Contributor
PVince81 commented Dec 6, 2016

Ok then, I suggest closing then.

The issue I think was critical is if the background scanner can never run due to API changes.
But these API changes were made in OC 9.0 and 9.1 and the fixes were made accordingly.

@marco-aa please try upgrading to OC 9.0 and reopen if the issue still persists.

@PVince81 PVince81 closed this Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment