Edmond Rodriguez on 6 Oct 2009 08:59:39 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Failure trying to write to a file in a virtual file system



A script related to hibernate fails when trying to write to a file "state" in /sys/power.

Here is the message:
/usr/lib/pm-utils/pm-functions: line 274: echo: write error: Device or resource busy

And here is line 274:
                echo -n "disk" > /sys/power/state


So with root, I manually cd to /sys/power and try manual edits to the files in this virtual file system.  I am not detecting, that I know of, any process having any of the files open.  Some of the files I can write to, and others I can not.

For example, the following fails:
**root@noname:/sys/power# echo -n "mem disk" > state
bash: echo: write error: Invalid argument

If I try to vi the file, and just do write, I get a "disk full" error.

What would be a reason for write failure?

Below shows the file system, a file listing, an fuser command, and manually trying writing to each file.

**root@noname:/sys/power# df -T .
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
sysfs        sysfs           0         0         0   -  /sys

**root@noname:/sys/power# ls -sal
total 0
0 drwxr-xr-x  2 root root    0 2009-10-06 08:14 .
0 drwxr-xr-x 12 root root    0 2009-10-06 04:08 ..
0 -rw-r--r--  1 root root 4096 2009-10-06 11:25 disk
0 -rw-r--r--  1 root root 4096 2009-10-06 10:46 image_size
0 -rw-r--r--  1 root root 4096 2009-10-06 11:20 resume
0 -rw-r--r--  1 root root 4096 2009-10-06 11:20 state

FUSER COMMAND  (no processes displayed)
**root@noname:/sys/power# fuser -av *
                     USER        PID ACCESS COMMAND
disk:
image_size:
resume:
state:

JUST DISPLAYING CONTENT OF THE FILES
**root@noname:/sys/power# cat disk
[platform] test testproc shutdown reboot
**root@noname:/sys/power# cat image_size
524288000
**root@noname:/sys/power# cat resume
3:3
**root@noname:/sys/power# cat state
mem disk


*** HERE I TRY TO WRITE TO THE FILES with the same thing that is already in them ,
    Two of them I can write to, two of them fail.

**root@noname:/sys/power# echo -n "[platform] test testproc shutdown reboot" > disk
bash: echo: write error: Invalid argument

**root@noname:/sys/power# echo -n "524288000" > image_size

**root@noname:/sys/power# echo -n "3:3" > resume

**root@noname:/sys/power# echo -n "mem disk" > state
bash: echo: write error: Invalid argument

If I try to vi "state" and do a write, I get a "disk full" error message.


Thanks for any help.

Edmond Rodriguez
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug