LXC-Web-Panel icon indicating copy to clipboard operation
LXC-Web-Panel copied to clipboard

failed login using default shows internal server error

Open bmullan opened this issue 11 years ago • 7 comments

ubuntu 14.04 lxc already installed and used installed using instructions at claudyus/lxc-web-panel point browser at 127.0.0.1:5000 and I see loging screen try to login w/default ID and password and immediately get 500 Internal Server error ?

bmullan avatar Aug 12 '14 14:08 bmullan

try to run the lwp.py with option --debug so that is a bit more verbose about the error.

claudyus avatar Aug 12 '14 17:08 claudyus

you can also set debug in the config file and restart

robvdl avatar Aug 13 '14 05:08 robvdl

Finally got back to trying this with Debug ... not sure what exactly you want to look at because there was some Traceback info in my terminal window but also in the web browser ... I will include both below. ==={ from terminal window }=== 127.0.0.1 - - [20/Aug/2014 22:50:50] "GET / HTTP/1.1" 500 - Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request return self.view_functionsrule.endpoint File "/srv/lwp/lwp.py", line 109, in new_handler return handler(_args, *_kwargs) File "/srv/lwp/lwp.py", line 132, in home listx = lxc.listx() File "/srv/lwp/lxclite/init.py", line 147, in listx state = info(container)['state'] File "/srv/lwp/lxclite/init.py", line 110, in info output = _run('lxc-info -qn {}'.format(container), output=True).splitlines() AttributeError: 'bool' object has no attribute 'splitlines' 127.0.0.1 - - [20/Aug/2014 22:50:50] "GET /?debugger=yes&cmd=resource&f=style.css HTTP/1.1" 200 - 127.0.0.1 - - [20/Aug/2014 22:50:50] "GET /?debugger=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 - 127.0.0.1 - - [20/Aug/2014 22:50:50] "GET /?debugger=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 - 127.0.0.1 - - [20/Aug/2014 22:50:51] "GET /?debugger=yes&cmd=resource&f=console.png HTTP/1.1" 200 - 127.0.0.1 - - [20/Aug/2014 22:50:51] "GET /?debugger=yes&cmd=resource&f=source.png HTTP/1.1" 200 - 127.0.0.1 - - [20/Aug/2014 22:50:51] "GET /?debugger=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

=={ from Browser after attempting to login to LWP using admin:admin }===

AttributeError

AttributeError: 'bool' object has no attribute 'splitlines' Traceback (most recent call last)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app

response = self.make_response(self.handle_exception(e))

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/srv/lwp/lwp.py", line 109, in new_handler

return handler(*args, **kwargs)

File "/srv/lwp/lwp.py", line 132, in home

listx = lxc.listx()

File "/srv/lwp/lxclite/__init__.py", line 147, in listx

state = info(container)['state']

File "/srv/lwp/lxclite/__init__.py", line 110, in info

output = _run('lxc-info -qn {}'.format(container), output=True).splitlines()

AttributeError: 'bool' object has no attribute 'splitlines'

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

bmullan avatar Aug 21 '14 02:08 bmullan

Hello bmullar, this probably happen if you have a directory inside /var/lib/lxc that is not a valid container.

Probably you have an empty directory here or a backup directory that should be removed. Let we know.

claudyus avatar Aug 21 '14 09:08 claudyus

My friend at work had a patch for this, let me ask him tomorrow, it was pretty simple

Sorry, just to add some more info... I meant just checking for a few extra files in each container folder in /var/lib/lxc, it was a pretty simple patch.

robvdl avatar Aug 21 '14 10:08 robvdl

@claudyus - Ok. this email is going to list a mix of comments.

  • I have backups of my existing containers so I deleted everything in /var/lib/lxc and did a service lwp restart. This time it does let me log in. The existing LXC containers I deleted in /var/lib/lxc ... were working containers or directories created by my install of lxc on ubuntu 14.04 such as the 2 "template" directories that are auto-created. Maybe LWP needs some better parsing in its examination of /var/lib/lxc contents somehow?
  • I tried to create the 1st container (called it 'test') and LWP and the browser's tab just kept spinning saying "Connecting"... the progress bar didn't really show "progress". The only reason I knew anything was happening was I'd started LWP.PY in a terminal and could watch as files for the new container template were retrieved etc. However, that seems to be taking a very long time compared to just doing lxc-create -t ubuntu -n test from the command line? I didn't really time it so maybe its my imagination.
  • Were you aware of the new "download" template-type that Stephane Graber (lxc core developer) introduced? They have daily builds for rootfs of most existing template-types so creating a new LXC container is much faster than building the rootfs from scratch. Stephane's 10 part LXC blog series on LXC 1.x describes the new "download" template and "unprivileged" containers: https://www.stgraber.org/2014/01/17/lxc-1-0-unprivileged-containers/
  • Stephane also introduced the LXC python API. The API documentation can be found at: https://qa.linuxcontainers.org/master/current/doc/api/
  • Are unprivileged containers supported in LWP yet? IMHO unprivilged containers would be widely used with LWP, if supported, since creating the containers wouldn't require "sudo" ?

bmullan avatar Aug 21 '14 10:08 bmullan

Hi bmullar, this commit https://github.com/claudyus/LXC-Web-Panel/commit/e2c527eb0c50eaefd64ab867b089af829afbe9c3 introduce a first step to support "unprivileged" container. This commit implement the original code from Stephane here https://github.com/claudyus/LXC-Web-Panel/commit/0579ccc0c8cd20e13e811d888a5e8ecb90cbf04b

About the download template it is "supported", you can use it but you should specify options like ```-d ubuntu -r trusty -a amd64" under "LXC Container configuration"

Anyway to discuss in general about lwp write me a mail, let keep the discussion in topic about your login bug.

claudyus avatar Aug 23 '14 06:08 claudyus