Raspberry pi3 B GPIO error

Hi Guys,
I am using Ubuntu core in Raspberry pi3 B, When I try to use LCD 20x4 display and Switch keypad in Raspberry pi3 B, it’s shows error
Exception in thread “main” java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Unable to open GPIO export interface: Permission denied.
The java program works fine in Raspbian, I use pi4j for reading the gpio pin.
Please guys help me to solve this problem. I tried lot, but nothing gives me the solution. please anyone guide me to solve this problem.

Hi guys, I solved this problem, by running the snap application in devmode.

well, you should instead have your java-program-snap use the correct interface slots … have a look at the output of snap interfaces when logged in to the pi and add the right plugs: stanzas to the apps section of your snapcraft.yaml

I used the gpio-memory-control interface, and also connect that interface manually to the snap application. in my case that’s not the problem. The application only run on devmode. Don’t know why?. Do you have any idea about this?. please let me also know…

that doesnt give you any access to the specific gpio, you need to define the gpio you want to use as well …

for further debugging, see:

specifically the bottom part …(Debugging confined apps)

I don’t get it, in snap interfaces, there is only gpio-memory-control interface, for access the gpio pins.

hmm, you should see something like:

$ snap interfaces|grep pi3
pi3:bcm-gpio-0            -
pi3:bcm-gpio-1            -
pi3:bcm-gpio-10           -
pi3:bcm-gpio-11           -
pi3:bcm-gpio-12           -
pi3:bcm-gpio-13           -
pi3:bcm-gpio-14           -
pi3:bcm-gpio-15           -
pi3:bcm-gpio-16           -
pi3:bcm-gpio-17           -
pi3:bcm-gpio-18           -
pi3:bcm-gpio-19           -
pi3:bcm-gpio-2            -
pi3:bcm-gpio-20           -
pi3:bcm-gpio-21           -
pi3:bcm-gpio-22           -
pi3:bcm-gpio-23           -
pi3:bcm-gpio-24           -
pi3:bcm-gpio-25           -
pi3:bcm-gpio-26           -
pi3:bcm-gpio-27           -
pi3:bcm-gpio-3            -
pi3:bcm-gpio-4            -
pi3:bcm-gpio-5            -
pi3:bcm-gpio-6            -
pi3:bcm-gpio-7            -
pi3:bcm-gpio-8            -
pi3:bcm-gpio-9            -
pi3:bt-serial             -
pi3:i2c-0                 -
pi3:i2c-1                 -
pi3:i2c-2                 -

is this an image you built yourself ?

Sorry, but when I run this command, I don’t get any list.

siva@localhost:~$ snap interfaces|grep pi3
siva@localhost:~$ snap interfaces |grep pi3
siva@localhost:~$ sudo snap interfaces |grep pi3

I also tried with sudo. Is there any problem on my system?

it looks like your gadget snaps is very old and missing all interfaces entries … try the following (though that will only update the interfaces entries but not give you the newer firmware from the newer gadget):

snap refresh pi3 --edge

alternatively use an image from:


and then switch kernel and core to the stable channel (they will be on edge by default in these images, which you do not want for these two snaps). that way you should also have the newer firmware (which includes some upstream power mgmt and thremal handling fixes).

Thanks @ogra,
I will try this and let you know the status…


Name        Version         Rev   Tracking  Publisher  Notes
core        16-2.34.3       5149  stable    canonical  core
pi2-kernel  4.4.0-1092.100  56    stable    canonical  kernel
pi3         16.04-0.5       6     stable    canonical  gadget

These are my core,kernel and gadget snap…