webfaction: Internal Server Error after upgrade to 1.96.2

75 views
Skip to first unread message

Pepe Araya

unread,
Jun 4, 2011, 3:30:13 AM6/4/11
to web...@googlegroups.com
Hi, my site have an "internal server error" after upgrade to 1.96.2

Webfaction support say:

Your app is trying to wrote to /dev/urandom which it will never be able to do:

[pepearaya@web136 apache2]$ tail /home/pepearaya/logs/user/error_crewcatalyst.log
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] from globals import current
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/globals.py", line 21, in <module>
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] from html import xmlescape, TABLE, TR, PRE
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/html.py", line 29, in <module>
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] from utils import web2py_uuid, hmac_hash
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/utils.py", line 98, in <module>
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] ctokens = initialize_urandom()
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/utils.py", line 90, in initialize_urandom
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] open('/dev/urandom','wb').write(''.join(chr(t) for t in ctokens))
[Sat Jun 04 01:34:25 2011] [error] [client 127.0.0.1] IOError: [Errno 13] Permission denied: '/dev/urandom'

So, you need to change that line to: "open('/dev/urandom','r').write(''.join(chr(t) for t in ctokens))"

after that change I get this error:
open('/dev/urandom','r').write(''.join(chr(t) for t in ctokens))
[Sat Jun 04 02:12:33 2011] [error] [client 127.0.0.1] IOError: [Errno 9] Bad file descriptor

any idea of what i can to do?

thanks!

Pepe Araya

unread,
Jun 4, 2011, 4:09:50 AM6/4/11
to web...@googlegroups.com
Reply 2:

> open('/dev/urandom','r').write(''.join(chr(t) for t in ctokens))

In this line, you are attempting to open /dev/urandom for reading, and then are attempting to write to it.

Instead, you need to read the data from /dev/urandom, and then open a new file for writing to write your output.

Hope that helps!


______

what can i do?

Massimo Di Pierro

unread,
Jun 4, 2011, 10:01:46 AM6/4/11
to web2py-users
I am releasing 1.96.3 in a minute to fix this.

Massimo

ron_m

unread,
Jun 4, 2011, 10:08:02 AM6/4/11
to web...@googlegroups.com
On my Ubuntu 10.04 system /dev/urandom has mode 666 which means read and write for everyone. If it is not writeable on Webfaction for others then it is either a policy for a different Linux distribution or a policy of Webfaction.

The idea behind writing to /dev/urandom is to seed the random number generator so the output read from the generator is less likely to be guessed which increases security.

ron_m

unread,
Jun 4, 2011, 10:29:35 AM6/4/11
to web...@googlegroups.com
To add some more, on Ubuntu and according to man urandom all major Linux distributions since 2000 the file /etc/init.d/urandom saves the random number pool into a seed file and restores it on startup by writing it back to /dev/urandom.

Pepe Araya

unread,
Jun 4, 2011, 4:02:05 PM6/4/11
to web...@googlegroups.com
Thanks Massimo!

I'll give a try

Pepe Araya

unread,
Jun 4, 2011, 6:45:09 PM6/4/11
to web...@googlegroups.com
Massimo, bad news :( it not work
this is the log:

[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]   File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/html.py", line 29, in <module>
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]     from utils import web2py_uuid, hmac_hash
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]   File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/utils.py", line 98, in <module>
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]     ctokens = initialize_urandom()
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]   File "/home/pepearaya/webapps/crewcatalyst/web2py/gluon/utils.py", line 90, in initialize_urandom
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1]     open('/dev/urandom','wb').write(''.join(chr(t) for t in ctokens))
[Sat Jun 04 17:41:31 2011] [error] [client 127.0.0.1] IOError: [Errno 13] Permission denied: '/dev/urandom'


Massimo Di Pierro

unread,
Jun 5, 2011, 8:41:07 PM6/5/11
to web2py-users
can you check the new trunk? If ok, I will post 1.96.4

Pepe Araya

unread,
Jun 5, 2011, 9:50:36 PM6/5/11
to web...@googlegroups.com
Massimo, I did a fresh install with the new trunk and this is the traceback:

Traceback (most recent call last):
  File "web2py.py", line 16, in <module>
    import gluon.widget
  File "/home/pepearaya/webapps/crewcatalyst2/web2py/gluon/__init__.py", line 15, in <module>
    from globals import current
  File "/home/pepearaya/webapps/crewcatalyst2/web2py/gluon/globals.py", line 21, in <module>
    from html import xmlescape, TABLE, TR, PRE
  File "/home/pepearaya/webapps/crewcatalyst2/web2py/gluon/html.py", line 29, in <module>
    from utils import web2py_uuid, hmac_hash
  File "/home/pepearaya/webapps/crewcatalyst2/web2py/gluon/utils.py", line 103, in <module>
    ctokens = initialize_urandom()
  File "/home/pepearaya/webapps/crewcatalyst2/web2py/gluon/utils.py", line 93, in initialize_urandom
    except IOerror:
NameError: global name 'IOerror' is not defined

Pepe Araya

unread,
Jun 5, 2011, 11:36:56 PM6/5/11
to web...@googlegroups.com
Quoting Jonathan Lundell:

It should be IOError (capital E)

---

with that change it works.
Reply all
Reply to author
Forward
0 new messages