huan / docker-wechat

DoChat is a Dockerized WeChat (盒装微信) PC Windows Client for Linux
https://hub.docker.com/r/zixia/wechat
Apache License 2.0
2.25k stars 204 forks source link

X Error of failed request: GLXBadContext #50

Open huan opened 4 years ago

huan commented 4 years ago
$ wine home/user/.wine/drive_c/Program\ Files/Tencent/WeChat/WeChat.exe 

[0426/191233:INFO:exception_record.cc(518)] [QB]Process ID: 8 Type: 1
[0426/191233:ERROR:network_change_notifier_win.cc(156)] WSALookupServiceBegin failed with: 8
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  628
  Current serial number in output stream:  627

$ glxinfo
name of display: :1
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  63
  Current serial number in output stream:  62

Maybe it's related to #29

Links

  1. https://github.com/scottyhardy/docker-wine/issues/57
gluckzhang commented 3 years ago

Hi @huan , great to meet you here! Long time no see :)

I had the same issue as you mentioned. My solution is:

  1. Install The NVIDIA Container Toolkit
    # Setup the stable repository and the GPG key
    distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
    && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
    && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
    # Install the nvidia-docker2
    sudo apt-get update
    sudo apt-get install -y nvidia-docker2
    # Restart the docker service
    sudo systemctl restart docker

This can save us some time in tuning the extra arguments when executing docker run. To test whether the installation works, one can run: sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi, which should output some information about the Nvidia card.

  1. Add --gpus=all --env="NVIDIA_DRIVER_CAPABILITIES=all" into the docker run command. This should make the GPU work in a container.

Hopefully it helps. Cheers!

Ref: [1] https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit [2] https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html#driver-capabilities

huan commented 3 years ago

Thank you very much for proposing a solution!

I'll try it out when I got time, appreciate it.

Earsuit commented 3 years ago

This works for me, thanks!

jicki commented 3 years ago

Hi @huan , great to meet you here! Long time no see :)

I had the same issue as you mentioned. My solution is:

  1. Install The NVIDIA Container Toolkit
# Setup the stable repository and the GPG key
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
   && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
   && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
# Install the nvidia-docker2
sudo apt-get update
sudo apt-get install -y nvidia-docker2
# Restart the docker service
sudo systemctl restart docker

This can save us some time in tuning the extra arguments when executing docker run. To test whether the installation works, one can run: sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi, which should output some information about the Nvidia card.

  1. Add --gpus=all --env="NVIDIA_DRIVER_CAPABILITIES=all" into the docker run command. This should make the GPU work in a container.

Hopefully it helps. Cheers!

Ref: [1] https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit [2] https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html#driver-capabilities

Good Job ..

HRHLALALA commented 2 years ago

@gluckzhang Hi, thanks for your answer but I got the error as following:

docker: Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #1: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: mount error: file creation failed: /var/lib/docker/overlay2/fb8685393211dac3ac80c458ef659f22c16012bd3d7803aa143e6209f40d09b1/merged/run/nvidia-persistenced/socket: no such device or address: unknown.

Do you know how to solve it?

gluckzhang commented 2 years ago

Hi @HRHLALALA , I just read your message. It seems that the toolkit failed to mount the NVIDIA-related files/devices.

Have you tried sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi after installing the NVIDIA Container Toolkit? Any error there?

ST-Saint commented 2 years ago

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi output the correct GPU

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.48.07    Driver Version: 515.48.07    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:2B:00.0  On |                  N/A |
|  0%   39C    P8    13W / 170W |    409MiB / 12288MiB |      5%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

but still run into error

