bordaigorl / rmview

A live viewer for reMarkable written in PyQt5
GNU General Public License v3.0
753 stars 62 forks source link

libGL error: MESA-LOADER: failed to retrieve device information #160

Open fosterlynch opened 5 months ago

fosterlynch commented 5 months ago

Remarkable 2 SW version 3.11.2.5

Using VNC branch of rmview,

along with rmview -v inside sh docker-run.sh results in the following behavior


[INFO] STARTING: Wed May  1 00:46:19 2024                                                                                                                                                                          
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[INFO] Searching configuration in rmview.json, /root/.config/rmview.json
[INFO] Fetching configuration from /root/.config/rmview.json
[WARNING] Config file "/root/.config/rmview.json" is readable by others (permissions=644). If your config file contains secrets (e.g. password) you are strongly encouraged to make sure it's not readable by other users (chmod 600 /root/.config/rmview.json)
libGL error: MESA-LOADER: failed to retrieve device information
[intel_init_bufmgr:1009] Error initializing buffer manager.
libGL error: failed to create dri screen
libGL error: failed to load driver: i915
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: iris

I have the same issues people have described in #156 (red dot but stuck on connecting) I wonder if they were to run rmview -v if maybe they are also having libGL issues?

additional docker info

Client: Docker Engine - Community                                                                                                                                                                                  
 Version:    26.0.1                                                                                                                                                                                                
 Context:    default                                                                                                                                                                                               
 Debug Mode: false                                                                                                                                                                                                 
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.13.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.26.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 372
  Running: 0
  Paused: 0
  Stopped: 372
 Images: 399
 Server Version: 26.0.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e377cd56a71523140ca6ae87e30244719194a521
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.15.0-105-generic
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 31.05GiB
 Name: 76383lx
 ID: f3065bf7-6a51-4a6c-8ab5-59d30ce98a67
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
mak3r commented 5 months ago

I am running into a similar issue.

I think it's not the network but rather an issue with loading the video driver. I notice you have the Intel i915/iris and I have an issue with the AMD radeonsi some (null) drivers. Additionally, I actually have 2 GPUs, the AMD as mentiononed but also an NVidia GeForce RTX 4060 (Asus ROG Zephyrus GA402). The other thing to note in my case is that I'm running podman not docker. It should be a drop-in replacement but you never know.

I can see the pen trail when I hover the pen over the tablet at a close distance and move it around but it stays on the "connecting to remarkable..." screen. And the pen marks my remarkable2 page but doesn't show up in the viewer.

docker-run.sh ouput:

2024-05-01 16:45:40+0000 [-] Log opened.
[INFO] STARTING: Wed May  1 16:45:40 2024
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[INFO] Searching configuration in rmview.json, /root/.config/rmview.json
[DEBUG] Configuration failure in rmview.json: [Errno 2] No such file or directory: 'rmview.json'
[INFO] Fetching configuration from /root/.config/rmview.json
libGL error: pci id for fd 10: 1002:15bf, driver (null)
libGL error: No driver found
libGL error: failed to load driver: (null)
libGL error: pci id for fd 10: 1002:15bf, driver (null)
pci id for fd 11: 1002:15bf, driver (null)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
[DEBUG] Config values: {'ssh': {'address': '192.168.8.135', 'username': 'root', 'password': '**********', 'timeout': 2, 'host_key_policy': 'auto_add'}, 'orientation': 'auto', 'pen_size': 15, 'pen_color': 'red', 'pen_trail': 200}
[INFO] Using known hosts file: /root/.config/rmview_known_hosts
[INFO] Loaded known hosts from /root/.config/rmview_known_hosts
[INFO] Connecting...
[INFO] Connected to 192.168.8.135
[DEBUG] Using update.conf as SW version authority
[INFO] Detected SW version: 3.11.2.5
[INFO] Detected device: reMarkable 2.0
[INFO] Using backend 'screenshare'
[INFO] Connecting to ScreenShare, make sure you enable it
[WARNING] Authenticating, please wait...
2024-05-01 16:45:51+0000 [-] ChallengeReaderProtocol starting on 5901
2024-05-01 16:45:51+0000 [-] Starting protocol <rmview.screenstream.screenshare.ChallengeReaderProtocol object at 0x7f7225246640>
[DEBUG] Stopping connection worker
[DEBUG] Stopping ScreenShare streamer thread...
[INFO] Disconnecting from VNC server...
[DEBUG] Disconnect failed ('ScreenShareStream' object has no attribute 'vncClient'), stopping reactor
[DEBUG] ScreenShare streamer thread stopped.
2024-05-01 16:45:52+0000 [ChallengeReaderProtocol (UDP)] (UDP Port 5901 Closed)
2024-05-01 16:45:52+0000 [ChallengeReaderProtocol (UDP)] Stopping protocol <rmview.screenstream.screenshare.ChallengeReaderProtocol object at 0x7f7225246640>
2024-05-01 16:45:52+0000 [-] Main loop terminated.
[INFO] QUITTING: Wed May  1 16:45:52 2024

