New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
4 participants
@marco-aa

marco-aa commented Apr 24, 2016

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

This comment has been minimized.

Show comment
Hide comment
@goopen

goopen 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}

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jul 6, 2016

Member

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

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@VicDeo

VicDeo Jul 6, 2016

Member

@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.

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

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jul 6, 2016

Member

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

Member

PVince81 commented Jul 6, 2016

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

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jul 6, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@VicDeo

VicDeo Jul 6, 2016

Member

@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)
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)
@VicDeo

This comment has been minimized.

Show comment
Hide comment
@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jul 12, 2016

Member

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

Member

PVince81 commented Jul 12, 2016

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

@VicDeo

This comment has been minimized.

Show comment
Hide comment
@VicDeo

VicDeo Jul 12, 2016

Member

@PVince81 Here you are #118

Member

VicDeo commented Jul 12, 2016

@PVince81 Here you are #118

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Jul 13, 2016

Member

@VicDeo thanks!

Member

PVince81 commented Jul 13, 2016

@VicDeo thanks!

@PVince81 PVince81 modified the milestones: 8.2.8, 8.2.7 Jul 18, 2016

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 21, 2016

Member

Waiting for the backport #128 to be merged before closing

Member

PVince81 commented Sep 21, 2016

Waiting for the backport #128 to be merged before closing

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Sep 21, 2016

Member

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

Member

PVince81 commented Sep 21, 2016

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

@PVince81 PVince81 modified the milestones: 8.2.9, 8.2.8 Sep 21, 2016

@PVince81 PVince81 modified the milestones: 8.2.10, 8.2.9 Oct 20, 2016

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81
Member

PVince81 commented Nov 8, 2016

@VicDeo ping

@VicDeo

This comment has been minimized.

Show comment
Hide comment
@VicDeo

VicDeo Nov 8, 2016

Member

@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.

Member

VicDeo commented Nov 8, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@VicDeo

VicDeo Nov 8, 2016

Member

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

Member

VicDeo commented Nov 8, 2016

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

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Nov 10, 2016

Member

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

Member

PVince81 commented Nov 10, 2016

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

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 Dec 6, 2016

Member

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.

Member

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