jlesage / docker-handbrake

Docker container for HandBrake
MIT License
809 stars 92 forks source link

[Bug] Headless system crashes with SIGSEVG when starting app #365

Open brandonscript opened 1 month ago

brandonscript commented 1 month ago

Current Behavior

I'm not entirely sure what specifically is incorrect, or if anything, however I'm running a headless Ubuntu 22.04 box with docker, and though I connect to it with the Microsoft RDP client (since VNC no longer works on Ubuntu), I generally don't have a display connected.

When starting the app, I get an endless loop of errors:

[supervisor        ] service 'app' exited (got signal SIGSEGV).
[supervisor        ] waiting termination of logger thread of service 'app'...
[supervisor        ] logger thread of service 'app' successfully terminated.
[supervisor        ] restarting service 'app'.
[supervisor        ] starting service 'app'...
[supervisor        ] started service 'app'.
[supervisor        ] service 'app' exited (got signal SIGSEGV).
[supervisor        ] waiting termination of logger thread of service 'app'...
[supervisor        ] logger thread of service 'app' successfully terminated.
[supervisor        ] restarting service 'app'.
[supervisor        ] starting service 'app'...
[supervisor        ] started service 'app'.
# (etc.)

After some sleuthing:

  1. Installing xhost and running xhost +: xhost: unable to open display ""
  2. Running /startapp.sh: (fr.handbrake.ghb:20718): Gtk-WARNING **: 11:48:57.696: Failed to open display

I realized that there's no DISPLAY set, since there's no GUI session on the host. I tried adding DISPLAY=${DISPLAY} to my docker-compose file, and this got it a little further, but now xvnc is still failing to load:

[cont-init   ] 89-info.sh: executing...
    ╭――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╮
    │                                                                      │
    │ Application:           HandBrake                                     │
    │ Application Version:   1.8.1                                         │
    │ Docker Image Version:  24.06.1                                       │
    │ Docker Image Platform: linux/amd64                                   │
    │                                                                      │
    ╰――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╯
[cont-init   ] 89-info.sh: terminated successfully.
[cont-init   ] all container initialization scripts executed.
[init        ] giving control to process supervisor.
[supervisor  ] loading services...
[supervisor  ] loading service 'default'...
[supervisor  ] loading service 'logrotate'...
[supervisor  ] loading service 'logmonitor'...
[supervisor  ] service 'logmonitor' is disabled.
[supervisor  ] loading service 'app'...
[supervisor  ] loading service 'gui'...
[supervisor  ] loading service 'xvnc'...
[supervisor  ] loading service 'nginx'...
[supervisor  ] loading service 'certsmonitor'...
[supervisor  ] service 'certsmonitor' is disabled.
[supervisor  ] loading service 'webauth'...
[supervisor  ] service 'webauth' is disabled.
[supervisor  ] loading service 'xcompmgr'...
[supervisor  ] loading service 'openbox'...
[supervisor  ] loading service 'audiorecorder'...
[supervisor  ] service 'audiorecorder' is disabled.
[supervisor  ] loading service 'pulseaudio'...
[supervisor  ] service 'pulseaudio' is disabled.
[supervisor  ] loading service 'autovideoconverter'...
[supervisor  ] all services loaded.
[supervisor        ] starting services...
[supervisor        ] starting service 'logrotate'...
[supervisor        ] started service 'logrotate'.
[supervisor        ] starting service 'xvnc'...
[supervisor        ] started service 'xvnc'.
[logrotate         ] ... 
[xvnc              ] Thu Jul 11 11:50:23 2024
[xvnc              ]  Config:      set rfbport(Int) to 5900
[xvnc              ]  Config:      set UseIPv6(Bool) to yes(1)
[xvnc              ]  Config:      set rfbunixpath(String) to /tmp/vnc.sock
[xvnc              ]  Config:      set rfbunixmode(Int) to 0660
[xvnc              ]  Config:      set SecurityTypes(String) to VncAuth
[xvnc              ]  Config:      set PasswordFile(String) to /tmp/.vncpass
[xvnc              ]  Config:      set desktop(String) to HandBrake
[xvnc              ] Xvnc TigerVNC 1.13.1 - built Jun 29 2024 04:33:24
[xvnc              ] Copyright (C) 1999-2022 TigerVNC Team and many others (see README.rst)
[xvnc              ] See https://www.tigervnc.org for information on TigerVNC.
[xvnc              ] Underlying X server release 12014000
[xvnc              ]  vncext:      VNC extension running!
[xvnc              ]  Config:      set immutable AllowOverride
[xvnc              ]  vncext:      Listening for VNC connections on /tmp/vnc.sock (mode 0660)
[xvnc              ]  vncext:      Listening for VNC connections on all interface(s), port 5900
[xvnc              ]  VNCServerST: creating single-threaded server HandBrake
[xvnc              ]  vncext:      created VNC server for screen 0
[supervisor        ] waiting for service 'xvnc' to be ready...
[supervisor        ] service 'xvnc' failed to be started: not ready after 5000 msec, giving up.
[supervisor        ] stopping service 'xvnc'...
[supervisor        ] service 'logrotate' exited (with status 0).
[supervisor        ] waiting termination of logger thread of service 'logrotate'...
[supervisor        ] logger thread of service 'logrotate' successfully terminated.
[xvnc              ] Thu Jul 11 11:50:28 2024
[xvnc              ]  VNCServerST: shutting down server HandBrake
[xvnc              ]  ComparingUpdateTracker: 0 pixels in / 0 pixels out
[xvnc              ]  ComparingUpdateTracker: (1:-nan ratio)
[supervisor        ] service 'xvnc' exited (with status 0).
[supervisor        ] waiting termination of logger thread of service 'xvnc'...
[supervisor        ] logger thread of service 'xvnc' successfully terminated.
[finish      ] executing container finish scripts...
[finish      ] all container finish scripts executed.

