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.23k stars 199 forks source link

无法正常打开 DoChat Exited with code [0] #188

Open baojiliu opened 1 year ago

baojiliu commented 1 year ago

在运行DoChat时,报错。随后启用DEBUG模式,发现Make sure that your X server is running and that $DISPLAY is set correctly ,我认为X11 目录挂在是正常的。期待任何建议,谢谢。

基本信息:

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

- X11

echo $DISPLAY :0 tree /tmp/.X11-unix /tmp/.X11-unix └── X0 0 directories, 1 file

- docker
```bash
docker version
Client:
 Version:           20.10.20
 API version:       1.41
 Go version:        go1.19.2
 Git commit:        9fdeb9c3de
 Built:             Sat Oct 22 19:31:23 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.20
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.2
  Git commit:       03df974ae9
  Built:            Sat Oct 22 19:30:29 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6.m
 runc:
  Version:          1.1.4
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

错误日志:

sudo curl -sL https://gitee.com/mirrors/dochat/raw/main/dochat.sh | DOCHAT_DEBUG=true bash

       ____         ____ _           _
      |  _ \  ___  / ___| |__   __ _| |_
      | | | |/ _ \| |   | '_ \ / _` | __|
      | |_| | (_) | |___| | | | (_| | |_
      |____/ \___/ \____|_| |_|\__,_|\__|

      https://github.com/huan/docker-wechat

                +--------------+
               /|             /|
              / |            / |
             *--+-----------*  |
             |  |           |  |
             |  |   盒装    |  |
             |  |   微信    |  |
             |  +-----------+--+
             | /            | /
             |/             |/
             *--------------*

      DoChat /dɑɑˈtʃæt/ (Docker-weChat) is:

      📦 a Docker image
      🤐 for running PC Windows WeChat
      💻 on your Linux desktop
      💖 by one-line of command

🚀 Pulling the docker image...

3.3.0.115: Pulling from zixia/wechat
Digest: sha256:851ef44dcbdaed6f0db8f538ea2a29d713292347a54ee711225f77682417673b
Status: Image is up to date for zixia/wechat:3.3.0.115
docker.io/zixia/wechat:3.3.0.115

🚀 Pulling the docker image done.
WARNING: you should run this program as super-user.
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
🚀 Starting DoChat /dɑɑˈtʃæt/ ...

+ 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
[DoChat] WeChat 3.3.0.115
+ echo '[DoChat] WeChat 3.3.0.115'
+ true
+ echo '[DoChat] Starting...'
[DoChat] Starting...
+ '[' -n true ']'
+ wine 'C:\Program Files\Tencent\WeChat\WeChat.exe'
00e0:fixme:ver:GetCurrentPackageId (04BCFEF0 00000000): stub
00e0:fixme:sync:SetWaitableTimerEx (000000BC, 04BCFDA0, 0, 00000000, 00000000, 00000000, 1500) semi-stub
00dc:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
00dc:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
011c:fixme:iphlpapi:NotifyAddrChange (Handle 0x661fefc, overlapped 0x661fee4): stub
00dc:fixme:win:RegisterTouchWindow (00030040 00000000): stub
0120:err:seh:NtRaiseException Unhandled exception code c0000005 flags 0 addr 0x7bc2a1f5
greasycat commented 1 year ago

Try

sudo pacman -S xorg-xhost
xhost +

https://github.com/huan/docker-wechat/issues/68#issuecomment-687655982

Adel-Magebinary commented 1 year ago

For ubuntu users, go

xhost +SI:localuser:YOUR_USER_NAME

WhyNotHugo commented 1 year ago

I ran:

> xhost +
access control disabled, clients can connect from any host

Still seeing the same issue:

[DoChat] WeChat 3.3.0.115
[DoChat] Starting...
+ echo '[DoChat] Starting...'
+ '[' -n true ']'
+ wine 'C:\Program Files\Tencent\WeChat\WeChat.exe'
00e0:fixme:ver:GetCurrentPackageId (04BCFEF0 00000000): stub
00e0:fixme:sync:SetWaitableTimerEx (000000C0, 04BCFDA0, 0, 00000000, 00000000, 00000000, 1500) semi-stub
00dc:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
00dc:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
011c:fixme:iphlpapi:NotifyAddrChange (Handle 0x661fefc, overlapped 0x661fee4): stub
00dc:fixme:win:RegisterTouchWindow (00030040 00000000): stub
0120:err:seh:NtRaiseException Unhandled exception code c0000005 flags 0 addr 0x7bc2a1f5
WhyNotHugo commented 1 year ago

I tinkered the script a bit to get an interactive shell:

diff --git a/dochat.sh b/dochat.sh
index 692aff0..55bdc93 100755
@@ -97,7 +97,7 @@ function main () {
     "${DEVICE_ARG[@]}" \
     --name DoChat \
     --rm \
-    -i \
+    -it \
     \
     -v "$HOME/DoChat/WeChat Files/":'/home/user/WeChat Files/' \
     -v "$HOME/DoChat/Applcation Data":'/home/user/.wine/drive_c/users/user/Application Data/' \

--- a/dochat.sh
+++ b/dochat.sh
@@ -117,12 +117,13 @@ function main () {
     -e UID="$(id -u)" \
     \
     --ipc=host \
     \
+    --entrypoint /bin/bash \
     "$DOCHAT_IMAGE_VERSION"

     echo

And checked the X11 socket:

user@c400af7960ec:/$ whoami
user
user@c400af7960ec:/$ ls -l /tmp/.X11-unix/X0 
srwxr-xr-x 1 root root 0  6月 20 18:13 /tmp/.X11-unix/X0

The socket itself is only writable by root, so the user running wechat cannot connect to it. An ugly hack could be to change the socket to be world writable (777), but this also affects the socket in the host and is terrible security.

I'm not sure how to properly fix this. My user on the host (hugo/1000) maps to root on the container (i.e.: 0). Running wechat as root inside the container would fix this, but would break in situations where docker itself is running as root.