Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 569738 - media-gfx/gimp - during compilation gegl tries to access /dev/nvidiactl if x11-drivers/nvidia-drivers is installed
Summary: media-gfx/gimp - during compilation gegl tries to access /dev/nvidiactl if x1...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
: 597718 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-25 18:04 UTC by DrSlony
Modified: 2016-12-04 19:32 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build error w/ two nvidia cards (media-gfx:gimp-2.9.4:20160917-112124.log,30.15 KB, text/plain)
2016-09-17 11:52 UTC, Michael Weber (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description DrSlony 2015-12-25 18:04:35 UTC
Emerging gimp-9999 (once libmypaint-9999 is installed, see bug #) dangerously fails:
/usr/bin/gegl-0.3 -x \
"<gegl> \
  <node operation='gegl:invert-linear'></node> \
  <node operation='gegl:load'> \
    <params> \
      <param name='path'>../../icons/Symbolic/12/gimp-quick-mask-on.png</param> \
    </params> \
  </node> \
</gegl>" -o 12/gimp-quick-mask-on.png
 * ACCESS DENIED:  open_wr:      /dev/nvidiactl
 * ISE:write_logfile: unable to append logfile: /var/log/sandbox/sandbox-10319.log
 * ../../sandbox-2.6/libsandbox/libsandbox.c:check_syscall():879: failure (Bad file descriptor):
 * ISE:
	abs_path: /dev/nvidiactl
	res_path: /dev/nvidiactl
/usr/lib64/libsandbox.so(+0xbad1)[0x7ff1a755aad1]
/usr/lib64/libsandbox.so(+0xbbc8)[0x7ff1a755abc8]
/usr/lib64/libsandbox.so(+0x591a)[0x7ff1a755491a]
/usr/lib64/libsandbox.so(open64+0x6c)[0x7ff1a755977c]
/usr/lib64/libnvidia-opencl.so.1(+0x172138)[0x7ff1a3300138]
/usr/lib64/libnvidia-opencl.so.1(+0x2bfab9)[0x7ff1a344dab9]
/usr/lib64/libnvidia-opencl.so.1(+0x2c3b08)[0x7ff1a3451b08]
/usr/lib64/libnvidia-opencl.so.1(+0x2c3b85)[0x7ff1a3451b85]
/usr/lib64/libnvidia-opencl.so.1(+0x20cfe6)[0x7ff1a339afe6]
/usr/lib64/libnvidia-opencl.so.1(+0x13b0ad)[0x7ff1a32c90ad]
/proc/10500/cmdline: /usr/bin/gegl-0.3 -x <gegl>   <node operation='gegl:invert-linear'></node>   <node operation='gegl:load'>     <params>       <param name='path'>../../icons/Symbolic/12/gimp-menu-right.png</param>     </params>   </node> </gegl> -o 12/gimp-menu-right.png 

Makefile:1358: recipe for target '12/gimp-menu-right.png' failed
make[3]: *** [12/gimp-menu-right.png] Aborted

See the full emerge log:
https://bpaste.net/raw/dd9feeaa9dc2

Reproducible: Always
Comment 1 DrSlony 2015-12-25 18:05:11 UTC
That should have been: see bug 569548.
Comment 2 Sebastian Pipping gentoo-dev 2015-12-26 09:59:51 UTC
I don't get the /dev/nvidiactl thing here; I have an Intel card, if that matters.
Comment 3 DrSlony 2015-12-26 18:21:52 UTC
Sebastien you used =media-libs/gegl-9999 and =media-gfx/gimp-9999 both from portage?
And what about mypaint and libmypaint, which versions did you emerge and did you use my libmypaint ebuild without changes? If you made changes, could you upload yours to bug 569548?
Comment 4 DrSlony 2015-12-27 15:33:58 UTC
I was advised to try USE="-test" or FEATURES="-sandbox". I tried both, neither worked.

I found that when I "eselect opencl set nvidia" then I get the above failure. When I "eselect opencl set mesa" then compilation succeeds!

I'm using:
virtual/opencl-0-r4
app-eselect/eselect-opencl-1.1.0-r3
x11-drivers/nvidia-drivers-340.96 (I cannot go above 340 because the newer drivers don't support my GTX 285M (G92))
media-libs/mesa-11.1.0
app-eselect/eselect-mesa-0.0.10
Comment 5 Alex Xu (Hello71) 2015-12-27 21:35:37 UTC
easiest workaround is to addpredict /dev/nvidiactl.
Comment 6 Sebastian Pipping gentoo-dev 2015-12-31 03:04:38 UTC
addpredict may not be an option if GEGL is writing to /dev/nvidiactl have the graphics card process image data for us (but I cannot try without an NVidia card).

DrSlony, could you try and report back which of these three approaches work when inserting to the Gimp 9999 ebuild, in order?  You can stop at the first that works.

  a) addpredict

     src_compile() {
       addwrite /dev/nvidiactl
       gnome2_src_compile
     }

  b) addwrite only

     src_compile() {
       addwrite /dev/nvidiactl
       gnome2_src_compile
     }

  c) addwrite + addread

     src_compile() {
       addwrite /dev/nvidiactl
       addread /dev/nvidiactl
       gnome2_src_compile
     }