Expected Behavior

There should be a way to configure the system to handle headless hosts (or perhaps I am doing something uniquely weird, and this is an RDP issue not a headless issue).

Steps To Reproduce

name: docker-apps

services:
  handbrake:
    # image: jlesage/handbrake
    build: .
    container_name: handbrake
    runtime: nvidia
    restart: unless-stopped
    environment:
      - USER_ID=1000
      - GROUP_ID=1000
      - UMASK=002
      - LANG=en_US.UTF-8
      - KEEP_APP_RUNNING=1
      - DISPLAY=${DISPLAY}
      - DARK_MODE=1
      - TZ=America/Vancouver
      - CONTAINER_DEBUG=1
    ports:
      - "5810:5800"
      - "5918:5900"
    volumes:
      - /etc/docker/handbrake/config:/config
      - /etc/docker/handbrake/output:/output
      - /etc/docker/handbrake/storage:/storage
      - /etc/docker/handbrake/watch:/watch
    networks:
      bridge:
        driver: bridge

And based on this Dockerfile:

FROM jlesage/handbrake:latest AS handbrake
RUN apk add nvtop --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN apk add xhost

# Create /tmp/handbrake directory
RUN mkdir -p /tmp/handbrake && chmod 777 /tmp/handbrake && chown 1000:1000 /tmp/handbrake

Environment

Container creation

(See in ^ repro)

Container log

(See in OP)

Container inspect

