Antivirus (ClamAV) not working

Hi all,

No matter which mode, Daemon, Socket,…I chose, ClamAV wouldn’t run.
I keep getting errors.
This has happening in OwnCloud 7 till now.
Ongoing issue at GitHub: https://github.com/owncloud/files_antivirus/issues/98

My server info:

  • Debian Wheezy
  • Nginx
    –PHP 5.4
    –ClamAV installed on host
    –NextCloud ClamAV also installed
    –Internal storage (data).

Are you guys plan to re-work the code or create a new antivirus in the future release?

Here’s one of the errors:


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 “4” has not been found.”,“Code”:0,“Trace”:"#0 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/apps/files_antivirus/lib/backgroundscanner.php(78): OC\Files\View->getPath(‘4’)\n#1 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/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 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/backgroundjob/legacy/regularjob.php(31): call_user_func(Array)\n#4 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/backgroundjob/job.php(52): OC\BackgroundJob\Legacy\RegularJob->run(Array)\n#5 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/cron.php(171): OC\BackgroundJob\Job->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))\n#6 {main}",“File”:"/media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/files/view.php",“Line”:1677}



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 “6” has not been found.”,“Code”:0,“Trace”:"#0 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/apps/files_antivirus/lib/backgroundscanner.php(78): OC\Files\View->getPath(‘6’)\n#1 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/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 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/backgroundjob/legacy/regularjob.php(31): call_user_func(Array)\n#4 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/backgroundjob/job.php(52): OC\BackgroundJob\Legacy\RegularJob->run(Array)\n#5 /media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/cron.php(145): OC\BackgroundJob\Job->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))\n#6 {main}",“File”:"/media/54bf67db-da31-4c50-bb3c-27140944b223/www/nextcloud/lib/private/files/view.php",“Line”:1677} …

1 Like

I just updated to NC v9.0.52 and ClamAV error persist.

ClamAV mode: Daemon (Socket)
Socket: /var/run/clamav/clamd.ctl
Stream Length: 26214400000

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 \"4\" has not been found.","Code":0,"Trace":"#0 \/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/apps\/files_antivirus\/lib\/backgroundscanner.php(78): OC\\Files\\View->getPath('4')\n#1 \/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/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 \/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/lib\/private\/backgroundjob\/legacy\/regularjob.php(31): call_user_func(Array)\n#4 \/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/lib\/private\/backgroundjob\/job.php(52): OC\\BackgroundJob\\Legacy\\RegularJob->run(Array)\n#5 \/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/cron.php(145): OC\\BackgroundJob\\Job->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#6 {main}","File":"\/media\/54bf67db-da31-4c50-bb3c-27140944b223\/www\/nextcloud\/lib\/private\/files\/view.php","Line":1677

Bump - seeing the same thing Ubuntu 16.04, Nginx, php 7.0.

+1 i though i didn’t write the good apt-get install commande…

Same config ubuntu 16.04 ( and 16.04.1) apache2 and php 7.0.8 and of course last stable version of nextcloud

Clam AV also not working for me :cry:
at other server usage clam av is working without any issue - only in NC error

I get this error at NC 10 beta - Daemon socket mode - php 7 - debian 8 - apache 2.4

OCA\Files_Antivirus\BackgroundScanner::run, exception: An exception occurred while executing 'SELECT fc.fileidFROMoc_filecachefc LEFT JOINoc_files_antivirusfa ON fa.fileid= fc.fileidINNER JOINoc_storagesss ON (fc.storage= ss.numeric_id) AND ((ss.idLIKE 'local::%') OR (ss.idLIKE 'home::%')) WHERE (fc.mimetype<> '2') AND ((fa.fileidIS NULL) OR (fc.mtime> fa.check_time)) AND (fc.pathLIKE 'files/%') AND (fc.size<>0) LIMIT 5': SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause'

UPDATE:
The original fix actually verified my suspicion that the compliled SQL statement was treating this number as a string. Further testing that my fix actually caused another error later on and thus the problem was truly not fixed. After digging into the source code and researching the issue more I discovered that the following works the best:

$qb->expr()->neq(‘fc.size’,$qb->createNamedParameter(0))

It seems that $qb->expr()->literal() should only be used with string values and not with integers.

I was receiving the same error and managed to track it down to “files_antivirus/lib/backgroundscanner.php” and the line:

$qb->expr()->neq(‘fc.size’, $qb->expr()->literal(‘0’))

After removing the single quotes around the 0 the error disappeared.

After you removed the quote, does the antivirus work though?

I don’t have this line in my backgroundscanner.php .

Yes, it started working. Let me research the difference in mine.

I am using the latest version from https://github.com/owncloud/files_antivirus

I found the latest OC antivirus link: https://codeload.github.com/owncloud/files_antivirus/zip/stable9.1

For those who reading this:
After you downloaded the files and copied it to NC apps directory, ensure to chown -R it to www-data:www-data , and install it.

Then look for the above line that wfunderberg posted, and remove the single quote around ‘0’.

@wfunderberg

Thanks for your help.
Hopefully this fix the annoying error.

One more thing, how do you check if the antivirus is working properly?

NextCloud should have its own antivirus apps instead using its predecessor antivirus.

Unfortunately not. The same error without the quotes around the 0.

Take a look into the log and the table files_antivirus.

Nextcloud has it’s own AV app now.

Bug reports, feature reqests, and PRs are welcome. :wink:

Mine is working fine.
I’m using the previous OC antivirus.

This error happening again with NC11 :frowning:

I have also the described error with NC11, log is full with error entries like:

OCA\Files_Antivirus\BackgroundScanner::run, exception: File with id “513” has not been found.

Is there any way to fix this ?

regards

The below solution didn’t work.

https://github.com/owncloud/files_antivirus/pull/118/files#r74958812