Thanks in advance!


PS: https://devmanual.gentoo.org/function-reference/sandbox-functions/index.html
Comment 7 DrSlony 2015-12-31 14:27:42 UTC
I switched eselect opencl back to nvidia and tried option a. I inserted your code between src_test() and src_install(). It compiled and runs well.
Comment 8 Sebastian Pipping gentoo-dev 2015-12-31 18:48:14 UTC
(In reply to DrSlony from comment #7)
> I switched eselect opencl back to nvidia and tried option a. I inserted your
> code between src_test() and src_install(). It compiled and runs well.

Excellent, thanks for testing!


# git show --stat | sed 's,@gentoo.org,@g.o,'
commit 6cef344c45b249d0ab3044b572306ec4db431159
Author: Sebastian Pipping <sping@g.o>
Date:   Thu Dec 31 19:46:50 2015 +0100

    media-gfx/gimp: Fix compile for NVidia OpenCL (bug #569738)
    
    Package-Manager: portage-2.2.26

 media-gfx/gimp/gimp-9999.ebuild | 5 +++++
 1 file changed, 5 insertions(+)
Comment 9 DrSlony 2016-01-01 21:34:21 UTC
Thank you.
Comment 10 DrSlony 2016-01-02 11:43:33 UTC
I emerged gegl and babl, then I tried to emerge gimp from portage (all 9999), but gimp failed:
/bin/sh: line 1:  9962 Illegal instruction     /usr/bin/gegl-0.3 -x "<gegl> <node operation='gegl:invert-linear'></node> <node operation='gegl:load'> <params> <param name='path'>../../icons/Symbolic/12/gimp-quick-mask-on.png</param> </params> </node> </gegl>" -o 12/gimp-quick-mask-on.png
Makefile:1531: recipe for target '12/gimp-quick-mask-on.png' failed
make[3]: *** [12/gimp-quick-mask-on.png] Error 132

Full build log:
https://bpaste.net/show/f33fa265aae8

Note that these messages also appeared when I emerged my gimp-9999 ebuild before the 2015-12-31 commit, and despite them the compilation succeeded:
  HMM....
  Something strange is happening,
  malloc and free function pointer changing between invocations in babl.
Comment 11 DrSlony 2016-01-02 12:02:59 UTC
And I get this regardless of the eselect opencl setting.
Comment 12 Sebastian Pipping gentoo-dev 2016-01-02 15:56:35 UTC
If it does not involve /dev/nvidiactl, it seems like a new/different bug to me.  If it is a different thing, let's not use the same bug report for it.  This looks like a problem with gegl and/or babl to me.
Comment 13 DrSlony 2016-01-02 16:35:45 UTC
You're right. I tried to rebuild now using -j1 and saw no reference to the previous error. I've opened a new report - bug 570622.
Comment 14 Sven B. 2016-07-19 13:15:34 UTC
in my case /dev/nvidia0 is accessed instead of nvidiactl

...

F: open_wr
S: deny
P: /dev/nvidia0
A: /dev/nvidia0
R: /dev/nvidia0
C: /usr/bin/gegl-0.3 ../../icons/Symbolic/48/gimp-prefs-session.png -o 48/gimp-prefs-session.png -- gegl:invert-gamma 

...

might be related to intel/nvidia offloading configuration
//

addwrite /dev/nvidia0

works for me.
Comment 15 Sebastian Pipping gentoo-dev 2016-07-20 17:11:24 UTC
Thanks for the report, fixed in git hopefully.  Else, please re-open.


commit 6fd9d728213574d0757df3a2f7bc4d2548434811
Author: Sebastian Pipping <sping@g.o>
Date:   Wed Jul 20 19:07:14 2016 +0200

    media-gfx/gimp: Graphics device access (bug #569738, #589198)
    
    Package-Manager: portage-2.2.28

 media-gfx/gimp/gimp-2.9.2-r2.ebuild | 3 +++
 media-gfx/gimp/gimp-2.9.4.ebuild    | 3 +++
 media-gfx/gimp/gimp-9999.ebuild     | 3 +++
 3 files changed, 9 insertions(+)

https://github.com/gentoo/gentoo/commit/6fd9d728213574d0757df3a2f7bc4d2548434811
Comment 16 Michael Weber (RETIRED) gentoo-dev 2016-09-17 11:52:48 UTC
Created attachment 446148 [details]
build error w/ two nvidia cards

This fails if more than one nvidia cards are present

>>> Compiling source in /var/tmp/portage/media-gfx/gimp-2.9.4/work/gimp-2.9.4 ...
 * ERROR: media-gfx/gimp-2.9.4::gentoo failed (compile phase):
 *   Usage: addwrite <colon-delimited list of paths>
 *
 * Call stack:
 *     ebuild.sh, line  115:  Called src_compile
 *   environment, line 4473:  Called addwrite '/dev/nvidia0' '/dev/nvidia1'
 *     ebuild.sh, line  145:  Called __sb_append_var 'WRITE' '/dev/nvidia0' '/dev/nvidia1'
 *     ebuild.sh, line  138:  Called die
 * The specific snippet of code:
 *      [[ -z $1 || -n $2 ]] && die "Usage: add$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${_v}") <colon-delimited list of paths>"
 *
Comment 17 Michael Weber (RETIRED) gentoo-dev 2016-09-17 12:03:52 UTC
The [ -e ... ] avoids a call to `addwrite /dev/nvidia[0-9]` and other non-existent files if the shell expansion doesn't match.
It still doesn't support more than ten cards, but well ..

--- a/media-gfx/gimp/gimp-2.9.4.ebuild
+++ b/media-gfx/gimp/gimp-2.9.4.ebuild
@@ -132,9 +132,11 @@ src_configure() {
 }
 
 src_compile() {
-       addwrite /dev/nvidiactl  # bug #569738
-       addwrite /dev/nvidia?  # bug #569738
-       addwrite /dev/nvidia-uvm  # bug #591214
+       #bugs #569738 and #591214
+       local nv
+       for nv in /dev/nvidia-uvm /dev/nvidiactl /dev/nvidia[0-9] ; do
+               [ -e $nv ] && addwrite $nv
+       done
        addwrite /dev/dri/  # bug #574038
        addwrite /dev/ati/  # bug 589198
        addwrite /proc/mtrr  # bug 589198
Comment 18 Sebastian Pipping gentoo-dev 2016-09-18 14:35:40 UTC
Fixed as proposed by Michael.

Please re-open as needed.


commit 88cfe3aff7ddd01e66272436bb1eee86280c8ef0
Author: Sebastian Pipping <sping@g.o>
Date:   Sun Sep 18 15:54:51 2016 +0200

    media-gfx/gimp: Graphics device access (bug #569738)
    
    Package-Manager: portage-2.3.0

 media-gfx/gimp/gimp-2.9.2-r2.ebuild | 8 +++++---
 media-gfx/gimp/gimp-2.9.4.ebuild    | 8 +++++---
 media-gfx/gimp/gimp-9999.ebuild     | 8 +++++---
 3 files changed, 15 insertions(+), 9 deletions(-)

https://github.com/gentoo/gentoo/commit/88cfe3aff7ddd01e66272436bb1eee86280c8ef0
Comment 19 Anton Gubarkov 2016-10-21 13:51:28 UTC
Exactly the same problem surfaced in media-gfx/gimp-2.9.4-r1
Should I create a new bug or this comment is enough?

many instances of 
F: open_wr
S: deny
P: /dev/nvidiactl
A: /dev/nvidiactl
R: /dev/nvidiactl
C: /usr/bin/gegl-0.3 ../../icons/Symbolic/12/gimp-visible.png -o 12/gimp-visible.png -- gegl:invert-gamma 
in /var/log/sandbox.log
Comment 20 Sebastian Pipping gentoo-dev 2016-10-23 13:44:42 UTC
(In reply to Anton Gubarkov from comment #19)
> Exactly the same problem surfaced in media-gfx/gimp-2.9.4-r1
> Should I create a new bug or this comment is enough?

I adjusted the subject to no longer be about specific versions.


> many instances of 
> F: open_wr
> S: deny
> P: /dev/nvidiactl
> A: /dev/nvidiactl
> R: /dev/nvidiactl
> C: /usr/bin/gegl-0.3 ../../icons/Symbolic/12/gimp-visible.png -o
> 12/gimp-visible.png -- gegl:invert-gamma 
> in /var/log/sandbox.log

I'm surprised you have it for /dev/nvidiactl as we unlock access to that if existing already.  Could you check if

  [[ -e /dev/nvidiactl ]] && echo found || echo missing

prints "found"?  If not we may need to rethink use of "-e" in the ebuild.
Comment 21 Anton Gubarkov 2016-10-24 09:34:18 UTC
very funny...

My nvidia is optimus geforce 730 and I run bumblebee to save battery. When I started my build there was no nvidia kernel module loaded - so no /dev/nvidiactl, that's why write-enabling in the  build scipt did nothing.

When gegl starts during the build, it loads nvidia kernel module, /dev/nvidiactl appears, but sandbox blocks any write to it.

I forced loading of nvidia kernel module and started the build. It completed successfully.

I'm not sure if the script should take such a config into account, but it would be nice.

Thanks for the hint.
Comment 22 Sebastian Pipping gentoo-dev 2016-12-04 19:30:38 UTC
Sorry, it tooks so long to react.

I hope it's fixed now.  Else, please re-open.


commit 05307e4b2c199686722c7d7c89fa4018339fbf83
Author: Sebastian Pipping <sping@g.o>
Date:   Sun Dec 4 20:28:08 2016 +0100

    media-gfx/gimp: Remove guard to addwrite (bug #569738 comment 21)
    
    Package-Manager: portage-2.3.2

 media-gfx/gimp/gimp-2.9.2-r2.ebuild | 6 ++++--
 media-gfx/gimp/gimp-2.9.4-r1.ebuild | 6 ++++--
 media-gfx/gimp/gimp-9999.ebuild     | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

https://github.com/gentoo/gentoo/commit/05307e4b2c199686722c7d7c89fa4018339fbf83
Comment 23 Sebastian Pipping gentoo-dev 2016-12-04 19:32:59 UTC
*** Bug 597718 has been marked as a duplicate of this bug. ***