[
  {
    "AppArmorProfile": "docker-default",
    "Args": [],
    "Config": {
      "AttachStderr": true,
      "AttachStdin": false,
      "AttachStdout": true,
      "Cmd": [
        "/init"
      ],
      "Domainname": "",
      "Entrypoint": null,
      "Env": [
        "USER_ID=1000",
        "TZ=America/Vancouver",
        "VNC_PASSWORD=starwars",
        "DISPLAY=",
        "KEEP_APP_RUNNING=1",
        "LANG=en_US.UTF-8",
        "UMASK=002",
        "DARK_MODE=1",
        "CONTAINER_DEBUG=1",
        "GROUP_ID=1000",
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/base/sbin:/opt/base/bin",
        "ENV=/root/.docker_rc",
        "SUP_GROUP_IDS=",
        "APP_NICENESS=0",
        "INSTALL_PACKAGES=",
        "PACKAGES_MIRROR=",
        "DISPLAY_WIDTH=1920",
        "DISPLAY_HEIGHT=1080",
        "SECURE_CONNECTION=0",
        "SECURE_CONNECTION_VNC_METHOD=SSL",
        "SECURE_CONNECTION_CERTS_CHECK_INTERVAL=60",
        "WEB_LISTENING_PORT=5800",
        "VNC_LISTENING_PORT=5900",
        "ENABLE_CJK_FONT=0",
        "WEB_AUDIO=0",
        "WEB_AUTHENTICATION=0",
        "WEB_AUTHENTICATION_DEFAULT_USERNAME=",
        "WEB_AUTHENTICATION_DEFAULT_PASSWORD=",
        "HANDBRAKE_DEBUG=0",
        "HANDBRAKE_GUI=1",
        "AUTOMATED_CONVERSION=1",
        "AUTOMATED_CONVERSION_PRESET=General/Very Fast 1080p30",
        "AUTOMATED_CONVERSION_FORMAT=mp4",
        "AUTOMATED_CONVERSION_SOURCE_STABLE_TIME=5",
        "AUTOMATED_CONVERSION_SOURCE_MIN_DURATION=10",
        "AUTOMATED_CONVERSION_SOURCE_MAIN_TITLE_DETECTION=0",
        "AUTOMATED_CONVERSION_KEEP_SOURCE=1",
        "AUTOMATED_CONVERSION_OUTPUT_DIR=/output",
        "AUTOMATED_CONVERSION_OUTPUT_SUBDIR=",
        "AUTOMATED_CONVERSION_OVERWRITE_OUTPUT=0",
        "AUTOMATED_CONVERSION_VIDEO_FILE_EXTENSIONS=",
        "AUTOMATED_CONVERSION_NON_VIDEO_FILE_ACTION=ignore",
        "AUTOMATED_CONVERSION_NON_VIDEO_FILE_EXTENSIONS=jpg jpeg bmp png gif txt nfo",
        "AUTOMATED_CONVERSION_MAX_WATCH_FOLDERS=5",
        "AUTOMATED_CONVERSION_CHECK_INTERVAL=5",
        "AUTOMATED_CONVERSION_HANDBRAKE_CUSTOM_ARGS=",
        "AUTOMATED_CONVERSION_INSTALL_PKGS=",
        "AUTOMATED_CONVERSION_NO_GUI_PROGRESS=0",
        "AUTOMATED_CONVERSION_USE_TRASH=0"
      ],
      "ExposedPorts": {
        "5800/tcp": {},
        "5900/tcp": {}
      },
      "Hostname": "0cfa13937090",
      "Image": "phantom-handbrake",
      "Labels": {
        "com.docker.compose.config-hash": "•••••",
        "com.docker.compose.container-number": "1",
        "com.docker.compose.depends_on": "",
        "com.docker.compose.image": "•••••",
        "com.docker.compose.oneoff": "False",
        "com.docker.compose.project": "phantom",
        "com.docker.compose.project.config_files": "/etc/docker/handbrake/docker-compose.handbrake.yml",
        "com.docker.compose.project.working_dir": "/etc/docker/handbrake",
        "com.docker.compose.replace": "•••••",
        "com.docker.compose.service": "handbrake",
        "com.docker.compose.version": "2.27.0",
        "org.label-schema.description": "Docker container for HandBrake",
        "org.label-schema.name": "handbrake",
        "org.label-schema.schema-version": "1.0",
        "org.label-schema.vcs-url": "https://github.com/jlesage/docker-handbrake",
        "org.label-schema.version": "24.06.1"
      },
      "OnBuild": null,
      "OpenStdin": false,
      "StdinOnce": false,
      "Tty": false,
      "User": "",
      "Volumes": {
        "/config": {},
        "/output": {},
        "/storage": {},
        "/trash": {},
        "/watch": {}
      },
      "WorkingDir": "/tmp"
    },
    "Created": "2024-07-11T18:58:41.397498778Z",
    "Driver": "overlay2",
    "ExecIDs": null,
    "GraphDriver": {
      "Data": {
        "LowerDir": "/var/lib/docker/overlay2/:••••:••••:etc.....",
        "MergedDir": "/var/lib/docker/overlay2/••••/merged",
        "UpperDir": "/var/lib/docker/overlay2/••••/diff",
        "WorkDir": "/var/lib/docker/overlay2/••••/work"
      },
      "Name": "overlay2"
    },
    "HostConfig": {
      "AutoRemove": false,
      "Binds": [
        "/etc/docker/handbrake/config:/config:rw",
        "/etc/docker/handbrake/output:/output:rw",
        "/etc/docker/handbrake/storage:/storage:rw",
        "/etc/docker/handbrake/watch:/watch:rw"
      ],
      "BlkioDeviceReadBps": null,
      "BlkioDeviceReadIOps": null,
      "BlkioDeviceWriteBps": null,
      "BlkioDeviceWriteIOps": null,
      "BlkioWeight": 0,
      "BlkioWeightDevice": null,
      "CapAdd": null,
      "CapDrop": null,
      "Cgroup": "",
      "CgroupParent": "",
      "CgroupnsMode": "private",
      "ConsoleSize": [
        0,
        0
      ],
      "ContainerIDFile": "",
      "CpuCount": 0,
      "CpuPercent": 0,
      "CpuPeriod": 0,
      "CpuQuota": 0,
      "CpuRealtimePeriod": 0,
      "CpuRealtimeRuntime": 0,
      "CpuShares": 256,
      "CpusetCpus": "",
      "CpusetMems": "",
      "DeviceCgroupRules": null,
      "DeviceRequests": null,
      "Devices": null,
      "Dns": null,
      "DnsOptions": null,
      "DnsSearch": null,
      "ExtraHosts": [],
      "GroupAdd": null,
      "IOMaximumBandwidth": 0,
      "IOMaximumIOps": 0,
      "IpcMode": "private",
      "Isolation": "",
      "Links": null,
      "LogConfig": {
        "Config": {},
        "Type": "json-file"
      },
      "MaskedPaths": [
        "/proc/asound",
        "/proc/acpi",
        "/proc/kcore",
        "/proc/keys",
        "/proc/latency_stats",
        "/proc/timer_list",
        "/proc/timer_stats",
        "/proc/sched_debug",
        "/proc/scsi",
        "/sys/firmware",
        "/sys/devices/virtual/powercap"
      ],
      "Memory": 4294967296,
      "MemoryReservation": 0,
      "MemorySwap": 8589934592,
      "MemorySwappiness": null,
      "Mounts": [
        {
          "Source": "•••",
          "Target": "/trash",
          "Type": "volume"
        }
      ],
      "NanoCpus": 1049999936,
      "NetworkMode": "phantom_bridge",
      "OomKillDisable": null,
      "OomScoreAdj": 0,
      "PidMode": "",
      "PidsLimit": null,
      "PortBindings": {
        "5800/tcp": [
          {
            "HostIp": "",
            "HostPort": "5810"
          }
        ],
        "5900/tcp": [
          {
            "HostIp": "",
            "HostPort": "5918"
          }
        ]
      },
      "Privileged": false,
      "PublishAllPorts": false,
      "ReadonlyPaths": [
        "/proc/bus",
        "/proc/fs",
        "/proc/irq",
        "/proc/sys",
        "/proc/sysrq-trigger"
      ],
      "ReadonlyRootfs": false,
      "RestartPolicy": {
        "MaximumRetryCount": 0,
        "Name": "unless-stopped"
      },
      "Runtime": "nvidia",
      "SecurityOpt": null,
      "ShmSize": 67108864,
      "UTSMode": "",
      "Ulimits": null,
      "UsernsMode": "",
      "VolumeDriver": "",
      "VolumesFrom": null
    },
    "HostnamePath": "/var/lib/docker/containers/•••/hostname",
    "HostsPath": "/var/lib/docker/containers/•••/hosts",
    "Id": "•••",
    "Image": "sha256:57e08896f87d09fc61f191fba7e89adb6f0db2916adb773ff73bbe72ae7c3a97",
    "LogPath": "/var/lib/docker/containers/•••/•••-json.log",
    "MountLabel": "",
    "Mounts": [
      {
        "Destination": "/trash",
        "Driver": "local",
        "Mode": "z",
        "Name": "•••",
        "Propagation": "",
        "RW": true,
        "Source": "/var/lib/docker/volumes/•••/_data",
        "Type": "volume"
      },
      {
        "Destination": "/config",
        "Mode": "rw",
        "Propagation": "rprivate",
        "RW": true,
        "Source": "/etc/docker/handbrake/config",
        "Type": "bind"
      },
      {
        "Destination": "/output",
        "Mode": "rw",
        "Propagation": "rprivate",
        "RW": true,
        "Source": "/etc/docker/handbrake/output",
        "Type": "bind"
      },
      {
        "Destination": "/storage",
        "Mode": "rw",
        "Propagation": "rprivate",
        "RW": true,
        "Source": "/etc/docker/handbrake/storage",
        "Type": "bind"
      },
      {
        "Destination": "/watch",
        "Mode": "rw",
        "Propagation": "rprivate",
        "RW": true,
        "Source": "/etc/docker/handbrake/watch",
        "Type": "bind"
      }
    ],
    "Name": "/handbrake",
    "NetworkSettings": {
      "Bridge": "",
      "EndpointID": "",
      "Gateway": "",
      "GlobalIPv6Address": "",
      "GlobalIPv6PrefixLen": 0,
      "HairpinMode": false,
      "IPAddress": "",
      "IPPrefixLen": 0,
      "IPv6Gateway": "",
      "LinkLocalIPv6Address": "",
      "LinkLocalIPv6PrefixLen": 0,
      "MacAddress": "",
      "Networks": {
        "phantom_bridge": {
          "Aliases": [
            "handbrake",
            "handbrake"
          ],
          "DNSNames": [
            "handbrake",
            "0cfa13937090"
          ],
          "DriverOpts": null,
          "EndpointID": "•••",
          "Gateway": "192.168.176.1",
          "GlobalIPv6Address": "",
          "GlobalIPv6PrefixLen": 0,
          "IPAMConfig": null,
          "IPAddress": "192.168.176.4",
          "IPPrefixLen": 20,
          "IPv6Gateway": "",
          "Links": null,
          "MacAddress": "02:42:c0:a8:b0:04",
          "NetworkID": "•••"
        }
      },
      "Ports": {
        "5800/tcp": [
          {
            "HostIp": "0.0.0.0",
            "HostPort": "5810"
          },
          {
            "HostIp": "::",
            "HostPort": "5810"
          }
        ],
        "5900/tcp": [
          {
            "HostIp": "0.0.0.0",
            "HostPort": "5918"
          },
          {
            "HostIp": "::",
            "HostPort": "5918"
          }
        ]
      },
      "SandboxID": "d7524de2d1411fa382565801179a57f8f133c8a1e0b68d4193cda486b54e36ca",
      "SandboxKey": "/var/run/docker/netns/d7524de2d141",
      "SecondaryIPAddresses": null,
      "SecondaryIPv6Addresses": null
    },
    "Path": "/init",
    "Platform": "linux",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/0cfa13937090439a221a59344833d75470462d41ca71f63c318b071cdef3c3e4/resolv.conf",
    "RestartCount": 12,
    "State": {
      "Dead": false,
      "Error": "",
      "ExitCode": 0,
      "FinishedAt": "2024-07-11T19:02:33.858026873Z",
      "OOMKilled": false,
      "Paused": false,
      "Pid": 1454920,
      "Restarting": false,
      "Running": true,
      "StartedAt": "2024-07-11T19:03:33.787117298Z",
      "Status": "running"
    }
  }
]