podman info:

host:
  arch: amd64
  buildahVersion: 1.35.3
  cgroupControllers:
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-30.1.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: unknown'
  cpuUtilization:
    idlePercent: 95.25
    systemPercent: 1.32
    userPercent: 3.43
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: opensuse-tumbleweed
    version: "20240419"
  eventLogger: journald
  freeLocks: 2024
  hostname: zephyrus
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1002
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 6.8.7-1-default
  linkmode: dynamic
  logDriver: journald
  memFree: 12547796992
  memTotal: 32819916800
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.10.0-1.3.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.10.0
    package: netavark-1.10.3-1.2.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.10.3
  ociRuntime:
    name: crun
    package: crun-1.14.4-49.1.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.14.4
      commit: a220ca661ce078f2c37b38c92e66cf66c012d9c1
      rundir: /run/user/1001/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-20240405.954589b-1.1.x86_64
    version: |
      pasta unknown version
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: false
    path: /run/user/1001/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2147549184
  swapTotal: 2147549184
  uptime: 3h 27m 50.00s (Approximately 0.12 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.opensuse.org
  - registry.suse.com
  - docker.io
store:
  configFile: /home/suse-mak3r/.config/containers/storage.conf
  containerStore:
    number: 23
    paused: 0
    running: 0
    stopped: 23
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/suse-mak3r/.local/share/containers/storage
  graphRootAllocated: 1486141521920
  graphRootUsed: 191271260160
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 70
  runRoot: /run/user/1001/containers
  transientStore: false
  volumePath: /home/suse-mak3r/.local/share/containers/storage/volumes
version:
  APIVersion: 5.0.2
  Built: 1713433976
  BuiltTime: Thu Apr 18 05:52:56 2024
  GitCommit: ""
  GoVersion: go1.21.9
  Os: linux
  OsArch: linux/amd64
  Version: 5.0.2
marcorusc commented 4 months ago

The following fix quickly fixed the problem for me: https://stackoverflow.com/questions/71010343/cannot-load-swrast-and-iris-drivers-in-fedora-35/72200748#72200748

I do not have anymore the libGL error: MESA-LOADER, but I still cannot connect share the screen. Probably something related to #146 but not sure...

rgon commented 3 months ago

Same issue here using Ubuntu 24.04 with Wayland with intel iGPU (MESA drivers). I suspect the previous commenter's fixes worked or happened only with eGPU/iGPU because switching those configurations most likely changed the display server back to X11.

startup logs ```log [INFO] STARTING: Wed Jun 5 09:05:34 2024 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' [INFO] Searching configuration in rmview.json, /root/.config/rmview.json [INFO] Fetching configuration from /root/.config/rmview.json [WARNING] Config file "/root/.config/rmview.json" is readable by others (permissions=644). If your config file contains secrets (e.g. password) you are strongly encouraged to make sure it's not readable by other users (chmod 600 /root/.config/rmview.json) libGL error: MESA-LOADER: failed to retrieve device information libGL error: Version 4 or later of flush extension not found libGL error: failed to load driver: i915 ```

The docker-run.sh command forwards the X11 sockets, but since all the environment variables say it's running on Wayland, the Qt platform runs expecting to be able to access it. As it can't, it errors out.

This can be solved by overriding the XDG_SESSION_TYPE environment variable to XDG_SESSION_TYPE=x11 when running the docker command, since xwayland is probably running on most systems for backup compatibility, so the display server connection will be successful.

We could probably add support for wayland directly (QT_QPA_PLATFORM=wayland), though. This is most definitely a 'hack'.

Changing the command to the following solves the issue:

docker run \
  --env XDG_SESSION_TYPE=x11 \
  --env DISPLAY=$DISPLAY \
  --network host \
  --volume $CONFIG_DIR:/root/.config \
  --volume /tmp/.X11-unix:/tmp/.X11-unix \
  rmview
fosterlynch commented 2 months ago

hey @rgon

I pulled your recent MR.

When running as is, I still got the same errors

libGL error: MESA-LOADER: failed to retrieve device information
[intel_init_bufmgr:1009] Error initializing buffer manager.
libGL error: failed to create dri screen
libGL error: failed to load driver: i915
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: iris

what I did to debug

docker run -it <container ID> /bin/bash env I noticed that XGD_SESSION_TYPE was not present

I added to the dockerfile ENV XDG_SESSION_TYPE=x11

which does add that argument to my env in my docker container, but still the same issues persist.


Local env XGD_SESSION_TYPE is x11, so it looks like I have been running X11 this whole time.

Can you add any relevant laptop, remarkable details on your end and I can try to compare your setup vs mine?

or if there are details on my side you'd like to know i'm happy to provide.