Edmond Rodriguez on 9 Oct 2009 13:04:03 -0700 |
Yes, this seems very kernel related. Thanks for the response. I guess I am back to my original problem. My hibernate only works 1/3 to 1/2 of the time. The other 1/2 to 2/3 of the time, it fails despite plenty of swap. Perhaps I have not looked at the right log for a reason, if one is provided anywhere. The request seems ultimately handed over to the kernel, so I need to learn what the kernel is using to hibernate. I think echo -n mem > /sys/power/state and echo -n disk > /sys/psower/state tries to trigger different power states like suspend and hibernate. But normally something like pm-utils does this for me only after including preprocessing and necessary maintenance for a graceful restart waking up. On another box with Ubuntu, I can echo "disk", and it responds, but not "mem". At least for the time I tried it. So it does show the selectivity that the system has for allowing writes to such files. From: Jason Stelzer <jason.stelzer@gmail.com> To: Philadelphia Linux User's Group Discussion List <plug@lists.phillylinux.org> Sent: Thursday, October 8, 2009 9:28:16 AM Subject: Re: [PLUG] Failure trying to write to a file in a virtual file system For what it's worth, whenever I've flipped bits in /proc I've always used echo. The only time I recall getting errors was when I tried enabling something that the currently running kernel didn't support. So, if you haven't done so already, consult your kernel config and make sure what you're trying to enable is actually turned on in the live kernel. On Thu, Oct 8, 2009 at 12:03 AM, Edmond Rodriguez <erodrig_97@yahoo.com> wrote: > > I just learned today that I can do something like echo -n "mem" > /sys/power/state > and the system responds, though I am not sure exactly what it is doing. Earlier I mentioned an error with a script trying to do echo -n "disk" > /sys/power/state . > > From Googling more, for this particular file, I believe there is more to this than just writing to the file. As Sean mentioned in an earlier mail, maybe not all the hierarchy can be written to. At least not anything you want to put in there. It seems, the file, in some cases, and whatever is monitoring it needs to accept what you wish to put in there. > > The write error seems sort of like a bad return code when invoking a function with some parameter. Now assuming that is true, how to find out the reason for the error? That is, why the system does not wish to accept the content that is being written to a particular file. > > > I've not researched this a whole lot, but this is what I am getting out of this so far. > > Edmond > > > ----- Original Message ---- >> From: Edmond Rodriguez <erodrig_97@yahoo.com> >> To: Philadelphia Linux User's Group Discussion List <plug@lists.phillylinux.org> >> Sent: Tuesday, October 6, 2009 2:53:15 PM >> Subject: Re: [PLUG] Failure trying to write to a file in a virtual file system >> >> Interesting, and I unsuccessfully tried a few quick perl scripts (sysread and >> syswrite), though it seems a bit complicated doing things as they suggest with >> the buffers. Maybe using "C" would be more appropriate. >> >> Curious though that I see other documentation using the "echo -n >" method to >> write data to /sys. >> >> But the text you copied below looks pretty clear to me that they want the entire >> buffer read first, and then the entire buffer written. Could it be saying that >> if you read the file, you must read the entire buffer, and same for writing? >> I also ask myself, in my case, why "echo -n" works with some files, and not >> others. >> >> >> Here is a random example I googled relating to some setting for a system: >> http://eslam-linux.blogspot.com/2009/02/ibm-thinkpad-trackpoint-configuration.html >> # echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity >> # echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/speed >> # echo -n 0 > /sys/devices/platform/i8042/serio1/serio2/press_to_select >> >> >> ----- Original Message ---- >> > From: Sean Collins >> > To: plug@lists.phillylinux.org >> > Sent: Tuesday, October 6, 2009 12:43:11 PM >> > Subject: Re: [PLUG] Failure trying to write to a file in a virtual file system >> > >> > Ah - it may be this bit right here >> > >> > > When writing sysfs files, userspace processes should first read the >> > > entire file, modify the values it wishes to change, then write the >> > > entire buffer back. >> > >> > http://delcom.sourceforge.net/sysfs.txt >> > >> > When you echo something and pipe it into the sysfs mount, that's a >> > stream. I think sysfs wants an atomic write. >> > >> > Again, a bit out on a limb here, but that's my best guess without >> > access to my linux box. >> > >> > >> > >> > Thank You, >> > >> > Sean Collins >> > >> > ---------------------------------------------------------------- >> > This message was sent using IMP, the Internet Messaging Program. >> > >> > ___________________________________________________________________________ >> > 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 >> >> ___________________________________________________________________________ >> 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 > > ___________________________________________________________________________ > 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 > -- J. ___________________________________________________________________________ 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 ___________________________________________________________________________ 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
|
|