### Anything else?

_No response_
brandonscript commented 1 month ago

Exploring a little more with this, I've tried exec'ing into the container, and when I first ran DISPLAY=:0 HANDBRAKE_DEBUG=1 /startapp.sh, it failed with:

libEGL warning: MESA-LOADER: failed to open swrast: Error loading shared library /usr/lib/xorg/modules/dri/swrast_dri.so: No such file or directory (search paths /usr/lib/xorg/modules/dri, suffix _dri)

Digging around, it appears there's a missing driver, so adding this to a Dockerfile got me past that:

RUN apk add xhost xterm mesa-dri-gallium

Now when I run the startup script, it gets a little further, and actually writes out to the handbrake debug log:

(fr.handbrake.ghb:9185): Gdk-DEBUG: 09:49:08.471: error: XDG_RUNTIME_DIR is invalid or not set in the environment.

(fr.handbrake.ghb:9185): GLib-GIO-DEBUG: 09:49:08.505: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.522: returning null (CustomTmpEnable)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.526: Could not access portal: Failed to execute child process “dbus-launch” (No such file or directory)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.541: Function: create_builder_or_die
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.604: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.604: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): GLib-GIO-DEBUG: 09:49:08.604: Failed to initialize portal (GPowerProfileMonitorPortal) for gio-power-profile-monitor: Not using portals
(fr.handbrake.ghb:9185): GLib-GIO-DEBUG: 09:49:08.604: _g_io_module_get_default: Found default implementation dbus (GPowerProfileMonitorDBus) for ‘gio-power-profile-monitor’
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.605: Function: ghb_ui_update (activity_location)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.605: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.605: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.605: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.605: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.623: Function: ghb_init_combo_box
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.623: Function: ghb_init_combo_box
(... repeats several times)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.624: Function: ghb_init_combo_box
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.625: returning null (PictureDeinterlaceFilter)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.626: returning null (PictureDenoiseFilter)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.626: returning null (PictureSharpenFilter)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.626: returning null (PictureSharpenFilter)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.642: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.642: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.642: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: ud 0x747ce694be60
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: builder 0x747ce692d270
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: Function: bind_audio_tree_model
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: Done
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: Function: bind_subtitle_tree_model
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: Function: ghb_presets_bind_tree_model
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.643: Done
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.645: returning null (DiskFreeLimit)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (FolderOpen)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.679: returning null (PresetDescription)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.703: Function: ghb_cache_volnames
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.899: Could not access portal: Failed to execute child process “dbus-launch” (No such file or directory)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:08.899: Could not create UPower proxy: Could not connect: No such file or directory
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_ui_settings_update (preview_count)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: returning null (PtoPType)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_ui_settings_update (VideoQualityGranularity)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: vqual_granularity_changed_cb
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: returning null (VideoQualitySlider)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_widget_to_setting
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.426: Function: ghb_get_setting_key
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (FileFormat)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: Function: set_destination_settings
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (dest_file)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (volume)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (volume)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.495: returning null (VideoEncoder)
(fr.handbrake.ghb:9185): ghb-DEBUG: 09:49:09.496: returning null (VideoEncoder)
(fr.handbrake.ghb:1433): Gdk-DEBUG: 09:51:05.065: error: XDG_RUNTIME_DIR is invalid or not set in the environment.

