Title: Permission denied when writing to files under /sys (sysfs) directory
Type: Severity: normal
Components: Core Versions: Jython 2.5
Status: open Resolution: remind
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, halfie, zyasoft
Priority: Keywords:

Created on 2012-03-19.09:36:50 by halfie, last changed 2015-02-08.06:24:44 by zyasoft.

File name Uploaded Description Edit Remove halfie, 2012-03-19.09:36:50 test script halfie, 2012-03-19.12:08:39 Test Case in Java
msg6816 (view) Author: halfie (halfie) Date: 2012-03-19.09:36:49
I am unable to write to files under /sys (sysfs) directory using Jython 2.5.2

When I run the attached "" file, I get

Traceback (most recent call last):
  File "", line 4, in <module>
IOError: [Errno 13] Permission denied: '/sys/block/sdc/device/delete'


Same code runs fine under Python 2.7.2. 

$ jython -V
Jython 2.5.2

$ java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
msg6817 (view) Author: halfie (halfie) Date: 2012-03-19.12:08:38
Attaching similar program written in Java which works just fine. So it doesn't seem to be a Java problem but a Jython problem.
msg7750 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-25.20:28:22
Sorry for the slow response - can you tell me more about your platform? Mainly what os you are on and some details about how /sys (sysfs) is mounted etc?
msg7782 (view) Author: halfie (halfie) Date: 2013-02-26.04:30:33
I am running CentOS 6.3 64-bit which uses Linux 2.6.32.x kernel.

$ mount | grep sysfs 
sysfs on /sys type sysfs (rw)

$ java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

Nothing fancy :)
msg7784 (view) Author: Alan Kennedy (amak) Date: 2013-02-26.08:32:47
Please can you run the following jython code on your system and report the results?


from import BufferedWriter, FileWriter
import java.lang

if __name__ == "__main__":
    fileName = "/sys/block/sdb/device/delete"
        writer = BufferedWriter(FileWriter(fileName,True))
    except java.lang.Exception, e:
msg9506 (view) Author: Jim Baker (zyasoft) Date: 2015-02-08.06:24:44
Any updates?
Date User Action Args
2015-02-08 06:24:44zyasoftsetnosy: + zyasoft
messages: + msg9506
2014-05-22 00:05:31zyasoftsetresolution: remind
2013-02-26 08:32:47amaksetmessages: + msg7784
2013-02-26 07:56:08amaksetnosy: + amak
2013-02-26 04:30:34halfiesetmessages: + msg7782
2013-02-25 20:28:22fwierzbickisetnosy: + fwierzbicki
messages: + msg7750
versions: + Jython 2.5, - 2.5.2
2012-03-19 12:08:39halfiesetfiles: +
messages: + msg6817
2012-03-19 09:36:50halfiecreate