+ main
++ id -u
+ '[' 1000 -ne 0 ']'
+ startWechat
+ hello
++ cat /VERSION
+ VERSION=0.15.0
+ echo '[DoChat] 盒装微信 v0.15.0'
[DoChat] 盒装微信 v0.15.0
+ setupFontDpi
+ DELETE_KEYS=('HKEY_CURRENT_USER\Control Panel\Desktop' 'HKEY_CURRENT_USER\Software\Wine\Fonts')
+ for key in "${DELETE_KEYS[@]}"
+ wine reg DELETE 'HKEY_CURRENT_USER\Control Panel\Desktop' /v LogPixels /f
+ true
+ for key in "${DELETE_KEYS[@]}"
+ wine reg DELETE 'HKEY_CURRENT_USER\Software\Wine\Fonts' /v LogPixels /f
+ wine reg ADD 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts' /v LogPixels /t REG_DWORD /d 120 /f
+ /dochat/patch-hosts.sh
+ /dochat/disable-upgrade.sh
Disabling patch for /home/user/.wine/drive_c/users/user/AppData/Roaming/Tencent/WeChat ...
Disabling patch for /home/user/.wine/drive_c/users/user/Application Data/Tencent/WeChat ...
+ '[' -n true ']'
+ unset WINEDEBUG
+ wine reg query 'HKEY_CURRENT_USER\Software\Tencent\WeChat'

HKEY_CURRENT_USER\Software\Tencent\WeChat
    NeedUpdateType    REG_DWORD    0x0

[DoChat] DISPLAY=:0
+ echo '[DoChat] DISPLAY=:0'
++ head -1 /home/VERSION.WeChat
+ VERSION=3.3.0.115
+ echo '[DoChat] WeChat 3.3.0.115'
+ true
[DoChat] WeChat 3.3.0.115
[DoChat] Starting...
+ echo '[DoChat] Starting...'
+ '[' -n true ']'
+ wine 'C:\Program Files\Tencent\WeChat\WeChat.exe'
00e4:fixme:ver:GetCurrentPackageId (04BCFEF0 00000000): stub
00e4:fixme:sync:SetWaitableTimerEx (000000C4, 04BCFDA0, 0, 00000000, 00000000, 00000000, 1500) semi-stub
0114:fixme:iphlpapi:NotifyAddrChange (Handle 0x62efefc, overlapped 0x62efee4): stub
00e0:fixme:win:RegisterTouchWindow (00010056 00000000): stub
011c:fixme:ole:NdrCorrelationInitialize (0694F154, 0694EC30, 1024, 0x0): semi-stub
011c:fixme:ole:NdrCorrelationFree (0694F154): stub
011c:fixme:reg:RegOpenUserClassesRoot (0000019C, 0x0, 0x2000000, 0694FBC8) semi-stub
0118:fixme:wlanapi:WlanEnumInterfaces (00000001, 00000000, 063FE380) semi-stub
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 04A0B060, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 064465E8, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 04A0B060, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 04A0B060, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 06420D30, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 04AC4A00, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
011c:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
011c:fixme:wbemprox:client_security_SetBlanket 62EA17A8, 04A0B060, 10, 0, (null), 3, 3, 00000000, 0x00000000
011c:fixme:wbemprox:client_security_Release 62EA17A8
0124:fixme:file:NtLockFile I/O completion on lock not implemented yet
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  285
  Current serial number in output stream:  284
hykilpikonna commented 1 year ago

Docker compose version:

    wechat:
        container_name: wechat
        image: zixia/wechat
        privileged: true
        stdin_open: true
        ipc: host
        environment:
            - XMODIFIERS=@im=fcitx
            - GTK_IM_MODULE=fcitx
            - QT_IM_MODULE=fcitx
            - GID=1000
            - UID=1000
            - DISPLAY
            - NVIDIA_DRIVER_CAPABILITIES=all
        volumes:
            - "./wechat/appdata:/home/user/.wine/drive_c/users/user/Application Data/"
            - "./wechat/files:/home/user/WeChat Files/"
            - "/tmp/.X11-unix:/tmp/.X11-unix"
        deploy:
            resources:
                reservations:
                    devices:
                        - driver: nvidia
                          count: 1
                          capabilities: [gpu]