OpenCpu and /tmp folder read error

60 views
Skip to first unread message

Atrayee Gupta

unread,
Sep 11, 2017, 6:13:49 AM9/11/17
to ope...@googlegroups.com
Hello,

I got the following error:

curl -L http://localhost/ocpu/library/Accumulator/R/Accumulator -d pid=1
argument is of length zero

In call:
if (file == "") file <- stdin() else {
    file <- if (nzchar(fileEncoding))
        file(file, "r", encoding = fileEncoding)
    else file(file, "r")
    on.exit(close(file))
}

In my package, I have a line that reads from a file in /tmp folder

 varF=file.path("/tmp")
...
temperature <- Sys.glob(file.path(varF, "Temperature.txt"))
I set the permission chmod777 to /tmp folder
I set the permission in /etc/apparmor.d/opencpu.d/custom as follows: To read from any folder and file  from /tmp and also read from myfolder123:
/tmp/** rw,
/tmp/** rwkmix,
/tmp/myfolder*/ rw,
/tmp/myfolder*/** rwkmix,

But still getting the above error. The code works fine in R. But I got the errors in opencpu. Please help me to resolve the error.

Thanks

Anita

unread,
Sep 11, 2017, 2:03:44 PM9/11/17
to opencpu
1.sudo tail -f /var/log/kern.log | grep opencpu
Sep 11 10:42:23 ubuntu kernel: [  760.747625] audit: type=1400 audit(1505151743.735:31): apparmor="DENIED" operation="open" profile="opencpu-exec" name="/tmp/" pid=3104 comm="apache2" requested_mask="r" denied_mask="r" fsuid=33 ouid=0

2.Solved by adding the /tmp/ rwmix, to 
gedit /etc/apparmor.d/opencpu.d/custom

As suggested in one of the post
Thanks
Reply all
Reply to author
Forward
0 new messages