Adding this to the Dockerfile fixes the XDG_RUNTIME_DIR error:

RUN mkdir -pv /xdgr && chmod 777 /xdgr && chown 1000:1000 /xdgr
ENV XDG_RUNTIME_DIR=/xdgr
ENV DISPLAY=:0.0

But then I get this in the hb debug log:

(fr.handbrake.ghb:28049): GLib-GIO-DEBUG: 11:08:47.696: Failed to initialize portal (GPowerProfileMonitorPortal) for gio-power-profile-monitor: Not using portals
(fr.handbrake.ghb:28049): GLib-GIO-DEBUG: 11:08:47.696: _g_io_module_get_default: Found default implementation dbus (GPowerProfileMonitorDBus) for ‘gio-power-profile-monitor’
(fr.handbrake.ghb:28049): ghb-DEBUG: 11:08:47.697: Function: ghb_ui_update (activity_location)
(fr.handbrake.ghb:28049): ghb-DEBUG: 11:08:47.697: Function: ghb_get_setting_key
(fr.handbrake.ghb:28049): ghb-DEBUG: 11:08:47.697: Function: ghb_widget_to_setting
(fr.handbrake.ghb:28049): ghb-DEBUG: 11:08:47.697: Function: ghb_get_setting_key
(fr.handbrake.ghb:28049): ghb-DEBUG: 11:08:47.697: Function: ghb_get_setting_key
(fr.handbrake.ghb:28058): ghb-DEBUG: 11:08:47.712: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop

My leading theory is that this is related to the host running Wayland and the container attempting to exist in X11, and for some reason there isn't true isolation between the host and container. I'll continue to dig.

Could also be related to using the nvidia runtime in my docker-compose.yml.

jlesage commented 1 month ago

This container doesn't need anything from the host for display purpose. So you should definitely not set the DISPLAY environment variables, which might create problems since the container handles this variable itself.

The nvidia runtime might be the problem. Did you try without it ?

Do you see the same crash if you run docker run --rm jlesage/handbrake ?