fcwu / docker-ubuntu-vnc-desktop

A Docker image to provide web VNC interface to access Ubuntu LXDE/LxQT desktop environment.
Apache License 2.0
3.91k stars 1.42k forks source link

White screen when login after logout #271

Open vemonet opened 2 years ago

vemonet commented 2 years ago

Describe the bug White screen when login to the web UI after logout

To Reproduce Steps to reproduce the behavior:

  1. Deploy Ubuntu dekstop
  2. Login: that works
  3. Logout
  4. Re-login: white screen

Expected behavior Should be able to re-login

Versions (please complete the following information):

Additional context

Error message printed by the server:

>>> sending remote command: "cmd=fb" via X11VNC_REMOTE X property.
2022-01-25 12:20:55,261 ERROR Command '['supervisorctl', '-c', '/etc/supervisor/supervisord.conf', 'status']' returned non-zero exit status 3. (response.py:36)
Traceback (most recent call last):
  File "/usr/local/lib/web/backend/vnc/response.py", line 28, in func
    return f(*args, **kwargs)
  File "/usr/local/lib/web/backend/vnc/app.py", line 32, in apistate
    mystate = state.to_dict()
  File "/usr/local/lib/web/backend/vnc/state.py", line 45, in to_dict
    self._update_health()
  File "/usr/local/lib/web/backend/vnc/state.py", line 31, in _update_health
    output = gsp.check_output([
  File "/usr/local/lib/python3.8/dist-packages/gevent/subprocess.py", line 348, in check_output
    raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command '['supervisorctl', '-c', '/etc/supervisor/supervisord.conf', 'status']' returned non-zero exit status 3.

It is due to this line: https://github.com/fcwu/docker-ubuntu-vnc-desktop/blob/develop/rootfs/usr/local/lib/web/backend/vnc/state.py#L31

output = gsp.check_output([
            'supervisorctl', '-c', '/etc/supervisor/supervisord.conf',
            'status'
        ], encoding='UTF-8')

It's weird because it I try to run this from the terminal with os.system instead of gevent.subprocess after connecting with the root user it works:

import os
os.system('supervisorctl -c /etc/supervisor/supervisord.conf status')

But it does not work with gevent:

from gevent import subprocess as gsp
output = gsp.check_output([
            'supervisorctl', '-c', '/etc/supervisor/supervisord.conf',
            'status'
        ], encoding='UTF-8')

@fcwu do you have any idea where it could come from? I'll look into it more deeply and try to fix this in my fork https://github.com/vemonet/docker-ubuntu-vnc-desktop

vemonet commented 2 years ago

The issue happens when you logout, then try to log back in, even when using the image locally. The desktop app bar at the bottom is not there anymore

It is due to x:wm being in EXITED status when the python backend checks the processes status with supervisorctl I found a way to mitigate this by restarting x:wm if it is found to be in EXITED status when doing the check

You can find the changes here: https://github.com/vemonet/docker-ubuntu-vnc-desktop/blob/develop/rootfs/usr/local/lib/web/backend/vnc/state.py#L44

Not sure if this is optimal, but it fixes the issue for us! Locally and when deploying on Kubernetes

You can use it with the published docker image ghcr.io/vemonet/docker-ubuntu-vnc-desktop:latest

docker run -p 6080:80 -v /dev/shm:/dev/shm -e PASSWORD=pass -e HTTP_PASSWORD=pass -e VNC_PASSWORD=pass ghcr.io/vemonet/docker-ubuntu-vnc-desktop:latest

I also added a GitHub Action workflow that I could contribute, to automatically build and publish an image to the GitHub Container Registry at each push to the develop branch.

@fcwu Let me know if you are interested for me to send a pull request for one or both features!